/* NSofts Webmail — design system.
   Deliberately NOT payroll-system's navy/blue system (that's right for a
   payroll tool, not a "modern, stylish" mail client). Warm ink on paper,
   one confident teal accent, serif/sans pairing on subject lines vs. UI
   chrome. Same mechanism as the rest of the workspace (CSS custom
   properties, light/dark via prefers-color-scheme + data-theme override),
   different look. See docs/business-logic.md for the confirmed direction.
*/

:root {
  --bg: #FAF9F6;
  --bg-elevated: #FFFFFF;
  --bg-sunken: #F1EFEA;
  --rail-bg: #F5F3EE;
  --text: #14171C;
  --text-muted: #66625A;
  --text-faint: #9C978C;
  --border: #E4E0D6;
  --border-strong: #D2CCBD;

  --accent: #0E7C7B;
  --accent-hover: #0A5F5E;
  --accent-soft: rgba(14, 124, 123, 0.10);
  --accent-soft-strong: rgba(14, 124, 123, 0.18);

  --danger: #B3452F;
  --danger-soft: rgba(179, 69, 47, 0.10);
  --warning: #A6740E;
  --warning-soft: rgba(166, 116, 14, 0.10);

  --shadow: rgba(20, 23, 28, 0.06);
  --shadow-strong: rgba(20, 23, 28, 0.12);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;

  --radius: 7px;
  --radius-lg: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1417;
    --bg-elevated: #161C20;
    --bg-sunken: #0B0F12;
    --rail-bg: #10161A;
    --text: #EDEBE5;
    --text-muted: #A6A198;
    --text-faint: #6E6A61;
    --border: #262D31;
    --border-strong: #33393D;

    --accent: #3FCFC9;
    --accent-hover: #6BE0DB;
    --accent-soft: rgba(63, 207, 201, 0.14);
    --accent-soft-strong: rgba(63, 207, 201, 0.22);

    --danger: #E08268;
    --danger-soft: rgba(224, 130, 104, 0.14);
    --warning: #DDB149;
    --warning-soft: rgba(221, 177, 73, 0.14);

    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-strong: rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --bg: #0F1417; --bg-elevated: #161C20; --bg-sunken: #0B0F12; --rail-bg: #10161A;
  --text: #EDEBE5; --text-muted: #A6A198; --text-faint: #6E6A61;
  --border: #262D31; --border-strong: #33393D;
  --accent: #3FCFC9; --accent-hover: #6BE0DB;
  --accent-soft: rgba(63, 207, 201, 0.14); --accent-soft-strong: rgba(63, 207, 201, 0.22);
  --danger: #E08268; --danger-soft: rgba(224, 130, 104, 0.14);
  --warning: #DDB149; --warning-soft: rgba(221, 177, 73, 0.14);
  --shadow: rgba(0, 0, 0, 0.3); --shadow-strong: rgba(0, 0, 0, 0.5);
}
:root[data-theme="light"] {
  --bg: #FAF9F6; --bg-elevated: #FFFFFF; --bg-sunken: #F1EFEA; --rail-bg: #F5F3EE;
  --text: #14171C; --text-muted: #66625A; --text-faint: #9C978C;
  --border: #E4E0D6; --border-strong: #D2CCBD;
  --accent: #0E7C7B; --accent-hover: #0A5F5E;
  --accent-soft: rgba(14, 124, 123, 0.10); --accent-soft-strong: rgba(14, 124, 123, 0.18);
  --danger: #B3452F; --danger-soft: rgba(179, 69, 47, 0.10);
  --warning: #A6740E; --warning-soft: rgba(166, 116, 14, 0.10);
  --shadow: rgba(20, 23, 28, 0.06); --shadow-strong: rgba(20, 23, 28, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; margin: 0 0 0.4em; color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.55em 1.1em;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  cursor: pointer;
  font-weight: 500;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { border-color: var(--text-faint); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-sunken); border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 0.35em; margin-bottom: 1em; }
.field label { font-size: 0.8em; font-weight: 500; color: var(--text-muted); }
.field input, .field select, .field textarea {
  padding: 0.6em 0.75em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px var(--shadow);
}

.tag {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  font-size: 0.75em;
  font-weight: 500;
}
.tag-active { background: var(--accent-soft); color: var(--accent); }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

.status-msg { font-size: 0.85em; color: var(--text-muted); min-height: 1.4em; }
.status-msg.error { color: var(--danger); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }
