/* ZeroCostNumber Admin v6 — plain, robust, modern admin
   No sprites, no backdrop-filter, no iOS tricks. Just solid CSS. */

/* ---------- Reset / base --------------------------------------------- */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #111827;
  background: #f7f8fa;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px;
       background: #f3f4f6; padding: 1px 6px; border-radius: 4px; }
img, svg { display: inline-block; vertical-align: middle; }

/* ---------- Layout --------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
.layout > .main { min-width: 0; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 22px 14px 18px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex; flex-direction: column; gap: 18px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px;
  color: #111827;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px;
  letter-spacing: -.02em;
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-name small { display: block; font-size: 11px; font-weight: 500; color: #6b7280; }

.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: #9ca3af;
  padding: 0 8px 4px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px; font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.nav a:hover { background: #f3f4f6; text-decoration: none; }
.nav a.is-active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}
.nav .dot-icon {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
}
.nav a.is-active .dot-icon { background: #2563eb; }

.side-foot { margin-top: auto; }

/* Mobile header (< 900px) */
.mobile-header { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-header {
    display: block;
    position: sticky; top: 0; z-index: 30;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 14px 0;
  }
  .mobile-top {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 8px;
  }
  .mobile-top .spacer { flex: 1; }
  .mobile-nav {
    display: flex; gap: 4px;
    overflow-x: auto;
    padding: 4px 0 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a {
    flex-shrink: 0;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px; font-weight: 500;
    color: #6b7280;
    background: #f3f4f6;
    white-space: nowrap;
    text-decoration: none;
  }
  .mobile-nav a.is-active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
  }
}

.content {
  padding: 28px 32px 56px;
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 720px) { .content { padding: 18px 16px 40px; } }

/* ---------- Typography --------------------------------------------- */
h1, h2, h3 { margin: 0; line-height: 1.25; }
.title { font-size: 24px; font-weight: 700; letter-spacing: -.015em; }
.subtitle { font-size: 17px; font-weight: 600; }
.muted { color: #6b7280; }
.small { font-size: 12px; }

.head { margin-bottom: 22px; }
.head .title { margin-bottom: 4px; }
.head.row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }

.section-label {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: #6b7280;
  margin: 22px 2px 8px;
}
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 8px 2px 10px;
}
.section-head h2 { font-size: 16px; font-weight: 600; }

/* ---------- Cards --------------------------------------------------- */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 18px;
}

/* ---------- Hero (top stat ribbon) --------------------------------- */
.hero {
  background: #2563eb;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #fff;
  border-radius: 10px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}
.hero-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-weight: 600; }
.hero-title { font-size: 20px; font-weight: 700; margin-top: 4px; }
.hero-meta { font-size: 13px; opacity: .9; margin-top: 6px; }
.hero-num { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; text-align: right; }
.hero-num small { display: block; font-size: 11px; font-weight: 600; opacity: .8; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding: 18px 18px; }
  .hero-num { text-align: left; font-size: 32px; }
}

/* ---------- Stats grid --------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  text-decoration: none;
  color: #111827;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color .15s ease, transform .15s ease;
}
.stat:hover {
  text-decoration: none;
  border-color: #d1d5db;
  transform: translateY(-1px);
}
.stat-label { font-size: 12px; color: #6b7280; font-weight: 500; }
.stat-num { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.stat .stat-tint { width: 3px; height: 18px; border-radius: 999px; background: #2563eb; margin-bottom: 6px; }
.stat.green  .stat-tint { background: #10b981; }
.stat.red    .stat-tint { background: #ef4444; }
.stat.amber  .stat-tint { background: #f59e0b; }
.stat.purple .stat-tint { background: #8b5cf6; }
.stat.pink   .stat-tint { background: #ec4899; }
.stat.teal   .stat-tint { background: #14b8a6; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ---------- List (groups of rows) ---------------------------------- */
.list {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.list .row,
.list a.row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none; color: inherit;
  border-bottom: 1px solid #e5e7eb;
  transition: background .12s ease;
}
.list > :last-child { border-bottom: 0; }
.list a.row:hover { background: #f9fafb; text-decoration: none; }

.row-art { display: grid; place-items: center; }
.row-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title {
  font-weight: 600; font-size: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.row-sub  { font-size: 12.5px; color: #6b7280;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-meta { font-size: 12px; color: #9ca3af; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-end  { display: flex; align-items: center; gap: 6px; }
.dot-sep  { color: #d1d5db; }

.chev::before { content: "›"; color: #d1d5db; font-size: 18px; line-height: 1; font-weight: 500; }

@media (max-width: 720px) {
  .list .row, .list a.row { padding: 12px; grid-template-columns: 32px 1fr auto; }
  .row-meta { display: none; }
}

/* ---------- Avatars ------------------------------------------------- */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 13px;
  letter-spacing: -.01em;
  background: #6b7280;
}
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.c0 { background: #2563eb; }
.avatar.c1 { background: #f59e0b; }
.avatar.c2 { background: #10b981; }
.avatar.c3 { background: #ec4899; }
.avatar.c4 { background: #8b5cf6; }
.avatar.c5 { background: #14b8a6; }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  display: inline-block;
}
.dot.blue   { background: #2563eb; }
.dot.green  { background: #10b981; }
.dot.amber  { background: #f59e0b; }
.dot.purple { background: #8b5cf6; }
.dot.red    { background: #ef4444; }
.dot.grey   { background: #9ca3af; }

/* ---------- Tags ---------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px; font-weight: 500;
  background: #f3f4f6;
  color: #374151;
  line-height: 1.4;
}
.tag.blue   { background: #dbeafe; color: #1e40af; }
.tag.green  { background: #d1fae5; color: #047857; }
.tag.red    { background: #fee2e2; color: #b91c1c; }
.tag.amber  { background: #fef3c7; color: #b45309; }
.tag.purple { background: #ede9fe; color: #6d28d9; }
.tag.grey   { background: #f3f4f6; color: #6b7280; }

/* ---------- Buttons ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 34px;
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn.primary {
  background: #2563eb;
  color: #fff;
}
.btn.primary:hover { background: #1d4ed8; }

.btn.danger {
  background: #ef4444;
  color: #fff;
}
.btn.danger:hover { background: #dc2626; }

.btn.secondary {
  background: #ffffff;
  border-color: #d1d5db;
  color: #111827;
}
.btn.secondary:hover { background: #f9fafb; border-color: #9ca3af; }

.btn.ghost {
  background: transparent;
  color: #374151;
}
.btn.ghost:hover { background: #f3f4f6; }

.btn.danger-ghost {
  background: transparent;
  color: #b91c1c;
}
.btn.danger-ghost:hover { background: #fee2e2; }

.btn.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 5px;
}
.btn.icon {
  width: 32px; height: 32px;
  padding: 0;
}
.btn.icon.small { width: 28px; height: 28px; }
.btn.block { width: 100%; }

.btn svg { width: 14px; height: 14px; }

/* ---------- Forms --------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field-label { font-size: 12px; font-weight: 500; color: #374151; }
.input, .field input, .field textarea, .field select, .select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { height: auto; min-height: 100px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field textarea:focus, .select:focus {
  outline: 0;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}
.input.compact { height: 32px; font-size: 13px; }

.form-card { display: flex; flex-direction: column; gap: 14px; }
.form-card .footer { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.row-flex { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.spacer { flex: 1; }

/* Search bar */
.search {
  display: flex; align-items: center; gap: 8px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0 12px;
  height: 36px;
  width: 320px; max-width: 100%;
}
.search:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.search input { flex: 1; border: 0; background: transparent; outline: 0; min-width: 0; height: 100%; font-size: 14px; }
.search input::placeholder { color: #9ca3af; }
.search .search-glyph { color: #9ca3af; flex-shrink: 0; }

@media (max-width: 720px) { .search { width: 100%; } }

/* Segmented control (tab pills) */
.segments {
  display: inline-flex;
  background: #f3f4f6;
  padding: 3px;
  border-radius: 7px;
  gap: 2px;
  border: 1px solid #e5e7eb;
}
.segments a {
  padding: 5px 14px;
  font-size: 13px; font-weight: 500;
  border-radius: 5px;
  color: #6b7280;
  text-decoration: none;
}
.segments a:hover { color: #111827; text-decoration: none; }
.segments a.is-active {
  background: #ffffff;
  color: #111827;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
@media (max-width: 720px) {
  .segments { display: flex; width: 100%; }
  .segments a { flex: 1 1 0; min-width: 0; text-align: center; padding: 6px 6px; }
}

/* Toggle switch */
.switch {
  position: relative; width: 38px; height: 22px;
  flex-shrink: 0; display: inline-block;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: absolute; inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background .2s ease;
}
.switch .thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .25s ease;
}
.switch input:checked + .track { background: #10b981; }
.switch.tone-blue input:checked + .track { background: #2563eb; }
.switch.tone-red  input:checked + .track { background: #ef4444; }
.switch input:checked ~ .thumb { transform: translateX(16px); }
.switch.busy { opacity: .5; }

/* Pills (chat header buttons) */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  height: 28px;
  transition: background .12s ease;
}
.pill:disabled { opacity: .5; pointer-events: none; }
.pill.green { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.pill.amber { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.pill.red   { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.pill.red-solid { background: #ef4444; color: #fff; border-color: #ef4444; }

/* Setting row (settings list) */
.setting {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}
.setting:first-child { border-radius: 8px 8px 0 0; }
.setting:last-child  { border-radius: 0 0 8px 8px; border-bottom: 0; }
.setting.only        { border-radius: 8px; }
.setting-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: #2563eb;
  display: grid; place-items: center;
  color: #fff;
  font-size: 16px; font-weight: 700;
}
.setting-icon.green  { background: #10b981; }
.setting-icon.red    { background: #ef4444; }
.setting-icon.amber  { background: #f59e0b; }
.setting-icon.purple { background: #8b5cf6; }
.setting-title { font-weight: 600; font-size: 14px; }
.setting-sub { color: #6b7280; font-size: 12.5px; }

/* Strip (3-cell stats) */
.strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.strip-cell {
  text-align: center;
  padding: 14px 8px;
  border-right: 1px solid #e5e7eb;
}
.strip-cell:last-child { border-right: 0; }
.strip-num { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-label { font-size: 11.5px; color: #6b7280; margin-top: 2px; }
@media (max-width: 720px) {
  .strip { grid-template-columns: 1fr; }
  .strip-cell { border-right: 0; border-bottom: 1px solid #e5e7eb; padding: 12px; }
  .strip-cell:last-child { border-bottom: 0; }
}

/* Profile head */
.profile-head {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 16px 18px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  margin-bottom: 22px;
  text-align: center;
}
.profile-head h1 { font-size: 20px; font-weight: 700; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.back-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* Redirects (each row is a card) */
.redirects { display: flex; flex-direction: column; gap: 10px; }
.redirect {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.redirect-status { display: grid; place-items: center; }
.redirect-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}
.redirect-actions { display: flex; align-items: center; gap: 8px; }
.redirect-meta { font-size: 12px; color: #6b7280; display: flex; align-items: center; gap: 6px; }

@media (max-width: 720px) {
  .redirect { grid-template-columns: 1fr; padding: 12px; gap: 10px; }
  .redirect-status { display: none; }
  .redirect-fields { grid-template-columns: 1fr; }
  .redirect-actions { justify-content: space-between; flex-wrap: wrap; }
  .redirect-meta { flex: 1; }
}

/* Banner / Toast */
.banner {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.banner.ok    { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.banner.error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

#toast-host {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; max-width: calc(100% - 40px);
}
.toast {
  pointer-events: auto;
  padding: 9px 14px;
  border-radius: 6px;
  background: #111827; color: #fff;
  border: 1px solid #1f2937;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .25s ease;
}
.toast-in  { opacity: 1; transform: translateY(0); }
.toast-out { opacity: 0; }
.toast.toast-error { background: #b91c1c; border-color: #991b1b; }

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 22px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.empty-art {
  width: 48px; height: 48px;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  display: grid; place-items: center;
  margin: 0 auto 12px;
  font-size: 24px;
}
.empty h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: space-between; margin: 16px 2px 0; }
@media (max-width: 720px) { .pager { flex-direction: column; gap: 10px; } }

/* Login */
.login-page {
  display: grid; place-items: center;
  min-height: 100vh; padding: 24px;
  background: #f7f8fa;
}
.login-card {
  width: 100%; max-width: 360px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 30px 26px 24px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.05);
}
.login-icon {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  font-size: 26px; font-weight: 700;
}
.login-card h1 { font-size: 20px; font-weight: 700; }
.login-sub { font-size: 12.5px; color: #6b7280; margin: 4px 0 18px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-foot { font-size: 11px; color: #9ca3af; margin-top: 16px; }

/* Chat page */
.chat-body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 100vh;
  background: #f7f8fa;
}
.chat-bar {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 30;
}
.chat-back {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #2563eb;
  font-size: 18px; font-weight: 600;
  text-decoration: none;
  line-height: 1;
}
.chat-who { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.chat-who:hover { text-decoration: none; }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.who-meta { color: #6b7280; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-tools { display: flex; align-items: center; gap: 6px; }

.archive-banner {
  margin: 12px 14px 0;
  padding: 10px 14px;
  border-radius: 6px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}

.chat-feed {
  overflow-y: auto;
  padding: 14px 14px 22px;
  max-width: 760px; width: 100%; margin: 0 auto;
}
.chat-empty { padding: 50px 0; text-align: center; }
.chat-messages { display: flex; flex-direction: column; gap: 4px; }

.day-sep {
  display: flex; justify-content: center;
  margin: 14px 0 6px;
  font-size: 11px; font-weight: 500; color: #6b7280;
}
.day-sep span { padding: 3px 10px; background: #f3f4f6; border-radius: 999px; }

.msg { display: flex; flex-direction: column; max-width: 78%; gap: 2px; }
.msg-bubble {
  padding: 7px 12px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.45;
  word-wrap: break-word; overflow-wrap: break-word;
  white-space: pre-wrap;
}
.msg-meta { font-size: 11px; color: #9ca3af; padding: 0 6px; }
.msg-grouped + .msg .msg-meta { display: none; }
.msg-in { align-self: flex-start; align-items: flex-start; }
.msg-in .msg-bubble {
  background: #ffffff; color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.msg-out { align-self: flex-end; align-items: flex-end; }
.msg-out .msg-bubble {
  background: #2563eb; color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-admin { align-self: flex-end; align-items: flex-end; }
.msg-admin .msg-bubble {
  background: #4f46e5; color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-composer {
  position: sticky; bottom: 0;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.chat-composer form {
  max-width: 760px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px; align-items: end;
}
.chat-composer textarea {
  border: 1px solid #d1d5db;
  border-radius: 18px;
  padding: 8px 13px;
  font-size: 14px;
  resize: none;
  background: #ffffff;
  max-height: 140px; min-height: 36px;
  line-height: 1.4;
  width: 100%;
}
.chat-composer textarea:focus { outline: 0; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: #2563eb;
  color: #fff;
  font-size: 20px;
  display: grid; place-items: center;
  line-height: 1;
}
.send-btn:hover { background: #1d4ed8; }
.send-btn:disabled { opacity: .5; pointer-events: none; }

.chat-composer-disabled {
  padding: 14px; text-align: center;
  font-size: 13px; color: #6b7280;
}

/* Misc */
.row-stack { display: flex; flex-direction: column; gap: 10px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 22px; }

@media (max-width: 720px) {
  .actions-row .btn { flex: 1 1 auto; min-width: 120px; }
}
