/* mailbox.app — design tokens */
:root {
  --bg: #faf8f5;
  --bg-elev: #ffffff;
  --bg-muted: #f3f0ea;
  --bg-sunken: #ede9e1;
  --line: #e6e1d6;
  --line-soft: #efece4;
  --ink: #1a1715;
  --ink-2: #3a3530;
  --ink-3: #6b655d;
  --ink-4: #9a948a;
  --accent: oklch(0.66 0.15 35);          /* warm coral */
  --accent-ink: oklch(0.42 0.14 35);
  --accent-soft: oklch(0.94 0.04 35);
  --accent-line: oklch(0.85 0.08 35);
  --good: oklch(0.62 0.13 155);
  --good-soft: oklch(0.94 0.04 155);
  --warn: oklch(0.72 0.13 75);
  --danger: oklch(0.58 0.17 25);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 0 rgba(26, 23, 21, 0.04), 0 1px 2px rgba(26, 23, 21, 0.04);
  --shadow-md: 0 1px 0 rgba(26, 23, 21, 0.04), 0 4px 16px -4px rgba(26, 23, 21, 0.08);
  --shadow-lg: 0 1px 0 rgba(26, 23, 21, 0.04), 0 24px 60px -16px rgba(26, 23, 21, 0.18);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --font-display: "Inter", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

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

a { color: inherit; text-decoration: none; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* —————————————————————————————— BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.12s ease;
  user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--ink-2); }
.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { filter: brightness(0.95); }
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--bg-muted); }
.btn-outline {
  background: var(--bg-elev);
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover { background: var(--bg-muted); border-color: var(--ink-4); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; }

/* —————————————————————————————— INPUTS */
.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(26, 23, 21, 0.06);
}
.input.input-mono { font-family: var(--font-mono); font-size: 13px; }
.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 6px;
  display: block;
  letter-spacing: 0.01em;
}

/* —————————————————————————————— CARDS */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* —————————————————————————————— BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--bg-muted);
  color: var(--ink-3);
  height: 20px;
}
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: oklch(0.95 0.04 75); color: oklch(0.45 0.13 75); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}

/* —————————————————————————————— TYPE */
.h-display {
  font-size: 56px;
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  color: var(--ink);
}
.h-title { font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
.h-subtitle { font-size: 16px; line-height: 1.4; color: var(--ink-3); font-weight: 400; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-3); }
.tiny { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }

/* —————————————————————————————— LAYOUT HELPERS */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.between { justify-content: space-between; }

/* —————————————————————————————— APP SHELL */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 4px;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 14px;
}
.sidebar-section { padding: 12px 8px 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}
.nav-item:hover { background: var(--bg-muted); }
.nav-item.active { background: var(--ink); color: var(--bg); }
.nav-item.active .nav-count { background: rgba(255,255,255,0.18); color: var(--bg); }
.nav-count {
  margin-left: auto;
  background: var(--bg-muted);
  color: var(--ink-3);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.nav-count.accent { background: var(--accent); color: white; }

.main {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
  overflow: hidden;
}

/* —————————————————————————————— LOGO MARK */
.logo-mark {
  width: 22px;
  height: 22px;
  background: var(--ink);
  border-radius: 5px;
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo-mark::before {
  content: "";
  position: absolute;
  inset: 4px 4px auto 4px;
  height: 8px;
  border: 1.5px solid var(--bg);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  transform: rotate(0deg);
}
.logo-mark::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 1.5px;
  background: var(--accent);
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 1px;
}

/* —————————————————————————————— UTILITIES */
.divider { height: 1px; background: var(--line); }
.divider-soft { height: 1px; background: var(--line-soft); }

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  background: var(--bg-elev);
}

/* —————————————————————————————— TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  z-index: 1000;
  animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* —————————————————————————————— MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 21, 0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modal-in {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* avatar circles */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* striped placeholder for missing imagery */
.placeholder-stripe {
  background-image: repeating-linear-gradient(
    135deg,
    var(--bg-muted) 0,
    var(--bg-muted) 8px,
    var(--bg-sunken) 8px,
    var(--bg-sunken) 16px
  );
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* fade-in helper */
.fade-in { animation: fade-in 0.22s ease; }

/* search snippet highlight (FTS5 snippet() output) */
mark {
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 0 2px;
  border-radius: 2px;
}
