/* =============================================
   SDR Visimob — Panel structural styles
   Built strictly on Visimob design tokens (tokens.css). No new colors.
   ============================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-brand);
  background: var(--color-off-white);
  color: var(--fg1);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}
a { color: var(--color-red); text-decoration: none; }
a:hover { color: var(--color-red-dark); }

/* ── Shell ── */
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  background: var(--color-ink); color: #fff;
  display: flex; align-items: center; gap: var(--space-3);
  padding: 12px 24px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar .wordmark { height: 18px; }
.topbar .sep { width: 1px; height: 16px; background: rgba(255,255,255,.2); }
.topbar .sysname { font-weight: 600; font-size: 13px; color: rgba(255,255,255,.85); letter-spacing: .04em; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 13px; color: rgba(255,255,255,.7); }
.topbar .user b { color: #fff; font-weight: 600; }
.topbar a.logout { color: rgba(255,255,255,.6); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-left: 16px; }
.topbar a.logout:hover { color: #fff; }

.body-grid { display: grid; grid-template-columns: 220px 1fr; min-height: 0; }
.sidebar { background: #0F0C0C; padding: 20px 0; }
.nav-group { margin-bottom: 18px; }
.nav-group-label { font-size: 9px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.3); padding: 0 24px; margin-bottom: 8px; }
.nav-item {
  display: block; padding: 10px 24px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.65); border-left: 2px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-item.active { color: #fff; background: var(--color-red-subtle); border-left-color: var(--color-red); font-weight: 600; }
.content { padding: 32px 48px; min-width: 0; }

/* ── Page header ── */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; }
.page-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--color-red); margin-bottom: 8px; }
.page-title { font-size: var(--text-2xl); font-weight: 900; line-height: 1; letter-spacing: -.02em; color: var(--fg1); }
.page-meta { font-size: 12px; color: var(--fg3); text-align: right; line-height: 1.7; }

/* ── Buttons ── */
.btn { font-family: var(--font-brand); font-weight: 700; font-size: 14px; letter-spacing: .04em; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all .15s ease; text-transform: uppercase; text-decoration: none; }
.btn-primary { background: var(--color-red); color: #fff; padding: 12px 24px; border-radius: var(--radius-sm); }
.btn-primary:hover { background: var(--color-red-dark); color: #fff; }
.btn-dark { background: var(--color-ink); color: #fff; padding: 12px 24px; border-radius: var(--radius-sm); }
.btn-outline { background: transparent; color: var(--color-red); padding: 11px 24px; border-radius: var(--radius-sm); border: 2px solid var(--color-red); }
.btn-outline-dark { background: transparent; color: var(--color-ink); padding: 11px 24px; border-radius: var(--radius-sm); border: 2px solid var(--color-ink); }
.btn-ghost { background: transparent; color: var(--color-red); padding: 12px 18px; border-radius: var(--radius-sm); }
.btn-sm { font-size: 12px; padding: 9px 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cards ── */
.card { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 24px; }
.card + .card { margin-top: 16px; }
.card-label { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-red); margin-bottom: 12px; }
.card-title { font-size: var(--text-lg); font-weight: 700; color: var(--fg1); margin-bottom: 6px; }
.card-text { font-size: 13px; color: var(--fg3); line-height: 1.5; }

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 16px; }
.stat-card { border-radius: var(--radius-md); padding: 22px 24px; }
.stat-card.red { background: var(--color-red); }
.stat-card.ink { background: var(--color-ink); }
.stat-card.white { background: #fff; box-shadow: var(--shadow-md); }
.stat-num { font-size: var(--text-2xl); font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.stat-card.red .stat-num, .stat-card.ink .stat-num { color: #fff; }
.stat-card.white .stat-num { color: var(--fg1); }
.stat-desc { font-size: 12px; margin-top: 6px; }
.stat-card.red .stat-desc { color: rgba(255,255,255,.8); }
.stat-card.ink .stat-desc { color: rgba(255,255,255,.6); }
.stat-card.white .stat-desc { color: var(--fg3); }

/* ── Badges ── */
.badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 12px; border-radius: var(--radius-full); display: inline-flex; align-items: center; line-height: 1; }
.badge-red { background: var(--color-red); color: #fff; }
.badge-ink { background: var(--color-ink); color: #fff; }
.badge-outline { background: transparent; color: var(--color-red); border: 1.5px solid var(--color-red); }
.badge-subtle { background: var(--color-red-subtle); color: var(--color-red); }
.badge-light { background: var(--color-surface); color: var(--fg2); border: 1px solid var(--color-border); }

/* ── Forms ── */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg3); }
.field-input, .field-select, .field-textarea {
  font-family: var(--font-brand); font-size: 15px; font-weight: 400; color: var(--fg1); background: #fff;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); padding: 12px 16px; outline: none;
  transition: border-color .15s; width: 100%;
}
.field-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field-input:focus, .field-select:focus, .field-textarea:focus { border-color: var(--color-red); }
.field-input.error { border-color: var(--color-red); }
.field-error { font-size: 11px; color: var(--color-red); }
.field-help { font-size: 11px; color: var(--fg3); }
.fields-row { display: flex; gap: 12px; }
.fields-row > .field-group { flex: 1; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row .field-input { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.checkbox-row label { font-size: 13px; color: var(--fg2); }

/* ── Table ── */
.table-wrap { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-md); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg3); padding: 14px 16px; border-bottom: 1px solid var(--color-border); }
table.data td { padding: 14px 16px; font-size: 14px; color: var(--fg2); border-bottom: 1px solid var(--color-surface); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--color-off-white); }
table.data a.row-link { color: var(--fg1); font-weight: 600; }

/* ── Filters ── */
.filters { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }
.filters .field-group { margin-bottom: 0; min-width: 160px; }

/* ── Flash ── */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.flash.success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #166534; }
.flash.error { background: var(--color-red-subtle); border: 1px solid rgba(232,25,44,.3); color: var(--color-red); }
.flash.info { background: var(--color-surface); border: 1px solid var(--color-border); color: var(--fg2); }

/* ── Login ── */
.login-wrap { min-height: 100vh; background: var(--color-ink); display: flex; align-items: center; justify-content: center; position: relative; }
.login-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--color-red); }
.login-card { background: #fff; padding: 36px 32px; width: 340px; border-radius: 2px; box-shadow: var(--shadow-lg); }
.login-logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--color-border); }
.login-logo-row .visimob { font-weight: 900; font-size: 15px; color: var(--color-ink); }
.login-logo-row .sep { width: 1px; height: 16px; background: var(--color-border); }
.login-logo-row .sysname { font-weight: 600; font-size: 13px; color: var(--fg3); }
.login-headline { font-weight: 800; font-size: 20px; color: var(--fg1); margin-bottom: 4px; }
.login-sub { font-weight: 300; font-size: 13px; color: var(--fg3); margin-bottom: 24px; }

/* ── Lead detail ── */
.lead-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.transcript { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 20px; max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 10px 14px; font-size: 14px; line-height: 1.45; }
.bubble .meta { font-size: 10px; margin-top: 5px; opacity: .7; }
.bubble.inbound { align-self: flex-start; background: var(--color-surface); color: var(--fg1); border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 2px; }
.bubble.outbound { align-self: flex-end; background: var(--color-red); color: #fff; border-radius: var(--radius-md) var(--radius-md) 2px var(--radius-md); }
.bubble.outbound .meta { color: rgba(255,255,255,.75); }
.bubble.system { align-self: center; background: transparent; color: var(--fg3); font-size: 11px; font-style: italic; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--color-surface); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--fg3); }
.kv .v { color: var(--fg1); font-weight: 600; text-align: right; }
.score-big { font-size: var(--text-3xl); font-weight: 900; line-height: 1; color: var(--color-red); }

/* ── Timeline ── */
.timeline { list-style: none; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 1px solid var(--color-border); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -4px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--color-red); }
.timeline .t-meta { font-size: 10px; color: var(--fg3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.timeline .t-body { font-size: 13px; color: var(--fg2); }

.section-sep { height: 1px; background: var(--color-border); margin: 20px 0; }
.muted { color: var(--fg3); }
.right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.repeat-row { display: flex; gap: 8px; margin-bottom: 8px; }
.repeat-row .field-input { flex: 1; margin: 0; }
