/* Tellectra AI — components. Frosted glass, soft curves, hover-lift. */

/* ── Glass ─────────────────────────────────────────────────────────────── */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--glass-line);
}
.glass.strong { background: var(--glass-strong); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

.card { padding: 18px; }
.card.tight { padding: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: var(--fs-md); letter-spacing: -0.015em; }

.lift { transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease); }
.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--glass-line); }
button.lift, a.lift { cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  --h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-weight: 650; font-size: var(--fs-base); line-height: 1; white-space: nowrap;
  text-decoration: none !important;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast);
  user-select: none;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; pointer-events: none; }
.btn.sm { --h: 30px; padding: 0 12px; font-size: var(--fs-sm); }
.btn.lg { --h: 44px; padding: 0 24px; font-size: var(--fs-md); }
.btn.block { width: 100%; }
.btn.icon { width: var(--h); padding: 0; }

.btn.primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-brand); }
.btn.primary:hover { background: var(--brand-hover); transform: translateY(-2px); }
.btn.secondary { background: var(--glass-strong); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-1); }
.btn.secondary:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.accent { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.accent { color: #0a111f; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-color: var(--on-brand) transparent var(--on-brand) transparent;
  animation: spin 0.7s linear infinite;
}
.btn.secondary.loading::after, .btn.ghost.loading::after { border-color: var(--ink) transparent var(--ink) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field .err { font-size: var(--fs-xs); color: var(--bad); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  background: var(--glass-strong); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238493ad' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input.sm, .select.sm { min-height: 32px; padding: 5px 10px; font-size: var(--fs-sm); }
.input-group { position: relative; }
.input-group > svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-4); pointer-events: none; }
.input-group > .input { padding-left: 42px; }
.input-group > .btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--sunken-strong); border-radius: var(--r-pill); transition: background var(--t-fast); }
.switch span::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform var(--t-fast) var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: 0.45; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--sunken); border-radius: var(--r-pill); }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; padding: 5px 13px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 650; color: var(--ink-3);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: var(--shadow-1); }
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { background: rgba(255,255,255,.12); }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 21px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
  background: var(--neutral-soft); color: var(--ink-2);
}
.badge svg { width: 12px; height: 12px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
:root[data-theme="light"] .badge.brand, :root:not([data-theme]) .badge.brand { color: #065f46; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

/* ── Avatar ────────────────────────────────────────────────────────────── */
.avatar {
  --s: 32px; width: var(--s); height: var(--s); flex: none; border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 750; font-size: calc(var(--s) * 0.38);
  color: #fff; background: linear-gradient(135deg, #10b981, #065f46); letter-spacing: 0;
}
.avatar.lg { --s: 46px; }
.avatar.sm { --s: 26px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th {
  text-align: left; font-weight: 650; color: var(--ink-3); font-size: var(--fs-xs);
  padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
  background: var(--glass-strong);
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--sunken); }
.table td.right, .table th.right { text-align: right; }
.cell-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-person .name { font-weight: 650; color: var(--ink); }
.cell-person .sub { font-size: var(--fs-xs); color: var(--ink-3); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; font-weight: 650; font-size: var(--fs-sm); color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }

/* ── Meter ─────────────────────────────────────────────────────────────── */
.meter { height: 8px; background: var(--sunken-strong); border-radius: var(--r-pill); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 600ms var(--ease); min-width: 0; }
.meter.warn > i { background: #d97706; }
.meter.bad > i { background: var(--bad); }

/* ── Overlays ──────────────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 90; background: rgba(3, 28, 21, 0.42);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: fade 180ms var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 91; width: min(520px, calc(100vw - 24px));
  display: flex; flex-direction: column; background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  animation: slide-in 320ms var(--ease);
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.drawer-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 10px; padding: 12px 20px; border-top: 1px solid var(--line); }
.modal {
  position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 22px;
  animation: pop 240ms var(--ease);
}
.modal.wide { width: min(860px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.98); } }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: min(420px, calc(100vw - 36px));
  padding: 12px 16px 12px 14px; background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-radius: var(--r-md); box-shadow: var(--shadow-3);
  font-size: var(--fs-sm); font-weight: 600; animation: toast-in 320ms var(--ease);
}
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: var(--ok); } .toast.bad svg { color: var(--bad); } .toast.info svg { color: var(--accent); }
@keyframes toast-in { from { transform: translateY(14px) scale(0.97); opacity: 0; } }

.menu {
  position: fixed; z-index: 120; min-width: 200px; padding: 6px;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-radius: var(--r-md); box-shadow: var(--shadow-3); animation: pop-sm 160ms var(--ease);
}
@keyframes pop-sm { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none;
  border-radius: var(--r-xs); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); text-align: left; text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
.menu svg { width: 17px; height: 17px; }
.menu hr { margin: 6px 4px; }

/* ── Empty / skeleton / banner ─────────────────────────────────────────── */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 34px 20px; }
.empty .art { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.empty .art svg { width: 25px; height: 25px; }
.empty h4 { font-size: var(--fs-md); }
.empty p { max-width: 380px; color: var(--ink-3); font-size: var(--fs-sm); }

.skeleton { position: relative; overflow: hidden; background: var(--sunken); border-radius: var(--r-sm); min-height: 14px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

.banner { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: var(--r-md); background: var(--info-soft); color: var(--ink); }
.banner > svg { width: 22px; height: 22px; flex: none; margin-top: 1px; color: var(--accent); }
.banner.warn { background: var(--warn-soft); } .banner.warn > svg { color: var(--warn); }
.banner.bad { background: var(--bad-soft); } .banner.bad > svg { color: var(--bad); }
.banner.info { background: var(--info-soft); }
.banner.ok { background: var(--ok-soft); } .banner.ok > svg { color: var(--ok); }
.banner .grow strong { display: block; margin-bottom: 2px; }
.banner p { font-size: var(--fs-sm); color: var(--ink-2); }

/* ── Brand lockup ──────────────────────────────────────────────────────── */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; font-weight: 800; letter-spacing: -0.03em; font-size: 1.05rem; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.logo small { font-weight: 600; letter-spacing: 0; color: var(--ink-3); font-size: 0.8em; margin-left: 2px; }

/* ── KPI ───────────────────────────────────────────────────────────────── */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .k-label { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kpi .k-label svg { width: 15px; height: 15px; }
.kpi .k-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: var(--fs-xs); color: var(--ink-3); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; font-size: var(--fs-sm); }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.copy-box {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.copy-box code { background: none; padding: 0; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: var(--fs-sm); }
pre.code {
  margin: 0; padding: 16px 18px; border-radius: var(--r-sm); background: #06231c; color: #d6f0e6;
  font-size: 0.75rem; line-height: 1.6; overflow-x: auto;
}
pre.code .c { color: #7fa89a; } pre.code .s { color: #fcd34d; } pre.code .k { color: #6ee7b7; }

.pill-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: var(--fs-sm); }
.pill-link svg { width: 15px; height: 15px; transition: transform var(--t-fast); }
.pill-link:hover svg { transform: translateX(3px); }

/* ── Charts ────────────────────────────────────────────────────────────── */
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; padding: 7px 11px; border-radius: var(--r-sm);
  background: var(--ink); color: var(--bg); font-size: var(--fs-xs); display: flex; flex-direction: column; gap: 1px;
  box-shadow: var(--shadow-2); white-space: nowrap;
}
.chart-tip strong { font-weight: 700; } .chart-tip span { opacity: .85; }
.fn-row { display: grid; grid-template-columns: 96px 1fr 40px; gap: 12px; align-items: center; padding: 7px 0; font-size: var(--fs-sm); }
.fn-label { color: var(--ink-2); font-weight: 600; }
.fn-track { height: 14px; background: var(--sunken); border-radius: var(--r-pill); overflow: hidden; }
.fn-track i { display: block; height: 100%; background: var(--chart-1); border-radius: var(--r-pill); transition: width 700ms var(--ease); }
.fn-val { text-align: right; font-weight: 700; }
.drawer.wide { width: min(760px, calc(100vw - 24px)); }

/* Plans */
.plan-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.plan-card.current { outline: 2px solid var(--brand); outline-offset: -2px; }
.plan-card .price { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.035em; }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: var(--fs-sm); }
.plan-card li { display: flex; gap: 10px; align-items: flex-start; }
.plan-card li .ico { width: 17px; height: 17px; color: var(--ok); margin-top: 2px; }
.plan-card li.off { color: var(--ink-4); } .plan-card li.off .ico { color: var(--ink-4); }

