/* ==========================================================================
   CoreGrid Mailing — themeable glass UI
   Every brandable value is a CSS variable, set per install from the Appearance
   admin screen. The defaults below are the shipped gold-and-charcoal theme.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Everything brandable is a variable. These are only the fallbacks: each page
   injects the saved values from the Appearance admin screen in a <style> block
   after this file, so an admin's choices always win.
   --------------------------------------------------------------------------- */
:root {
  --accent: #f0c865;
  --accent-rgb: 240 200 101;
  --accent-soft: #d9a441;
  --accent-soft-rgb: 217 164 65;
  --accent-deep: #9c6a1c;
  --accent-deep-rgb: 156 106 28;
  --accent-ink: #1c1406;

  --ink-rgb: 7 7 8;
  --surface-rgb: 17 17 20;
  --line-rgb: 214 218 224;

  --brand-mark: url('../img/default-mark.svg');
  --bg-image: url('../img/aurora.jpg');
  --bg-filter: hue-rotate(200deg) saturate(.55) brightness(.6);
  --veil-strength: .82;

  --ink-900: #070708;
  --ink-800: #0d0d0f;
  --ink-700: #141417;
  --ink-600: #1c1c20;

  --ice-100: #f4f4f5;
  --ice-200: #dcdee2;
  --ice-300: #aeb3ba;
  --ice-400: #80868f;

  --neon: #f0c865;
  --neon-soft: #d9a441;
  --neon-deep: #9c6a1c;
  --violet: #d7dbe0;
  --danger: #ff6b81;
  --warn: #ffc46b;
  --ok: #57e6b4;

  --glass: rgb(var(--surface-rgb) / 0.62);
  --glass-2: rgb(var(--surface-rgb) / 0.5);
  --line: rgb(var(--line-rgb) / 0.14);
  --line-strong: rgb(var(--line-rgb) / 0.26);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --glow: 0 0 0 1px rgb(var(--accent-rgb) / 0.35), 0 0 28px rgb(var(--accent-soft-rgb) / 0.28);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", var(--sans);

  --sidebar-w: 268px;
  --list-w: 392px;

  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Panels below set display on their own class, which would otherwise beat the
   UA rule for [hidden]. Keep the attribute authoritative. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--sans);
  color: var(--ice-100);
  background: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

kbd {
  font: 600 10.5px/1 var(--sans);
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ice-200);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgb(var(--line-rgb) / 0.18);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgb(var(--line-rgb) / 0.32); background-clip: content-box; }

/* ───────────────────────────── background stage ───────────────────────────── */

/* The photo, its colour treatment and the veil all come from branding vars.
   bg_hue re-tints a stock photo to any accent (the shipped shot is blue). */
.app-bg, .auth-bg {
  position: fixed;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.app-bg { filter: var(--bg-filter) brightness(.85); transform: scale(1.06); }
.auth-bg { filter: var(--bg-filter); }

.app-veil, .auth-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(1100px 620px at 50% -8%, rgb(var(--accent-rgb) / 0.22), transparent 62%),
    radial-gradient(900px 700px at 100% 100%, rgb(var(--accent-deep-rgb) / 0.24), transparent 60%),
    linear-gradient(180deg,
      rgb(var(--ink-rgb) / calc(var(--veil-strength) * 0.63)) 0%,
      rgb(var(--ink-rgb) / var(--veil-strength)) 100%);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  box-shadow: var(--shadow);
}

/* ───────────────────────────────── buttons ───────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 14px/1 var(--sans);
  color: var(--ice-100);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }

.btn.primary {
  background: linear-gradient(135deg, var(--neon) 0%, var(--neon-soft) 45%, var(--neon-deep) 100%);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px rgb(var(--accent-soft-rgb) / 0.35);
  font-weight: 700;
}
.btn.primary:hover { box-shadow: 0 14px 38px rgb(var(--accent-soft-rgb) / 0.48); }

.btn.ghost { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.09); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 14px; font-size: 13px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ice-300);
  cursor: pointer;
  text-decoration: none;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--ice-100); border-color: var(--line); }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(255, 107, 129, .35); background: rgba(255, 107, 129, .12); }
.icon-btn.on { color: var(--neon); }

.link-btn {
  background: none;
  border: 0;
  color: var(--ice-300);
  font: 600 12.5px var(--sans);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 7px;
}
.link-btn:hover { color: var(--neon); background: rgb(var(--accent-rgb) / .08); }

.push-right { margin-left: auto; }
.muted { color: var(--ice-400); }
.muted.small { font-size: 12px; line-height: 1.55; }

/* ─────────────────────────────── auth screen ─────────────────────────────── */

.auth-body { display: grid; place-items: center; }
.auth-stage { position: relative; width: 100%; height: 100%; display: grid; place-items: center; padding: 24px; }

.auth-card {
  position: relative;
  z-index: 2;
  width: min(430px, 100%);
  padding: 38px 34px 28px;
  overflow: hidden;
  /* Denser than the app panels: it sits over the brightest part of the photo. */
  background: rgb(var(--ink-rgb) / 0.78);
  animation: rise .6s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* Soft light spill from the ring in the photograph — no second hard circle. */
.auth-ring {
  position: absolute;
  top: -140px;
  left: 50%;
  width: 420px;
  height: 300px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, rgb(var(--accent-rgb) / .28), transparent 65%);
  filter: blur(6px);
  pointer-events: none;
}

.auth-head { text-align: center; margin-bottom: 26px; position: relative; }
.auth-head h1 { font: 700 27px/1.1 var(--display); margin: 14px 0 6px; letter-spacing: -.4px; }
.auth-head p { margin: 0; color: var(--ice-400); font-size: 13.5px; }

.brand-mark {
  width: 46px;
  height: 46px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, rgb(var(--accent-rgb) / .35), transparent 70%);
  border: 1.5px solid rgb(var(--accent-rgb) / .75);
  box-shadow: 0 0 22px rgb(var(--accent-rgb) / .5);
}
.brand-mark span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, var(--neon));
  box-shadow: 0 0 14px rgb(var(--accent-rgb) / .9);
}

/* JC Green Holdings logo */
.auth-logo {
  display: block;
  width: min(250px, 72%);
  height: auto;
  margin: 0 auto 10px;
  filter: drop-shadow(0 8px 26px rgba(0, 0, 0, .65));
}
.brand-logo {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5));
}

.auth-form { display: grid; gap: 16px; }

.field { display: grid; gap: 7px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--ice-300); letter-spacing: .3px; }
.field-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: rgb(var(--ink-rgb) / .55);
  transition: border-color .2s, box-shadow .2s;
}
.field-wrap:focus-within { border-color: rgb(var(--accent-rgb) / .6); box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / .12); }
.field-icon { color: var(--ice-400); width: 18px; height: 18px; }
.field-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ice-100);
  font: 500 14.5px var(--sans);
  padding: 14px 0;
}
.field-wrap input::placeholder { color: rgb(var(--line-rgb) / .45); }
.reveal { border: 0; background: none; color: var(--ice-400); cursor: pointer; padding: 4px; border-radius: 8px; }
.reveal:hover, .reveal.on { color: var(--neon); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  margin-bottom: 18px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .05);
}
.alert svg { width: 17px; height: 17px; margin-top: 1px; }
.alert.error { border-color: rgba(255, 107, 129, .4); background: rgba(255, 107, 129, .12); color: #ffd7dd; }
.alert.ok { border-color: rgba(87, 230, 180, .35); background: rgba(87, 230, 180, .1); color: #c8fff0; }

.auth-foot { margin-top: 22px; text-align: center; }
.lock { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ice-400); }
.lock svg { width: 14px; height: 14px; }

/* ─────────────────────────────── app layout ─────────────────────────────── */

.app {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) 1fr;
  gap: 14px;
  padding: 14px;
}

.app > section, .app > aside { min-height: 0; min-width: 0; overflow: hidden; }

/* ───────────────────────────────── sidebar ───────────────────────────────── */

.sidebar { display: flex; flex-direction: column; padding: 16px 14px; gap: 14px; }

.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand .brand-mark { width: 38px; height: 38px; }
.brand .brand-mark span { width: 11px; height: 11px; }
.brand-text { display: grid; min-width: 0; }
.brand-text strong { font: 700 15px var(--display); letter-spacing: -.2px; }
.brand-text small { font-size: 11px; color: var(--ice-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.compose-btn { position: relative; padding: 13px 18px; }
.compose-btn kbd { margin-left: auto; background: rgba(28, 20, 6, .22); border-color: rgba(28, 20, 6, .25); color: #2a1d07; }

.folders { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }

.folder {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--ice-200);
  font: 500 13.5px var(--sans);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .16s, color .16s, border-color .16s;
}
.folder:hover { background: rgba(255, 255, 255, .06); }
.folder svg { width: 18px; height: 18px; color: var(--ice-400); }
.folder .f-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder .count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / .16);
  color: var(--neon);
}
.folder.on {
  background: linear-gradient(100deg, rgb(var(--accent-rgb) / .2), rgb(var(--accent-rgb) / .05));
  border-color: rgb(var(--accent-rgb) / .3);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .06);
}
.folder.on svg { color: var(--neon); }
.folder[data-depth="1"] { padding-left: 26px; }
.folder[data-depth="2"] { padding-left: 40px; }

.folders-skeleton { display: grid; gap: 8px; padding: 6px 4px; }
.folders-skeleton span {
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.ghost-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
  background: none;
  color: var(--ice-300);
  font: 500 13px var(--sans);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.ghost-row:hover { color: var(--neon); border-color: rgb(var(--accent-rgb) / .45); background: rgb(var(--accent-rgb) / .07); }
.ghost-row svg { width: 17px; height: 17px; }

.storage { padding: 11px 12px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.storage-top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ice-400); margin-bottom: 8px; }
.storage-top strong { color: var(--ice-200); }
.meter { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--neon), var(--violet));
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.meter.warn i { background: linear-gradient(90deg, var(--warn), var(--danger)); }

.side-foot { display: grid; gap: 10px; }
.account { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .04); }
.account-text { display: grid; min-width: 0; flex: 1; }
.account-text strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-text small { font-size: 11px; color: var(--ice-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font: 700 12.5px var(--sans);
  color: #fffaf0;
  /* Muted per-sender tint so avatars stay distinguishable but sit in the gold/silver palette. */
  background: linear-gradient(140deg, hsl(var(--hue, 40) 26% 36%), hsl(calc(var(--hue, 40) + 30) 20% 20%));
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .28);
}

/* ─────────────────────────────── list pane ─────────────────────────────── */

.list-pane { display: flex; flex-direction: column; }

.list-head { padding: 14px 14px 0; border-bottom: 1px solid var(--line); }
.list-head-top { display: flex; align-items: center; gap: 9px; }

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgb(var(--ink-rgb) / .5);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: rgb(var(--accent-rgb) / .55); box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / .1); }
.search-icon { width: 17px; height: 17px; color: var(--ice-400); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ice-100);
  font: 500 13.5px var(--sans);
  padding: 11px 0;
}
.search input::placeholder { color: rgb(var(--line-rgb) / .45); }
.search input::-webkit-search-cancel-button { display: none; }
.clear-search { border: 0; background: none; color: var(--ice-400); cursor: pointer; padding: 2px; }
.clear-search:hover { color: var(--danger); }

.list-head-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 2px 12px; }
.list-head-bottom h2 { margin: 0; font: 700 17px var(--display); letter-spacing: -.3px; }

.filters { display: flex; gap: 5px; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: none;
  color: var(--ice-300);
  font: 600 11.5px var(--sans);
  cursor: pointer;
  transition: all .16s;
}
.chip:hover { color: var(--ice-100); border-color: var(--line-strong); }
.chip.on { background: rgb(var(--accent-rgb) / .16); border-color: rgb(var(--accent-rgb) / .42); color: var(--neon); }

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 2px 11px;
  border-top: 1px solid var(--line);
  animation: fade .2s ease both;
}
.bulk-bar strong { font-size: 12.5px; color: var(--ice-200); }
.bulk-actions { display: flex; gap: 2px; margin-left: auto; }
.bulk-actions .icon-btn { width: 32px; height: 32px; }
.bulk-actions svg { width: 17px; height: 17px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.check { position: relative; display: grid; place-items: center; width: 18px; height: 18px; flex: none; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.check span {
  width: 17px;
  height: 17px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  transition: all .16s;
  display: grid;
  place-items: center;
}
.check input:checked + span {
  background: var(--neon);
  border-color: var(--neon);
  box-shadow: 0 0 12px rgb(var(--accent-rgb) / .5);
}
.check input:checked + span::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #1c1406;
  border-bottom: 2px solid #1c1406;
  rotate: -45deg;
  margin-top: -2px;
}

.list-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px; }
.msg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }

.msg {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
  animation: slideIn .25s ease both;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.msg:hover { background: rgba(255, 255, 255, .055); }
.msg.on {
  background: linear-gradient(100deg, rgb(var(--accent-rgb) / .16), rgb(var(--accent-rgb) / .04));
  border-color: rgb(var(--accent-rgb) / .3);
}
.msg.unread::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  translate: 0 -50%;
  width: 3px;
  height: 22px;
  border-radius: 3px;
  background: var(--neon);
  box-shadow: 0 0 10px rgb(var(--accent-rgb) / .8);
}
.msg .check { align-self: center; opacity: 0; transition: opacity .15s; }
.msg:hover .check, .msg .check input:checked ~ span, .msg.picked .check { opacity: 1; }
.msg.picked { background: rgb(var(--accent-rgb) / .1); }

.msg .avatar { width: 34px; height: 34px; border-radius: 11px; align-self: flex-start; }

.msg-main { min-width: 0; display: grid; gap: 3px; }
.msg-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
/* Flex children default to min-width:auto, which defeats the ellipsis. */
.msg-from, .msg-subject, .msg-snippet { min-width: 0; }
.msg-from { font-size: 13.2px; font-weight: 500; color: var(--ice-200); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.unread .msg-from { font-weight: 700; color: #fff; }
.msg-time { margin-left: auto; font-size: 10.5px; color: var(--ice-400); white-space: nowrap; flex: none; }
.msg-subject { font-size: 13px; color: var(--ice-200); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.unread .msg-subject { color: #fff; font-weight: 600; }
.msg-snippet { font-size: 11.8px; color: var(--ice-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-tags { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.msg-tags svg { width: 13px; height: 13px; }
.msg-tags .star { color: var(--ice-400); cursor: pointer; background: none; border: 0; padding: 0; display: grid; }
.msg-tags .star:hover { color: var(--warn); }
.msg-tags .star.on { color: var(--warn); fill: var(--warn); }
.msg-tags .star.on svg { fill: var(--warn); }
.msg-tags .clip { color: var(--ice-400); }

.list-state { padding: 46px 22px; text-align: center; color: var(--ice-400); font-size: 13.5px; display: none; }
.list-state.show { display: block; }
.list-state .big { font: 700 16px var(--display); color: var(--ice-200); margin-bottom: 6px; display: block; }

.skeleton-row {
  height: 62px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,.035), rgba(255,255,255,.08), rgba(255,255,255,.035));
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 9px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ice-300); }

/* ─────────────────────────────── read pane ─────────────────────────────── */

.read-pane { display: flex; flex-direction: column; position: relative; }

.read-empty { margin: auto; text-align: center; padding: 40px; position: relative; }
.read-empty h3 { font: 700 19px var(--display); margin: 0 0 8px; }
.read-empty p { color: var(--ice-400); font-size: 13.5px; margin: 0 0 22px; }
.halo {
  width: 150px;
  height: 150px;
  margin: 0 auto 26px;
  border-radius: 50%;
  border: 2px solid rgb(var(--accent-rgb) / .5);
  box-shadow: 0 0 50px rgb(var(--accent-rgb) / .35), inset 0 0 40px rgb(var(--accent-rgb) / .18);
  background: var(--brand-mark, url('../img/default-mark.svg')) center / 62% no-repeat;
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .75; }
  50% { transform: scale(1.05); opacity: 1; }
}
.hints { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 12px; color: var(--ice-400); }

.read-body { display: flex; flex-direction: column; min-height: 0; height: 100%; animation: fade .25s ease both; }

.read-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.read-actions { display: flex; align-items: center; gap: 3px; margin-bottom: 14px; flex-wrap: wrap; }
.read-actions .btn { padding: 8px 14px; font-size: 13px; }
.read-actions .spacer { flex: 1; }

.read-subject { font: 700 20px/1.3 var(--display); margin: 0 0 14px; letter-spacing: -.3px; }

.read-meta { display: flex; align-items: flex-start; gap: 12px; }
.read-meta .avatar { width: 42px; height: 42px; border-radius: 13px; }
.meta-text { min-width: 0; flex: 1; }
.meta-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.meta-name { font-weight: 700; font-size: 14px; }
.meta-mail { font-size: 12.5px; color: var(--ice-400); }
.meta-to { font-size: 12px; color: var(--ice-400); margin-top: 3px; }
.meta-date { margin-left: auto; font-size: 11.5px; color: var(--ice-400); white-space: nowrap; }

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 22px 0;
  padding: 9px 13px;
  border-radius: 11px;
  font-size: 12.5px;
  border: 1px solid rgba(255, 196, 107, .32);
  background: rgba(255, 196, 107, .1);
  color: #ffe6bd;
}
.banner button {
  margin-left: auto;
  border: 0;
  background: rgba(255, 196, 107, .2);
  color: #ffe6bd;
  padding: 5px 11px;
  border-radius: 8px;
  font: 600 12px var(--sans);
  cursor: pointer;
}
.banner button:hover { background: rgba(255, 196, 107, .34); }

.read-scroll { flex: 1; overflow-y: auto; padding: 20px 22px 28px; }

.mail-html {
  font-size: 14px;
  line-height: 1.62;
  color: var(--ice-100);
  overflow-wrap: anywhere;
}
.mail-html a { color: var(--neon); }
.mail-html img { max-width: 100%; height: auto; border-radius: 8px; }
.mail-html table { max-width: 100%; border-collapse: collapse; }
.mail-html blockquote {
  margin: 12px 0;
  padding: 4px 0 4px 14px;
  border-left: 2px solid var(--line-strong);
  color: var(--ice-300);
}
.mail-html pre { overflow-x: auto; padding: 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); }
.plain-body { white-space: pre-wrap; font-size: 14px; line-height: 1.62; }
.plain-body.empty { color: var(--ice-400); font-style: italic; }

.att-strip { display: flex; flex-wrap: wrap; gap: 9px; padding: 14px 22px; border-top: 1px solid var(--line); }
.att {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px 8px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--ice-200);
  text-decoration: none;
  font-size: 12.5px;
  transition: all .16s;
}
.att:hover { border-color: rgb(var(--accent-rgb) / .45); background: rgb(var(--accent-rgb) / .09); transform: translateY(-1px); }
.att svg { width: 17px; height: 17px; color: var(--neon); }
.att small { display: block; color: var(--ice-400); font-size: 10.5px; }

/* ─────────────────────────────── composer ─────────────────────────────── */

.composer {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: min(620px, calc(100vw - 36px));
  max-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop .26s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

.composer.expanded {
  right: 50%;
  bottom: 50%;
  translate: 50% 50%;
  width: min(1000px, calc(100vw - 48px));
  height: min(88vh, 900px);
  max-height: 88vh;
}

.composer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(100deg, rgb(var(--accent-rgb) / .14), transparent);
}
.composer-head strong { font: 600 14px var(--display); }
.composer-tools { margin-left: auto; display: flex; gap: 2px; }
.composer-tools .icon-btn { width: 32px; height: 32px; }

.composer-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.c-row { display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.c-row label { font-size: 12px; font-weight: 600; color: var(--ice-400); width: 52px; flex: none; }
.c-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ice-100);
  font: 500 13.5px var(--sans);
  padding: 12px 0;
}
.c-row input::placeholder { color: rgb(var(--line-rgb) / .4); }

.c-toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.c-toolbar button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ice-300);
  cursor: pointer;
  font: 600 14px var(--sans);
}
.c-toolbar button:hover { background: rgba(255, 255, 255, .08); color: var(--ice-100); }
.c-toolbar svg { width: 17px; height: 17px; }
.c-toolbar .sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 6px; }

.editor {
  flex: 1;
  min-height: 190px;
  overflow-y: auto;
  padding: 16px 18px;
  outline: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ice-100);
}
.editor:empty::before { content: attr(data-placeholder); color: rgb(var(--line-rgb) / .4); }
.editor blockquote { margin: 10px 0; padding-left: 13px; border-left: 2px solid var(--line-strong); color: var(--ice-300); }
.editor a { color: var(--neon); }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line); }
.chip-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  font-size: 12px;
}
.chip-file button { border: 0; background: none; color: var(--ice-400); cursor: pointer; display: grid; padding: 0; }
.chip-file button:hover { color: var(--danger); }
.chip-file svg { width: 14px; height: 14px; }

.composer-foot { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.save-state { font-size: 11.5px; color: var(--ice-400); }

/* ──────────────────────────────── drawer ──────────────────────────────── */

.drawer-scrim, .palette-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(var(--ink-rgb) / .64);
  backdrop-filter: blur(4px);
  animation: fade .2s ease both;
}

.drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 51;
  width: min(560px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideLeft .3s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes slideLeft { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.drawer-head strong { font: 700 16px var(--display); display: block; }
.drawer-head small { font-size: 12px; color: var(--ice-400); }

.tabs { display: flex; gap: 4px; padding: 12px 16px 0; }
.tab {
  padding: 8px 14px;
  border: 0;
  border-radius: 10px 10px 0 0;
  background: none;
  color: var(--ice-300);
  font: 600 13px var(--sans);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ice-100); }
.tab.on { color: var(--neon); border-bottom-color: var(--neon); background: rgb(var(--accent-rgb) / .08); }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.tab-panel { display: none; }
.tab-panel.on { display: block; animation: fade .2s ease both; }
.panel-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }

.admin-list { display: grid; gap: 8px; }
.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
}
.admin-row strong { font-size: 13.5px; display: block; }
.admin-row .sub { font-size: 11.5px; color: var(--ice-400); margin-top: 3px; }
.admin-row .meter { margin-top: 7px; max-width: 220px; }
.row-actions { display: flex; gap: 2px; }
.row-actions .icon-btn { width: 32px; height: 32px; }
.row-actions svg { width: 16px; height: 16px; }

.stack-form { display: grid; gap: 13px; margin-bottom: 18px; }
.stack-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ice-300); }
.stack-form input {
  border: 1px solid var(--line-strong);
  background: rgb(var(--ink-rgb) / .5);
  color: var(--ice-100);
  border-radius: 11px;
  padding: 11px 13px;
  font: 500 13.5px var(--sans);
  outline: 0;
  width: 100%;
}
.stack-form input:focus { border-color: rgb(var(--accent-rgb) / .55); box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / .1); }
.stack-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.suffix-wrap { display: flex; align-items: center; gap: 0; }
.suffix-wrap input { border-radius: 11px 0 0 11px; }
.suffix, .suffix-btn {
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 11px 11px 0;
  font-size: 12.5px;
  color: var(--ice-400);
  background: rgba(255, 255, 255, .05);
  white-space: nowrap;
}
.suffix-btn { cursor: pointer; color: var(--neon); font-weight: 600; }
.suffix-btn:hover { background: rgb(var(--accent-rgb) / .14); }

/* ──────────────────────── appearance admin screen ──────────────────────── */

.group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 15px 16px;
  margin: 0 0 4px;
  display: grid;
  gap: 12px;
  background: rgb(255 255 255 / .02);
}
.group legend {
  font: 700 11.5px var(--sans);
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ice-400);
  padding: 0 6px;
}

.upload-row { display: flex; gap: 13px; align-items: center; }
.upload-preview {
  width: 68px;
  height: 68px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, rgb(255 255 255 / .04) 25%, transparent 25%, transparent 75%, rgb(255 255 255 / .04) 75%) 0 0 / 14px 14px,
    rgb(var(--ink-rgb) / .5);
}
.upload-preview.wide { width: 128px; }
.upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upload-meta { display: grid; gap: 3px; min-width: 0; }
.upload-meta strong { font-size: 13px; }
.upload-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.file-btn { cursor: pointer; }

.presets { display: flex; flex-wrap: wrap; gap: 7px; }
.preset {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--p2, #111);
  color: var(--ice-200);
  font: 600 12px var(--sans);
  cursor: pointer;
  transition: border-color .16s, transform .16s;
}
.preset::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--p1, #fff);
  box-shadow: 0 0 10px var(--p1, #fff);
}
.preset:hover { border-color: var(--accent); transform: translateY(-1px); }

.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.color-grid label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ice-300); }
.swatch { display: block; height: 38px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); }
.swatch input[type="color"] {
  width: 130%;
  height: 130%;
  margin: -12px 0 0 -12px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: rgb(var(--ink-rgb) / .4); }
.seg-btn {
  flex: 1;
  padding: 8px 6px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ice-300);
  font: 600 12px var(--sans);
  cursor: pointer;
  transition: background .16s, color .16s;
}
.seg-btn:hover { color: var(--ice-100); background: rgb(255 255 255 / .05); }
.seg-btn.on { background: rgb(var(--accent-rgb) / .18); color: var(--accent); }

.slider { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 12px; font-weight: 600; color: var(--ice-300); align-items: center; }
.slider output { font-variant-numeric: tabular-nums; color: var(--ice-200); font-weight: 700; }
.slider input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 999px;
  background: rgb(var(--line-rgb) / .2);
  outline: 0;
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
  cursor: pointer;
  box-shadow: 0 0 10px rgb(var(--accent-rgb) / .6);
}
.slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
  cursor: pointer;
}

.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.danger-text { color: var(--danger); }
.danger-text:hover { color: var(--danger); background: rgb(255 107 129 / .12); }

/* ───────────────────────────── license panel ───────────────────────────── */

.lic-state {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  margin-bottom: 14px;
}
.lic-state strong { font-size: 13.5px; display: block; }
.lic-state .sub { font-size: 12.5px; color: var(--ice-300); margin-top: 3px; line-height: 1.5; }
.lic-state .lic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
}
.lic-state.ok { border-color: rgb(87 230 180 / .4); background: rgb(87 230 180 / .08); }
.lic-state.ok .lic-dot { background: var(--ok); box-shadow: 0 0 10px rgb(87 230 180 / .8); }
.lic-state.bad { border-color: rgb(255 107 129 / .45); background: rgb(255 107 129 / .1); }
.lic-state.bad .lic-dot { background: var(--danger); box-shadow: 0 0 10px rgb(255 107 129 / .8); }

.lic-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 16px;
  margin: 0 0 18px;
  font-size: 12.5px;
}
.lic-facts dt { color: var(--ice-400); font-weight: 600; }
.lic-facts dd { margin: 0; color: var(--ice-200); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* ─────────────────────────────── palette ─────────────────────────────── */

.palette-scrim { display: grid; place-items: start center; padding-top: 14vh; }
.palette { width: min(560px, calc(100vw - 32px)); overflow: hidden; animation: pop .22s ease both; }
.palette input {
  width: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ice-100);
  font: 500 15px var(--sans);
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.palette ul { list-style: none; margin: 0; padding: 8px; max-height: 46vh; overflow-y: auto; }
.palette li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ice-200);
}
.palette li .k { margin-left: auto; font-size: 11px; color: var(--ice-400); }
.palette li.on, .palette li:hover { background: rgb(var(--accent-rgb) / .14); color: #fff; }
.palette li svg { width: 17px; height: 17px; color: var(--neon); }

/* ──────────────────────────────── toasts ──────────────────────────────── */

.toasts { position: fixed; bottom: 18px; left: 50%; translate: -50% 0; z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 17px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ice-100);
  background: rgb(var(--surface-rgb) / .92);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: toastIn .28s cubic-bezier(.2, .8, .2, 1) both;
  pointer-events: auto;
}
.toast.ok { border-color: rgba(87, 230, 180, .45); }
.toast.ok svg { color: var(--ok); }
.toast.err { border-color: rgba(255, 107, 129, .5); }
.toast.err svg { color: var(--danger); }
.toast.out { animation: toastOut .22s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

.toast .undo { border: 0; background: none; color: var(--neon); font: 700 12.5px var(--sans); cursor: pointer; }

/* ──────────────────────────────── loading ──────────────────────────────── */

.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

.only-mobile { display: none; }

/* ─────────────────────────────── responsive ─────────────────────────────── */

@media (max-width: 1180px) {
  :root { --sidebar-w: 240px; --list-w: 340px; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .only-mobile { display: inline-flex; }

  .sidebar {
    position: fixed;
    inset: 10px auto 10px 10px;
    width: 280px;
    z-index: 60;
    transform: translateX(calc(-100% - 14px));
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .sidebar.open { transform: none; }

  .list-pane { display: flex; }
  .read-pane { display: none; }
  body.reading .list-pane { display: none; }
  body.reading .read-pane { display: flex; }

  .composer { right: 10px; left: 10px; bottom: 10px; width: auto; max-height: 86vh; }
  .composer.expanded { inset: 10px; translate: none; width: auto; height: auto; }
  .read-subject { font-size: 17px; }
}

@media (max-width: 560px) {
  .read-head { padding: 14px 15px 12px; }
  .meta-date { margin-left: 0; width: 100%; order: 3; }
  .read-scroll { padding: 16px 15px 24px; }
  .att-strip { padding: 12px 15px; }
  .filters .chip { padding: 5px 9px; }
  .toasts { left: 10px; right: 10px; translate: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
