/* smwatcher app — layout + components on top of the design tokens (styles.css). */
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--sw-font);
  background: var(--sw-surface-page); color: var(--sw-text);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sw-surface-card); border-right: 1px solid var(--sw-border);
  padding: 22px 16px 18px; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 20px;
  border-bottom: 1px solid var(--sw-border); margin-bottom: 12px; }
.brand b { font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--sw-text-strong); }
.brand small { font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--sw-text-muted); display: block; margin-top: 2px; }
.nav-group { font-size: 10px; font-weight: 700; color: var(--sw-text-muted);
  letter-spacing: .1em; text-transform: uppercase; padding: 12px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--sw-text-soft); cursor: pointer; }
.nav-item:hover { background: var(--sw-surface-page); }
.nav-item.active { background: var(--sw-brand-soft); color: var(--sw-brand); font-weight: 600; }
.nav-item .badge-count { margin-left: auto; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; background: var(--color-red-600); color: #fff; }
.acct { margin-top: auto; padding: 11px; background: var(--sw-surface-page); border-radius: 12px;
  display: flex; align-items: center; gap: 10px; }
.acct .ini { width: 34px; height: 34px; border-radius: 9px; background: var(--sw-brand-soft);
  color: var(--sw-brand); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { padding: 16px 28px; border-bottom: 1px solid var(--sw-border);
  background: var(--sw-surface-card); display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 5; }
.crumb { font-size: 11px; font-weight: 600; color: var(--sw-text-muted); }
.title { font-size: 22px; font-weight: 700; letter-spacing: -.015em; color: var(--sw-text-strong); margin: 2px 0 0; }
.spacer { margin-left: auto; }
.listening { display: flex; align-items: center; gap: 8px; padding: 7px 13px;
  background: var(--sw-sent-pos-bg); border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--color-green-700); }
.listening .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-green-500); }
.listening.live .dot { animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(11,199,193,.5)} 70%{box-shadow:0 0 0 7px rgba(11,199,193,0)} 100%{box-shadow:0 0 0 0 rgba(11,199,193,0)} }

.content { padding: 22px 28px 40px; }

/* ---------- generic UI ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 16px; }
.card { background: var(--sw-surface-card); border: 1px solid var(--sw-border);
  border-radius: 16px; box-shadow: var(--sw-shadow-1); }
.card-pad { padding: 18px; }
.muted { color: var(--sw-text-muted); }
.section-h { font-size: 15px; font-weight: 700; color: var(--sw-text-strong); }

.kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--sw-surface-card); border: 1px solid var(--sw-border); border-radius: 12px; padding: 11px 14px; }
.kpi .label { font-size: 11.5px; font-weight: 600; color: var(--sw-text-soft); }
.kpi .val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 3px; font-variant-numeric: tabular-nums; color: var(--sw-text-strong); }
.kpi .sub { font-size: 11px; color: var(--sw-text-muted); margin-top: 2px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.term { font-size: 11px; font-weight: 600; color: var(--sw-brand);
  background: var(--color-decorative-soft-blue-01); padding: 3px 9px; border-radius: 7px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px;
  font-size: 13px; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; background: transparent; }
.btn-primary { background: var(--sw-brand); color: #fff; }
.btn-primary:hover { background: var(--sw-brand-hover); }
.btn-secondary { border-color: var(--sw-border-strong); color: var(--sw-text); background: var(--sw-surface-card); }
.btn-secondary:hover { border-color: var(--sw-brand); }
.btn-text { color: var(--sw-text-soft); }
.btn-text:hover { color: var(--sw-text-strong); }
.btn-danger { color: var(--color-red-600); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.input, .select, textarea.input {
  height: 40px; border-radius: 10px; border: 1.5px solid var(--sw-border-strong);
  padding: 0 13px; font-size: 13px; font-family: var(--sw-font); color: var(--sw-text);
  background: var(--sw-surface-card); outline: none; width: 100%;
}
textarea.input { height: auto; padding: 10px 13px; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--sw-brand); }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--sw-text-soft); margin-bottom: 6px; }

.chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--sw-border-strong); cursor: pointer; color: var(--sw-text-soft); background: var(--sw-surface-card); }
.chip:hover { border-color: var(--sw-brand); }
.chip.active { border-color: var(--sw-brand); background: var(--sw-brand-soft); color: var(--sw-brand); }
.chip .c { font-weight: 700; margin-left: 5px; }

.alert-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1180px) { .alert-grid { grid-template-columns: 1fr; } }
.alert-card { display: flex; background: var(--sw-surface-card); border: 1px solid var(--sw-border);
  border-radius: 12px; overflow: hidden; cursor: pointer; }
.alert-card:hover { border-color: var(--sw-brand); box-shadow: var(--sw-shadow-2); }
.sev-bar { flex: 0 0 4px; }
.alert-body { flex: 1; min-width: 0; padding: 11px 14px; }
.alert-title { font-size: 14px; font-weight: 700; color: var(--sw-text-strong); letter-spacing: -.01em; line-height: 1.3; margin: 5px 0 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alert-snip { font-size: 12.5px; color: var(--sw-text-soft); line-height: 1.45; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pager { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pg { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--sw-border-strong);
  background: var(--sw-surface-card); color: var(--sw-text-soft); font-size: 13px; font-weight: 600; cursor: pointer; }
.pg:hover:not(:disabled) { border-color: var(--sw-brand); }
.pg.active { background: var(--sw-brand); color: #fff; border-color: var(--sw-brand); }
.pg:disabled { opacity: .4; cursor: not-allowed; }
.pg-e { color: var(--sw-text-muted); padding: 0 2px; }
.pg-info { margin-left: 10px; font-size: 12px; color: var(--sw-text-muted); }

.empty { text-align: center; padding: 56px 0; color: var(--sw-text-muted); }
.empty b { display: block; font-size: 16px; color: var(--sw-text-soft); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--sw-text-muted); padding: 8px 10px; border-bottom: 1px solid var(--sw-border); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--sw-border); font-size: 13px; }

/* ---------- slide-over ---------- */
.overlay { position: fixed; inset: 0; background: var(--sw-overlay); z-index: 40; display: none; }
.overlay.open { display: block; }
.panel { position: fixed; top: 0; right: 0; width: 600px; max-width: 94vw; height: 100vh;
  background: var(--sw-surface-card); box-shadow: var(--sw-shadow-panel); z-index: 41;
  transform: translateX(100%); transition: transform .18s ease; display: flex; flex-direction: column; }
.panel.open { transform: translateX(0); }
.panel-head { padding: 18px 22px; border-bottom: 1px solid var(--sw-border); display: flex; align-items: center; gap: 12px; }
.panel-body { padding: 22px; overflow: auto; flex: 1; }
.x { margin-left: auto; cursor: pointer; color: var(--sw-text-muted); font-size: 22px; line-height: 1; background: none; border: none; }

.box { border: 1px solid var(--sw-border); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.box h4 { margin: 0 0 10px; font-size: 13px; font-weight: 700; }

.tl { list-style: none; padding: 0; margin: 0; }
.tl li { padding: 8px 0 8px 18px; position: relative; font-size: 13px; color: var(--sw-text-soft); border-left: 2px solid var(--sw-border); margin-left: 4px; }
.tl li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--sw-brand); }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--color-primary-dark-blue-900); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 600; box-shadow: var(--sw-shadow-3); display: flex; align-items: center; gap: 10px;
  opacity: 0; pointer-events: none; transition: all .18s ease; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-green-400); }

.spark { display: block; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars .b { flex: 1; background: var(--sw-brand); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .b.neg { background: var(--color-red-600); }
.tagchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  background: var(--color-decorative-soft-blue-01); color: var(--sw-brand); padding: 4px 6px 4px 10px; border-radius: 7px; }
.tagchip .rm { cursor: pointer; }

.toggle { width: 42px; height: 24px; border-radius: 999px; background: var(--color-neutral-400);
  position: relative; cursor: pointer; flex: 0 0 42px; transition: background .12s ease; }
.toggle.on { background: var(--color-green-500); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(8,33,75,.2); transition: left .12s ease; }
.toggle.on .knob { left: 21px; }

/* ---------- auth screens ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--sw-surface-card);
  border: 1px solid var(--sw-border); border-radius: 18px; box-shadow: var(--sw-shadow-2); padding: 32px; }
.auth-card .field { margin-bottom: 14px; }
