/* ZapClip — design system (tema claro + dourado) */
:root {
  --bg: #ffffff;
  --bg-soft: #fdfaf3;
  --panel: #ffffff;
  --panel-2: #fffdf7;
  --panel-3: #f7efdd;
  --line: #ece0c8;
  --line-strong: #e2d3b4;
  --text: #241d12;
  --muted: #7b6a4f;
  --muted-2: #9d8d73;
  --gold: #c9a227;
  --gold-deep: #9a7715;
  --gold-soft: rgba(201, 162, 39, 0.13);
  --bronze: #b08d3e;
  --bronze-soft: rgba(176, 141, 62, 0.13);
  --amber: #b7791f;
  --amber-soft: rgba(183, 121, 31, 0.12);
  --red: #b4371f;
  --red-soft: rgba(180, 55, 31, 0.09);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 22px 50px -28px rgba(96, 72, 16, 0.45);
  --shadow-soft: 0 1px 2px rgba(120, 90, 20, 0.05), 0 14px 30px -26px rgba(120, 90, 20, 0.5);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
code { font-family: var(--mono); font-size: 12px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(160, 130, 60, 0.25); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: rgba(160, 130, 60, 0.42); }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------- boot */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  justify-items: center;
  background: var(--bg);
  z-index: 90;
}
.boot-logo { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; color: var(--gold-deep); }
.spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(201, 162, 39, 0.2);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- login */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.07fr 0.93fr;
  background:
    radial-gradient(900px 520px at 4% -6%, rgba(201, 162, 39, 0.18), transparent 62%),
    radial-gradient(760px 500px at 96% 104%, rgba(176, 141, 62, 0.14), transparent 60%),
    #fffdf8;
}

.auth-hero {
  position: relative;
  padding: 56px clamp(32px, 5vw, 80px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--line);
}
.auth-glow {
  position: absolute;
  width: 460px; height: 460px;
  right: -160px; top: -120px;
  background: radial-gradient(circle, rgba(214, 175, 55, 0.3), transparent 68%);
  filter: blur(24px);
  pointer-events: none;
}
.auth-hero h1 {
  position: relative;
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 800;
  max-width: 15ch;
  color: #241d12;
}
.auth-hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #b98e12, #e0bd4f 52%, #a97f16);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-sub { color: var(--muted); font-size: 15px; max-width: 46ch; }
.auth-bullets { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 11px; }
.auth-bullets li { display: flex; align-items: center; gap: 10px; color: #4c4130; font-size: 14px; }
.auth-bullets span {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  font-size: 11px;
  font-weight: 700;
}
.auth-proof {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  max-width: 520px;
}
.auth-proof strong { display: block; font-size: 20px; letter-spacing: -0.02em; color: var(--gold-deep); }
.auth-proof span { color: var(--muted-2); font-size: 12px; }

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 28px;
}
.auth-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #f8f1e2;
  border-radius: 12px;
  margin-bottom: 20px;
}
.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.is-active { background: #fff; color: var(--gold-deep); box-shadow: 0 2px 8px -4px rgba(120, 90, 20, 0.4); }
.auth-form { display: grid; gap: 13px; }
.auth-hint { color: var(--muted-2); font-size: 12px; text-align: center; }
.auth-hint code { color: var(--gold-deep); background: #fbf4e4; padding: 2px 5px; border-radius: 5px; }
.auth-foot { color: var(--muted-2); font-size: 12px; }

/* ---------------------------------------------------------- structure */
.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--bg-soft);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #fffefb, #fdf7ea);
  min-height: 0;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #e3c25c, #b78e18);
  color: #3a2c07;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.05em;
  box-shadow: 0 6px 14px -8px rgba(154, 119, 21, 0.9);
}
.brand-name { font-weight: 800; letter-spacing: -0.03em; font-size: 17px; color: #2b2213; }
.brand-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--gold-deep);
  background: var(--gold-soft);
  border-radius: 6px;
  padding: 2px 6px;
}
.brand-lg { gap: 12px; }
.brand-lg .brand-mark { width: 38px; height: 38px; font-size: 20px; border-radius: 11px; }
.brand-lg .brand-name { font-size: 21px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 9px;
  color: #6b5c43;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav-item:hover { background: #f9f2e2; color: #3a2f1c; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(201, 162, 39, 0.2), rgba(201, 162, 39, 0.05));
  color: #6d5410;
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav-item.is-active svg { opacity: 1; color: var(--gold-deep); }
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--gold);
  color: #3a2c07;
  border-radius: 20px;
  padding: 1px 7px;
}

.sidebar-foot { display: grid; gap: 10px; }
.plan-card {
  border: 1px solid rgba(201, 162, 39, 0.34);
  background: linear-gradient(150deg, rgba(201, 162, 39, 0.16), rgba(201, 162, 39, 0.03));
  border-radius: 11px;
  padding: 11px 12px;
  display: grid;
  gap: 2px;
}
.plan-card strong { font-size: 12px; color: #6f5510; }
.plan-card span { font-size: 11px; color: #8f7b4e; }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: var(--text);
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.user-card:hover { background: #fdf7ea; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #fbf3df, #f3e6c8);
  border: 1px solid #e8d9b8;
  color: #7a6117;
  font-weight: 700;
  font-size: 12px;
  flex: none;
}
.user-meta { display: grid; min-width: 0; }
.user-meta strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { font-size: 11px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-exit { margin-left: auto; color: var(--muted-2); font-size: 14px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  flex: none;
}
.topbar-title h2 { font-size: 18px; letter-spacing: -0.02em; font-weight: 700; }
.topbar-title p { color: var(--muted-2); font-size: 12.5px; margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #5e4f36;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.status-pill.is-online .dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2); }
.status-pill.is-offline .dot { background: var(--amber); }

.view { flex: 1; overflow-y: auto; padding: 24px 28px 44px; min-height: 0; }
.view-inner { max-width: 1360px; margin: 0 auto; display: grid; gap: 18px; }

/* ----------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn .ico { width: 15px; height: 15px; }
.btn-primary {
  background: linear-gradient(160deg, #e7c75f, #bd931f);
  color: #33270a;
  box-shadow: 0 10px 22px -14px rgba(154, 119, 21, 0.9);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: #5b4c33;
}
.btn-ghost:hover { background: #fdf7ea; }
.btn-danger { background: var(--red-soft); border-color: rgba(180, 55, 31, 0.25); color: var(--red); }
.btn-danger:hover { background: rgba(180, 55, 31, 0.16); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 30px; height: 30px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #8b7a5e;
  cursor: pointer;
  display: grid; place-items: center;
}
.btn-icon:hover { background: #f9f1df; color: #4b3d24; }
.btn-icon svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------ inputs */
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; color: #6b5c43; font-weight: 500; }
.field small { font-size: 11.5px; color: var(--muted-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(201, 162, 39, 0.75);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16);
}
input::placeholder, textarea::placeholder { color: #b6a88f; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #a08f75 50%), linear-gradient(135deg, #a08f75 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.form-error { color: var(--red); font-size: 12.5px; background: var(--red-soft); padding: 8px 10px; border-radius: 8px; }

/* ------------------------------------------------------------- cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.card-head p { font-size: 12px; color: var(--muted-2); }
.card-head .btn { flex: none; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  position: relative;
  background: linear-gradient(180deg, #fffefb, #fffbf1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.kpi::after {
  content: "";
  position: absolute;
  width: 130px; height: 130px;
  right: -52px; top: -64px;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.2), transparent 70%);
}
.kpi-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi-label svg { width: 14px; height: 14px; color: var(--gold); }
.kpi-value { font-size: 30px; font-weight: 750; letter-spacing: -0.04em; margin-top: 8px; line-height: 1; color: #2b2213; }
.kpi-foot { margin-top: 7px; font-size: 11.5px; color: var(--muted-2); }
.kpi-foot b { color: var(--gold-deep); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* ------------------------------------------------------------ charts */
.chart-wrap { width: 100%; overflow: hidden; }
.chart-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.chart-legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #efe4cf; stroke-width: 1; }
.chart .axis-label { fill: #a08f75; font-size: 9px; font-family: var(--font); }
.chart .line-path { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .area-path { fill: url(#gradArea); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bars .stack { width: 100%; max-width: 34px; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; height: 100%; }
.bars .b1 { background: linear-gradient(180deg, #e5c463, #b98f1e); border-radius: 4px; min-height: 2px; }
.bars .b2 { background: rgba(176, 141, 62, 0.42); border-radius: 4px; min-height: 2px; }
.bars .cap { font-size: 10px; color: var(--muted-2); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid #f4ecda; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffcf4; }
.td-actions { display: flex; gap: 2px; justify-content: flex-end; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-name { font-weight: 550; }
.cell-sub { color: var(--muted-2); font-size: 11.5px; }

/* ------------------------------------------------------------ badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: #f6efe0;
  color: #7d6a45;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.green { background: rgba(201, 162, 39, 0.16); color: #7d5f0c; }
.badge.amber { background: rgba(183, 121, 31, 0.14); color: #8f5411; }
.badge.blue { background: rgba(176, 141, 62, 0.14); color: #6f5a25; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.plain::before { display: none; }
.tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #fbf2dd;
  color: #8a6c1c;
  margin-right: 4px;
  white-space: nowrap;
  border: 1px solid #f0e2c2;
}

.progress { height: 6px; background: #f3ebda; border-radius: 20px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #c9a227, #e6c86a); border-radius: 20px; transition: width 0.4s; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-2);
  display: grid;
  gap: 8px;
  justify-items: center;
  font-size: 13px;
}
.empty strong { color: #4b3f2a; font-size: 14px; }
.empty svg { width: 32px; height: 32px; opacity: 0.45; }

/* ------------------------------------------------------------- lists */
.row-list { display: grid; gap: 2px; }
.row-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 8px;
  border-radius: 9px;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  width: 100%;
}
.row-item:hover { background: #fdf7ea; }
.row-item .grow { min-width: 0; flex: 1; display: grid; gap: 1px; }
.row-item .name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .preview { font-size: 12px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item time { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.unread-dot {
  background: var(--gold);
  color: #33270a;
  font-size: 10px;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

/* -------------------------------------------------------------- inbox */
.inbox {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 155px);
  min-height: 460px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}
.inbox-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: #fffdf8; }
.inbox-search { padding: 12px; border-bottom: 1px solid var(--line); }
.inbox-items { overflow-y: auto; flex: 1; padding: 6px; }
.conv-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
  width: 100%;
  text-align: left;
}
.conv-item:hover { background: #fdf7ea; }
.conv-item.is-active { background: rgba(201, 162, 39, 0.13); box-shadow: inset 2px 0 0 var(--gold); }
.conv-item .meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.conv-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-item .who { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .when { font-size: 10px; color: var(--muted-2); flex: none; }
.conv-item .last { font-size: 12px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat { display: flex; flex-direction: column; min-height: 0; background:
  radial-gradient(620px 420px at 92% 0%, rgba(201, 162, 39, 0.09), transparent 62%),
  #fffdf9; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
  background: rgba(255, 255, 255, 0.7);
}
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head .who { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chat-head .sub { font-size: 11.5px; color: var(--muted-2); }
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.msg { max-width: min(78%, 520px); display: grid; gap: 3px; }
.msg .bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg time { font-size: 10px; color: var(--muted-2); }
.msg.in { align-self: flex-start; }
.msg.in .bubble { background: #fff; border: 1px solid #ecdfc4; border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; justify-items: end; }
.msg.out .bubble { background: linear-gradient(160deg, #fdf2d3, #f8e7bb); border: 1px solid #eddbaf; border-bottom-right-radius: 4px; color: #3a2f14; }
.msg.out time { text-align: right; }
.msg.auto .bubble::after {
  content: "auto";
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-deep);
  opacity: 0.75;
  margin-left: 8px;
}
.chat-composer {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  flex: none;
  background: #fffdf7;
}
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea { min-height: 42px; max-height: 140px; resize: none; }
.quick-bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.quick-chip {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #7a6740;
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
}
.quick-chip:hover { border-color: var(--gold); color: var(--gold-deep); background: #fffdf5; }

/* ------------------------------------------------------------- modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 45, 18, 0.32);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 60;
  animation: fade 0.16s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(600px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 30px 60px -24px rgba(70, 52, 10, 0.45);
  animation: pop 0.18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(0.99); opacity: 0; } }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; letter-spacing: -0.02em; }
.modal-head p { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.modal-body { padding: 18px 20px; display: grid; gap: 14px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: #fffdf8;
}
.modal-sm { width: min(420px, 100%); }
.qr-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  width: 236px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.qr-box svg { width: 100%; height: auto; display: block; }
.qr-steps { display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); counter-reset: step; }
.qr-steps div { display: flex; gap: 9px; align-items: flex-start; }
.qr-steps span {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #6b5c43;
  border-radius: 20px;
  padding: 5px 10px;
  cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold-deep); }
.inline-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: #5b4c33;
  user-select: none;
}
.toggle input { display: none; }
.toggle i {
  width: 34px; height: 19px;
  border-radius: 20px;
  background: #e6d9bd;
  position: relative;
  transition: background 0.18s;
  flex: none;
}
.toggle i::after {
  content: "";
  position: absolute;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  box-shadow: 0 1px 3px rgba(70, 52, 10, 0.3);
  transition: transform 0.18s;
}
.toggle input:checked + i { background: var(--gold); }
.toggle input:checked + i::after { transform: translateX(15px); background: #fffdf6; }

/* ------------------------------------------------------------ toast */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  animation: slide 0.2s ease-out;
}
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }
.toast.ok { border-color: rgba(201, 162, 39, 0.55); }
.toast.ok .toast-ico { color: var(--gold-deep); }
.toast.err { border-color: rgba(180, 55, 31, 0.4); }
.toast.err .toast-ico { color: var(--red); }

/* ------------------------------------------------------------ flows */
.flow-card { display: grid; gap: 10px; }
.flow-card .flow-head { display: flex; align-items: flex-start; gap: 10px; }
.flow-card .flow-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--gold-soft);
  color: var(--gold-deep);
  flex: none;
}
.flow-card .flow-icon svg { width: 16px; height: 16px; }
.flow-card .flow-head .grow { flex: 1; min-width: 0; }
.flow-card h4 { font-size: 13.5px; font-weight: 600; }
.flow-preview {
  font-size: 12.5px;
  color: #5f5138;
  background: #fffcf5;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  white-space: pre-wrap;
  max-height: 96px;
  overflow: hidden;
  position: relative;
}
.flow-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted-2); }

.section-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: linear-gradient(100deg, rgba(201, 162, 39, 0.15), rgba(255, 255, 255, 0.65));
  box-shadow: var(--shadow-soft);
}
.section-band h3 { font-size: 14px; }
.section-band p { font-size: 12.5px; color: #6f6047; }

.api-line {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fffdf7;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 11px;
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
}
.api-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; color: #6f5510; }
pre.code {
  margin: 0;
  padding: 12px;
  background: #fdf8ec;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #6b5a37;
  overflow-x: auto;
  line-height: 1.6;
}
.stat-row { display: grid; gap: 10px; }
.stat-row .stat { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid #f5eddc; gap: 12px; }
.stat-row .stat:last-child { border-bottom: 0; }
.stat-row .stat b { font-weight: 600; }

/* --------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 74px minmax(0, 1fr); }
  .brand-name, .brand-badge, .nav-label, .nav-item span.label, .plan-card, .user-meta, .user-exit { display: none; }
  .nav-item { justify-content: center; padding: 11px; }
  .nav-count { display: none; }
  .sidebar { padding: 18px 12px; }
  .user-card { justify-content: center; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { min-height: 100vh; }
}
@media (max-width: 780px) {
  .view { padding: 16px 14px 40px; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; }
  .topbar-actions .btn-ghost, .status-pill { display: none; }
  .kpi-grid, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 190px); }
  .inbox.has-chat .inbox-list { display: none; }
  .inbox:not(.has-chat) .chat { display: none; }
  .inline-row { grid-template-columns: 1fr; }
}
