/* Klo Enterprise. System fonts only, no external resources. RTL-first. */

:root {
  --navy: #1e3a5f;
  --navy-600: #25476f;
  --navy-700: #193250;
  --navy-800: #142a44;
  --navy-50: #edf2f8;
  --navy-100: #dbe4f0;
  --navy-200: #c3d2e5;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e3e8ef;
  --border-strong: #cdd5e1;
  --text: #16202d;
  --text-2: #3b4757;
  --muted: #6a7586;
  --faint: #929cad;
  --green: #11774f;
  --green-bg: #e8f5ee;
  --green-border: #c2e4d2;
  --red: #c2352b;
  --red-bg: #fdefed;
  --red-border: #f3c9c4;
  --amber: #925400;
  --amber-bg: #fff6e5;
  --amber-border: #f2d9a6;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 6px 24px rgba(20, 42, 68, 0.1);
  --ring: 0 0 0 3px rgba(43, 104, 178, 0.32);
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --col: 560px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
code { font-family: var(--mono); font-size: 0.9em; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 3px solid rgba(43, 104, 178, 0.55); outline-offset: 2px; border-radius: 6px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 16px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tone-green { color: var(--green); }
.tone-amber { color: var(--amber); }
.tone-red { color: var(--red); }
.icon { flex: none; display: block; }

/* ---------- boot / splash ---------- */
.boot {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
}
.boot-text { color: var(--muted); font-size: 14px; }
.boot-error { display: flex; flex-direction: column; gap: 14px; align-items: center; width: min(420px, 100%); }
.boot-error .error-box { width: 100%; }
.noscript { text-align: center; padding: 24px; }

/* ---------- face (voice avatar, logo) ---------- */
.face {
  --size: 168px;
  position: relative; flex: none;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #33598a 0%, #24466f 38%, #1e3a5f 66%, #193250 100%);
  box-shadow: 0 14px 34px rgba(30, 58, 95, 0.22), inset 0 -6px 18px rgba(0, 0, 0, 0.12);
}
.face--md { --size: 84px; }
.face--sm { --size: 56px; }
.face-eye {
  position: absolute; top: 37%;
  width: calc(var(--size) * 0.068); height: calc(var(--size) * 0.068);
  border-radius: 50%; background: #fff;
  transform-origin: center;
}
.face-eye--a { left: 31%; }
.face-eye--b { right: 31%; }
.face-mouth {
  position: absolute; left: 50%; top: 61%;
  width: calc(var(--size) * 0.28); height: calc(var(--size) * 0.095);
  margin-left: calc(var(--size) * -0.14);
  background: #fff;
  border-radius: 3px 3px 999px 999px;
  transform-origin: top center;
}
.face::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid rgba(30, 58, 95, 0.28); opacity: 0; pointer-events: none;
}
.face.is-idle .face-eye { animation: blink 5.5s infinite; }
.face.is-listening::after { animation: ring 1.5s ease-out infinite; }
.face.is-listening .face-mouth { animation: listen 1.5s ease-in-out infinite; }
.face.is-thinking .face-eye { animation: think 1.6s ease-in-out infinite; }
.face.is-thinking .face-mouth { transform: scaleX(0.7) scaleY(0.55); transition: transform 0.3s; }
.face.is-speaking .face-mouth { animation: speak 0.42s ease-in-out infinite alternate; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.12); } }
@keyframes ring { 0% { opacity: 0.9; transform: scale(0.96); } 100% { opacity: 0; transform: scale(1.18); } }
@keyframes listen { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.8); } }
@keyframes think { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(calc(var(--size) * 0.035)); } 70% { transform: translateX(calc(var(--size) * -0.035)); } }
@keyframes speak { from { transform: scaleY(0.45); } to { transform: scaleY(1.25); } }

/* ---------- shell ---------- */
.shell {
  position: relative;
  max-width: var(--col); margin: 0 auto;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
}
@media (min-width: 600px) {
  .shell { box-shadow: 0 0 0 1px rgba(20, 42, 68, 0.05), 0 10px 40px rgba(20, 42, 68, 0.06); }
}
.skip-link {
  position: absolute; top: 8px; right: 8px; z-index: 20;
  padding: 8px 14px; border-radius: 8px; border: 0;
  background: #fff; color: var(--navy); font-weight: 700;
  transform: translateY(-160%);
}
.skip-link:focus-visible { transform: none; }

.topbar {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  min-height: 78px;
  padding: calc(env(safe-area-inset-top, 0px) + 13px) 18px 13px 20px;
  background: var(--navy); color: #fff;
}
.topbar-back {
  flex: none; display: grid; place-items: center;
  width: 34px; height: 34px; margin-inline-start: -8px;
  border-radius: 50%; color: #fff;
}
.topbar-back:hover { background: rgba(255, 255, 255, 0.08); }
.topbar-text { min-width: 0; }
.topbar-title {
  font-size: 19px; font-weight: 800; line-height: 1.35; letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-title:focus-visible { outline-color: rgba(255, 255, 255, 0.7); }
.topbar-sub {
  display: flex; align-items: center; gap: 5px;
  margin-top: 1px; font-size: 12.5px; color: #c9d6e7;
  overflow: hidden; white-space: nowrap;
}
.topbar-sub span { overflow: hidden; text-overflow: ellipsis; }
.topbar-sub .icon { color: #e6c46c; }

.banner {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 16px; font-size: 13px;
  background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid var(--amber-border);
}

.main {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.main > * { flex-shrink: 0; }
.main:focus-visible { outline: none; }
.main--chat { padding: 14px 14px 12px; gap: 0; }
.dock { flex: none; }

.tabbar {
  flex: none;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px 10px;
  color: #8f99a9; text-decoration: none;
  font-size: 11.5px; line-height: 1.3;
}
.tab-icon { position: relative; display: block; }
.tab .icon { width: 24px; height: 24px; }
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--navy); font-weight: 800; }
.tab.is-active .icon { stroke-width: 2.1; }
.tab-badge {
  position: absolute; top: -5px; right: 15px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; border: 2px solid #fff;
  background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 14px; text-align: center;
  direction: ltr;
}

/* ---------- cards, sections, rows ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card-list { padding: 0; overflow: hidden; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head--pad { padding: 14px 16px 4px; margin: 0; }
.card-head-end { margin-inline-start: auto; }
.card-title { font-size: 15.5px; font-weight: 800; }
.card-foot { padding: 10px 16px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.lead { color: var(--text-2); font-size: 14px; }

.section { display: flex; flex-direction: column; gap: 8px; }
.section-title { font-size: 13px; font-weight: 800; color: var(--muted); padding: 4px 4px 0; letter-spacing: 0.01em; }
.section + .section { margin-top: 4px; }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px;
  background: none; border: 0; text-align: start;
  color: inherit; text-decoration: none;
}
.rows > * + * { border-top: 1px solid var(--border); }
a.row:hover, button.row:hover { background: var(--surface-2); }
.row--tall { padding-block: 14px; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-title-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-sub { color: var(--muted); font-size: 13px; min-width: 0; }
.row-meta { flex: none; color: var(--faint); font-size: 12px; direction: ltr; }
.row-chev { color: var(--faint); }
.row--danger .row-title { color: var(--red); }

.icon-tile {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
}
.icon-tile-navy { background: var(--navy-50); color: var(--navy); }
.icon-tile-green { background: var(--green-bg); color: var(--green); }
.icon-tile-red { background: var(--red-bg); color: var(--red); }
.icon-tile-amber { background: var(--amber-bg); color: var(--amber); }
.icon-tile-grey { background: #f0f2f5; color: var(--faint); }

.avatar {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  font-weight: 800; font-size: 16px;
}
.avatar-navy { background: var(--navy); color: #fff; }
.avatar-soft { background: var(--navy-50); color: var(--navy); }
.avatar-grey { background: #eceff3; color: var(--faint); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; border: 1px solid transparent;
  font-size: 11.5px; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.badge-grey { background: #f1f3f6; color: var(--text-2); border-color: var(--border); }
.badge-navy { background: var(--navy-50); color: var(--navy); border-color: var(--navy-100); }
.badge-green { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.badge-red { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; gap: 5px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-600); }
.btn-soft { background: var(--navy-50); color: var(--navy); border-color: var(--navy-100); }
.btn-soft:hover:not(:disabled) { background: var(--navy-100); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover:not(:disabled) { background: var(--navy-50); }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-outline { background: #fff; color: var(--red); border-color: var(--red-border); }
.btn-danger-outline:hover:not(:disabled) { background: var(--red-bg); }
.btn:disabled { opacity: 0.5; }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }
.btn.is-busy { opacity: 0.85; }
.btn.is-busy .btn-label, .btn.is-busy .icon { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
.link-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--navy); font-size: 13.5px; font-weight: 700; text-decoration: none;
}
.link-btn:hover { background: var(--navy-50); }

.icon-btn {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff; color: #6d7889;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.icon-btn:hover:not(:disabled) { color: var(--navy); background: var(--navy-50); }
.icon-btn:active:not(:disabled) { transform: scale(0.95); }
.icon-btn:disabled { opacity: 0.45; }
.icon-btn-sm { width: 34px; height: 34px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-hint { font-size: 12.5px; color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.input {
  width: 100%; height: 44px; padding: 0 12px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--navy); box-shadow: var(--ring); }
.input::placeholder { color: #a3acba; }
.input[dir="ltr"] { text-align: left; }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.textarea { height: auto; min-height: 110px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-inline-start: 12px; padding-inline-end: 32px;
  background-image: linear-gradient(45deg, transparent 50%, #6a7586 50%), linear-gradient(135deg, #6a7586 50%, transparent 50%);
  background-position: 14px 50%, 19px 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select-sm { height: 36px; font-size: 14px; min-width: 104px; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; }
.form-error {
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border);
  font-size: 13.5px;
}
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin: 0; display: grid; gap: 12px; }
.fieldset legend { padding: 0 6px; font-size: 13px; font-weight: 800; color: var(--text-2); }
.key-hint { font-size: 11px; color: var(--faint); font-weight: 500; }

.switch {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: none;
  width: 44px; height: 26px; margin: 0;
  border-radius: 999px; background: #d3d9e2;
  transition: background-color 0.2s;
}
.switch::before {
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch:checked { background: var(--navy); }
.switch:checked::before { transform: translateX(-18px); }
.switch:focus-visible { box-shadow: var(--ring); outline: none; }
.switch:disabled { opacity: 0.5; }
.switch-wrap { display: inline-flex; align-items: center; }
.radio { width: 20px; height: 20px; margin: 0; accent-color: var(--navy); flex: none; }

/* ---------- feedback ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--navy-50); overflow: hidden; }
.progress-bar { display: block; height: 100%; border-radius: inherit; transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.progress-navy { background: var(--navy); }
.progress-amber { background: #d18a17; }
.progress-red { background: var(--red); }

.spinner {
  display: inline-block; flex: none;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--navy-200); border-top-color: var(--navy);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 30px; color: var(--muted); }

.skeleton { display: flex; flex-direction: column; gap: 10px; }
.sk-line { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eef1f5 0%, #f6f8fa 50%, #eef1f5 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.sk-0 { width: 45%; height: 14px; }
.sk-1 { width: 88%; }
.sk-2 { width: 70%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 20px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--navy-50); color: var(--navy); margin-bottom: 4px; }
.empty-title { font-weight: 800; color: var(--text); }
.empty-text { font-size: 13.5px; }
.empty .btn { margin-top: 8px; }

.error-box { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; border-color: var(--red-border); }
.error-box-head { display: flex; gap: 8px; align-items: flex-start; color: var(--red); font-weight: 700; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid; }
.notice .icon { margin-top: 2px; }
.notice-info { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-700); }
.notice-warn { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.notice-error { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.notice-text { flex: 1; }
.fine-print { display: flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 12px; color: var(--muted); }

.toasts {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 86px);
  width: min(520px, calc(100% - 32px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: 12px;
  background: var(--navy-800); color: #fff; font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s ease both;
}
.toast-ok .icon { color: #7ee0b0; }
.toast-error { background: #7f1f18; }
.toast.is-leaving { animation: toastOut 0.3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

.dialog {
  width: min(400px, calc(100% - 32px)); padding: 20px;
  border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  color: var(--text);
}
.dialog::backdrop { background: rgba(14, 26, 42, 0.45); }
.dialog-title { font-size: 17px; font-weight: 800; }
.dialog-text { margin-top: 8px; color: var(--text-2); font-size: 14px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 18px; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; max-width: var(--col); margin: 0 auto; display: flex; flex-direction: column; }
.auth-hero {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + 40px) 24px 64px;
  background: var(--navy); color: #fff;
}
.auth-hero .face { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08), 0 12px 30px rgba(0, 0, 0, 0.25); }
.auth-title { font-size: 23px; font-weight: 800; }
.auth-sub { color: #c9d6e7; font-size: 14px; }
.auth-main { flex: 1; padding: 0 16px 28px; margin-top: -40px; display: flex; flex-direction: column; gap: 16px; }
.auth-card { padding: 20px; box-shadow: var(--shadow-md); }
.auth-card .notice { margin-bottom: 2px; }
.auth-foot { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--faint); font-size: 12.5px; }
.auth-alt { display: flex; justify-content: center; margin-top: 10px; }

/* ---------- home ---------- */
.greet { padding: 2px 2px 2px; }
.greet-title { font-size: 21px; font-weight: 800; }
.greet-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; min-width: 0; }
a.stat:hover { border-color: var(--navy-200); }
.stat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.stat-head .icon-tile { width: 32px; height: 32px; border-radius: 9px; }
.stat-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.stat-num { font-size: 30px; font-weight: 800; line-height: 1.1; direction: ltr; text-align: right; }
.stat--alert .stat-num { color: var(--red); }
.stat-status { display: flex; align-items: center; gap: 5px; font-size: 18px; font-weight: 800; line-height: 1.35; }
.stat-text { font-size: 12.5px; color: var(--muted); }
.cost-row + .cost-row { margin-top: 14px; }
.cost-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.cost-row-label { font-size: 14px; font-weight: 700; color: var(--text-2); }
.cost-row-value { font-size: 13.5px; color: var(--muted); }
.cost-row-value b { color: var(--text); font-size: 15px; }
.usage-list { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.provider-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.provider-label { font-weight: 800; font-size: 16px; }
.provider-model { padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }

/* ---------- agents ---------- */
.agent-hero { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; }
.agent-hero .avatar { width: 52px; height: 52px; font-size: 21px; }
.agent-hero-name { font-size: 18px; font-weight: 800; }
.agent-hero-desc { color: var(--muted); font-size: 13.5px; }
.agent-hero .btn { grid-column: 1 / -1; }

/* ---------- chat ---------- */
.chat-log { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.chat-loading { display: flex; justify-content: center; padding: 40px; }
.chat-intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 20px; }
.chat-intro .face { margin-bottom: 6px; }
.chat-intro-title { font-weight: 800; font-size: 16px; }
.chat-intro-text { color: var(--muted); font-size: 13.5px; }
.day-sep { align-self: center; margin: 10px 0 6px; font-size: 12px; color: var(--muted); }
.day-sep span { padding: 2px 10px; }

.msg { display: flex; }
.msg--user { justify-content: flex-end; }
.msg--bot { justify-content: flex-start; }
.msg--notice { justify-content: center; }
.msg--card { display: block; }
.bubble {
  max-width: min(84%, 440px); min-width: 64px;
  padding: 10px 14px 6px;
  border-radius: 14px;
  font-size: 15px; line-height: 1.72;
  overflow-wrap: anywhere;
  animation: bubbleIn 0.22s ease both;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px); } }
.bubble--user { background: var(--navy); color: #fff; font-weight: 700; }
.bubble--bot { background: #fff; color: var(--text); border: 1px solid var(--border); }
.bubble--error { background: #fff8f7; border-color: var(--red-border); }
.bubble-flag { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; color: var(--red); font-size: 12.5px; font-weight: 800; }
.bubble-voice { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; font-size: 12px; font-weight: 700; opacity: 0.78; }
.bubble-text > * + * { margin-top: 8px; }
.bubble-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bubble-time { display: block; margin-top: 3px; font-size: 11px; font-weight: 500; text-align: left; color: var(--faint); }
.bubble--user .bubble-time { color: rgba(255, 255, 255, 0.66); }
.notice-bubble {
  display: flex; align-items: flex-start; gap: 7px; max-width: 92%;
  padding: 8px 12px; border-radius: 12px;
  background: #eef1f6; color: var(--text-2); font-size: 13px; line-height: 1.6;
}
.notice-bubble .icon { margin-top: 3px; color: var(--muted); }
.notice-body { flex: 1; }
.notice-bubble .bubble-time { margin: 0; align-self: flex-end; }

/* markdown inside bubbles */
.md-code { padding: 1px 5px; border-radius: 5px; background: #eef2f7; font-size: 0.86em; unicode-bidi: isolate; }
.bubble--user .md-code { background: rgba(255, 255, 255, 0.15); }
.md-codeblock { position: relative; }
.md-pre {
  margin: 0; padding: 12px 14px; border-radius: 10px;
  background: #0f1d30; color: #e6edf6;
  font: 12.5px/1.6 var(--mono); overflow-x: auto; text-align: left;
}
.md-lang { position: absolute; top: 6px; left: 12px; font: 10.5px var(--mono); color: #8ea3bf; }
.md-pre:has(+ *) { margin-bottom: 0; }
.md-lang + .md-copy + .md-pre { padding-top: 24px; }
.md-copy {
  position: absolute; top: 5px; right: 6px;
  display: grid; place-items: center; width: 28px; height: 28px;
  border: 0; border-radius: 7px; background: rgba(255, 255, 255, 0.08); color: #b9c7da;
}
.md-copy:hover { background: rgba(255, 255, 255, 0.16); }
.md-copy.is-done { color: #7ee0b0; }
.md-list { margin: 0; padding-inline-start: 22px; }
.md-list li + li { margin-top: 2px; }
.md-h { font-weight: 800; }
.md-hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.md-table-wrap { overflow-x: auto; }
.md-table { border-collapse: collapse; font-size: 13.5px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 5px 9px; text-align: start; }
.md-table th { background: var(--surface-2); font-weight: 800; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--bg); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 5px 10px; border-radius: 999px;
  background: #fff; border: 1px solid var(--border); color: var(--text-2);
  font-size: 12.5px; text-decoration: none;
}
.chip-link:hover { border-color: var(--navy-200); color: var(--navy); }
.bubble--user .chip { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; font-weight: 700; }
.chip-size { color: var(--faint); font-size: 11.5px; }
.bubble--user .chip-size { color: rgba(255, 255, 255, 0.7); }
.chip-lead { display: inline-flex; }
.chip-lead .spinner { display: none; width: 14px; height: 14px; }
.chip.is-uploading .chip-lead .spinner { display: inline-block; }
.chip.is-uploading .chip-lead .icon { display: none; }
.chip-x { display: grid; place-items: center; width: 22px; height: 22px; margin-inline-end: -4px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.chip-x:hover { background: var(--navy-50); color: var(--red); }

/* run status */
.run-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; font-size: 13px; color: var(--muted);
  background: var(--bg);
}
.run-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { display: none; gap: 3px; }
.run-status.is-active .dots { display: inline-flex; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--navy); opacity: 0.35; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.run-status[data-state="waiting_approval"] { color: var(--amber); font-weight: 700; }
.run-status[data-state="error"] { color: var(--red); }

/* composer */
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px 9px;
  background: var(--bg); border-top: 1px solid var(--border);
}
.composer-input {
  flex: 1; min-width: 0;
  height: 40px; max-height: 140px; padding: 8px 15px;
  border: 1px solid var(--border); border-radius: 20px; background: #fff;
  line-height: 1.5; resize: none; overflow-y: auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-input:focus { border-color: var(--navy-200); box-shadow: 0 0 0 2px rgba(43, 104, 178, 0.14); }
.composer-input::placeholder { color: #9aa4b3; }
.send-btn { background: var(--navy); border-color: var(--navy); color: #fff; }
.send-btn:hover:not(:disabled) { background: var(--navy-600); color: #fff; }
.send-btn .icon { transform: translateX(-1px); }
.send-btn.is-stop { background: #fff; color: var(--navy); border-color: var(--navy-200); }
.send-btn.is-stop .icon { transform: none; }
.mic-btn.is-live { background: var(--red); border-color: var(--red); color: #fff; animation: pulseRed 1.4s infinite; }
.mic-btn.is-live:hover { background: #a92c23; color: #fff; }
.mic-btn.is-off { opacity: 0.5; }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(194, 53, 43, 0.45); } 70% { box-shadow: 0 0 0 9px rgba(194, 53, 43, 0); } 100% { box-shadow: 0 0 0 0 rgba(194, 53, 43, 0); } }
.rec-bar {
  flex: 1; min-width: 0; height: 40px;
  display: flex; align-items: center; gap: 9px; padding: 0 8px 0 14px;
  background: #fff; border: 1px solid var(--red-border); border-radius: 20px;
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: blinkDot 1s infinite; }
@keyframes blinkDot { 50% { opacity: 0.25; } }
.rec-label { font-size: 13.5px; font-weight: 700; color: var(--red); }
.rec-time { font: 13px var(--mono); color: var(--text-2); }
.rec-cancel { margin-inline-start: auto; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.rec-cancel:hover { background: var(--red-bg); color: var(--red); }

/* ---------- voice ---------- */
.voice { display: flex; flex-direction: column; align-items: center; padding: 26px 0 8px; }
.pill {
  margin-top: 18px; padding: 4px 16px; min-width: 64px; text-align: center;
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12.5px; color: var(--text-2);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.pill[data-phase="listening"] { color: var(--red); border-color: var(--red-border); background: #fff8f7; }
.pill[data-phase="thinking"] { color: var(--navy); border-color: var(--navy-100); }
.pill[data-phase="speaking"] { color: var(--green); border-color: var(--green-border); }
.btn-talk {
  margin-top: 16px; width: min(300px, 100%); height: 58px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 12px;
  background: var(--navy); color: #fff;
  font-size: 16px; font-weight: 800;
  box-shadow: 0 8px 20px rgba(30, 58, 95, 0.18);
  transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn-talk:hover:not(:disabled) { background: var(--navy-600); }
.btn-talk:active:not(:disabled) { transform: scale(0.985); }
.btn-talk:disabled { opacity: 0.55; box-shadow: none; }
.btn-talk:focus-visible { outline: 3px solid rgba(43, 104, 178, 0.5); outline-offset: 3px; }
.talk-icon { display: grid; place-items: center; }
.btn-talk.is-recording .talk-icon { color: #fff; }
.voice-alert { width: 100%; margin-top: 16px; }
.voice-alert:empty { display: none; }
.transcript { width: 100%; margin-top: 20px; display: flex; flex-direction: column; gap: 9px; padding: 0 4px; }
.transcript:empty { display: none; }
.tline { font-size: 14px; color: var(--text-2); line-height: 1.7; animation: bubbleIn 0.25s ease both; }
.tline strong { color: var(--text); font-weight: 800; }
.cost-card { width: 100%; margin-top: 20px; display: flex; align-items: center; gap: 10px; padding: 14px; }
.cost-card .icon-tile { width: 30px; height: 30px; border-radius: 8px; }
.cost-card-body { min-width: 0; }
.cost-line { margin-top: 2px; font-size: 12.5px; color: var(--text-2); }
.voice-links { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }

/* ---------- approvals ---------- */
.approval-list, .approval-history { display: flex; flex-direction: column; gap: 10px; }
.approval {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
  transition: background-color 0.3s, border-color 0.3s, padding 0.3s;
}
.approval--inline { margin: 4px 0; border-color: var(--navy-100); box-shadow: 0 2px 10px rgba(30, 58, 95, 0.06); }
.approval-head { display: flex; align-items: center; gap: 8px; }
.approval-cat { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14.5px; color: var(--navy); }
.approval-cat.is-critical { color: var(--red); }
.approval-time { margin-inline-start: auto; font-size: 12px; color: var(--faint); direction: ltr; }
.approval-summary { font-size: 15px; line-height: 1.65; color: var(--text); overflow-wrap: anywhere; }
.approval-details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.approval-details summary {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 700; color: var(--text-2);
}
.approval-details summary::-webkit-details-marker { display: none; }
.approval-details summary::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-inline-start: 2px solid currentColor; border-bottom: 2px solid currentColor;
  /* closed: points to the reading direction (left in RTL); open: points down */
  transform: rotate(135deg); transition: transform 0.15s;
}
.approval-details[open] summary::before { transform: rotate(45deg); margin-top: -4px; }
.approval-details summary:focus-visible { outline-offset: -2px; }
.approval-details-pre {
  margin: 0; padding: 10px 12px; max-height: 220px; overflow: auto;
  border-top: 1px solid var(--border); background: #fff;
  font: 12px/1.55 var(--mono); color: var(--text-2); text-align: left;
  white-space: pre-wrap; overflow-wrap: anywhere;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.approval-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.approval-meta b { color: var(--text-2); font-weight: 700; }
.approval-tool { font: 11.5px var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); }
.approval-expiry { display: inline-flex; align-items: center; gap: 4px; direction: rtl; }
.approval-expiry.is-urgent { color: var(--red); font-weight: 700; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 3px; }
.approval-actions .btn { flex: 1 1 0; min-width: 92px; }
.approval-actions .btn-primary { flex-grow: 1.4; }
.approval-wait { display: flex; align-items: center; gap: 6px; color: var(--amber); font-size: 13px; font-weight: 700; }
.approval.is-collapsed { padding: 10px 14px; gap: 0; box-shadow: none; }
.approval.is-folding { overflow: hidden; transition: height 0.38s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.3s, border-color 0.3s, padding 0.3s; }
.approval.is-folding .approval-line { animation: lineIn 0.38s ease both; }
@keyframes lineIn { from { opacity: 0; transform: translateY(-4px); } }
.approval-line { font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
/* A decided approval is ONE line on every screen width; the full text is in the title tooltip. */
.approval.is-collapsed .approval-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.approval--ok { background: #f3faf6; border-color: var(--green-border); color: var(--green); }
.approval--deny { background: #fdf5f4; border-color: var(--red-border); color: var(--red); }
.approval--expired { background: #f6f7f9; border-color: var(--border); color: var(--muted); }
.approval--pending { color: var(--amber); }
.approval-history .approval { box-shadow: none; }
.more-wrap { display: flex; justify-content: center; }
.more-wrap:empty { display: none; }

/* ---------- settings ---------- */
.account { display: flex; align-items: center; gap: 12px; padding: 16px; }
.account .avatar { width: 48px; height: 48px; font-size: 19px; }
.account-text { flex: 1; min-width: 0; }
.account-name { font-weight: 800; font-size: 16px; }
.account-email { color: var(--muted); font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.pw-slot { padding: 4px 16px 16px; }
.connector .row { cursor: default; }
.pair-panel { margin: 0 16px 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--navy-50); border: 1px solid var(--navy-100); display: flex; flex-direction: column; gap: 8px; }
.pair-label { font-size: 12.5px; font-weight: 800; color: var(--navy); }
.pair-code-row { display: flex; align-items: center; gap: 10px; }
.pair-code { font: 800 24px var(--mono); letter-spacing: 0.12em; color: var(--navy-800); }
.pair-instructions { font-size: 13.5px; color: var(--text-2); }
.pair-cmd { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; background: #fff; border: 1px solid var(--navy-100); font-size: 13px; color: var(--navy-800); }
.pair-left { font-size: 12.5px; color: var(--muted); }
.pair-left.is-expired { color: var(--red); }
.about { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--faint); font-size: 12.5px; padding: 6px 0 4px; }

/* ---------- admin ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user { display: flex; flex-direction: column; gap: 10px; }
.user.is-disabled { background: var(--surface-2); }
.user-head { display: flex; align-items: center; gap: 12px; }
.user-text { min-width: 0; flex: 1; }
.user-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 800; }
.user-email { color: var(--muted); font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.user-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.user-meta b { color: var(--text-2); }
.user-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.user-actions .field-label { margin: 0; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 12px; text-align: start; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table thead th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 800; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.policy-table tbody th { font-weight: 700; }
.policy-label { display: block; }
.policy-table .badge { margin-top: 3px; }
.policy-table tr.is-critical th { box-shadow: inset -3px 0 0 var(--red); }
.policy-table .select-sm { min-width: 0; width: 100%; }
.sticky-actions {
  position: sticky; bottom: -28px; z-index: 2;
  margin: 2px -16px -28px; padding: 12px 16px calc(12px + 0px);
  background: linear-gradient(to top, var(--bg) 70%, rgba(243, 245, 249, 0));
  display: flex; justify-content: flex-start;
}
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pricing-grid .fieldset { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.provider-list { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.provider { display: flex; flex-direction: column; gap: 10px; }
.provider.is-active { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy) inset; }
.provider.is-muted { background: var(--surface-2); }
.provider-head { display: flex; align-items: center; gap: 10px; }
.provider-name { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15.5px; cursor: pointer; }
.provider.is-muted .provider-name { color: var(--muted); cursor: default; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text-2); text-align: right; min-width: 0; }
.kv code { font-size: 12px; }
.provider-reason { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--amber); }
.provider-reason .icon { margin-top: 2px; }
.test-result { font-size: 13px; color: var(--muted); }
.test-result:empty { display: none; }

.agent-admin { display: flex; flex-direction: column; gap: 14px; }
.agent-admin-head { display: flex; align-items: center; gap: 12px; }
.agent-admin.is-muted { background: var(--surface-2); }
.agent-form { padding-top: 14px; border-top: 1px solid var(--border); }
.tool-chip { padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }

.chain { display: flex; }
.chain-ok, .chain-bad { flex: 1; display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid; font-weight: 700; font-size: 14px; }
.chain-ok { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.chain-bad { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.audit-table { font-size: 13px; }
.audit-table td { vertical-align: top; }
.audit-table .details { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.sc-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sc-summary .row-body { flex: 1 1 180px; }
.sc-title { font-size: 16px; font-weight: 800; }
.tone-bg-green { background: var(--green-bg); border-color: var(--green-border); }
.tone-bg-amber { background: var(--amber-bg); border-color: var(--amber-border); }
.tone-bg-red { background: var(--red-bg); border-color: var(--red-border); }
.checks { list-style: none; margin: 0; padding: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; }
.check + .check { border-top: 1px solid var(--border); }
.check-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; }
.check-green .check-icon { background: var(--green-bg); }
.check-amber .check-icon { background: var(--amber-bg); }
.check-red .check-icon { background: var(--red-bg); }
.check .row-title { font-size: 14px; }

/* ---------- my data, deletion, key rotation, orphans ---------- */
a.btn { text-decoration: none; }
.badge .spinner { width: 11px; height: 11px; border-width: 2px; }
.card > .card-title + .steps, .card > .lead + .bullets { margin-top: 12px; }
.bullets { margin: 8px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; color: var(--text-2); font-size: 14px; }
.export-row .btn { flex: none; }
.meta-line { display: flex; flex-wrap: wrap; gap: 0 10px; }


.how { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.how summary { display: flex; align-items: center; gap: 9px; padding: 11px 14px; cursor: pointer; list-style: none; font-weight: 700; font-size: 14px; color: var(--navy); }
.how summary::-webkit-details-marker { display: none; }
.how summary::before {
  content: ""; flex: none; width: 7px; height: 7px; margin-top: -3px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform 0.15s;
}
.how[open] summary::before { transform: rotate(-135deg); margin-top: 3px; }
.how-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; font-size: 13.5px; color: var(--text-2); }

.cmd { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.cmd-pre {
  width: 100%; margin: 0; padding: 12px 14px;
  background: var(--navy-800); color: #e8eef7; border-radius: var(--radius-sm);
  font: 12.5px/1.75 var(--mono); text-align: left;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.cmd-pre code { font: inherit; }
.code-chip, .key-chip {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--navy-800); unicode-bidi: isolate;
}
.key-chip { padding: 2px 9px; font-weight: 700; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: step; position: relative; display: flex; flex-direction: column; gap: 1px; min-height: 28px; padding-inline-start: 38px; }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0;
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--navy-50); color: var(--navy); font-weight: 800; font-size: 13px;
}
.steps li b { font-size: 14.5px; }
.steps li span { color: var(--text-2); font-size: 13.5px; }

.checkbox { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red); }
.check-line { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.del-form { margin-top: 2px; padding: 16px; border: 1px solid var(--red-border); border-radius: var(--radius); background: var(--surface); }
.del-state .lead { margin-bottom: 12px; }

.freeze { display: flex; flex-direction: column; gap: 14px; border-color: var(--red-border); background: var(--red-bg); }
.freeze-head { display: flex; align-items: flex-start; gap: 12px; }
.freeze-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--red); color: #fff; }
.freeze-title { font-size: 17px; font-weight: 800; color: var(--red); }
.freeze-sub { margin-top: 2px; font-size: 13.5px; color: var(--text-2); }
.freeze-when { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--red-border); border-radius: var(--radius-sm); background: #fff; }
.freeze-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.freeze-date { font-size: 18px; font-weight: 800; line-height: 1.5; }
.freeze-left { font-size: 14px; font-weight: 800; color: var(--red); }
.freeze-note { font-size: 13.5px; color: var(--text-2); }

.del-when { font-size: 13px; color: var(--text-2); }
.del-when b { color: var(--text); }
.user-actions.del-actions { flex-wrap: wrap; justify-content: flex-start; }
.del-why { margin-top: -2px; }

.progress-green { background: var(--green); }
.progress-thin { height: 5px; }
.rk-keys { display: grid; gap: 10px; margin-bottom: 14px; }
.rk-key { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; }
.rk-key-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.rk-total { margin-bottom: 10px; }
.rk-total .cost-row-head { margin-bottom: 7px; }
.rk-percent { font-size: 17px; font-weight: 800; color: var(--text); }
.rk-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rk-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 13.5px; }
.rk-label { font-weight: 700; color: var(--text-2); }
.rk-count { font: 12.5px var(--mono); color: var(--muted); }
.rk-safe { display: flex; flex-direction: column; gap: 12px; border-color: var(--green-border); background: var(--green-bg); font-size: 14px; }
.rk-safe-head { display: flex; align-items: center; gap: 10px; }
.rk-safe-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; }
.rk-safe-head .card-title { color: var(--green); }

.field-inline .field-label { white-space: nowrap; }
.orphan-id { white-space: nowrap; font-size: 12px; }
.orphan-table th, .orphan-table td { padding-inline: 8px; }
.reason-list { list-style: none; margin: 8px 0 0; padding: 0; }
.reason { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.reason:first-child { border-top: 0; }
.reason-nums { display: flex; align-items: center; gap: 8px; flex: none; }

/* stacked tables on narrow screens */
@media (max-width: 600px) {
  .audit-table thead { display: none; }
  .audit-table, .audit-table tbody, .audit-table tr, .audit-table td { display: block; width: 100%; }
  .audit-table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .audit-table tbody tr:last-child { border-bottom: 0; }
  .audit-table td { padding: 2px 0; border: 0; display: flex; gap: 10px; text-align: start; }
  .audit-table td:empty { display: none; }
  .audit-table td::before { content: attr(data-label); flex: none; width: 64px; color: var(--faint); font-size: 12px; font-family: var(--font); }
  .audit-table .details { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .policy-table th, .policy-table td { padding: 10px 8px; }
  .policy-table th:first-child { padding-inline-start: 14px; }
  .policy-table td:last-child { padding-inline-end: 12px; }
}

@media (max-width: 360px) {
  .stats { grid-template-columns: 1fr; }
  .tab-label { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.dialog-option { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; }
.dialog-option span { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.dialog-option small { font-size: 12.5px; line-height: 1.5; }
