/* Alloy Marketing PM — executive light theme. Percheron-board deck aesthetic.
   No emojis. Conservative typography. State-of-play, no commentary. */
:root {
  --bg: #f5f4ef;              /* warm cream */
  --bg-card: #ffffff;
  --bg-soft: #faf9f5;
  --border: #e2dfd6;
  --border-strong: #cbc7bc;
  --text: #1a1a1a;
  --text-dim: #6b6b6b;
  --muted: #9a9690;
  --accent: #8c6a1f;          /* deep Alloy gold */
  --accent-hover: #a47e2c;
  --pri-high: #a72d2d;        /* restrained red */
  --pri-med:  #b87c1b;        /* amber */
  --pri-low:  #4a7a4a;        /* sage */
  --warn: #b87c1b;
  --ok: #4a7a4a;
  --err: #a72d2d;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --radius: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* --- Auth --- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.auth-brand {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
}
.auth-logo { display: block; height: 36px; width: auto; margin: 0 0 10px; }
.brand-logo { display: block; height: 28px; width: auto; }
.brand { display: flex; align-items: center; gap: 16px; }
.auth-sub {
  margin: 0 0 28px;
  color: var(--text-dim);
  font-size: 13px;
}
.auth-form label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.auth-form input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 16px;
  font-family: inherit;
}
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.auth-form button {
  width: 100%;
  padding: 11px 14px;
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.auth-form button:hover { background: var(--accent-hover); }
.link-btn {
  background: transparent;
  color: var(--text-dim);
  border: 0;
  padding: 8px 0;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.link-btn:hover { color: var(--text); text-decoration: underline; }
.auth-msg { margin: 14px 0 0; min-height: 1.2em; font-size: 13px; color: var(--text-dim); }
.auth-msg[data-kind="ok"] { color: var(--ok); }
.auth-msg[data-kind="err"] { color: var(--err); }

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.brand-name {
  font-family: var(--font-display);
  color: var(--accent);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.3px;
}
.brand-sub { color: var(--text-dim); font-size: 13px; margin-left: 14px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user { color: var(--text-dim); font-size: 13px; }
.pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pill-ok { color: var(--ok); border-color: var(--ok); background: rgba(74,122,74,.06); }
.pill-warn { color: var(--warn); border-color: var(--warn); background: rgba(184,124,27,.06); }

/* --- Main --- */
.dash {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 32px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* AI tools strip */
.ai-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.ai-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.ai-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ai-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.ext { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.ai-desc { margin: 0; color: var(--text-dim); font-size: 12px; }
.ai-pulse { font-size: 12px; }
.pulse-when { color: var(--accent); margin-right: 8px; font-weight: 600; }
.pulse-msg { color: var(--text); }
.muted { color: var(--muted); font-style: italic; }

/* Quick input */
.quick-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.quick-input form { display: flex; gap: 10px; align-items: flex-start; }
.quick-input textarea {
  flex: 1;
  resize: vertical;
  min-height: 48px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}
.quick-input button {
  padding: 10px 20px;
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  align-self: stretch;
  font-family: inherit;
}
.quick-input button:hover { background: var(--accent-hover); }
.quick-result { margin: 8px 0 0; font-size: 12px; color: var(--text-dim); min-height: 1em; }

/* Review queue */
.review-queue {
  background: var(--bg-card);
  border-left: 3px solid var(--warn);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.review-queue h2 { margin: 0 0 12px; font-size: 13px; color: var(--warn); text-transform: uppercase; letter-spacing: .5px; }
.review-queue .count {
  background: var(--warn);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  margin-left: 6px;
  font-weight: 600;
}
.review-item { padding: 12px 0; border-top: 1px solid var(--border); }
.review-item header { display: flex; gap: 12px; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.review-suggestion { margin: 6px 0; font-size: 13px; }
.review-item details { font-size: 12px; color: var(--text-dim); margin: 6px 0; }
.review-item pre { white-space: pre-wrap; background: var(--bg-soft); padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); max-height: 200px; overflow: auto; }
.review-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.review-actions button, .review-actions select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.review-actions button:hover { background: var(--bg-soft); }

/* Category state-of-play */
.cat-stack { display: flex; flex-direction: column; gap: 18px; }
.cat-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cat-head {
  padding: 14px 20px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.cat-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.proj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.proj-table th, .proj-table td {
  text-align: left;
  padding: 12px 16px;
  vertical-align: top;
}
.proj-table thead th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.proj-table tbody tr { border-top: 1px solid var(--border); }
.proj-table tbody tr:first-child { border-top: 0; }
.proj-row:hover { background: var(--bg-soft); }

.th-name, .td-name { font-weight: 600; width: 14%; }
.th-pri, .td-pri { width: 9%; }
.th-state, .td-state { width: 30%; }
.th-target, .td-target { width: 9%; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.th-last, .td-last { width: 30%; }
.th-exp, .td-exp { width: 8%; }

.ms-date { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.ms-text { color: var(--text); margin-left: 8px; }

/* Priority pills */
.pri-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1px solid;
}
.pri-pill.pri-high  { color: var(--pri-high); border-color: var(--pri-high); background: rgba(167,45,45,.06); }
.pri-pill.pri-medium { color: var(--pri-med); border-color: var(--pri-med); background: rgba(184,124,27,.06); }
.pri-pill.pri-low   { color: var(--pri-low); border-color: var(--pri-low); background: rgba(74,122,74,.06); }

/* Left border on rows by priority — subtle */
.proj-row.pri-high td:first-child  { box-shadow: inset 3px 0 0 var(--pri-high); }
.proj-row.pri-medium td:first-child { box-shadow: inset 3px 0 0 var(--pri-med); }
.proj-row.pri-low td:first-child   { box-shadow: inset 3px 0 0 var(--pri-low); }

/* History drawer */
details summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .5px;
  list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary:hover { color: var(--accent-hover); }
ul.ms-history {
  margin: 8px 0 0;
  padding: 8px 0 0;
  list-style: none;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
ul.ms-history li { padding: 4px 0; color: var(--text); }

/* Pollers (admin) */
.pollers { font-size: 12px; color: var(--text-dim); }
.pollers h2 { font-size: 12px; color: var(--text-dim); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.poller-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.poll-err { color: var(--err); }
.poller-list .err { display: block; font-size: 11px; margin-top: 2px; color: var(--err); }

/* Responsive */
@media (max-width: 1200px) {
  .ai-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .dash { padding: 16px; gap: 16px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 18px; }
  .ai-strip { grid-template-columns: 1fr; }
  .proj-table thead { display: none; }
  .proj-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 14px; }
  .proj-table td { padding: 2px 0; }
  .td-name { grid-column: 1 / 2; }
  .td-pri { grid-column: 2 / 3; text-align: right; }
  .td-state { grid-column: 1 / 3; }
  .td-target, .td-last { grid-column: 1 / 3; }
  .td-exp { grid-column: 1 / 3; }
}

@media (prefers-color-scheme: dark) {
  /* deliberately not implementing — executive light only. */
}
