/* Hivelyn panel styles. Reuses the site's palette and type so the panel
   feels like part of the site rather than a bolted-on tool. */

:root {
  --bg: #0a1428;
  --bg-2: #0f1d38;
  --panel: #12213f;
  --line: #22345a;
  --ink: #eaf0fb;
  --muted: #93a4c4;
  --gold: #e8b64c;
  --gold-ink: #1a1204;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --radius: 14px;
  --input-bg: #0b1730;
  --inset: #0e1c36;
  --topbar-bg: rgba(10, 20, 40, .92);
  --label: #c8d5ee;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1000px 480px at 85% -10%, rgba(232, 182, 76, .07) 0%, transparent 55%),
    radial-gradient(800px 420px at -10% 30%, rgba(59, 100, 190, .12) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: "Space Grotesk", Inter, sans-serif; margin: 0 0 .35rem; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
code { background: var(--input-bg); border: 1px solid var(--line); border-radius: 5px; padding: .05em .35em; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 1.5rem 1.5rem;
  background:
    radial-gradient(900px 500px at 15% -10%, #1b3563 0%, transparent 60%),
    radial-gradient(700px 400px at 100% 100%, #1a2b4d 0%, transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.4rem; }
.brand img { border-radius: 9px; }
.brand h1 { margin: 0; }
.brand p { margin: 0; font-size: .85rem; }
.brand.small { margin: 0; gap: .5rem; }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--label); }

input[type="text"], input[type="password"], input[type="url"], input[type="search"], input[type="email"], input[type="number"], input[type="date"], input[type="tel"], textarea, select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  padding: .6rem .7rem;
  font: inherit;
  font-size: .92rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 182, 76, .16);
}
textarea { resize: vertical; min-height: 70px; font-family: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: .6rem 1rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s, background .15s, border-color .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold); color: var(--gold-ink); box-shadow: 0 3px 12px rgba(232, 182, 76, .25); }
.login-card .btn.primary { width: 100%; margin-top: .9rem; }
.chat-input .btn.primary { align-self: flex-end; }
.btn.primary:hover { background: #f2c463; box-shadow: 0 4px 16px rgba(232, 182, 76, .38); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold); background: rgba(232, 182, 76, .07); }
.btn.sm { padding: .42rem .75rem; font-size: .84rem; }
.btn.danger { background: transparent; border-color: #5a2530; color: var(--danger); }
.btn.danger:hover { background: #2a1219; border-color: var(--danger); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.error {
  color: var(--danger);
  background: #2a1219;
  border: 1px solid #5a2530;
  border-radius: 8px;
  padding: .5rem .7rem;
  font-size: .86rem;
  margin: .7rem 0 0;
}

.missing { margin: .8rem 0; padding-left: 1.1rem; }
.missing li { margin-bottom: .3rem; font-family: ui-monospace, monospace; font-size: .88rem; color: var(--gold); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: .65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.topbar-inner .brand strong { font-size: 1rem; letter-spacing: .01em; }

.topbar-actions { display: flex; gap: .5rem; align-items: center; }

/* ---------- sidebar navigation ---------- */
#nav-open { display: none; }
#nav-scrim { position: fixed; inset: 0; background: rgba(4, 10, 22, .55); z-index: 29; }
.sidebar {
  position: fixed;
  top: 57px;
  left: 0;
  bottom: 0;
  width: 226px;
  z-index: 21;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: .7rem .6rem;
  transition: width .18s ease, transform .18s ease;
}
.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.side-group {
  flex: 0 0 auto;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: .68rem;
  font-weight: 700;
  margin: .8rem .5rem .3rem;
  white-space: nowrap;
  overflow: hidden;
}
.side-group:first-child { margin-top: .2rem; }
.tab {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: .5rem .6rem;
  min-height: 40px;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: background .15s, color .15s;
}
.tab .ic { width: 22px; text-align: center; flex: 0 0 auto; }
.tab:hover { color: var(--ink); background: rgba(232, 182, 76, .1); }
.tab.active { color: var(--gold-ink); background: var(--gold); box-shadow: 0 2px 10px rgba(232, 182, 76, .35); }
#nav-collapse { align-self: stretch; margin-top: .5rem; }
#nav-close { display: none; position: absolute; top: 10px; right: 10px; z-index: 2; min-width: 34px; min-height: 34px; padding: 6px; align-items: center; justify-content: center; border-radius: 999px; font-size: 1.05rem; line-height: 1; }

.app-body { margin-left: 226px; transition: margin .18s ease; }

/* Collapsed (icon rail) on medium screens or when pinned closed */
body.nav-collapsed .sidebar { width: 62px; }
body.nav-collapsed .tab { justify-content: center; padding: .5rem 0; }
body.nav-collapsed .tab .lbl,
body.nav-collapsed .side-group { display: none; }
body.nav-collapsed .app-body { margin-left: 62px; }
body.nav-collapsed #nav-collapse { transform: rotate(180deg); }

@media (max-width: 1100px) and (min-width: 721px) {
  body:not(.nav-pinned) .sidebar { width: 62px; }
  body:not(.nav-pinned) .tab { justify-content: center; padding: .5rem 0; }
  body:not(.nav-pinned) .tab .lbl,
  body:not(.nav-pinned) .side-group { display: none; }
  body:not(.nav-pinned) .app-body { margin-left: 62px; }
  body:not(.nav-pinned) #nav-collapse { transform: rotate(180deg); }
}

/* Phone: overlay drawer - always the full rail, above the scrim */
@media (max-width: 720px) {
  #nav-open { display: inline-flex; }
  .topbar-inner .brand strong { white-space: nowrap; }
  .sidebar {
    top: 0;
    transform: translateX(-105%);
    width: 250px !important;
    padding-top: 1rem;
    z-index: 30;
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.5); }
  #nav-collapse { display: none; }
  .app-body, body.nav-collapsed .app-body { margin-left: 0; }
  body.nav-collapsed .tab { justify-content: flex-start; padding: .5rem .6rem; }
  body.nav-collapsed .tab .lbl { display: inline; }
  body.nav-collapsed .side-group { display: block; }
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 6rem; }

.banner {
  max-width: 1080px;
  margin: 1rem auto 0;
  padding: .7rem 1rem;
  border-radius: 10px;
  font-size: .9rem;
  border: 1px solid var(--line);
  background: var(--panel);
}
.banner.ok { border-color: #1f5c3a; background: #0e2a1c; color: #b8f5d0; }
.banner.err { border-color: #5a2530; background: #2a1219; color: #ffc9c9; }
.banner a { color: inherit; text-decoration: underline; }

.demo-banner {
  max-width: 1080px;
  margin: .6rem auto 0;
  padding: .55rem 1rem;
  border-radius: 10px;
  font-size: .85rem;
  border: 1px solid var(--gold, #c89b3c);
  background: rgba(232, 182, 76, .12);
  color: var(--ink);
}
:root[data-theme="light"] .demo-banner { background: rgba(232, 182, 76, .16); }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 1.3rem; }
.panel-head .muted { max-width: 60ch; }
.panel-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.panel-actions .btn.primary { width: auto; margin-top: 0; }

.sub { margin: 1.75rem 0 .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; }

/* ---------- editor cards ---------- */
.editor { display: grid; gap: .9rem; }

.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: 0 6px 18px rgba(2, 8, 20, .25);
  transition: border-color .15s;
}
.item:hover { border-color: rgba(232, 182, 76, .28); }
.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .8rem;
}
.item-head strong { font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.item-tools { display: flex; gap: .35rem; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
}
.icon-btn:hover { color: var(--ink); border-color: var(--gold); }
.icon-btn.del:hover { color: var(--danger); border-color: var(--danger); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.field { margin-bottom: .75rem; }
.field:last-child { margin-bottom: 0; }
.hint { font-size: .78rem; color: var(--muted); margin: .3rem 0 0; }

.check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.check input { width: auto; }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

.group-items { display: grid; gap: .6rem; margin-top: .6rem; }
.group-items .item { background: var(--inset); box-shadow: none; }

@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .topbar-inner { gap: .5rem; padding: .6rem .9rem; }
  .topbar-inner .brand strong { font-size: .95rem; }
  .btn, .btn.sm { min-height: 40px; padding: .5rem .8rem; }
  .icon-btn { width: 36px; height: 36px; }
  .item { padding: .95rem; }
  .panel-head { flex-direction: column; }
  .panel-actions { width: 100%; }
  .panel-actions .btn { flex: 1; }
  .wrap { padding: 1rem .8rem 4rem; }
  .login-card { margin: 6vh 1rem 0; }
  .chat-msg { max-width: 94%; }
  .chat-input { flex-direction: column; align-items: stretch; }
  .chat-input .btn { width: 100%; }
  .chat-quick .btn { flex: 1 1 42%; }
  .chat-log { max-height: 20rem; padding: .7rem; }
}

/* ---------------- copilot chat + forms ---------------- */
.chat-log {
  display: flex; flex-direction: column; gap: .6rem;
  min-height: 10rem; max-height: 26rem; overflow-y: auto;
  padding: 1rem; margin-bottom: .9rem;
  background: var(--chat-bg, #0b1730); border: 1px solid var(--chat-line, #1c2c4d); border-radius: 12px;
}
.chat-msg { max-width: 82%; }
.chat-msg .chat-body { padding: .55rem .8rem; border-radius: 10px; white-space: pre-wrap; line-height: 1.45; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.user .chat-body { background: var(--gold); color: var(--gold-ink); }
.chat-msg.assistant { align-self: flex-start; }
.chat-msg.assistant .chat-body { background: var(--chat-bubble, #14243f); color: var(--chat-ink, #eaf0fb); }
.chat-msg .hint { margin: .2rem .2rem 0; }
.chat-quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.chat-input { display: flex; gap: .6rem; align-items: flex-end; }
.chat-input textarea { flex: 1; resize: vertical; }

/* QR codes */
.qr-row { display: flex; gap: 16px; align-items: flex-start; margin-top: 10px; }
.qr-canvas { flex: 0 0 auto; background: #fff; border-radius: 10px; padding: 6px; }
.qr-canvas svg, .qr-canvas img { display: block; width: 96px; height: 96px; }
.qr-meta { flex: 1; min-width: 0; }
.qr-meta .hint { word-break: break-all; }

/* Light theme (toggle in the topbar; default follows the system) */
:root[data-theme="light"] {
  --bg: #f3f5fa;
  --bg-2: #e9edf5;
  --panel: #ffffff;
  --line: #d5dce8;
  --ink: #1b2a44;
  --muted: #5b6b85;
  --gold: #d8951d;
  --gold-ink: #1a1204;
  --danger: #d92d20;
  --ok: #15803d;
  --input-bg: #ffffff;
  --inset: #eef1f8;
  --topbar-bg: rgba(255, 255, 255, .92);
  --label: #44546f;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(1000px 480px at 85% -10%, rgba(216, 149, 29, .08) 0%, transparent 55%),
    radial-gradient(800px 420px at -10% 30%, rgba(59, 100, 190, .07) 0%, transparent 55%),
    var(--bg);
}
:root[data-theme="light"] {
  --chat-bg: #f7f9fd;
  --chat-line: #d5dce8;
  --chat-bubble: #e9edf5;
  --chat-ink: #1b2a44;
}
:root[data-theme="light"] code { background: #eef1f7; }
:root[data-theme="light"] .chat-msg .chat-body a { color: #1d4ed8; }
.code-editor {
  width: 100%; min-height: 55vh; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5;
  background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}

/* ---------------- stats dashboard ---------------- */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: .9rem; }
.stats-cards .stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; }
.stats-cards .stat-card .num { font-size: 1.6rem; font-weight: 700; }
.stats-cards .stat-card .lbl { color: var(--muted); font-size: .82rem; }
.stats-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: .6rem; }
.stats-chart .bar { flex: 1; background: var(--gold); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.stats-chart .bar span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--muted); }
.stats-chart-wrap { display: flex; gap: 4px; margin-top: .2rem; }
.stats-chart-wrap .day { flex: 1; text-align: center; font-size: .64rem; color: var(--muted); overflow: hidden; }
.stats-row { display: flex; justify-content: space-between; gap: .8rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.stats-row:last-child { border-bottom: 0; }
.stats-row .muted { flex-shrink: 0; }

/* keyboard focus */
.tab:focus-visible, .btn:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

#theme-toggle { min-width: 42px; font-size: .95rem; }

/* ---------------- profiles ---------------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.2rem; }
.avatar-fallback { display: grid; place-items: center; background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.person-row { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.person-row .hint { word-break: break-word; }
.profile-form { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.profile-form input[type="file"] { font-size: .82rem; color: var(--muted); }
.chat-side { max-width: 100%; min-width: 0; }
.chat-msg.assistant { display: flex; gap: .55rem; align-items: flex-start; }
.chat-msg.assistant .avatar { margin-top: .15rem; }

/* QR stats + design */
.spark { display:flex; align-items:flex-end; gap:4px; height:60px; margin:8px 0 4px; }
.spark-bar { flex:1; background:var(--accent); border-radius:3px 3px 0 0; min-width:8px; }
.qr-design { display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; margin:8px 0; }
.qr-design .field { min-width:0; }
.qr-design input[type=color] { width:52px; height:38px; padding:2px; border:1px solid var(--input-border); border-radius:8px; background:var(--input-bg); }
.qr-stats { margin-top:10px; border-top:1px dashed var(--input-border); padding-top:10px; }
@media (max-width: 720px) {
  .qr-row { flex-direction: column; }
  .qr-canvas svg, .qr-canvas img { width: 140px; height: 140px; }
}

/* global panel search: mini icon in the nav; tap to open the input */
.side-logo {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 2px 8px 8px; padding: 8px 10px; border: none; border-radius: 11px;
  background: transparent; cursor: pointer; color: inherit; text-align: left;
  transition: background .12s ease;
}
.side-logo:hover { background: var(--inset); }
.side-logo img { border-radius: 8px; background: #fff; padding: 2px; border: 1px solid var(--line); flex: 0 0 auto; }
.side-logo-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side-logo-txt strong { font-size: .86rem; }
.side-logo-txt .hint { font-size: .7rem; }
body.nav-collapsed .side-logo { justify-content: center; padding: 8px 0; margin: 2px 4px 8px; }
body.nav-collapsed .side-logo-txt { display: none; }

.side-search { padding: 4px 8px; }
.side-search #search-open { width: 100%; }
.side-search.open #search-open { display: none; }
.side-search input { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text); font-size: 14px; }
.side-search:not(.open) input { display: none; }
body.nav-collapsed .side-search #search-open { justify-content: center; padding: .5rem 0; }
.search-results { position: fixed; z-index: 60; top: 64px; left: 12px; right: 12px; max-width: 560px; max-height: 70vh; overflow: auto; background: var(--topbar-bg); border: 1px solid var(--input-border); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.35); padding: 10px; }
@media (min-width: 1100px) { .search-results { left: 238px; right: auto; width: 560px; } }
.search-results .sr-type { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--label); margin: 10px 4px 4px; }
.search-results .sr-item { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; background: none; border: none; color: var(--text); cursor: pointer; }
.search-results .sr-item:hover { background: var(--inset); }
.search-results .sr-title { font-weight: 600; font-size: 14px; }
.search-results .sr-snip { font-size: 12.5px; color: var(--label); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1100px) { body.nav-collapsed .search-results { left: 74px; } }

/* ---------------- Messenger-style team chat ---------------- */
.im-panel { padding: 0; overflow: hidden; }
.im-wrap { display: grid; grid-template-columns: 280px 1fr; height: 72vh; min-height: 480px; }
.im-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--inset); }
.im-list-head { padding: .7rem; border-bottom: 1px solid var(--line); }
.im-list-head input { width: 100%; }
.im-convs { flex: 1; overflow-y: auto; min-height: 0; }
.im-conv { display: flex; gap: .6rem; align-items: center; padding: .6rem .7rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.im-conv:hover { background: var(--panel); }
.im-conv.active { background: var(--panel); box-shadow: inset 3px 0 0 var(--gold); }
.im-conv .avatar { flex: 0 0 auto; }
.im-conv-meta { min-width: 0; flex: 1; }
.im-conv-title { display: flex; justify-content: space-between; gap: .4rem; align-items: baseline; }
.im-conv-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.im-conv-title time { font-size: .72rem; color: var(--muted); flex: 0 0 auto; }
.im-conv-prev { display: flex; justify-content: space-between; gap: .4rem; align-items: center; margin-top: .1rem; }
.im-conv-prev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; color: var(--muted); }
.im-badge { background: var(--gold); color: var(--gold-ink); border-radius: 999px; min-width: 1.15rem; height: 1.15rem; font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 .3rem; }
.im-list-foot { padding: .6rem .7rem; border-top: 1px solid var(--line); }
.im-list-foot .hint { margin: 0; }
.im-person { display: flex; gap: .6rem; align-items: center; padding: .55rem .7rem; cursor: pointer; color: var(--muted); }
.im-person:hover { background: var(--panel); color: var(--text); }
.im-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.im-sect { padding: .5rem .7rem .2rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.im-main { display: flex; flex-direction: column; min-height: 0; }
.im-head { display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem; border-bottom: 1px solid var(--line); }
.im-head .im-back { display: none; }
.im-head strong { font-size: .98rem; }
.im-head .hint { margin: 0; }
.im-msgs { flex: 1; overflow-y: auto; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .35rem; min-height: 0; background: var(--chat-bg); }
.im-day { align-self: center; font-size: .72rem; color: var(--muted); background: var(--inset); border: 1px solid var(--line); padding: .15rem .6rem; border-radius: 999px; margin: .4rem 0; }
.im-row { display: flex; gap: .5rem; align-items: flex-end; max-width: 78%; }
.im-row .avatar { margin-bottom: .1rem; }
.im-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.im-row.theirs { align-self: flex-start; }
.im-bubble { padding: .5rem .75rem; border-radius: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.im-row.mine .im-bubble { background: var(--gold); color: var(--gold-ink); border-bottom-right-radius: 4px; }
.im-row.theirs .im-bubble { background: var(--chat-bubble, #14243f); color: var(--chat-ink, #eaf0fb); border-bottom-left-radius: 4px; }
.im-meta { font-size: .7rem; color: var(--muted); margin-top: .15rem; display: flex; gap: .35rem; align-items: baseline; }
.im-row.mine .im-meta { justify-content: flex-end; }
.im-seen { font-size: .7rem; color: var(--muted); align-self: flex-end; margin-top: .1rem; }
.im-typing { padding: .3rem 1rem; display: flex; gap: 4px; align-items: center; }
.im-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: im-blink 1.2s infinite; }
.im-typing span:nth-child(2) { animation-delay: .2s; }
.im-typing span:nth-child(3) { animation-delay: .4s; }
.im-typing em { font-style: normal; font-size: .75rem; color: var(--muted); margin-left: .4rem; }
@keyframes im-blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.im-form { display: flex; gap: .6rem; padding: .7rem .9rem; border-top: 1px solid var(--line); align-items: flex-end; }
.im-form textarea { flex: 1; resize: none; max-height: 7rem; }
.tab-badge { background: var(--gold); color: var(--gold-ink); border-radius: 999px; min-width: 1.05rem; height: 1.05rem; font-size: .66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 .25rem; margin-left: .35rem; }

@media (max-width: 720px) {
  .im-wrap { grid-template-columns: 1fr; height: 78vh; }
  .im-main { display: none; }
  .im-wrap.chat-open .im-main { display: flex; }
  .im-wrap.chat-open .im-list { display: none; }
  .im-head .im-back { display: inline-flex; }
  .im-row { max-width: 92%; }
}

/* ---------------- File manager ---------------- */
.fm-toolbar { display: flex; gap: .6rem; align-items: center; margin: .2rem 0 .8rem; flex-wrap: wrap; }
.fm-crumbs { display: flex; gap: .15rem; align-items: center; flex-wrap: wrap; flex: 1; min-width: 12rem; }
.fm-crumbs button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: .2rem .3rem; border-radius: 6px; }
.fm-crumbs button:hover { color: var(--text); background: var(--inset); }
.fm-crumbs button.current { color: var(--text); font-weight: 600; }
.fm-crumbs .sep { color: var(--muted); }
#fm-search { width: 13rem; }
.fm-viewtoggle { display: flex; gap: .25rem; }
.fm-viewtoggle .on { outline: 2px solid var(--gold); }
.fm-drop { position: relative; border: 1px dashed transparent; border-radius: 12px; min-height: 12rem; }
.fm-drop.drag { border-color: var(--gold); background: var(--inset); }
.fm-dropnote { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; font-weight: 600; color: var(--gold); pointer-events: none; }
.fm-drop.drag .fm-dropnote { display: flex; }
.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.fm-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: .7rem; cursor: pointer; display: flex; flex-direction: column; gap: .45rem; position: relative; }
.fm-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.fm-thumb { height: 84px; border-radius: 8px; background: var(--inset); display: flex; align-items: center; justify-content: center; font-size: 2rem; overflow: hidden; }
.fm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fm-name { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-sub { font-size: .72rem; color: var(--muted); }
.fm-actions { display: flex; gap: .25rem; flex-wrap: wrap; }
.fm-rows { display: flex; flex-direction: column; }
.fm-rowf { display: grid; grid-template-columns: 2rem 1fr 6.5rem 9.5rem auto; gap: .6rem; align-items: center; padding: .45rem .5rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.fm-rowf:hover { background: var(--inset); }
.fm-rowf .fm-ic { font-size: 1.2rem; text-align: center; }
.fm-rowf .fm-name { font-weight: 500; }
.fm-folder .fm-ic, .fm-folder .fm-thumb { color: var(--gold); }
.fm-preview { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 1rem; }
.fm-preview-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(860px, 96vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.fm-preview-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
.fm-preview-head .actions { display: flex; gap: .4rem; }
.fm-preview-body { padding: .9rem; overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.fm-preview-body img { max-width: 100%; border-radius: 8px; }
.fm-preview-body iframe, .fm-preview-body embed { width: 100%; height: 66vh; border: none; }
.fm-preview-body pre { white-space: pre-wrap; overflow-wrap: anywhere; width: 100%; max-height: 60vh; overflow: auto; background: var(--inset); padding: .8rem; border-radius: 8px; font-size: .82rem; }
@media (max-width: 720px) {
  .fm-rowf { grid-template-columns: 1.6rem 1fr auto; }
  .fm-rowf .fm-size, .fm-rowf .fm-date { display: none; }
  #fm-search { width: 100%; }
}

/* ---------------- undo/redo snackbar ---------------- */
.snackbar { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .8rem; display: flex; gap: .7rem; align-items: center; z-index: 90; box-shadow: 0 6px 24px rgba(0,0,0,.35); max-width: min(92vw, 30rem); }
.snackbar span { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-row .im-del { visibility: hidden; align-self: center; background: none; border: none; color: var(--muted); cursor: pointer; font-size: .85rem; padding: .1rem .35rem; border-radius: 6px; }
.im-row:hover .im-del { visibility: visible; }
.im-row .im-del:hover { color: var(--danger); background: var(--inset); }

/* ---------------- premium pass: compact, organized, modern ---------------- */
:root {
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --sh-sm: 0 1px 2px rgba(2, 8, 23, .25);
  --sh-md: 0 4px 14px rgba(2, 8, 23, .28), 0 1px 3px rgba(2, 8, 23, .2);
  --sh-lg: 0 16px 44px rgba(2, 8, 23, .4), 0 3px 10px rgba(2, 8, 23, .25);
  --ring: 0 0 0 3px rgba(232, 182, 76, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t: .15s;
}
:root[data-theme="light"] {
  --sh-sm: 0 1px 2px rgba(27, 42, 68, .07);
  --sh-md: 0 4px 14px rgba(27, 42, 68, .09), 0 1px 3px rgba(27, 42, 68, .06);
  --sh-lg: 0 16px 44px rgba(27, 42, 68, .14), 0 3px 10px rgba(27, 42, 68, .08);
  --ring: 0 0 0 3px rgba(216, 149, 29, .2);
}

html { scroll-behavior: smooth; }
body { font-size: 14px; line-height: 1.5; }
::selection { background: rgba(232, 182, 76, .28); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3 { letter-spacing: -.01em; }

/* topbar: slim glass */
.topbar {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--sh-sm);
}
.topbar-inner { padding-top: .45rem; padding-bottom: .45rem; }

/* sidebar: tidy groups, alive hover, gold active rail */
.sidebar { border-right: 1px solid var(--line); background: var(--bg-2); }
.side-group > .side-label, .side-group-label { letter-spacing: .09em; font-size: .68rem; font-weight: 600; }
.tab {
  border-radius: var(--r-sm);
  transition: background var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--ease);
}
.tab:hover { background: var(--inset); transform: translateX(2px); }
.tab.active, .tab.on, .tab[aria-current] {
  background: var(--inset);
  box-shadow: inset 2.5px 0 0 var(--gold);
  font-weight: 600;
}

/* buttons: consistent heights, weight, lift on hover */
.btn {
  border-radius: 9px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: .42rem .85rem;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease), filter var(--t) var(--ease);
  box-shadow: var(--sh-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-md); }
.btn:active { transform: translateY(0); box-shadow: var(--sh-sm); }
.btn.primary {
  background: linear-gradient(180deg, #f3c86b 0%, var(--gold) 100%);
  border: 1px solid rgba(0, 0, 0, .18);
  color: var(--gold-ink);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { box-shadow: none; }
.btn.sm { padding: .28rem .6rem; border-radius: 8px; }

/* inputs: calm filled fields, gold focus ring */
input, select, textarea {
  border-radius: 9px;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: var(--ring); }
::placeholder { color: var(--muted); opacity: .75; }

/* cards: layered, soft, lifted on hover where clickable */
.item, .fm-card, .login-card, .stats-cards > * {
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease), border-color var(--t) var(--ease);
}
.fm-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.item-head { letter-spacing: -.005em; }

/* login: glass card */
.login-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--sh-lg);
  border-radius: var(--r-lg);
}

/* modals: blurred backdrop, pop-in */
.fm-preview { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.fm-preview-box { box-shadow: var(--sh-lg); animation: pop .18s var(--ease); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* snackbar: slide up */
.snackbar { animation: rise .2s var(--ease); box-shadow: var(--sh-lg); }
@keyframes rise { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* chat: softer bubbles, mine in brand gradient */
.im-bubble { box-shadow: var(--sh-sm); }
.im-row.mine .im-bubble { background: linear-gradient(180deg, #f3c86b, var(--gold)); color: var(--gold-ink); }
.im-conv { transition: background var(--t) var(--ease); }
.im-conv:hover { background: var(--inset); }

/* lists, rows, editors: gentle hover */
.fm-rowf, .person-row, .im-person { transition: background var(--t) var(--ease); }

/* section labels: organized, quiet */
.sub { letter-spacing: .1em; font-weight: 600; }

/* panels fade in on tab switch */
.panel { animation: fadein .18s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------------- AI screens: ChatGPT pattern ----------------
   Centered conversation column, user = compact right bubble, AI = plain
   full-width rows with an avatar chip, docked pill composer, typing dots. */
.ai-panel { max-width: 780px; margin: 0 auto; }
.ai-panel .panel-head { margin-bottom: .6rem; }

.ai-panel .chat-log {
  background: transparent; border: none; padding: .25rem .1rem;
  max-height: min(58vh, 34rem); gap: .85rem;
}
.ai-panel .chat-msg { max-width: 100%; display: flex; }
.ai-panel .chat-msg.user { justify-content: flex-end; }
.ai-panel .chat-msg.user .chat-body {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px; border-bottom-right-radius: 6px;
  padding: .45rem .8rem; max-width: 80%;
  box-shadow: var(--sh-sm);
  animation: fadein .16s var(--ease, ease) both;
}
.ai-panel .chat-msg.assistant { align-items: flex-start; gap: .55rem; animation: fadein .16s var(--ease, ease) both; }
.ai-panel .chat-msg.assistant::before {
  content: '✨'; flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; margin-top: .1rem;
  background: var(--panel); border: 1px solid var(--line);
}
[data-panel="master"] .chat-msg.assistant::before { content: '🧠'; }
.ai-panel .chat-msg.assistant .chat-body {
  background: transparent; color: var(--ink);
  padding: .2rem .1rem 0; border-radius: 0; line-height: 1.5;
  min-width: 0; overflow-wrap: anywhere;
}
.ai-panel .chat-msg .hint { margin: .15rem 0 0; font-size: 11px; }
.ai-panel .chat-msg.assistant { flex-wrap: wrap; }
.ai-panel .chat-msg.assistant .hint { flex-basis: 100%; margin-left: 2.3rem; }

/* typing dots */
.chat-typing { display: inline-flex; gap: 4px; padding: .5rem .1rem !important; }
.chat-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); opacity: .5;
  animation: typing-bounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* quick-start chips */
.ai-panel .chat-quick { gap: .35rem; margin: .1rem 0 .6rem; }
.ai-panel .chat-quick .btn { border-radius: 999px; }

/* docked pill composer */
.ai-panel .chat-input {
  align-items: flex-end; gap: .4rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 24px; padding: .3rem .3rem .3rem .9rem;
  box-shadow: var(--sh-md, 0 4px 16px rgba(0,0,0,.18));
  transition: border-color .15s, box-shadow .15s;
}
.ai-panel .chat-input:focus-within {
  border-color: var(--gold);
  box-shadow: var(--ring);
}
.ai-panel .chat-input textarea {
  border: none; background: transparent; box-shadow: none;
  padding: .45rem 0; resize: none; line-height: 1.4;
  max-height: 160px; min-height: 22px;
}
.ai-panel .chat-input textarea:focus { outline: none; box-shadow: none; }
.send-round {
  width: 34px; height: 34px; min-width: 34px; padding: 0;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
}

@media (max-width: 720px) {
  .ai-panel .chat-log { max-height: min(52vh, 30rem); }
  .ai-panel .chat-msg.user .chat-body { max-width: 88%; }
  .chat-input .btn { width: auto; }
}
@media (max-width: 500px) {
  .ai-panel .chat-input { flex-direction: row; }
}

/* ---------------- AI usage + activity ---------------- */
.ai-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.ai-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .8rem; display: flex; flex-direction: column; gap: .3rem;
  animation: fadein .16s var(--ease, ease) both;
}
.ai-card.warn { border-color: var(--gold); }
.ai-card-head { display: flex; align-items: center; gap: .4rem; }
.ai-card-head strong { flex: 1; }
.ai-card-nums { font-weight: 600; }
.ai-card a.link { color: var(--gold); text-decoration: none; }
.ai-card a.link:hover { text-decoration: underline; }
.hint.dim { opacity: .75; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 6px rgba(74, 222, 128, .5); }
.status-dot.warn { background: var(--gold); box-shadow: 0 0 6px rgba(232, 182, 76, .5); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 6px rgba(255, 107, 107, .5); }
.status-dot.idle { background: var(--muted); opacity: .6; }
.meter { height: 6px; border-radius: 999px; background: var(--inset, rgba(127,147,180,.15)); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--ok); transition: width .3s var(--ease, ease); }
.meter.warn .meter-fill { background: var(--gold); }

.act-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.act-filters select, .act-filters input { max-width: 12rem; width: auto; flex: 0 1 auto; }
.act-filters input[type="date"] { max-width: 9.5rem; width: auto; }
.act-list .item { padding: .45rem .6rem; }
.actor-chip {
  background: var(--inset, rgba(127,147,180,.15)); border: 1px solid var(--line);
  border-radius: 999px; padding: .05rem .5rem; font-size: 12px; font-weight: 600;
}
.act-line { margin-top: .15rem; font-size: 13px; }
.act-line code { color: var(--gold); background: transparent; padding: 0; }
@media (max-width: 720px) {
  .ai-cards { grid-template-columns: 1fr 1fr; }
  .act-filters select, .act-filters input { max-width: 100%; flex: 1 1 42%; }
}
@media (max-width: 460px) {
  .ai-cards { grid-template-columns: 1fr; }
}

/* ---------------- my profile ---------------- */
.fld { display: block; font-size: .85rem; font-weight: 600; color: var(--label); margin: 0; }
.fld input { margin-top: .3rem; font-weight: 400; }
.fld input[type="file"] { font-size: 12px; }
.me-btn {
  display: flex; align-items: center; gap: .4rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: .15rem .6rem .15rem .15rem; cursor: pointer; color: var(--ink);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.me-btn:hover { border-color: var(--gold); }
.me-avatar {
  width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #f3c86b, var(--gold)); color: var(--gold-ink);
  font-weight: 700; font-size: 13px; flex: 0 0 auto;
}
.me-avatar.lg { width: 56px; height: 56px; font-size: 24px; }
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-name { font-size: 13px; font-weight: 600; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; max-width: 900px; }
.profile-grid .card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: .8rem .9rem; display: flex; flex-direction: column; gap: .5rem;
}
.profile-avatar-row { display: flex; align-items: center; gap: .8rem; }
.profile-avatar-row .fld { flex: 1; margin: 0; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .me-name { display: none; } }

/* ---------------- unified Mail client ---------------- */
.mail-accounts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mail-acct { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; font-size: 13px; transition: border-color .15s, background .15s; }
.mail-acct:hover { border-color: var(--gold); }
.mail-acct.on { border-color: var(--gold); background: var(--inset); }
.mail-acct .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.mail-acct .dot.ok { background: var(--ok); }
.mail-acct .mail-acct-addr { color: var(--muted); font-size: 11.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.mail-toolbar input[type="search"] { flex: 1; min-width: 160px; }
.mail-folders { display: flex; gap: 6px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.chip:hover { color: var(--ink); border-color: var(--gold); }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }

.mail-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.mail-row { display: flex; gap: 11px; align-items: center; width: 100%; padding: 10px 12px; background: none; border: none; border-bottom: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.mail-row:last-child { border-bottom: none; }
.mail-row:hover { background: var(--inset); }
.mail-row.active { background: var(--inset); box-shadow: inset 3px 0 0 var(--gold); }
.mail-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; text-transform: uppercase; }
.mail-row-main { flex: 1; min-width: 0; }
.mail-row-top { display: flex; align-items: baseline; gap: 8px; }
.mail-row-from { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.mail-row-time { font-size: 11.5px; color: var(--muted); flex: none; }
.mail-row-subject { font-size: 13.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row-snip { font-size: 12px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.unread .mail-row-from, .mail-row.unread .mail-row-subject { font-weight: 700; color: var(--ink); }
.mail-row .unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: none; }

.mail-read { margin: 0 0 10px; }
.mail-read-meta { display: flex; gap: 10px; align-items: center; margin: 4px 0 10px; }
.mail-read-meta .mail-avatar { width: 38px; height: 38px; }
#mail-read-from { font-size: 14px; font-weight: 600; }
.mail-body { white-space: pre-wrap; font-family: inherit; font-size: 13.5px; line-height: 1.55; margin: 0; max-height: 480px; overflow: auto; background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.mail-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------------- Keys manager ---------------- */
.keys-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.keys-summary .chip { cursor: default; }
.keys-summary .chip b { margin-left: 4px; }
.keys-group { margin-bottom: 18px; }
.keys-group-head { margin: 0 0 8px; }
.keys-group-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.keys-group-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.key-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 8px; }
.key-row-main { flex: 1; min-width: 0; }
.key-row-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.key-row-actions { display: flex; gap: 6px; flex: none; }
.key-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.key-status.stored { background: rgba(74, 222, 128, .14); color: var(--ok); }
.key-status.env { background: rgba(232, 182, 76, .14); color: var(--gold); }
.key-status.missing { background: rgba(147, 164, 196, .14); color: var(--muted); }
.key-edit { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; margin: -2px 0 8px; background: var(--inset); }
.key-edit input { flex: 1; }

/* ---------------- floating copilot ---------------- */
#copilot-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 70;
  width: 3.1rem; height: 3.1rem; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--gold), #c99a2e);
  color: var(--gold-ink);
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45), 0 0 0 1px rgba(232, 182, 76, .35);
  transition: transform .18s ease, box-shadow .18s ease;
  animation: cf-fab-glow 3.2s ease-in-out infinite;
}
@keyframes cf-fab-glow {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 1px rgba(232,182,76,.35); }
  50% { box-shadow: 0 8px 26px rgba(0,0,0,.5), 0 0 0 5px rgba(232,182,76,.14), 0 0 0 1px rgba(232,182,76,.5); }
}
#copilot-fab:hover { transform: translateY(-2px) scale(1.06); animation-play-state: paused; box-shadow: 0 12px 30px rgba(0, 0, 0, .5), 0 0 0 1px var(--gold); }
#copilot-float {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 70;
  width: min(24.5rem, calc(100vw - 1.5rem));
  height: min(31rem, calc(100dvh - 3rem));
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5), 0 0 0 1px rgba(232, 182, 76, .18);
  overflow: hidden;
  transform-origin: bottom right;
  animation: cf-pop .18s ease-out;
}
@keyframes cf-pop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}
#copilot-float .cf-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(232,182,76,.14), transparent 60%), var(--bg-2);
}
#copilot-float .cf-avatar {
  width: 1.7rem; height: 1.7rem; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), #c99a2e); color: var(--gold-ink);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#copilot-float .cf-titles { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
#copilot-float .cf-titles strong { font-size: .88rem; }
#copilot-float .cf-titles .hint { font-size: .72rem; }
#copilot-float .cf-close {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: .85rem; padding: .25rem .45rem; border-radius: 8px;
  transition: background .12s ease, color .12s ease;
}
#copilot-float .cf-close:hover { color: var(--ink); background: var(--inset); }
#copilot-float .chat-log { flex: 1; min-height: 0; max-height: none; overflow-y: auto; border: none; border-radius: 0; background: transparent; margin-bottom: 0; }
#copilot-float .chat-input { padding: .6rem .7rem; border-top: 1px solid var(--line); background: var(--bg-2); }
#copilot-float .chat-input textarea { border-radius: 12px; }
.cf-quick { display: flex; flex-direction: column; gap: .45rem; margin-top: .7rem; }
.cf-quick button {
  text-align: left; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); border-radius: 10px; padding: .5rem .7rem; font-size: .8rem;
  cursor: pointer; transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.cf-quick button:hover { border-color: var(--gold); background: var(--inset); transform: translateY(-1px); }
@media (max-width: 640px) {
  #copilot-float { right: .75rem; bottom: .75rem; }
  #copilot-fab { right: .9rem; bottom: .9rem; }
}

/* keyboard shortcuts */
.sc-list { display: grid; gap: 4px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.sc-row { display: flex; align-items: center; gap: 12px; padding: 5px 2px; font-size: .85rem; }
.sc-row kbd {
  min-width: 1.7rem; text-align: center; padding: 3px 7px; border-radius: 7px;
  background: var(--inset); border: 1px solid var(--line); border-bottom-width: 2px;
  font-family: inherit; font-weight: 700; font-size: .78rem; color: var(--ink);
}

/* deep-link highlight */
.flash-hl { animation: flash-hl-kf 2.6s ease; border-radius: 12px; }
@keyframes flash-hl-kf {
  0%, 60% { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(232,182,76,.35); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------------- AI routing card ---------------- */
.ai-routing { margin-bottom: 1rem; }
.ai-routing-controls { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: .6rem; }
.ai-routing-controls select.input { max-width: 11rem; }
.ai-chk { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }

/* ---------------- passkeys ---------------- */
.login-divider { display: flex; align-items: center; gap: .7rem; margin: .9rem 0 .6rem; color: rgba(255, 255, 255, .4); font-size: .8rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, .12); }
[data-theme="light"] .login-divider { color: rgba(10, 20, 40, .45); }
[data-theme="light"] .login-divider::before, [data-theme="light"] .login-divider::after { background: rgba(10, 20, 40, .14); }
#login-passkey { width: 100%; }
.passkey-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .7rem; }
.passkey-list .item { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }

/* ---------------- re-auth modal + subtle destructive actions ---------------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 10, 24, .6);
  display: grid; place-items: center;
  padding: 1rem;
}
.modal-card {
  width: min(24rem, 100%);
  background: var(--panel);
  border: 1px solid rgba(232, 182, 76, .25);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
.modal-card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.modal-card .fld { display: block; margin-top: .7rem; }
.modal-card .fld input { width: 100%; margin-top: .3rem; }
.modal-card .error { margin: .5rem 0 0; font-size: .85rem; }
.modal-card .panel-actions { margin-top: .9rem; }
.subtle-danger { opacity: .65; font-weight: 500; }
.subtle-danger:hover { opacity: 1; color: #e06c6c; border-color: #e06c6c; background: rgba(224, 108, 108, .07); }

/* ---------------- crisp SVG nav icons + mobile icon nav ---------------- */
.tab .ic { display: inline-flex; align-items: center; justify-content: center; }
.tab .ic svg { width: 19px; height: 19px; display: block; }
.tb-ic { display: inline-flex; align-items: center; gap: .45rem; }
.tb-ic svg { width: 17px; height: 17px; display: block; }
#theme-toggle svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
  /* drawer: compact single-column list, one tap per row */
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar .nav-group { padding: 14px 10px 5px; font-size: 9px; letter-spacing: .13em; }
  .sidebar .nav-group:first-child { padding-top: 6px; }
  .tab { flex-direction: row; gap: .6rem; justify-content: flex-start; padding: .42rem .55rem; min-height: 38px; text-align: left; }
  .tab .ic { width: 20px; }
  .tab .ic svg { width: 18px; height: 18px; }
  .tab .lbl { font-size: .82rem; font-weight: 600; line-height: 1.2; white-space: nowrap; }
  .side-search .tab { min-height: 40px; }
  .side-search .tab .lbl { font-size: .9rem; }
  /* topbar: icon-first, labels hidden, tighter */
  .topbar-inner { gap: .4rem; }
  .tb-lbl { display: none; }
  .tb-ic { padding: .45rem .5rem; }
  .topbar-inner .brand strong { display: none; }
  /* room for the floating copilot over row actions */
  .wrap { padding-bottom: 6.5rem; }
}
@media (max-width: 1100px) {
  .tb-lbl { display: none; }
}

/* ---------------- mobile overflow hardening ---------------- */
.item { max-width: 100%; overflow: hidden; }
.item .hint, .item-head strong { overflow-wrap: anywhere; }
.item-head { flex-wrap: wrap; gap: .4rem; min-width: 0; }
.item-tools { flex-wrap: wrap; min-width: 0; }
@media (max-width: 720px) {
  .item-head { flex-direction: column; align-items: flex-start; }
  .item-tools { width: 100%; }
  .item-tools .btn { flex: 1 1 auto; }
}

/* ---------------- messenger-grade chat polish ---------------- */
.im-panel { border-radius: 16px; }
.im-wrap { height: calc(100dvh - 200px); min-height: 460px; border-radius: 16px; overflow: hidden; }
.im-list { background: var(--bg-2); gap: 0; }
.im-list-head { padding: .8rem .8rem .7rem; }
.im-list-head input { border-radius: 999px; padding-left: .9rem; }
.im-convs { padding: .35rem .45rem; }
.im-conv { border-bottom: none; border-radius: 12px; padding: .55rem .6rem; margin-bottom: 2px; }
.im-conv .avatar { width: 40px; height: 40px; }
.im-conv.active { background: var(--panel); box-shadow: none; outline: 1px solid rgba(232, 182, 76, .35); }
.im-person { border-radius: 12px; padding: .5rem .6rem; }
.im-person .avatar { width: 36px; height: 36px; }
.im-sect { padding: .7rem .65rem .25rem; font-weight: 700; }
.im-list-foot .hint { font-size: .72rem; }

.im-head { padding: .6rem 1rem; background: var(--bg-2); }
.im-head .avatar { width: 36px; height: 36px; }

.im-msgs { padding: 1.1rem 1rem; gap: .5rem;
  background-image: radial-gradient(rgba(232, 182, 76, .045) 1px, transparent 1px);
  background-size: 22px 22px; }
:root[data-theme="light"] .im-msgs { background-image: radial-gradient(rgba(120, 90, 20, .06) 1px, transparent 1px); }
.im-day { font-weight: 600; padding: .2rem .7rem; margin: .5rem 0; }
.im-row { max-width: 72%; gap: .55rem; }
.im-bubble { padding: .55rem .85rem; border-radius: 18px; box-shadow: 0 1px 3px rgba(2, 6, 16, .25); }
.im-row.mine .im-bubble { border-bottom-right-radius: 6px; }
.im-row.theirs .im-bubble { border-bottom-left-radius: 6px; border: 1px solid var(--line); }
.im-meta { margin-top: .2rem; }
.im-typing { padding: .35rem 1.1rem; }

.im-form { border-top: none; padding: .6rem .8rem .8rem; background: transparent; }
.im-form textarea { border-radius: 999px; padding: .6rem 1rem; min-height: 42px; }
.im-send-btn {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: none;
  background: linear-gradient(180deg, #f3c86b, var(--gold)); color: var(--gold-ink);
  box-shadow: 0 2px 8px rgba(232, 182, 76, .4);
  transition: transform .12s ease, box-shadow .12s ease;
}
.im-send-btn svg { width: 18px; height: 18px; }
.im-send-btn:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(232, 182, 76, .5); }
.im-send-btn:active { transform: scale(.96); }

.im-empty { margin: auto; text-align: center; display: grid; gap: .35rem; justify-items: center; padding: 2rem; }
.im-empty-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: var(--inset); border: 1px solid var(--line); color: var(--gold); }
.im-empty-ic svg { width: 30px; height: 30px; }

@media (max-width: 720px) {
  .im-wrap { height: calc(100dvh - 150px); }
  .im-row { max-width: 88%; }
}

/* ---------------- Canva designs ---------------- */
.canva-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-top: .8rem; }
.canva-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg-2); transition: border-color .15s ease, transform .15s ease; }
.canva-card:hover { border-color: rgba(232, 182, 76, .4); transform: translateY(-1px); }
.canva-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--inset); }
.canva-noimg { width: 100%; aspect-ratio: 4/3; display: grid; place-items: center; color: var(--muted); font-size: .78rem; background: var(--inset); }
.canva-card-body { padding: .6rem .7rem .7rem; display: grid; gap: .3rem; }
.canva-title { font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canva-actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }
@media (max-width: 720px) { .canva-grid { grid-template-columns: repeat(2, 1fr); } }

/* Workspace finish: restrained navy, warm gold, clear surfaces. */
:root {
  --bg: #0c1320; --bg-2: #101a2b; --panel: #142034;
  --line: #28364c; --ink: #edf2f9; --muted: #9aabc1;
  --input-bg: #101b2d; --inset: #1a2940; --label: #c4d0df;
  --gold: #e6b54e; --radius: 12px;
}
:root[data-theme="light"] {
  --bg: #f5f6f8; --bg-2: #eef0f4; --panel: #fff;
  --line: #e0e5ec; --ink: #172337; --muted: #64738a;
  --input-bg: #fff; --inset: #f4f6fa; --label: #47566d;
  --gold: #dba83b; --sh-sm: 0 1px 3px #192a4210;
}
html, :root[data-theme="light"] body { background: var(--bg); }
body { background: var(--bg); font-size: 14px; }
.topbar { height: 64px; box-shadow: none; }
.topbar-inner { max-width: none; height: 100%; padding: 0 28px; }
.topbar .brand { min-width: 0; }
.topbar .brand img { width: 34px; height: 34px; border-radius: 9px; background: #fff; padding: 2px; border: 1px solid var(--line); }
.workspace-crumb { border-left: 1px solid var(--line); padding-left: 20px; margin-left: 16px; font-size: 12px; font-weight: 500; color: var(--muted); }
.topbar-actions { gap: 8px; }
.sidebar { top: 64px; padding: 18px 12px 12px; background: #101b2c; border-color: #223149; }
.sidebar .tab { color: #a8b6cb; font-size: 12px; font-weight: 500; min-height: 36px; padding: 8px 12px; border-radius: 7px; }
.sidebar .tab:hover { color: #fff; background: #1a2a41; transform: none; }
.sidebar .tab.active { color: #fff; background: #24334a; box-shadow: inset 3px 0 var(--gold); }
.sidebar .side-group { color: #73859f; font-size: 9px; letter-spacing: .12em; margin: 22px 12px 8px; }
.sidebar .side-group:first-child { margin-top: 12px; }
.side-nav { gap: 3px; scrollbar-color: #334157 transparent; }
.sidebar .side-search .tab { border: 1px solid #30405a; background: #17243a; }
.sidebar #nav-collapse { border-color: #2a3a53; color: #92a4bf; }
:root[data-theme="light"] .sidebar { background: #ffffff; border-color: #d9e0ea; }
:root[data-theme="light"] .sidebar .tab { color: #4a5a74; }
:root[data-theme="light"] .sidebar .tab:hover { color: #172337; background: #eef2f8; }
:root[data-theme="light"] .sidebar .tab.active { color: #172337; background: #e6ebf4; }
:root[data-theme="light"] .sidebar .side-group { color: #8494ab; }
:root[data-theme="light"] .sidebar .side-search .tab { border-color: #d5dce8; background: #f4f6fa; }
:root[data-theme="light"] .sidebar #nav-collapse { border-color: #d5dce8; color: #64738a; }
@media(max-width:720px){:root[data-theme="light"] .sidebar .nav-group{color:#8494ab;}}
.wrap { max-width: 1280px; padding: 32px 36px 96px; }
.panel-head { padding-bottom: 22px; margin-bottom: 24px; gap: 16px; align-items: center; }
.panel-head h2 { font-family: Inter, system-ui, sans-serif; font-size: 24px; font-weight: 650; letter-spacing: -.7px; margin-bottom: 7px; }
.panel-head .muted { font-size: 13px; line-height: 1.65; max-width: 74ch; }
.panel-head .panel-actions { align-self: flex-start; }
.item { padding: 20px; border-radius: 12px; box-shadow: var(--sh-sm); }
.item:hover { border-color: var(--line); }
.editor { gap: 20px; }
.item .item { background: var(--inset); border-color: transparent; box-shadow: none; padding: 18px; }
.item-head { margin-bottom: 16px; }
.item-head strong { font-size: 11px; letter-spacing: .08em; }
label { font-size: 12px; font-weight: 550; margin-bottom: 6px; }
.hint { font-size: 11px; line-height: 1.5; margin-top: 6px; }
input[type="text"],input[type="password"],input[type="url"],input[type="search"],input[type="email"],input[type="number"],input[type="date"],input[type="tel"],textarea,select { border-radius: 8px; padding: 10px 12px; font-size: 13px; box-shadow: 0 1px 2px #00000003; }
textarea { line-height: 1.6; }
.btn { min-height: 34px; border-radius: 7px; font-size: 12px; box-shadow: none; padding: 8px 13px; }
.btn:hover { transform: none; box-shadow: none; background: var(--inset); }
.btn.primary { background: var(--gold); border-color: #b88827; box-shadow: 0 2px 3px #9f75151a; color: #251b07; }
.btn.primary:hover { background: #edc16b; filter: none; }
.btn.sm { min-height: 30px; font-size: 11px; }
.btn:disabled { cursor: wait; opacity: .55; }
.btn:focus-visible,.tab:focus-visible,.icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.icon-btn { width: 30px; height: 30px; }
.sub { font-size: 10px; letter-spacing: .13em; margin: 28px 0 14px; }
.empty-state { border: 1px dashed var(--line); border-radius: 12px; background: var(--inset); padding: 32px; color: var(--muted); }
.mail-acct { padding: 12px 16px; border-radius: 9px; }
.mail-acct.on { box-shadow: inset 0 -2px var(--gold); background: var(--panel); }
.mail-list { border-radius: 12px; box-shadow: var(--sh-sm); }
.mail-row { padding: 15px 16px; }
.mail-row:hover { background: var(--inset); }
.canva-card { border-radius: 10px; }
.canva-card-body { padding: 14px; }
.canva-noimg { background: var(--inset); font-size: 12px; padding: 12px; text-align: center; }
.chat-msg .item { margin-bottom: 8px; }
.chat-msg .hint { overflow-wrap: anywhere; }
.im-wrap { min-height: 420px; }
@media (min-width: 1500px) { .wrap { margin-left: 3vw; margin-right: 3vw; } }
@media (max-width: 1100px) and (min-width: 721px) { .workspace-crumb { display: none; }.wrap { padding: 28px; } }
@media (max-width: 720px) {
  .topbar { height: 60px; }
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .topbar .brand { margin-right: auto; }
  .topbar .brand strong,.workspace-crumb { display: none; }
  .topbar .brand img { width: 30px; height: 30px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn { min-width: 34px; min-height: 34px; padding: 7px; }
  .topbar #me-open { width: 34px; height: 34px; }
  .wrap { padding: 24px 16px 100px; }
  .panel-head { align-items: stretch; padding-bottom: 20px; margin-bottom: 20px; }
  .panel-head h2 { font-size: 23px; }
  .panel-head .muted { font-size: 12px; line-height: 1.6; }
  .panel-actions { gap: 8px; }.panel-actions .btn { min-height: 38px; }
  .item { padding: 16px; border-radius: 12px; }
  .item .item { padding: 14px; }.editor { gap: 16px; }
  input[type="text"],input[type="password"],input[type="url"],input[type="search"],input[type="email"],input[type="number"],textarea,select { font-size: 16px; min-height: 42px; }
  .sidebar { width: min(300px,84vw) !important; top: 0; padding: 14px 12px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .sidebar .side-search { margin-right: 42px; }
  .side-search { margin-bottom: 8px; }.sidebar .side-search .tab { min-height: 40px; }
  #nav-close { display: inline-flex; }
  .im-wrap { height: calc(100dvh - 124px); min-height: 320px; }
  .mail-accounts { display: flex; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .mail-acct { flex: 0 0 auto; max-width: 290px; padding: 10px 12px; }
  .mail-toolbar { gap: 10px; }.mail-toolbar input[type="search"] { min-width: 100%; }
  .mail-row { padding: 13px 10px; }.mail-folders { flex-wrap: wrap; }
  .chat-msg .item .btn { width: 100%; margin-top: 8px; }
  #copilot-float { width: calc(100vw - 24px); right: 12px; bottom: 12px; max-height: calc(100dvh - 84px); }
  #copilot-fab { width: 44px; height: 44px; right: 18px; bottom: 20px; opacity: .94; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.request-detail { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; padding: 14px; border-radius: 8px; background: var(--inset); line-height: 1.8; }
#profile-approval-status { padding: 10px 12px; border-left: 2px solid var(--gold); background: var(--inset); border-radius: 4px; margin: 12px 0; }
@media(max-width:720px){.sidebar .nav-group{line-height:16px;min-height:16px;color:#8195ae;}}

/* Feature workspace navigation and safely retired duplicate controls. */
.maintenance-legacy{display:none!important}.nav-group{font-size:10px;font-weight:750;letter-spacing:.12em;color:#8195ae;padding:22px 12px 8px}.mail-acct{overflow-wrap:anywhere}.mail-acct.on{border-color:var(--gold,#cfa83d)}#mail-from{min-width:180px;max-width:100%}#mail-organize{flex-wrap:wrap;margin:12px 0}#mail-organize select{max-width:100%}#calendar-accounts{flex-wrap:wrap}

.login-recovery{width:min(440px,calc(100% - 32px));margin:20px auto;padding:18px;border:1px solid var(--line,#dfe5ee);border-radius:12px;background:var(--panel);color:var(--ink)}.login-recovery summary{cursor:pointer;font-weight:650}.login-recovery .fld{display:block;margin-top:12px}.login-recovery button{margin-top:12px}#recovery-card .actions{flex-wrap:wrap}

.builder-credit{font-size:11px;line-height:1.6;text-align:center;padding:18px 12px;color:var(--muted,#68788e)}.builder-credit a{color:inherit;text-decoration:none}.builder-credit a:hover{text-decoration:underline}

.qr-advanced{border-top:1px solid var(--line,#dde3ed);margin-top:12px;padding-top:10px}.qr-advanced summary{cursor:pointer;font-size:12px;font-weight:600;margin-bottom:12px}#jform-template{max-width:210px;padding:7px 10px;font-size:12px}

input[type="datetime-local"]{display:block;width:100%;max-width:360px;min-height:38px;border:1px solid var(--line,#dbe2ec);border-radius:8px;padding:8px 10px;background:var(--input-bg);color:inherit;font:inherit} .qr-meta>.sub{display:block;margin:14px 0 10px}

.login-recovery summary{color:var(--ink)}.login-recovery .fld{color:var(--label);font-size:13px}.login-recovery input{display:block;width:100%;margin-top:6px;background:var(--input-bg);color:var(--ink);border:1px solid var(--line);border-radius:8px;padding:10px 12px;font:inherit}.login-recovery input:focus{outline:2px solid var(--gold);outline-offset:2px}.login-recovery .hint{margin-top:12px;color:var(--muted)}.login-recovery summary:focus-visible{outline:2px solid var(--gold);outline-offset:5px}
/* Theme-aware upload controls and readable compact actions. */
input[type="file"]{max-width:100%;min-width:0;color:var(--ink);font:inherit;font-size:12px}
input[type="file"]::file-selector-button{background:var(--inset);color:var(--ink);border:1px solid var(--line);border-radius:7px;padding:8px 12px;margin-right:10px;font:inherit;font-weight:600;cursor:pointer}
input[type="file"]::file-selector-button:hover{border-color:var(--gold)}
input[type="file"]:focus-visible{outline:2px solid var(--gold);outline-offset:3px}
.profile-form input[type="file"]{color:var(--ink)}
.profile-form .person-row>.field{min-width:0}
.btn.primary,.btn.primary.sm{color:#211803;font-weight:700;text-shadow:none;opacity:1}
.btn.primary.sm{font-size:12px;min-height:34px}
.btn.primary:disabled{opacity:.65}

/* Focused two-step account recovery, using the same theme tokens as sign-in. */
.recovery-link{display:block;margin:16px auto 0;border:0;background:transparent;color:var(--ink);font:inherit;font-size:13px;text-decoration:underline;text-underline-offset:4px;cursor:pointer;padding:8px}
.reset-card{max-width:440px;width:100%;text-align:left}.reset-card h1{font-size:25px;line-height:1.2;letter-spacing:-.025em;margin:16px 0 10px}.reset-heading{display:flex;align-items:center;gap:12px}.eyebrow{font-size:10px;font-weight:750;letter-spacing:.13em;color:var(--muted)}.reset-mark{background:var(--gold);color:#172033;width:36px;height:36px;border-radius:10px;display:grid;place-items:center;font-size:22px}.reset-progress{display:flex;gap:8px;margin:22px 0}.reset-progress span{flex:1;border-top:3px solid var(--line);padding-top:9px;font-size:11px;color:var(--muted)}.reset-progress .active{border-color:var(--gold);color:var(--ink);font-weight:700}.reset-card .fld{display:block;margin:16px 0 8px;font-size:12px;font-weight:600}.reset-card input{width:100%;margin-top:7px;min-height:44px;background:var(--input-bg);border:1px solid var(--line);color:var(--ink);padding:10px 12px;border-radius:9px}.reset-card .btn.primary{width:100%;margin-top:14px;min-height:44px}.reset-help{background:var(--inset);border:1px solid var(--line);padding:15px;border-radius:11px;margin-top:20px;font-size:12px}.reset-help p{font-size:12px;color:var(--muted);line-height:1.6;margin:6px 0 0}.reset-delivery{font-size:13px;line-height:1.6;color:var(--muted)}.reset-status{font-size:12px;line-height:1.6;color:var(--ink);margin-top:16px;overflow-wrap:anywhere}.reset-secondary{display:flex;justify-content:space-between;gap:8px;margin-top:12px;flex-wrap:wrap}.reset-success{font-size:30px;color:#178762;background:#e8f7ef;border-radius:50%;width:56px;height:56px;display:grid;place-items:center;margin:20px 0}.recovery-settings{margin-top:20px}.recovery-state{padding:14px;border:1px solid var(--line);border-radius:9px;background:var(--inset);font-size:13px;line-height:1.6}.recovery-verify-step{max-width:380px;margin-top:20px;padding-top:12px;border-top:1px solid var(--line)}#reset-code,#recovery-code{letter-spacing:.3em;font-size:21px;font-variant-numeric:tabular-nums}#username-request-card .fld{display:block;margin-bottom:12px}#username-request-card input{width:100%;margin-top:5px}
@media(max-width:500px){.reset-card{padding:22px 18px}.reset-card h1{font-size:24px}.reset-secondary .btn{flex:1}.recovery-settings .actions{display:flex;flex-wrap:wrap}.recovery-settings .actions .btn{flex:1;min-width:160px}}
/* Profile cards must shrink below the file-picker's intrinsic width. */
.profile-grid{align-items:start;grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:16px;max-width:100%}
.profile-grid .card,.profile-avatar-row>div{min-width:0;max-width:100%}
#profile-overview{margin-bottom:16px}
#profile-own-activity{max-height:300px;overflow:auto;margin-top:16px}
#profile-own-activity .hint{padding:9px 0;border-bottom:1px solid var(--line)}
@media(max-width:860px){.profile-grid{grid-template-columns:minmax(0,1fr)}}

/* Connections: account status first, technical setup on demand. */
.connection-notice{display:flex;gap:20px;align-items:baseline;border-left:3px solid var(--gold);padding:14px 18px;margin-bottom:24px;background:var(--inset);border-radius:6px;font-size:12px}
.connection-notice strong{flex:0 0 210px}.connection-notice p{margin:0;color:var(--muted)}
.connection-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-bottom:24px;align-items:start}
.connection-card{margin:0!important;padding:24px!important;min-width:0;box-shadow:0 2px 5px rgba(15,25,45,.04)}
.connection-card h3{font-size:18px;letter-spacing:-.02em;margin:6px 0 14px}.connection-card>.hint{font-size:12px;line-height:1.7;min-height:42px;margin-bottom:18px}
.connection-eyebrow{font-size:9px;font-weight:750;color:var(--muted);letter-spacing:.12em}
.connection-card .item-head{margin:16px 0 0;justify-content:flex-start}.connection-card .item-head>span:empty{display:none}.connection-card .item-head .actions{margin:0}
.connection-card .actions,.connection-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:16px 0 0}.connection-card .btn{min-height:36px;font-size:11px;margin:0}
.connection-details,.connection-card #canva-setup{border-top:1px solid var(--line);padding-top:15px!important;margin-top:20px!important;font-size:12px}.connection-details summary,.connection-card #canva-setup summary{font-weight:600;color:var(--ink);cursor:pointer}.connection-details p{margin-top:12px}
.connection-account-list{display:grid;gap:8px;margin:14px 0}.connection-account{display:flex;gap:10px;align-items:center;justify-content:space-between;border:1px solid var(--line);border-radius:8px;padding:10px 12px;font-size:12px;flex-wrap:wrap}.connection-account-address{overflow-wrap:anywhere;min-width:0}
.connection-badge{font-size:10px;border-radius:5px;padding:3px 7px;border:1px solid var(--line);color:var(--muted)}.connection-badge.is-connected{color:var(--ok);background:var(--inset)}
.connection-muted{grid-column:1/-1;background:var(--inset)!important}.connection-muted h3{font-size:14px}.connection-muted p{min-height:0!important;margin:0!important}
.connection-advanced{border:1px solid var(--line);border-radius:12px;background:var(--panel);padding:20px}.connection-advanced>summary{display:flex;gap:12px;justify-content:space-between;cursor:pointer;font-size:14px;font-weight:650}.connection-advanced[open]>summary{margin-bottom:20px}.connection-key-intro{margin-bottom:16px}.connection-advanced .keys-group{margin-bottom:16px}
@media(max-width:1000px){.connection-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:720px){.connection-notice{display:block}.connection-notice strong{display:block;margin-bottom:8px}.connection-card{padding:20px!important}.connection-advanced{padding:16px}.connection-advanced>summary{flex-direction:column}.connection-card .btn{flex:1;white-space:normal}.connection-card .actions{width:100%}}

.connection-card h3.sub{font-size:18px;color:var(--ink);letter-spacing:-.02em;text-transform:none;font-weight:700}.connection-card .btn{opacity:1}.connection-card .subtle-danger{color:var(--muted)}
@media(max-width:500px){.connection-actions{display:grid;grid-template-columns:1fr 1fr}.connection-actions>.btn{min-height:42px}.connection-card #nylas-refresh{grid-column:1/-1}}
.master-history{margin-top:24px}.master-history>summary{cursor:pointer;font-weight:650;font-size:13px}.master-history[open]>summary{margin-bottom:12px}
.ai-panel .chat-msg.assistant::before{content:'AI';font:700 9px Inter,system-ui,sans-serif}
[data-panel="master"] .chat-msg.assistant{position:relative;display:flex;flex-direction:column;gap:10px;padding-left:36px;width:100%;min-width:0}
[data-panel="master"] .chat-msg.assistant::before{content:'AI';position:absolute;left:0;top:1px}
[data-panel="master"] .chat-msg.assistant .request-detail{margin:0;width:100%;max-width:100%;padding:16px;white-space:pre-wrap;overflow-wrap:anywhere;background:var(--panel);border:1px solid var(--line);border-radius:10px}
[data-panel="master"] .chat-msg.assistant>.btn{align-self:flex-start;max-width:100%;white-space:normal}
[data-panel="master"] .chat-msg.assistant .hint{margin-left:0}
@media(max-width:720px){[data-panel="master"] .chat-msg.assistant{padding-left:0;padding-top:30px}}

.operator-action-card{width:100%;background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:18px}.operator-action-card h3{font-size:15px;margin-bottom:8px}.operator-action-card>.hint{margin-bottom:14px!important}.operator-fields{margin:12px 0;display:grid;grid-template-columns:110px minmax(0,1fr);gap:8px 16px;font-size:12px}.operator-fields dt{font-weight:650;color:var(--muted)}.operator-fields dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.operator-fields .operator-fields{margin:0;grid-template-columns:90px minmax(0,1fr)}.operator-technical{border-top:1px solid var(--line);padding-top:12px;margin:14px 0;font-size:11px}.operator-technical summary{cursor:pointer;color:var(--muted)}.operator-technical pre{margin-top:12px!important}.result-succeeded>strong{color:var(--ok)}
@media(max-width:500px){.operator-action-card{padding:15px}.operator-fields{grid-template-columns:1fr;gap:4px}.operator-fields dd{margin-bottom:8px}.operator-fields .operator-fields{grid-template-columns:1fr}}
.access-level-select{max-width:22rem;width:auto;flex:0 1 auto;padding:7px 10px;font-size:12.5px;min-height:0}
@media (max-width:700px){.access-level-select{max-width:100%;flex:1 1 auto}}

/* ---- Albums ---- */
.al-newrow { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.al-newrow input { flex: 1 1 160px; }
.al-card .al-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.al-card .al-head strong { font-size: .95rem; }
.al-card .al-meta { color: var(--muted); font-size: .8rem; }
.al-card .al-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.al-badge { font-size: .68rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--gold, #c9a227); color: var(--gold, #c9a227); }
.al-badge.draft { opacity: .55; border-color: currentColor; color: inherit; }
.al-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; margin-top: .6rem; }
.al-thumb { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; border: 1px solid var(--border, #2a2f3a); }
.al-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.al-thumb button { position: absolute; top: 4px; right: 4px; padding: .1rem .45rem; font-size: .72rem; border-radius: 6px; }
.al-upload-row { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }

/* ---- Polls ---- */
.pl-card .pl-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pl-card .pl-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.pl-opts { margin-top: .6rem; display: grid; gap: .35rem; }
.pl-opt { font-size: .85rem; }
.pl-bar-bg { height: 5px; border-radius: 999px; background: rgba(140,150,170,.18); overflow: hidden; margin-top: 3px; }
.pl-bar { height: 100%; background: var(--gold, #c9a227); border-radius: 999px; }

/* form builder: template gallery + response management toolbar */
.tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px;margin-top:8px}
.tpl-card{border:1px solid var(--line);border-radius:10px;padding:10px 12px;cursor:pointer;background:var(--inset)}
.tpl-card:hover{border-color:var(--gold)}
.tpl-card b{display:block;font-size:13px;margin-bottom:2px}
.tpl-card span{font-size:11.5px;color:var(--muted)}
.subs-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0 4px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:var(--inset)}
.subs-tools input[type=search]{flex:1;min-width:140px;padding:7px 10px;border:1px solid var(--line);border-radius:8px;background:var(--panel,#fff);color:inherit;font:inherit;font-size:13px}
/* forms workspace */
.jfw-stats { margin: 4px 0 14px; }
.jfw-toolbar { display: flex; gap: 8px; margin: 0 0 14px; }
.jfw-toolbar input[type=search] { flex: 1; }
.jfw-toolbar select { width: auto; }
.jfw-pill { font-size: 10px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; border-radius: 999px; padding: 3px 9px; border: 1px solid var(--line); color: var(--muted); }
.jfw-pill.is-open { color: var(--ok); border-color: var(--ok); }
.jfw-pill.is-closed { color: var(--muted); }
.jfw-pill.is-full { color: var(--warn, #d9a13b); border-color: var(--warn, #d9a13b); }
.jfw-meter { height: 4px; border-radius: 2px; background: var(--inset); margin-top: 8px; overflow: hidden; }
.jfw-meter > span { display: block; height: 100%; border-radius: 2px; background: var(--accent, #4f8cff); }
.jfw-legacy { margin-top: 18px; }
.jfw-legacy > summary { cursor: pointer; font-weight: 600; font-size: .95rem; padding: 6px 0; }
/* forms workspace sub-nav */
.jfw-nav { display: inline-flex; gap: 2px; background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 0 0 14px; }
.jfw-tab { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.jfw-tab.is-active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.18); }
/* inbuilt calendar */
.jcal-bar { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.jcal-month { margin-left: 8px; font-size: 1.02rem; }
.jcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.jcal-wd { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.jcal-cell { min-height: 74px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 5px; cursor: pointer; background: var(--panel); display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.jcal-cell:hover { border-color: var(--muted); }
.jcal-cell.is-other { opacity: .38; }
.jcal-cell.is-today .jcal-num { background: var(--ok); color: #08131f; border-radius: 999px; }
.jcal-cell.is-selected { outline: 2px solid var(--ok); }
.jcal-num { font-size: .78rem; font-weight: 700; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.jcal-chip { font-size: .66rem; line-height: 1.25; border-radius: 4px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.jcal-chip.is-event { background: rgba(217,161,59,.18); color: #c98f1f; }
.jcal-chip.is-meeting { background: rgba(79,140,255,.16); color: #4f8cff; }
.jcal-chip.is-deadline { background: rgba(239,83,80,.14); color: #e5534b; }
.jcal-chip.is-other { background: var(--inset); color: var(--muted); }
.jcal-item .jcal-chip { display: inline-block; }
.jcal-more { font-size: .66rem; color: var(--muted); }
.jcal-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.jcal-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.jcal-form-row > * { flex: 1; min-width: 120px; }
@media (max-width: 640px) { .jcal-cell { min-height: 56px; } .jcal-chip { font-size: .6rem; } }

/* Volunteers review queue */
.vol-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.vol-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; display: flex; flex-direction: column; min-width: 96px; }
.vol-stat strong { font-size: 20px; }
.vol-stat span { font-size: 11.5px; color: var(--muted); }
.vol-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.vol-filter .chip { background: transparent; border: 1px solid var(--line); color: inherit; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.vol-filter .chip.active { background: var(--accent, #e9a62b); border-color: var(--accent, #e9a62b); color: var(--on-accent, #1a1204); font-weight: 600; }
.vol-list { display: grid; gap: 12px; }
.vol-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.vol-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.vol-who { display: flex; flex-direction: column; gap: 2px; }
.vol-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.vol-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.vol-tag { font-size: 11.5px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.vol-msg { font-size: 13.5px; margin: 10px 0 0; white-space: pre-wrap; }
.vol-hist { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; display: grid; gap: 3px; }
.vol-hist-row { font-size: 11.5px; color: var(--muted); }
.vol-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.vlp { font-size: 10px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; border-radius: 999px; padding: 3px 9px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.vlp-pending { color: var(--warn, #d9a13b); border-color: var(--warn, #d9a13b); }
.vlp-wait { color: var(--accent, #4f8cff); border-color: var(--accent, #4f8cff); }
.vlp-ok { color: var(--ok); border-color: var(--ok); }
.vlp-no { color: var(--danger, #e0655a); border-color: var(--danger, #e0655a); }

/* Home dashboard */
/* home dashboard - Direction 3 mockup fidelity */
.home-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 2px 22px; }
.home-hero-main { min-width: 0; }
.home-date { margin: 0 0 7px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.home-hero h2 { margin: 0; font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 600; font-size: 1.9rem; letter-spacing: -.01em; }
.home-greet-name { font-style: italic; color: var(--gold); }
.home-status { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); text-align: right; max-width: 340px; }
.home-status strong { color: var(--gold); font-weight: 600; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.home-main { min-width: 0; }
.home-rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.home-board { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; }
.home-rail .home-board { margin-bottom: 0; }
.home-board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 13px; }
.home-board-head h3 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.home-board-hint { font-family: Inter, system-ui, sans-serif; font-size: 11.5px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.home-board-link { background: none; border: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.home-board-link:hover { color: var(--gold); }
.home-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.home-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.home-stat:hover { border-color: var(--gold); transform: translateY(-1px); }
.home-stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-stat-label { font-size: 12px; color: var(--muted); }
.home-stat-ic { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 12.5px; }
.home-stat strong { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 30px; line-height: 1.05; color: var(--ink); }
.home-stat.hot strong { color: var(--gold); }
.home-stat-sub { display: flex; align-items: center; gap: 6px; min-width: 0; }
.home-stat-pill { font-style: normal; font-size: 10.5px; font-weight: 600; padding: 1.5px 7px; border-radius: 999px; background: rgba(74, 222, 128, .13); color: var(--ok); white-space: nowrap; }
.home-stat-pill.gold { background: rgba(232, 182, 76, .13); color: var(--gold); }
.home-stat-hint { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-attn-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.home-attn-chip { font: inherit; font-size: 11.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.home-attn-chip:hover { border-color: var(--gold); color: var(--gold); }
.home-attn-chip.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.home-attn-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .home-attn-cols { grid-template-columns: minmax(0, 1fr); } }
.home-attn-col { background: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.home-attn-col-head { display: flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 2px 2px 10px; }
.home-attn-col-head em { font-style: normal; margin-left: auto; font-weight: 700; }
.home-attn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.home-attn-urgent .home-attn-dot { background: var(--danger); }
.home-attn-week .home-attn-dot { background: var(--gold); }
.home-attn-approvals .home-attn-dot { background: var(--ok); }
.home-attn-row { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; color: inherit; text-align: left; cursor: pointer; margin-bottom: 8px; }
.home-attn-row:last-child { margin-bottom: 0; }
.home-attn-row:hover { border-color: var(--gold); }
.home-attn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.home-attn-src { display: flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.home-attn-ic { color: var(--gold); font-size: 12px; }
.home-attn-text { font-size: 13px; line-height: 1.4; }
.home-attn-go { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; white-space: nowrap; }
.home-attn-row:hover .home-attn-go { color: var(--gold); border-color: var(--gold); }
.home-attn-go.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.home-attn-go.gold:hover { color: var(--gold-ink); }
#home-attn .empty-state { grid-column: 1 / -1; }
.home-tickets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .home-tickets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .home-tickets { grid-template-columns: minmax(0, 1fr); } }
#home-upcoming .empty-state { grid-column: 1 / -1; }
.home-ticket { display: flex; gap: 11px; min-width: 0; background: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; color: inherit; text-align: left; cursor: pointer; align-items: center; transition: border-color .15s ease, transform .15s ease; }
.home-ticket:hover { border-color: var(--gold); transform: translateY(-1px); }
.home-ticket-date { flex: 0 0 46px; display: flex; flex-direction: column; align-items: center; border-right: 1px dashed var(--line); padding-right: 11px; }
.home-ticket-date em { font-style: normal; font-size: 9.5px; letter-spacing: .08em; color: var(--muted); }
.home-ticket-date strong { font-size: 21px; line-height: 1.1; font-family: "Playfair Display", Georgia, serif; font-weight: 600; color: var(--gold); }
.home-ticket-date i { font-style: normal; font-size: 9.5px; color: var(--muted); }
.home-ticket-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-ticket-body strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-ticket-body .hint { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-quick-title { margin: 0 0 12px; font-family: "Playfair Display", Georgia, serif; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.home-cta { display: flex; align-items: center; gap: 12px; width: 100%; border-radius: 12px; padding: 12px 14px; font: inherit; text-align: left; cursor: pointer; margin-bottom: 10px; transition: transform .15s ease, border-color .15s ease; }
.home-cta.gold { background: var(--gold); border: 1px solid var(--gold); color: var(--gold-ink); }
.home-cta.gold:hover { transform: translateY(-1px); }
.home-cta.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.home-cta.ghost:hover { border-color: var(--gold); transform: translateY(-1px); }
.home-cta-ic { width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 15px; }
.home-cta.gold .home-cta-ic { background: rgba(26, 18, 4, .14); color: var(--gold-ink); }
.home-cta.ghost .home-cta-ic { border: 1px solid var(--line); color: var(--gold); }
.home-cta-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.home-cta-body strong { font-size: 13.5px; }
.home-cta-body span { font-size: 11px; opacity: .78; }
.home-cta-arrow { font-size: 15px; }
.home-actions { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.home-action { display: flex; align-items: center; gap: 12px; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; font: inherit; color: inherit; cursor: pointer; text-align: left; transition: background .12s ease, border-color .12s ease; }
.home-action:hover { background: var(--inset); border-color: var(--line); }
.home-action-ic { width: 32px; height: 32px; flex: 0 0 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; color: var(--gold); font-size: 14px; }
.home-action-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.home-action strong { font-size: 13px; }
.home-action .hint { font-size: 11px; margin: 0; }
.home-assistant-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.home-assistant-ic { color: var(--gold); font-size: 15px; }
.home-assistant-head strong { font-size: 14px; }
.home-assistant .hint { font-size: 12px; margin: 0 0 12px; }
.home-assistant .btn.primary { width: 100%; }

/* Master AI hero + quick tiles */
.master-hero { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, var(--panel) 0%, var(--panel) 50%, rgba(233,166,43,.12) 100%); margin-bottom: 14px; }
.master-hero h2 { margin: 0 0 6px; font-size: 1.35rem; }
.master-hero .hint { margin: 0 0 12px; max-width: 62ch; }
.master-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip { font-size: 11px; font-weight: 600; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--muted); }
.mquick { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mquick-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.mquick-tile:hover { border-color: var(--gold, #e9a62b); transform: translateY(-1px); }
.mquick-ic { font-size: 16px; color: var(--gold, #e9a62b); }
.mquick-tile strong { font-size: 13px; }
.mquick-tile span:last-child { font-size: 11.5px; color: var(--muted); }

/* notice editor: templates, kind picker, status chips */
.tpl-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.tpl-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-chip { font-size: .74rem; font-weight: 600; padding: 5px 11px; border-radius: 999px; border: 1px dashed var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: all .12s ease; }
.tpl-chip:hover { color: var(--gold); border-color: var(--gold); border-style: solid; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row .chip { font-size: .76rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: all .12s ease; }
.chip-row .chip:hover { border-color: var(--gold); }
.chip-row .chip.active { color: var(--panel); background: var(--gold); border-color: var(--gold); }
.chip-row .chip.kind-urgent.active { background: #ef4444; border-color: #ef4444; color: #fff; }
.chip-row .chip.kind-success.active { background: #34d399; border-color: #34d399; color: #0b2e22; }
.chip-row .chip.kind-event.active { background: #4f8ef7; border-color: #4f8ef7; color: #fff; }
.notice-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.notice-status { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.nst { font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.nst-pin { color: var(--gold); border-color: var(--gold); }
.nst-sched { color: #4f8ef7; border-color: #4f8ef7; }
.nst-exp { color: #ef4444; border-color: #ef4444; }
input[type="datetime-local"].input { font: inherit; }

/* my AI key (BYOK) */
.byok-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.byok-row:last-child { border-bottom: none; }
.byok-tag { font-size: .8rem; font-weight: 600; }
.byok-row .hint { flex: 1; }

/* AI chat workspaces: thread rail + chat column */
.aichat{display:grid;grid-template-columns:230px minmax(0,1fr);gap:14px;align-items:start}
.aichat-rail{position:sticky;top:12px;display:flex;flex-direction:column;gap:10px}
.aichat-list{display:flex;flex-direction:column;gap:6px;max-height:60vh;overflow:auto}
.aichat-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:9px 11px;border:1px solid var(--line);border-radius:10px;background:var(--panel);cursor:pointer;font-size:12.5px;color:var(--text)}
.aichat-item.on{border-color:var(--gold);background:var(--input-bg)}
.aichat-item-t{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.aichat-item-c{color:var(--muted);font-size:11px}
.aichat-item-x{color:var(--muted);font-size:11px;padding:2px 6px;border-radius:6px;white-space:nowrap}
.aichat-item-x:hover{color:#e5534b}
.aichat-note{font-size:11px;margin:0;line-height:1.5}
.aichat-main{min-width:0}
@media(max-width:760px){.aichat{grid-template-columns:1fr}.aichat-rail{position:static;flex-direction:row;align-items:center;flex-wrap:wrap}.aichat-list{flex-direction:row;max-height:none;flex-wrap:wrap;flex:1}.aichat-item{width:auto;max-width:46%}}

/* ---------- sign-in split layout ---------- */
.login-top{position:fixed;top:0;left:0;right:0;display:flex;justify-content:space-between;align-items:center;padding:16px 22px;z-index:5}
.login-brand{display:flex;align-items:center;gap:.55rem;color:var(--ink);text-decoration:none;font-weight:600;font-size:.95rem}
.login-brand img{border-radius:7px}
.login-brand b{color:var(--gold)}
.login-back{color:var(--muted);text-decoration:none;font-size:.85rem;font-weight:500}
.login-back:hover{color:var(--gold)}
.login-split{display:grid;grid-template-columns:minmax(340px,400px) minmax(0,1fr);gap:3.2rem;align-items:center;width:100%;max-width:1040px}
.login-side{display:flex;flex-direction:column;align-items:stretch;min-width:0}
.login-eyebrow{text-transform:uppercase;letter-spacing:.14em;font-size:.68rem;color:var(--gold);font-weight:700;margin:0 0 .3rem}
.login-card h1{font-size:1.55rem;margin:0 0 .15rem}
.login-sub{font-size:.85rem;margin:0 0 1.1rem}
.login-tabs{display:flex;gap:4px;background:var(--inset);border:1px solid var(--line);border-radius:10px;padding:4px;margin-bottom:1.05rem}
.login-tab{flex:1;padding:.45rem .5rem;border:1px solid transparent;background:transparent;color:var(--muted);font:inherit;font-size:.84rem;font-weight:600;border-radius:7px;cursor:pointer;transition:background .15s,color .15s}
.login-tab.active{background:var(--panel);color:var(--ink);border-color:var(--line);box-shadow:0 1px 4px rgba(0,0,0,.28)}
:root[data-theme="light"] .login-tab.active{box-shadow:0 1px 4px rgba(20,30,60,.12)}
.login-labelrow{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem}
.login-labelrow .recovery-link{font-size:.78rem;padding:0;margin-bottom:.35rem}
.login-passkey-btn{width:100%;margin-top:.55rem}
.login-passkey-note{text-align:center;font-size:.78rem;margin:.4rem 0 0}
.login-fineprint{margin:1rem 0 0;font-size:.75rem;text-align:center}
.login-hero{min-width:0}
.login-hero h2{font-size:2.05rem;line-height:1.16;margin:0 0 .7rem;font-weight:650;letter-spacing:-.01em}
.login-hero h2 em{font-style:normal;color:var(--gold)}
.login-hero-sub{color:var(--muted);max-width:48ch;margin:0 0 1.5rem;font-size:.92rem}
.login-hero-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem;max-width:430px}
.lh-item{display:flex;align-items:center;gap:.6rem;padding:.68rem .8rem;border:1px solid var(--line);border-radius:10px;background:var(--panel);font-size:.83rem;font-weight:600;color:var(--ink)}
.lh-item svg{color:var(--gold);flex:none}
.login-hero-foot{margin:1.3rem 0 0;color:var(--muted);font-size:.8rem}
@media(max-width:900px){
  .login-split{grid-template-columns:1fr;gap:1.7rem;max-width:440px}
  .login-hero h2{font-size:1.45rem}
  .login-hero-grid{max-width:none}
  .login-card{margin:0}
}

/* ---- SEO section ---- */
.seo-subnav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.seo-sites { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: .8rem; margin: .8rem 0; }
.seo-site-head { display: flex; align-items: center; gap: .9rem; margin-bottom: .5rem; }
.seo-ring { width: 72px; height: 72px; flex: none; }
.seo-ring-bg { fill: none; stroke: var(--line); stroke-width: 7; }
.seo-ring-fg { fill: none; stroke-width: 7; stroke-linecap: round; }
.seo-ring-t { fill: var(--ink); font: 700 20px system-ui, sans-serif; }
.seo-tag { display: inline-block; font-size: .72rem; border: 1px solid var(--line); border-radius: 99px; padding: .05rem .55rem; color: var(--muted); white-space: nowrap; }
.seo-critical, .seo-high { color: var(--danger); border-color: var(--danger); }
.seo-medium { color: #e8b64c; border-color: #e8b64c; }
.seo-ok { color: #2fbf71; border-color: #2fbf71; }
.seo-good { color: #2fbf71; } .seo-warn { color: #e8b64c; }
.seo-sevrow { display: flex; flex-wrap: wrap; gap: .35rem; }
.seo-tablewrap { overflow-x: auto; margin: .4rem 0; }
.seo-table { width: 100%; border-collapse: collapse; min-width: 480px; font-size: .88rem; }
.seo-table th { text-align: left; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
.seo-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.seo-filters { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .6rem; }
.seo-group summary { cursor: pointer; }
.seo-ex { margin: .4rem 0 0 1.1rem; padding: 0; }
.seo-url { overflow-wrap: anywhere; color: var(--gold); }
.seo-chart { width: 100%; height: auto; max-width: 100%; }
.seo-grid { stroke: var(--line); stroke-width: 1; } .seo-axis { fill: var(--muted); font: 10px system-ui, sans-serif; }
.seo-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .35rem; }
.seo-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.seo-site { min-width: 0; } .seo-site-head > div { min-width: 0; overflow-wrap: anywhere; }
.seo-filters select { width: auto; min-width: 11rem; }
.seo-sevrow { margin-top: .5rem; }

/* Responsive polish (merged workspace): the icon rail must not leak text, and SEO tables must stay readable on phones. */
body.nav-collapsed .nav-group,
body.nav-collapsed .side-logo-txt { display: none; }
body.nav-collapsed .side-logo { justify-content: center; }
@media (max-width: 1100px) and (min-width: 721px) {
  body:not(.nav-pinned) .nav-group,
  body:not(.nav-pinned) .side-logo-txt { display: none; }
  body:not(.nav-pinned) .side-logo { justify-content: center; }
}
@media (max-width: 720px) {
  .seo-table, .seo-table tbody, .seo-table tr, .seo-table td { display: block; min-width: 0; width: 100%; }
  .seo-table thead { display: none; }
  .seo-table tr { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; margin-bottom: .55rem; }
  .seo-table td { border-bottom: 0; padding: .2rem 0; }
  .seo-table td::before { content: attr(data-label); display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
}

/* Websites section */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: .8rem; margin-top: .8rem; }
.site-card { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.site-card a { overflow-wrap: anywhere; }
.site-card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
