/* account-shell.css — left side-menu + Dashboard for the Account page.
   Namespaced under .acct-* so it never collides with account.css
   (which owns .nav for the top header, .card, .account-*).
   Light-only, aligned to the site tokens in account.css. */

.acct-shell{
  --acct-green:#12b981;
  --acct-green-soft:rgba(18,185,129,0.12);
  --acct-blue:#3b82f6;
  --acct-blue-soft:rgba(59,130,246,0.12);
  --acct-pink:#e0508a;
  --acct-pink-soft:rgba(224,80,138,0.12);
  --acct-amber:#e08a1e;
  --acct-amber-soft:rgba(224,138,30,0.14);
  --acct-mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;

  display:grid;
  grid-template-columns:236px 1fr;
  gap:26px;
  align-items:start;
  margin-top:22px;
}

/* ── Left menu ───────────────────────────────────────────── */
.acct-side{
  position:sticky;
  top:88px;
  display:flex;
  flex-direction:column;
  gap:3px;
  background:var(--bg-elevated);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-soft);
  padding:12px 10px;
}
.acct-navlabel{
  font-size:11px;
  letter-spacing:0.09em;
  text-transform:uppercase;
  color:var(--muted);
  font-weight:700;
  padding:14px 10px 6px;
}
.acct-nav{
  display:flex;
  align-items:center;
  gap:11px;
  width:100%;
  text-align:left;
  padding:10px 11px;
  border:0;
  border-radius:11px;
  background:transparent;
  color:var(--muted);
  font:inherit;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  transition:background 180ms ease, color 180ms ease;
}
.acct-nav svg{ width:18px; height:18px; flex:none; }
.acct-nav:hover{ background:var(--accent-soft); color:var(--text); }
.acct-nav.is-active{
  background:var(--accent);
  color:#fff;
  box-shadow:0 6px 16px rgba(102,81,246,0.32);
}
.acct-nav.is-active svg{ stroke:#fff; }
.acct-nav:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* ── Panels ──────────────────────────────────────────────── */
.acct-main{ min-width:0; }
.acct-panel{ display:none; }
.acct-panel.is-active{ display:block; animation:acctFade 220ms ease; }
@keyframes acctFade{ from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;} }
@media (prefers-reduced-motion:reduce){ .acct-panel.is-active{ animation:none; } }

/* Shared card used by dashboard sections */
.acct-card{
  background:var(--bg-elevated);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-soft);
  padding:20px;
}

/* ── Dashboard header ────────────────────────────────────── */
.dash-top{ margin-bottom:20px; display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; }
.dash-h1{ margin:0; font-size:24px; font-weight:800; letter-spacing:-0.01em; }
.dash-sub{ margin:4px 0 0; color:var(--muted); font-size:14px; }

/* Period picker (segmented control + optional custom month range) */
.dash-periodwrap{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.dash-range{ display:inline-flex; align-items:center; gap:8px; }
.dash-range input[type="date"], .dash-range input[type="month"]{
  font:inherit; font-size:12.5px; font-weight:600; color:var(--text);
  background:var(--bg-elevated); border:1px solid var(--border); border-radius:10px;
  padding:6px 10px; cursor:pointer;
}
.dash-range input:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
.dash-range-sep{ color:var(--muted); font-weight:600; }
.dash-period{ display:flex; gap:4px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:12px; padding:4px; box-shadow:var(--shadow-soft); }
.dash-period button{ border:0; background:transparent; color:var(--muted); font:inherit; font-weight:600; font-size:12.5px; padding:6px 12px; border-radius:9px; cursor:pointer; white-space:nowrap; }
.dash-period button:hover{ color:var(--text); }
.dash-period button.on{ background:var(--accent-soft); color:var(--accent); }
.dash-period button:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* ── Tiles ───────────────────────────────────────────────── */
.dash-tiles{
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:14px;
  margin-bottom:22px;
}
.dash-tile{
  background:var(--bg-elevated);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  box-shadow:var(--shadow-soft);
  padding:16px 16px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
}
.dash-tile .ico{ width:34px; height:34px; border-radius:10px; display:grid; place-items:center; }
.dash-tile .ico svg{ width:18px; height:18px; }
.dash-tile .k{ font-size:12px; color:var(--muted); font-weight:600; }
.dash-tile .v{
  font-family:var(--acct-mono);
  font-weight:600;
  font-size:28px;
  line-height:1;
  letter-spacing:-0.02em;
  font-variant-numeric:tabular-nums;
}

/* ── Grid ────────────────────────────────────────────────── */
/* Single column so a collapsed fold stays compact (equal-height
   stretch in a 2-col grid blew the closed fold up to the chart height). */
.dash-grid{ display:grid; grid-template-columns:1fr; gap:18px; }
/* Grid items default to min-width:auto, so the team matrix (min-width 560px)
   stretched the whole dashboard past a phone screen. Let cards shrink; the
   matrix keeps its own horizontal scroll inside .dash-matrix-scroll. */
.dash-grid > *{ min-width:0; }

.dash-saved{
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  gap:26px;
  color:#fff;
  border:0;
  background:linear-gradient(120deg,var(--accent) 0%,#7a63ff 55%,var(--acct-green) 165%);
}
.dash-saved .lab{ opacity:0.9; font-size:13px; font-weight:600; letter-spacing:0.02em; }
.dash-saved .big{
  font-family:var(--acct-mono);
  font-weight:600;
  font-size:48px;
  line-height:0.98;
  letter-spacing:-0.03em;
  font-variant-numeric:tabular-nums;
}
.dash-saved .divider{ width:1px; height:54px; background:rgba(255,255,255,0.28); }
.dash-saved .note{ opacity:0.9; font-size:12.5px; max-width:36ch; }

.dash-card-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.dash-card-h{ margin:0 0 3px; font-size:16px; font-weight:800; letter-spacing:-0.01em; display:flex; align-items:center; gap:8px; }
.dash-card-sub{ margin:0 0 16px; color:var(--muted); font-size:12.5px; }
.dash-pill{ font-size:11px; font-weight:800; padding:2px 8px; border-radius:999px; background:var(--accent-soft); color:var(--accent); }
.dash-example{
  display:inline-block; margin-left:6px; font-size:10.5px; letter-spacing:0.04em;
  text-transform:uppercase; color:var(--muted);
  border:1px dashed var(--border); border-radius:6px; padding:2px 7px; vertical-align:middle;
}

/* Fold (personal breakdown) */
.dash-fold summary{
  list-style:none; cursor:pointer;
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.dash-fold summary::-webkit-details-marker{ display:none; }
.dash-fold .chev{ width:20px; height:20px; color:var(--muted); flex:none; transition:transform 180ms ease; margin-top:3px; }
.dash-fold[open] .chev{ transform:rotate(180deg); }
.dash-fold:hover .chev{ color:var(--accent); }
.dash-fold summary:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:10px; }
@media (prefers-reduced-motion:reduce){ .dash-fold .chev{ transition:none; } }

/* Tables (breakdown) */
.dash-table{ width:100%; border-collapse:collapse; font-size:13px; margin-top:16px; }
.dash-table th{ text-align:left; font-size:11px; letter-spacing:0.06em; text-transform:uppercase; color:var(--muted); font-weight:700; padding:0 0 10px; }
.dash-table td{ padding:11px 0; border-top:1px solid var(--border); font-variant-numeric:tabular-nums; }
.dash-table tr td:last-child, .dash-table tr th:last-child{ text-align:right; }
.dash-act{ display:flex; align-items:center; gap:10px; font-weight:500; }
.dash-dot{ width:8px; height:8px; border-radius:50%; flex:none; }
.dash-min{ color:var(--muted); font-family:var(--acct-mono); }
.dash-savemin{ font-family:var(--acct-mono); font-weight:600; }

/* Bars (activity over time) — each bar sizes to its own content and the row
   bottom-aligns, so the month labels line up and the columns show true
   proportional pixel heights (percentage heights resolved ambiguously in a
   flex column and came out near-equal). */
.dash-bars{ display:flex; align-items:flex-end; gap:12px; min-height:190px; padding-top:10px; }
.dash-bar{ flex:1; display:flex; flex-direction:column; align-items:center; gap:8px; justify-content:flex-end; }
.dash-bar .col{
  width:100%; max-width:46px; border-radius:8px 8px 4px 4px; min-height:3px;
  background:linear-gradient(180deg,var(--accent),color-mix(in srgb,var(--accent) 55%,var(--acct-green)));
}
.dash-bar .col.dim{ background:var(--accent-soft); }
.dash-bar .cv{ font-family:var(--acct-mono); font-size:12px; font-weight:600; }
.dash-bar .cl{ font-size:11px; color:var(--muted); font-weight:600; }

/* Team matrix */
.dash-matrixwrap{ grid-column:1 / -1; }
.dash-teamsaved{ display:flex; align-items:baseline; gap:11px; margin:0 0 16px; flex-wrap:wrap; }
.dash-teamsaved .n{ font-family:var(--acct-mono); font-weight:600; font-size:26px; letter-spacing:-0.02em; color:var(--accent); font-variant-numeric:tabular-nums; }
.dash-teamsaved .t{ color:var(--muted); font-weight:600; }
.dash-matrix-scroll{ overflow-x:auto; }
.dash-matrix{ width:100%; border-collapse:collapse; font-size:13px; min-width:560px; table-layout:fixed; }
/* Even metric columns: Member flexible, the six number columns equal width. */
.dash-matrix th:first-child, .dash-matrix td:first-child{ width:24%; }
.dash-matrix th:not(:first-child), .dash-matrix td:not(:first-child){ width:12.6%; }
.dash-matrix th{ text-align:right; font-size:11px; letter-spacing:0.04em; text-transform:uppercase; color:var(--muted); font-weight:700; padding:0 0 12px 16px; white-space:nowrap; }
.dash-matrix th:first-child{ text-align:left; padding-left:0; }
.dash-matrix td{ padding:12px 0 12px 16px; border-top:1px solid var(--border); text-align:right; font-family:var(--acct-mono); font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }
.dash-matrix td:first-child{ text-align:left; padding-left:8px; font-family:inherit; font-weight:500; }
/* Keep the last (AI msgs) column off the card's right edge. */
.dash-matrix th:last-child, .dash-matrix td:last-child{ padding-right:8px; }
.dash-matrix tr.total td{ background:var(--accent-soft); border-top:0; font-weight:800; }
.dash-matrix tr.total td:first-child{ color:var(--accent); border-radius:9px 0 0 9px; }
.dash-matrix tr.total td:last-child{ border-radius:0 9px 9px 0; }
.dash-muser{ display:flex; align-items:center; gap:9px; }
.dash-uav{ width:24px; height:24px; border-radius:50%; background:var(--accent-soft); color:var(--accent); display:grid; place-items:center; font-weight:700; font-size:11px; }

.dash-loading{ color:var(--muted); font-size:13px; padding:20px 0; }
.dash-empty{ color:var(--muted); font-size:13px; }

/* Team card inside the shell: stack full-width — Members on top (readable,
   fits one screen with no horizontal scroll), Invite below. column-reverse
   flips the DOM order (invite, members) so members render first. Dropping the
   720px min-width lets the members table fit the full-width panel. */
.acct-panel .team-layout{ display:flex; flex-direction:column-reverse; gap:14px; }
.acct-panel .team-panel{ min-width:0; }
.acct-panel .team-table{ min-width:0; }
.acct-panel .team-table-wrap{ overflow-x:auto; }

/* ── Templates editor ────────────────────────────────────── */
.tpl-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.tpl-usage{ color:var(--muted); font-size:13px; font-weight:600; }
.tpl-form{ border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--accent-soft); padding:16px; margin-bottom:16px; }
.tpl-form-title{ font-weight:800; font-size:15px; margin-bottom:12px; }
.tpl-form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.tpl-label{ display:flex; flex-direction:column; gap:6px; font-size:13px; font-weight:700; color:var(--text); }
/* display:flex above would otherwise beat the UA [hidden]{display:none}, so the
   "New group name" field must be re-hidden explicitly when toggled off. */
.tpl-label[hidden]{ display:none !important; }
.tpl-input{ font:inherit; font-size:14px; font-weight:400; color:var(--text); background:var(--bg-elevated); border:1px solid var(--border); border-radius:10px; padding:9px 11px; width:100%; box-sizing:border-box; }
.tpl-input:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
.tpl-textarea{ resize:vertical; min-height:110px; line-height:1.45; }
.tpl-select{ cursor:pointer; }
.tpl-form-actions{ display:flex; gap:10px; margin-top:12px; }
.tpl-msg{ font-size:13px; font-weight:600; margin-bottom:12px; }
.tpl-msg--ok{ color:var(--acct-green); }
.tpl-msg--err{ color:#d64545; }
.tpl-muted{ color:var(--muted); font-weight:400; }
.tpl-empty{ color:var(--muted); font-size:14px; padding:18px 0; }
.tpl-group{ margin-bottom:18px; }
.tpl-group-h{ font-size:11px; letter-spacing:0.06em; text-transform:uppercase; color:var(--muted); font-weight:800; padding:0 0 8px; }
.tpl-item{ display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:12px 0; border-top:1px solid var(--border); }
.tpl-item:first-of-type{ border-top:0; }
.tpl-item-main{ min-width:0; }
.tpl-item-name{ font-weight:700; font-size:14px; margin-bottom:3px; }
.tpl-item-body{ color:var(--muted); font-size:13px; line-height:1.4; word-break:break-word; }
.tpl-item-actions{ display:flex; gap:8px; flex:none; }
.tpl-del{ color:#d64545; }
@media (max-width:600px){ .tpl-form-grid{ grid-template-columns:1fr; } .tpl-item{ flex-direction:column; } }

/* ── Custom fields editor ─────────────────────────────────── */
.cf-tabs{ display:flex; gap:6px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:12px; padding:4px; margin-bottom:12px; width:fit-content; }
.cf-tab{ border:0; background:transparent; color:var(--muted); font:inherit; font-weight:600; font-size:13px; padding:7px 16px; border-radius:9px; cursor:pointer; }
.cf-tab:hover{ color:var(--text); }
.cf-tab.is-active{ background:var(--accent); color:#fff; box-shadow:0 4px 12px rgba(102,81,246,0.30); }
.cf-hint{ color:var(--muted); font-size:13px; margin:0 0 14px; }
.cf-msg{ font-size:13px; font-weight:600; margin-bottom:12px; }
.cf-msg--ok{ color:var(--acct-green); }
.cf-msg--err{ color:#d64545; }
.cf-row{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; align-items:center; padding:10px 0; border-top:1px solid var(--border); }
.cf-row:first-child{ border-top:0; }
.cf-check{ display:flex; align-items:center; gap:9px; font-size:14px; font-weight:600; cursor:pointer; min-width:0; }
.cf-check input{ flex:none; width:16px; height:16px; accent-color:var(--accent); cursor:pointer; }
.cf-name{ overflow:hidden; text-overflow:ellipsis; }
.cf-input .tpl-input{ margin:0; }
.cf-input .tpl-input:disabled{ opacity:0.5; cursor:not-allowed; }
.cf-actions{ margin-top:16px; }
@media (max-width:600px){ .cf-row{ grid-template-columns:1fr; gap:8px; } }

/* ── AI Enrichment editor ─────────────────────────────────── */
.enr-connected{ border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--acct-green-soft); padding:12px 14px; margin:12px 0; }
.enr-connected-row{ display:flex; gap:10px; align-items:center; }
.enr-connected-row .tpl-input{ flex:1; font-family:var(--acct-mono); }
.enr-since{ font-size:12px; color:var(--muted); margin-top:6px; }
.enr-actions{ display:flex; gap:10px; margin-top:12px; }
.enr-btns{ display:flex; gap:10px; }
#enrCard .tpl-label{ margin-bottom:12px; }
/* Copilot enrichment is read-only until Edit — tint the locked textarea. */
#copEnrCard .tpl-textarea[readonly]{ background:var(--accent-soft); cursor:default; }
/* Locked key entry when a provider is already connected (one key per provider). */
#enrCard .tpl-input:disabled{ opacity:0.55; cursor:not-allowed; background:var(--accent-soft); }
#enrCard .btn:disabled{ opacity:0.5; cursor:not-allowed; }

/* Simple placeholder for panels still being wired */
.acct-soon{
  border:1px dashed var(--border);
  border-radius:var(--radius-md);
  padding:28px;
  color:var(--muted);
  font-size:14px;
  background:var(--bg-elevated);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width:900px){
  .acct-shell{ grid-template-columns:1fr; gap:16px; }
  .acct-side{
    position:static;
    flex-direction:row;
    flex-wrap:wrap;
    gap:6px;
    overflow:auto;
  }
  .acct-nav{ width:auto; }
  .acct-navlabel{ display:none; }
  .dash-tiles{ grid-template-columns:repeat(2,1fr); }
  .dash-grid{ grid-template-columns:1fr; }
  .dash-saved{ flex-wrap:wrap; gap:16px; }
  .dash-saved .divider{ display:none; }
}
