/* 1Mail — base layer built from the brandbook tokens (sources/design-tokens.json) */
@font-face { font-family: "Noto Sans"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/shared/fonts/NotoSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("/shared/fonts/NotoSans-Bold.woff2") format("woff2"); }

:root {
  /* brand */
  --ink: #18252B; --coral: #F35B45; --action: #C23E2C; --paper: #F5F3EE; --white: #FFFFFF;
  --muted: #64717A; --border: #DDE2E1; --teal: #087F76; --lime: #DDF2BB;
  /* derived surfaces seen in the UI kit */
  --row-selected: #EEF2E9; --coral-soft: #FBE4DE; --teal-soft: #E9F4F1; --warn-bg: #F8EDD7; --warn-text: #855321;
  --chip: #F8F9F7; --danger-bg: #FCECE7; --sub-ink: #415057; --on-ink-muted: #C5CECD; --olive: #8D9564;
  /* semantic (light) */
  --canvas: var(--paper); --surface: var(--white); --text: var(--ink); --text-muted: var(--muted); --line: var(--border);
  --nav-active: var(--lime); --input-bg: var(--paper); --hover: #EFF2ED;
  --font: "Noto Sans", Arial, sans-serif;
  --r-small: 8px; --r-control: 12px; --r-card: 20px; --r-pill: 999px;
  --ease: cubic-bezier(0.2, 0, 0, 1); --t-quick: 120ms; --t-default: 180ms; --t-panel: 240ms;
  color-scheme: light;
}
[data-theme="dark"] {
  --canvas: #101C22; --surface: #18272F; --text: #F5F3EE; --text-muted: #A8B5BB; --line: #31424A;
  --row-selected: #243740; --hover: #1F3038; --input-bg: #101C22; --nav-active: var(--lime); --chip: #1F3038;
  --coral-soft: #4A2A26; --teal-soft: #173A38; --warn-bg: #3A3220; --warn-text: #E7C27C; --danger-bg: #3E2522;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--canvas);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

.icon { width: 24px; height: 24px; flex: none; stroke-width: 1.7; }
.icon.sm { width: 18px; height: 18px; }
.icon.xs { width: 14px; height: 14px; }

/* Brand lockup: coral mark + ink wordmark */
.brand { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--text); }
.brand img { width: 34px; height: 34px; }
.brand b { font-size: 31px; font-weight: 700; letter-spacing: -0.045em; line-height: 1; }

/* Buttons: 44px actions, radius 12 (kit uses 10–12) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: var(--r-control); border: 1px solid transparent; font-size: 14px; font-weight: 700; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease); }
.btn-primary { background: var(--action); color: #fff; }
.btn-primary:hover { background: #AD3626; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--hover); }
.btn-ghost { background: transparent; color: var(--text); padding: 0 12px; }
.btn-ghost:hover { background: var(--hover); }
.btn[disabled], .btn:disabled { background: #E6E9E8; color: #8A969B; border-color: transparent; cursor: not-allowed; }
[data-theme="dark"] .btn[disabled] { background: #24343B; color: #6E7E85; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent;
  border-radius: 12px; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--hover); }

/* Fields */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 700; }
.field small { font-size: 12px; color: var(--text-muted); }
.input, .select, textarea.input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font-size: 14px; }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,127,118,.14); }
.input[readonly] { background: var(--chip); color: var(--text-muted); }
.input.invalid { border-color: var(--action); }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='%2364717A' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.error-text { color: var(--action); font-size: 13px; }

/* Pills / status (always labelled, never colour-only) */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-teal { background: var(--teal-soft); color: var(--teal); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-coral { background: var(--coral-soft); color: var(--action); }
.pill-gray { background: var(--chip); color: var(--text-muted); border: 1px solid var(--line); }
.pill-lime { background: var(--lime); color: var(--ink); }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--paper); color: var(--ink); font-size: 9px; font-weight: 700; letter-spacing: .02em; }
.avatar.lg { width: 40px; height: 40px; font-size: 11px; }
.avatar.lime { background: var(--lime); }
.avatar.coral { background: var(--coral-soft); color: var(--action); }
[data-theme="dark"] .avatar { background: #24343B; color: var(--text); }
[data-theme="dark"] .avatar.lime { background: var(--lime); color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.overline { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast { display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 0 8px 0 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(24,37,43,.25); }
.toast button { background: transparent; border: 0; color: #FFB8A6; font-weight: 700; height: 40px; padding: 0 12px; cursor: pointer; border-radius: 10px; }
.toast button:hover { background: rgba(255,255,255,.08); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(16,28,34,.45); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: var(--r-card); padding: 28px; display: grid; gap: 18px;
  box-shadow: 0 30px 80px rgba(16,28,34,.3); max-height: calc(100vh - 32px); overflow: auto; }
.modal h2 { font-size: 22px; }
.modal .actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--teal); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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