/* Palette lifted verbatim from the repairs portal so the two apps read as one
   system. Near-black rather than blue-tinted, gold as the only accent. */
:root {
  --bg: #0f0f14;
  --panel: #1b1b22;
  --panel-2: #14141a;
  --line: #2e2e38;
  --line-strong: #3a3a45;
  --text: #f0f0f5;
  --muted: #8f8f9d;
  --gold: #cd9812;
  --gold-dark: #a87b0e;
  --gold-lit: #e8b830;
  --danger: #c0392b;
  --ok: #27ae60;
  --warning: #f39c12;
  --shadow-emboss: 0 2px 0 #0a0a0d, 0 4px 8px rgba(0, 0, 0, .3);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

a { color: var(--gold-lit); }

/* The real logo, not a webfont approximation of it. */
.brand img { display: block; height: 30px; width: auto; }
.brand-sub {
  font-size: .7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
header .spacer { flex: 1; }

.pill {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .8rem;
  color: var(--muted);
}
.pill b { color: var(--gold-lit); }

button, select, input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
button { cursor: pointer; }
button:hover { border-color: var(--gold); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary {
  background: linear-gradient(180deg, var(--gold-lit), var(--gold));
  color: #14100a;
  font-weight: 700;
  border: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
button.ghost { background: transparent; }
button.danger { color: var(--danger); }

.layout { display: grid; grid-template-columns: 380px 1fr; min-height: calc(100vh - 60px); }
.queue { border-right: 1px solid var(--line); overflow-y: auto; max-height: calc(100vh - 60px); }
.detail { padding: 22px 26px; overflow-y: auto; max-height: calc(100vh - 60px); }

.filters { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filters select, .filters input { padding: 6px 10px; font-size: .85rem; }
.filters input { flex: 1; min-width: 120px; }

.row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.row:hover { background: var(--panel); }
.row.active { background: var(--panel-2); border-left: 3px solid var(--gold); padding-left: 11px; }
.row .top { display: flex; justify-content: space-between; gap: 10px; font-size: .82rem; color: var(--muted); }
.row .subj { font-weight: 600; margin: 3px 0; }
.row .prev { font-size: .84rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.tag {
  display: inline-block;
  font-size: .68rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-right: 5px;
}
.tag.acct { color: var(--gold-lit); border-color: #3a2f14; }
.tag.draft { color: var(--ok); border-color: #1e3d2e; }
.tag.review { color: #e8a33d; border-color: #43331a; }
.tag.clip { color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 12px; font-size: .85rem; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }

.meta { color: var(--muted); font-size: .88rem; margin-bottom: 10px; }
.meta b { color: var(--text); }
pre.body { white-space: pre-wrap; word-wrap: break-word; margin: 0; font: inherit; }

/* HTML email rendering.
   The iframe is sandboxed with an EMPTY sandbox attribute, which blocks
   scripts, forms, popups and same-origin access. Email bodies are written by
   strangers, so the markup is treated as hostile: it renders, it cannot run. */
.mailview {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;              /* most HTML mail assumes a light background */
  min-height: 220px;
}
.viewtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.viewtabs button {
  font-size: .75rem;
  padding: 5px 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
.viewtabs button.on { color: var(--gold-lit); border-color: var(--gold-dark); }

textarea.reply { width: 100%; min-height: 260px; resize: vertical; line-height: 1.65; }
.field { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.field label { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); min-width: 72px; }
.field input, .field select { flex: 1; min-width: 180px; }

.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.warn {
  background: #2a2013;
  border: 1px solid #5a4318;
  color: #f0c674;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: .88rem;
  margin-bottom: 14px;
}
.empty { color: var(--muted); padding: 40px 20px; text-align: center; }
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 50;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  padding: 12px 18px; border-radius: 8px; max-width: 380px;
}
.toast.err { border-left-color: var(--danger); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.login-box .brand img { display: block; height: 46px; width: auto; margin: 0 auto 12px; }
.login-box p { text-align: center; color: var(--muted); font-size: .85rem; margin: 0 0 22px; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-box button { width: 100%; }
.err { color: var(--danger); font-size: .85rem; min-height: 20px; text-align: center; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .queue { max-height: 45vh; border-right: none; border-bottom: 1px solid var(--line); }
  .detail { max-height: none; padding: 16px; }
}
