/* Customer console: builds on style.css tokens (--bg, --surface, --ink, --muted, --line, --accent…). */
:root { --warn: #b54708; --shadow: 0 1px 2px rgba(29, 27, 22, .06), 0 8px 24px rgba(29, 27, 22, .06); }
@media (prefers-color-scheme: dark) { :root { --warn: #fdb022; --shadow: 0 1px 2px rgba(0, 0, 0, .4); } }

body.console { display: block; }
body.console .gate-screen, body.console .app { margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- auth ---------- */
.auth { max-width: 380px; }
.auth h1 { font-size: 24px; line-height: 1.35; }
.auth-form { display: grid; gap: 10px; }
.auth-form input {
  height: 50px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  padding: 0 14px; width: 100%;
}
.auth-form input[type="email"], .auth-form input[type="password"] { direction: ltr; text-align: right; }
.quiet-link { color: var(--muted); font-size: 14px; text-decoration: none; }
.quiet-link:hover { color: var(--accent); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab {
  flex: none; border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.auth .tabs { justify-content: center; }

/* ---------- dashboard ---------- */
.dash { width: 100%; max-width: 1040px; margin: 0 auto; padding: 18px 16px 48px; }
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.dash-user { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; }
.pill {
  padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--ink);
  font-size: 13px; font-weight: 600; direction: rtl;
}
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); }
.dash-tabs { margin-bottom: 20px; }
.panel { animation: rise .25s var(--ease); }
.section-title { font-size: 14px; color: var(--muted); margin: 26px 0 10px; }
.empty-note { color: var(--muted); padding: 28px 0; }

/* ---------- agent cards ---------- */
.agent-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.agent-card {
  display: grid; gap: 3px; align-content: start; text-align: start; padding: 18px; min-height: 200px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow);
}
.agent-icon { font-size: 30px; line-height: 1.3; }
.agent-name { font-size: 20px; }
.agent-company { color: var(--accent); font-weight: 600; font-size: 14px; }
.agent-meta { color: var(--muted); font-size: 13px; }
.agent-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; align-self: end; }
.primary.small { height: 42px; font-size: 15px; }
.add-card {
  cursor: pointer; border-style: dashed; box-shadow: none; background: transparent; place-content: center;
  justify-items: center; text-align: center; transition: border-color .2s ease, background .2s ease;
}
.add-card:hover { border-color: var(--accent); background: var(--surface); }
.add-card .agent-icon { color: var(--accent); }

/* ---------- editor ---------- */
#agent-editor { width: min(620px, 100%); }
.template-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.template {
  display: grid; gap: 2px; text-align: start; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); font-size: 13px;
}
.template small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.template[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.ghost.danger { color: var(--danger); }
textarea[name="knowledge"] { font-size: 14px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.calls-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.calls-table th, .calls-table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.calls-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.calls-table tr:last-child td { border-bottom: 0; }
.calls-table .chip { height: 30px; font-size: 13px; }

/* ---------- usage ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: 2fr repeat(3, 1fr); }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } .stats .stat:first-child { grid-column: 1 / -1; } }
.stat { padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; line-height: 1.2; }
.budget-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 6px; }
.budget-bar span { display: block; height: 100%; background: var(--accent); transform-origin: right; transition: transform .4s var(--ease); }
.budget-bar.warn span { background: var(--warn); }
.daily {
  display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; align-items: end; height: 120px;
  padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); direction: ltr;
}
.day { display: block; height: 100%; border-radius: 3px; background: var(--line); transform-origin: bottom; transform: scaleY(max(var(--h), .03)); }
.day.has { background: var(--accent); }

/* ---------- transcript ---------- */
.transcript { display: flex; flex-direction: column; gap: 8px; max-height: 60dvh; overflow-y: auto; }

/* ---------- calls tools ---------- */
.calls-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 14px; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.inline-field select { width: auto; }
.sheet-foot.single { grid-template-columns: auto; justify-content: start; }
