:root {
  --bg: #f2f6f4;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --soft: #94a3b8;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --brand-deep: #08211e;
  --brand-soft: #dff7f2;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(circle at 8% 0%, rgba(20, 184, 166, 0.12), transparent 28rem),
    radial-gradient(circle at 92% 8%, rgba(37, 99, 235, 0.08), transparent 26rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}

.login-brand {
  padding: 54px 58px;
  background:
    radial-gradient(circle at 18% 12%, rgba(20, 184, 166, 0.32), transparent 24rem),
    radial-gradient(circle at 90% 88%, rgba(245, 158, 11, 0.18), transparent 22rem),
    linear-gradient(145deg, #071c19 0%, #0b302b 52%, #102f3d 100%);
  color: #ecfdf5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-brand::after {
  content: '';
  position: absolute;
  right: -120px;
  bottom: -150px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 52px rgba(255, 255, 255, 0.03), 0 0 0 104px rgba(255, 255, 255, 0.02);
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2dd4bf, #f59e0b);
  color: #06201d;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -1px;
  box-shadow: 0 14px 30px rgba(45, 212, 191, 0.22);
}

.login-brand h1 {
  font-size: clamp(38px, 4vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.05em;
  margin: 30px 0 18px;
  max-width: 720px;
}

.login-brand p {
  color: #a7f3d0;
  line-height: 1.8;
  max-width: 620px;
  font-size: 16px;
}

.login-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.login-tags span {
  border: 1px solid rgba(167, 243, 208, 0.22);
  color: #d1fae5;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.04);
}

.login-foot {
  color: #6ee7b7;
  font-size: 13px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.login-panel {
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(430px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  border-radius: 26px;
  padding: 34px;
  backdrop-filter: blur(18px);
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.login-card .sub {
  color: var(--muted);
  margin: 0 0 26px;
  line-height: 1.6;
}

.demo-accounts {
  margin-top: 22px;
  border-top: 1px dashed var(--line);
  padding-top: 18px;
}

.demo-accounts p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.demo-account {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 12px;
  padding: 9px 11px;
  text-align: left;
  color: var(--ink);
  font-size: 13px;
  transition: 0.16s ease;
}

.demo-account:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.demo-account small { display: block; color: var(--muted); margin-top: 3px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  color: #cbd5e1;
  background:
    radial-gradient(circle at 10% 0%, rgba(20, 184, 166, 0.18), transparent 16rem),
    linear-gradient(180deg, #081d1a 0%, #0b2723 56%, #0a1f2a 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
}

.sidebar-brand .brand-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 15px; }
.sidebar-brand strong { display: block; color: white; font-size: 16px; letter-spacing: -0.02em; }
.sidebar-brand small { display: block; color: #6ee7b7; margin-top: 3px; font-size: 11px; letter-spacing: 0.08em; }

.sidebar-nav { display: grid; gap: 4px; overflow-y: auto; padding-right: 2px; }
.nav-section { margin: 14px 10px 6px; color: #64748b; font-size: 10px; letter-spacing: 0.16em; font-weight: 700; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #a8b6b2;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  transition: 0.16s ease;
}

.nav-item:hover { color: #ecfdf5; background: rgba(255, 255, 255, 0.055); }
.nav-item.active { color: #06201d; background: linear-gradient(135deg, #5eead4, #fbbf24); font-weight: 700; box-shadow: 0 10px 26px rgba(20, 184, 166, 0.18); }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-footer strong { color: #d1fae5; display: block; margin-bottom: 4px; }

.main { min-width: 0; padding: 24px 30px 46px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin: 6px 0 22px;
}

.page-head h1 { margin: 4px 0 8px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -0.05em; line-height: 1.1; }
.page-head p { margin: 0; color: var(--muted); line-height: 1.7; max-width: 760px; }
.eyebrow { color: var(--brand); font-weight: 800; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.16s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

.btn:hover { transform: translateY(-1px); border-color: #cbd5e1; box-shadow: var(--shadow-soft); }
.btn svg { width: 14px; height: 14px; flex: 0 0 14px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: white; }
.btn.primary:hover { background: #0d6b63; }
.btn.dark { background: #0b1f1d; border-color: #0b1f1d; color: white; }
.btn.ghost { background: rgba(255, 255, 255, 0.5); }
.btn.danger { color: var(--red); border-color: #fecaca; background: #fff7f7; }
.btn.sm { padding: 7px 10px; font-size: 12px; border-radius: 9px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.card-head > svg { width: 22px; height: 22px; flex: 0 0 22px; color: var(--muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.metric-card {
  background: var(--panel);
  border: 1px solid rgba(226, 232, 240, 0.82);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  right: -40px;
  top: -40px;
  background: var(--brand-soft);
  opacity: 0.55;
}

.metric-card.red::after { background: var(--red-soft); }
.metric-card.amber::after { background: var(--amber-soft); }
.metric-card.blue::after { background: var(--blue-soft); }
.metric-card.purple::after { background: var(--purple-soft); }
.metric-card.clickable { cursor: pointer; transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; }
.metric-card.clickable:hover { transform: translateY(-2px); border-color: rgba(15, 118, 110, 0.28); box-shadow: 0 12px 30px rgba(15, 23, 42, 0.09); }
.metric-card.clickable:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.28); outline-offset: 2px; }
.metric-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.metric-link { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--brand); font-size: 11px; font-weight: 700; }
.metric-link svg { width: 12px; height: 12px; }
.metric-value { font-size: 28px; font-weight: 850; letter-spacing: -0.04em; line-height: 1.1; }
.metric-sub { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.metric-value small { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side-main { grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr); }

.card {
  background: var(--panel);
  border: 1px solid rgba(226, 232, 240, 0.86);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.card-head {
  padding: 17px 18px 13px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.card-head h3 { margin: 0; font-size: 15px; letter-spacing: -0.02em; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.card-body { padding: 17px 18px; }
.card-body.tight { padding: 0; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
  transition: 0.16s ease;
}

.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12); }
.input::placeholder, .textarea::placeholder { color: #a8b3c2; }
.textarea { min-height: 110px; resize: vertical; }
.search-input { min-width: 230px; }
.field { display: grid; gap: 6px; margin-bottom: 13px; }
.field label { font-size: 12px; color: #475569; font-weight: 700; }
.field .hint { font-size: 11px; color: var(--muted); line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }

.table-wrap { width: 100%; overflow-x: auto; }
.wrap-cell { min-width: 220px; max-width: 360px; white-space: normal; line-height: 1.45; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0.03em; padding: 11px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr { transition: background 0.14s ease; }
tbody tr:hover { background: #f8fbfa; }
tbody tr.clickable { cursor: pointer; }
td .sub { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.strong { font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.green { background: var(--brand-soft); color: #0f766e; }
.badge.red { background: var(--red-soft); color: #b91c1c; }
.badge.amber { background: var(--amber-soft); color: #b45309; }
.badge.blue { background: var(--blue-soft); color: #1d4ed8; }
.badge.purple { background: var(--purple-soft); color: #6d28d9; }
.badge.gray { background: #f1f5f9; color: #475569; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--brand-2); flex: 0 0 8px; }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.dot.blue { background: var(--blue); }

.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 220px; padding: 8px 2px 0; }
.bar-group { flex: 1; min-width: 36px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; height: 100%; }
.bar-pair { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.bar { width: 34%; max-width: 18px; border-radius: 7px 7px 3px 3px; min-height: 3px; transition: height 0.5s ease; }
.bar.revenue { background: linear-gradient(180deg, #2dd4bf, #0f766e); }
.bar.cost { background: linear-gradient(180deg, #fcd34d, #f59e0b); }
.bar-label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.hbar-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 68px; gap: 10px; align-items: center; margin-bottom: 12px; font-size: 12px; }
.hbar-track { height: 9px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2dd4bf, #0f766e); min-width: 2px; }
.hbar-fill.amber { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.hbar-fill.red { background: linear-gradient(90deg, #fca5a5, #dc2626); }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: #334155; white-space: nowrap; }

.exception-list { display: grid; gap: 9px; }
.exception-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid #f1f5f9; background: #fbfdfc; border-radius: 13px; }
.exception-item .dot { margin-top: 5px; }
.exception-item strong { display: block; font-size: 13px; margin-bottom: 3px; }
.exception-item span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.exception-item.high { border-color: #fee2e2; background: #fffafa; }

.priority-list { display: grid; gap: 10px; }
.priority-item { padding: 12px; border-radius: 13px; background: #fbfdfc; border: 1px solid #eef2f7; }
.priority-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.priority-top strong { font-size: 13px; }
.priority-item p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.progress { height: 7px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.progress.amber > i { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.progress.red > i { background: linear-gradient(90deg, #fca5a5, #dc2626); }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat-chip { background: #f8fafc; border: 1px solid #eef2f7; border-radius: 13px; padding: 11px 12px; }
.stat-chip span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.stat-chip strong { font-size: 18px; letter-spacing: -0.03em; }

.empty, .loading {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.loading::before {
  content: '';
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #ccfbf1;
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: -3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 1000; display: grid; gap: 9px; }
.toast { background: #0b1f1d; color: #ecfdf5; padding: 12px 15px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13px; animation: toast-in 0.2s ease; max-width: 360px; }
.toast.error { background: #7f1d1d; }
.toast.warn { background: #78350f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.48); backdrop-filter: blur(5px); z-index: 900; display: grid; place-items: center; padding: 24px; animation: fade-in 0.16s ease; }
.modal { width: min(760px, 100%); max-height: min(86vh, 900px); overflow: auto; background: white; border-radius: 22px; box-shadow: 0 30px 90px rgba(2, 6, 23, 0.3); animation: modal-in 0.2s ease; }
.modal.wide { width: min(980px, 100%); }
.modal-head { padding: 19px 22px 14px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; position: sticky; top: 0; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-close { border: 0; background: #f1f5f9; color: #475569; width: 32px; height: 32px; border-radius: 10px; font-size: 18px; line-height: 1; }
.modal-close:hover { background: #e2e8f0; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid #f1f5f9; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.section-title h2 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.upload-zone { border: 1px dashed #cbd5e1; border-radius: 15px; padding: 18px; background: #fbfdfc; text-align: center; color: var(--muted); font-size: 13px; }
.upload-zone input { display: none; }
.upload-zone label { cursor: pointer; color: var(--brand); font-weight: 750; }
.upload-results { margin-top: 16px; display: grid; gap: 8px; }
.upload-result { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid #eef2f7; border-radius: 12px; background: #fbfdfc; }
.upload-result > div:first-child { min-width: 0; }
.upload-result > div:last-child { flex: 0 0 auto; }
.upload-result strong { display: block; font-size: 13px; }
.upload-result strong, .upload-result .sub { overflow-wrap: anywhere; }
.upload-result .sub { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.5; }
.preview { width: 100%; max-height: 320px; object-fit: contain; border-radius: 13px; background: #f8fafc; margin-top: 12px; }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.photo-card { border: 1px solid #eef2f7; border-radius: 14px; overflow: hidden; background: #fff; }
.photo-card img { width: 100%; height: 160px; object-fit: cover; display: block; background: #f1f5f9; }
.photo-meta { padding: 10px 12px; }
.photo-meta strong { display: block; font-size: 12px; }
.photo-meta span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; line-height: 1.45; }

.chat-shell { display: grid; gap: 12px; }
.chat-log { display: grid; gap: 12px; max-height: 520px; overflow-y: auto; padding: 4px; }
.chat-message { max-width: 86%; padding: 13px 15px; border-radius: 16px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.chat-message.assistant { background: #f8fafc; border: 1px solid #eef2f7; border-bottom-left-radius: 5px; }
.chat-message.user { background: var(--brand); color: white; justify-self: end; border-bottom-right-radius: 5px; }
.chat-citations { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.chat-citations span { background: var(--brand-soft); color: #0f766e; border-radius: 999px; padding: 3px 8px; font-size: 10px; }
.suggestions { display: flex; gap: 7px; flex-wrap: wrap; }
.suggestion { border: 1px solid #dbe7e3; background: #f7fdfb; color: #0f766e; border-radius: 999px; padding: 7px 10px; font-size: 12px; }
.suggestion:hover { background: var(--brand-soft); }

.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.import-card { border: 1px solid #eef2f7; border-radius: 16px; padding: 16px; background: #fbfdfc; }
.import-card h3 { margin: 0 0 5px; font-size: 14px; }
.import-card p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.import-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.code-block { background: #0b1f1d; color: #d1fae5; border-radius: 13px; padding: 14px; font-size: 12px; line-height: 1.6; overflow: auto; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; white-space: pre-wrap; }

.collection-node-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid #eef2f7; border-radius: 14px; background: #fbfdfc; margin-bottom: 10px; }
.collection-node-row .field { margin-bottom: 0; }
.collection-node-remove { margin-bottom: 1px; }
.collection-node-list { display: grid; gap: 10px; }
.collection-node-card { border: 1px solid #eef2f7; border-radius: 15px; padding: 14px; background: #fff; }
.collection-node-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.collection-node-head strong { display: block; font-size: 14px; }
.collection-node-head .sub { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.collection-node-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.collection-node-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.collection-node-metrics span { background: #f8fafc; border-radius: 10px; padding: 9px 10px; color: var(--muted); font-size: 11px; }
.collection-node-metrics strong { display: block; color: var(--ink); font-size: 13px; margin-top: 3px; }
.collection-node-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 11px; border-top: 1px dashed #eef2f7; }
.credential-box { display: grid; gap: 10px; }
.credential-box > div, .credential-inline > div { background: #f8fafc; border: 1px solid #eef2f7; border-radius: 12px; padding: 11px 13px; }
.credential-box span, .credential-inline span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.credential-box strong, .credential-inline strong { font-size: 14px; word-break: break-all; }
.credential-password { color: var(--brand); letter-spacing: 0.06em; }
.credential-inline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; gap: 10px; align-items: center; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.check-line input { width: auto; }
.ocr-preview { max-height: 280px; overflow: auto; background: #0b1f1d; color: #d1fae5; border-radius: 12px; padding: 14px; font-size: 11px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.invoice-list { display: flex; gap: 6px; flex-wrap: wrap; }
.invoice-list a { color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 4px 8px; font-size: 11px; }
.invoice-list a:hover { text-decoration: underline; }

.divider { height: 1px; background: #f1f5f9; margin: 18px 0; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-6 { gap: 6px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.w-full { width: 100%; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side-main { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { padding: 36px 28px; min-height: 320px; }
  .login-panel { padding: 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px; }
  .sidebar-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); display: grid; }
  .nav-section { display: none; }
  .nav-item { justify-content: center; padding: 9px 6px; font-size: 12px; }
  .nav-item svg { display: none; }
  .sidebar-footer { display: none; }
  .main { padding: 18px 14px 34px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .grid.two-col, .grid.three-col { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
  .collection-node-row { grid-template-columns: 1fr; }
  .collection-node-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-node-footer { align-items: flex-start; flex-direction: column; }
  .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-card { padding: 24px; }
  .sidebar-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .photo-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-node-head { flex-direction: column; }
  .collection-node-badges { justify-content: flex-start; }
  .credential-inline { grid-template-columns: 1fr; }
  .demo-grid { grid-template-columns: 1fr; }
}
