/* gmail·sender — the design system. Soft neutrals, one indigo accent,
 * generous space, quiet motion. Every screen is screens drawn by app.js;
 * this file is the whole face. */

:root {
  --bg: #f5f5f8;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #eceaff 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 110%, #e9f4ff 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f6f6f9;
  --surface-3: #efeff4;
  --line: #ececf1;
  --line-strong: #dcDce4;
  --ink: #191922;
  --ink-soft: #3a3a46;
  --muted: #6f6f7c;
  --faint: #a2a2af;
  --accent: #5a4bd8;
  --accent-strong: #4636c9;
  --accent-ink: #ffffff;
  --accent-soft: #eeecfb;
  --accent-glow: rgba(90, 75, 216, .16);
  --ok: #2f9e6e;
  --ok-soft: #e3f3ea;
  --warn: #cf8a2a;
  --warn-soft: #faf0dd;
  --err: #dd4b3a;
  --err-soft: #fdece9;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(25, 25, 34, .05);
  --shadow: 0 1px 2px rgba(25, 25, 34, .04), 0 10px 30px rgba(25, 25, 34, .07);
  --shadow-lg: 0 2px 6px rgba(25, 25, 34, .06), 0 24px 70px rgba(25, 25, 34, .16);
  --ring: 0 0 0 3px var(--accent-glow);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--err); }
.msg { font-size: 13px; color: var(--muted); }
.msg.err { color: var(--err); }
.ic { vertical-align: -3px; }
button .ic { margin-right: 6px; }

/* ── the shell ───────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100%; }

.sidebar {
  width: 248px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 2px 10px 22px; }
.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7a68ff);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 6px 16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark .ic { vertical-align: 0; }
.brand-name { font-weight: 700; letter-spacing: -.01em; font-size: 15.5px; color: var(--ink); }
.brand-sub { font-size: 11px; color: var(--faint); letter-spacing: .05em; text-transform: uppercase; font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-chip {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  flex: none;
}
.nav a.active .nav-chip { background: var(--accent); color: #fff; }
.nav a .nav-ico { display: contents; }
.nav-count { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; background: var(--surface-3); padding: 1px 8px; border-radius: 20px; }
.nav a.active .nav-count { background: rgba(90,75,216,.14); color: var(--accent-strong); }

.side-foot { margin-top: auto; padding: 14px 10px 2px; border-top: 1px solid var(--line); }
.side-status { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
.side-line { display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #d6d6de; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.bad { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.dot.wait { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ── buttons / inputs ────────────────────────────────────────────────────── */
button {
  font: inherit; font-size: 14px; font-weight: 550;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .03s ease, box-shadow .15s ease;
}
button:hover { border-color: #c9c9d4; background: var(--surface-2); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(90,75,216,.25), 0 6px 16px var(--accent-glow); }
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }
button.sm { padding: 3px 10px; font-size: 12.5px; border-radius: 8px; font-weight: 550; }
a.btn-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-strong); text-decoration: none; font-size: 13px; font-weight: 550; padding: 7px 11px; border-radius: 9px; border: 1px solid var(--accent-glow); background: var(--accent-soft); }
a.btn-link:hover { background: var(--accent); color: #fff; }
button.big { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; border-radius: 12px; }
button.big .ic { vertical-align: -3px; margin-right: 6px; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 13px; font-weight: 500; letter-spacing: .01em; }
label input, label textarea, label select {
  display: block; width: 100%; margin-top: 5px;
  font: inherit; font-size: 14.5px; font-weight: 400; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
label input::placeholder, label textarea::placeholder { color: var(--faint); }
label input:focus, label textarea:focus, label select:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
textarea { resize: vertical; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; appearance: none; padding-right: 32px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 15px 17px; background: var(--surface); }
legend { font-size: 11.5px; color: var(--muted); padding: 0 7px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* ── screens ─────────────────────────────────────────────────────────────── */
.view { flex: 1; padding: 38px 44px 70px; max-width: 1040px; margin: 0 auto; min-width: 0; width: 100%; }

.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 26px; }
.page-head h1 { font-size: 27px; margin: 0; letter-spacing: -.03em; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }
.page-head .spacer { flex: 1; }

.backlink { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; margin-bottom: 18px; padding: 5px 10px 5px 6px; border-radius: 8px; transition: color .15s ease, background .15s ease; }
.backlink:hover { color: var(--ink); background: var(--surface-2); }

/* dashboard: list cards */
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.list-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 15px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.list-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.list-card .lc-top { display: flex; align-items: center; gap: 12px; }
.list-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong);
  font-weight: 700; font-size: 16px;
}
.list-card h2 { margin: 0; font-size: 16.5px; letter-spacing: -.01em; font-weight: 650; }
.list-card .meta { color: var(--muted); font-size: 12.5px; }
.list-card .counts { display: flex; gap: 22px; font-size: 13px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.list-card .counts .n { font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; display: block; letter-spacing: -.02em; }
.list-card .counts .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.list-card .actions { display: flex; gap: 8px; margin-top: 2px; }
.list-card .last-sent { color: var(--faint); font-size: 12px; }

.empty {
  background: var(--surface); border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg); padding: 56px 30px; text-align: center;
  color: var(--muted);
}
.empty .big { font-size: 16px; color: var(--ink); font-weight: 650; margin-bottom: 6px; }
.empty .empty-ico { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; }
.empty .empty-ico .ic { vertical-align: 0; }

/* list detail */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tabs button {
  border: none; background: transparent; border-radius: 9px 9px 0 0;
  padding: 10px 16px; color: var(--muted); font-weight: 550; font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s ease;
}
.tabs button .ic { margin-right: 6px; }
.tabs button.active { color: var(--accent-strong); border-bottom-color: var(--accent); background: transparent; }
.tabs button:hover { color: var(--ink); background: transparent; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 17px 22px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 20px 22px; }

.bulk { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; background: var(--surface-2); }
.bulk textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; width: 100%; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td .email { font-weight: 550; }
td .name { color: var(--muted); font-size: 13px; }
td .tag { font-size: 11.5px; padding: 3px 10px; border-radius: 20px; font-weight: 550; white-space: nowrap; }
td .tag.sub { color: var(--ok); background: var(--ok-soft); }
td .tag.out { color: var(--warn); background: var(--warn-soft); }
td .tag.removed { color: var(--err); background: var(--err-soft); }
td .act { display: flex; gap: 6px; justify-content: flex-end; }
td .act .ic { margin-right: 4px; }

/* compose */
.compose-card { max-width: 760px; }
.compose-card .subject-row input { font-size: 17px; font-weight: 600; padding: 12px 14px; border-radius: 12px; }
.compose-body textarea { font-size: 15px; min-height: 220px; line-height: 1.65; }
.editor { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface); }
.toolbar { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.toolbar button { border: none; background: transparent; border-radius: 7px; padding: 5px 10px; color: var(--muted); font-size: 13px; min-width: 32px; }
.toolbar button:hover { background: var(--surface-3); color: var(--ink); }
.editable { min-height: 210px; padding: 14px 16px; font-size: 15px; line-height: 1.7; outline: none; }
.editable:empty::before { content: attr(data-placeholder); color: var(--faint); }
.editable:focus { box-shadow: inset 0 0 0 3px var(--accent-glow); }
.editable .evblock { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 12px 16px; margin: 10px 0; }
.editable .evblock h3 { margin: 0 0 8px; font-size: 14px; }
.editable .evblock ul { margin: 0; padding-left: 18px; }
.editable .evblock li { margin: 4px 0; }

.invite-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; margin-top: 16px;
  transition: border-color .15s ease;
}
.invite-toggle:hover { border-color: var(--line-strong); }
.invite-toggle .l { font-weight: 600; font-size: 14px; }
.invite-toggle .l .ic { color: var(--accent); margin-right: 8px; }
.invite-toggle .d { color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 20px; background: #d9d9e1; transition: background .18s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

.results { margin-top: 18px; }
.results .summary { font-weight: 650; margin-bottom: 10px; }
.results .summary .ic { color: var(--ok); }
.results .row-r { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.results .row-r .email { font-weight: 550; }
.results .ok { color: var(--ok); }
.results .fail { color: var(--err); }

/* log */
.log-line { display: flex; gap: 12px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.log-line:last-child { border-bottom: none; }
.log-line .t { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.log-line .s { font-weight: 600; }
.log-line .r { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; flex: none; }

/* calendar */
.cal-nav { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cal-nav strong { flex: 1; text-align: center; font-size: 15px; }
.cal-nav button { padding: 5px 10px; }
.cal-grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.cal-grid th { padding: 10px 0 6px; text-align: center; }
.cal-grid td { text-align: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.cal-grid td.has { font-weight: 650; color: var(--accent-strong); }
.cal-grid td .d-dots { display: block; color: var(--accent); font-size: 8px; letter-spacing: 2px; margin-top: 2px; }
.cal-grid td.dim { color: var(--faint); }

/* settings */
.settings-card { max-width: 820px; }
.settings-card .grid2 { margin-bottom: 14px; }
.settings-card fieldset { margin-bottom: 4px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.admin-row .email { font-size: 13.5px; font-weight: 550; }
.admin-row .tag { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.admin-row .tag.sub { color: var(--ok); background: var(--ok-soft); }

/* ── overlays ────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(25, 25, 34, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 30px 34px;
  width: 760px; max-width: 100%; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: rise .22s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.sheet.narrow { width: 440px; }
.sheet h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.sheet p.muted { margin: 0 0 20px; }

/* ── the login screen ────────────────────────────────────────────────────── */
.login {
  width: 440px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 34px 38px 26px;
  box-shadow: var(--shadow-lg);
  animation: rise .22s ease;
  position: relative;
  overflow: hidden;
}
.login::before {
  content: ""; position: absolute; inset: -40% -20% auto;
  height: 220px;
  background: radial-gradient(400px 160px at 50% 0%, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.login-brand { display: flex; gap: 13px; align-items: center; margin-bottom: 24px; position: relative; }
.login-brand .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 20px; }
.login-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.login-tag { font-size: 12px; color: var(--muted); }
.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 4px;
  margin-bottom: 22px;
}
.seg button { border: none; background: transparent; border-radius: 9px; padding: 8px 0; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.input {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--surface); padding: 0 12px; margin-top: 5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.input .lead { display: grid; place-items: center; color: var(--faint); flex: none; }
.input input {
  flex: 1; border: none; outline: none; background: transparent;
  font: inherit; font-size: 14.5px; color: var(--ink);
  padding: 11px 0; margin: 0; box-shadow: none !important;
}
.input .eye { border: none; background: none; padding: 5px; color: var(--faint); display: grid; place-items: center; flex: none; }
.input .eye:hover { color: var(--ink); background: none; }
.hint { display: block; font-size: 11.5px; color: var(--faint); margin: 4px 0 12px; }

.login-alt { margin-top: 16px; text-align: center; }
.login-alt .ghost { font-size: 12.5px; }
.login-alt .input { margin: 8px 0; }
.login-foot { margin: 20px 0 0; font-size: 12px; color: var(--faint); text-align: center; line-height: 1.6; }

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; margin-left: auto; }
  .nav a { padding: 6px 9px; }
  .nav a span:last-child { display: none; }
  .side-foot { display: none; }
  .view { padding: 22px 16px 50px; }
  .grid2 { grid-template-columns: 1fr; }
}