/* LIST LABS Figma palette on warm paper: navy primary, green secondary. */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Surfaces. */
  --paper: #f8f6f2;
  --surface: #ffffff;
  --surface-muted: #efece7;
  --surface-hover: #faf8f5;

  /* Ink. */
  --text: #2a241d;
  --text-muted: #786b5e;
  --line: #e4dfd8;

  /* Figma primary (Blue 300/500/700/1000). */
  --brand: #285695;
  --brand-deep: #1c365e;
  --brand-mid: #8c9ecc;
  --brand-soft: #f0f5fc;

  /* Green: a strong match. */
  --good: #007d5b;
  --good-line: #408f69;
  --good-soft: #e4f6ef;

  /* Orange: a match worth reviewing. */
  --warn: #a35a00;
  --warn-line: #ec7f00;
  --warn-soft: #fff4e3;

  /* One content column, shared by the top bar, the dev notice and main. */
  --column: 1100px;
  --gutter: 32px;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(26, 20, 16, 0.05);
  --shadow: 0 1px 3px rgba(26, 20, 16, 0.06), 0 8px 24px -12px rgba(26, 20, 16, 0.14);
  --shadow-lg: 0 2px 4px rgba(26, 20, 16, 0.05), 0 18px 48px -16px rgba(26, 20, 16, 0.2);
  --ring: 0 0 0 3px rgba(40, 86, 149, 0.18);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }
::selection { background: var(--brand-soft); color: var(--brand-deep); }

:where(a, button, .tab, .button):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

/* Top bar: the rule spans the window, its contents share the content column. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
/* Equal side columns keep the tabs on the centre of the window. */
.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  max-width: var(--column);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 30px; }
.brand-name {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Tabs: a segmented control. */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-muted);
}
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tab svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.tab:hover { background: rgba(255, 255, 255, 0.7); color: var(--text); }
.tab.active,
.tab.active:hover {
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: var(--shadow-sm);
}
.tab:focus-visible { border-radius: 999px; }
.account { justify-self: end; display: flex; align-items: center; gap: 16px; color: var(--text-muted); }
.account form { margin: 0; }
.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
}
.link-button:hover { color: var(--brand-deep); }

.notice {
  max-width: calc(var(--column) - 2 * var(--gutter));
  margin: 16px auto -8px;
  padding: 10px 14px;
  border-left: 3px solid var(--warn-line);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 14px;
}

/* Content */
main { max-width: var(--column); margin: 0 auto; padding: 36px var(--gutter) 64px; }
h1 { margin: 0 0 6px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.lead { margin: 0 0 24px; color: var(--text-muted); max-width: 66ch; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}
.empty { color: var(--text-muted); }

/* Report table */
.table-card { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 24px; text-align: left; }
th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--surface-hover); }
tbody tr + tr td { border-top: 1px solid var(--line); }
td.date { font-weight: 600; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .button + .button { margin-left: 8px; }
.day-note, .day-error { display: block; margin-top: 4px; font-size: 14px; }
.day-note { color: var(--text-muted); }
.day-error { color: var(--warn); }

.pill {
  display: inline-block;
  min-width: 34px;
  padding: 3px 11px;
  border-radius: 999px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.pill.high { background: var(--good-soft); color: var(--good); }
.pill.match { background: var(--warn-soft); color: var(--warn); }

/* Buttons */
.button {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  background: var(--brand);
  color: var(--surface);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.button:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.button.secondary { background: var(--surface); border-color: var(--line); color: var(--brand-deep); }
.button.secondary:hover { background: var(--surface-hover); border-color: var(--brand-mid); }

/* Keyword lists */
.columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.keywords { border-top: 3px solid var(--good-line); }
.keywords.match { border-top-color: var(--warn-line); }
.keywords.exclude { border-top-color: var(--line); }
.count { color: var(--text-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.help { margin: 0 0 16px; color: var(--text-muted); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 14px;
}
.keywords.match .tags li { background: var(--warn-soft); color: var(--warn); }
.keywords.exclude .tags li { background: var(--surface-muted); color: var(--text-muted); }

/* Recipients */
.recipients { margin: 0; padding: 0; list-style: none; }
.recipients li { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.recipients li.paused .email { color: var(--text-muted); }
.row-actions { display: flex; gap: 8px; margin-left: auto; }
.row-actions form { margin: 0; }
.recipients li + li { border-top: 1px solid var(--line); }

/* Change notices */
.flash {
  margin: 0 0 20px;
  padding: 10px 14px;
  border-left: 3px solid var(--good-line);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--good-soft);
  color: var(--good);
  font-size: 14px;
}
.flash.error { border-left-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }

/* Forms */
.add-form { display: flex; gap: 8px; margin: 0 0 16px; }
.add-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.add-form input:focus { outline: none; border-color: var(--brand-mid); box-shadow: var(--ring); }
button.button { font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.button.small { padding: 4px 11px; font-size: 13px; }
.button.danger { color: var(--warn); }
.button.danger:hover { border-color: var(--warn-line); }

.tags form { display: inline; margin: 0; }
.tags li { display: inline-flex; align-items: center; gap: 4px; padding-right: 5px; }
.tag-remove {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: none;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
}
.tag-remove:hover { opacity: 1; background: rgba(0, 0, 0, 0.07); }

/* Last run */
.run { margin-bottom: 20px; }
.run-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.run-head h2 { margin: 0; }
.run-sources { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.run-sources .source { font-weight: 600; margin-right: 6px; }
.source-error { color: var(--warn); }
.pill.status-succeeded { background: var(--good-soft); color: var(--good); }
.pill.status-partial, .pill.status-running { background: var(--warn-soft); color: var(--warn); }
.pill.status-failed { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.pill.status-paused { background: var(--surface-muted); color: var(--text-muted); font-size: 12px; }

/* Login */
body.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(60rem 40rem at 50% -10%, var(--brand-soft), transparent 70%),
    var(--paper);
}
.login-card {
  width: 420px;
  max-width: 100%;
  padding: 44px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card img { width: 200px; }
.login-card h1 { margin-top: 12px; }
.login-card p { color: var(--text-muted); margin-bottom: 28px; }
.login-card .button { padding: 11px 20px; }

@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .topbar { position: static; }
  .topbar-inner { grid-template-columns: 1fr auto; height: auto; padding: 12px var(--gutter); gap: 12px; }
  .brand { grid-row: 1; grid-column: 1; }
  .account { grid-row: 1; grid-column: 2; }
  .tabs { grid-row: 2; grid-column: 1 / -1; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .notice { margin: 16px var(--gutter) -8px; }
  main { padding: 24px var(--gutter) 48px; }
  .columns { grid-template-columns: 1fr; }
}

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