/* Tight, neutral, focused-on-doing-work UI. No frills. */
:root {
  --bg: #fafaf7;
  --fg: #1a1a18;
  --muted: #6a6a64;
  --line: #e6e3da;
  --accent: #2b4a3a;
  --accent-fg: #ffffff;
  --amber: #b87900;
  --amber-bg: #fff3da;
  --green: #2c6e3a;
  --green-bg: #e0f1e3;
  --red: #a23a2a;
  --red-bg: #fbe4df;
  --gray: #555;
  --gray-bg: #ececec;
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--red); }
code { font-family: var(--mono); background: #efece2; padding: 1px 4px; border-radius: 3px; }
pre { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; background: #f3f0e6; padding: 8px; border-radius: 4px; }

.nav {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.nav .brand { font-size: 16px; }
.nav .navlink { color: var(--fg); padding: 4px 8px; border-radius: 4px; }
.nav .navlink:hover { background: var(--gray-bg); text-decoration: none; }
.nav .spacer { flex: 1; }
.nav .inline { display: inline; }

.container { max-width: 1180px; margin: 0 auto; padding: 22px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px 0; font-size: 22px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); }

.tabs { display: flex; gap: 6px; margin: 8px 0 16px; border-bottom: 1px solid var(--line); }
.tabs .tab { padding: 6px 12px; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs .tab.active { background: #fff; color: var(--fg); border: 1px solid var(--line); border-bottom-color: #fff; margin-bottom: -1px; }

.empty { padding: 40px; text-align: center; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }

.rows { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows th, .rows td { text-align: left; padding: 9px 12px; vertical-align: top; }
.rows thead th { background: #f3f0e6; font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.rows tbody tr { border-top: 1px solid var(--line); }
.rows tbody tr.applied { background: #f6fcf7; }
.rows tbody tr.dismissed { opacity: 0.55; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; margin-right: 4px; }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.gray { background: var(--gray-bg); color: var(--gray); }

button, .btn {
  font: inherit; padding: 6px 12px; border-radius: 5px; border: 1px solid var(--line);
  background: #fff; color: var(--fg); cursor: pointer;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.05); text-decoration: none; }
button.ghost { background: transparent; }
button:hover { background: #f7f5ee; }
.actions { white-space: nowrap; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.actions-row .btn { padding: 8px 14px; }

.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.filterbar input[type="search"] { flex: 1; min-width: 220px; }

.form { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; background: #fff; }
.form legend { padding: 0 6px; font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form label.check { flex-direction: row; align-items: center; gap: 6px; }
.form input, .form select, .form textarea {
  font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff;
  color: var(--fg);
}
.form textarea { font-family: var(--mono); font-size: 13px; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form .compose textarea[name="body"] { min-height: 360px; }
.form button[type="submit"] { align-self: flex-start; padding: 8px 18px; }

.compose { max-width: 920px; }

.hint { background: #fffbf0; border: 1px solid #f1e3ad; border-radius: var(--radius); padding: 8px 12px; }
.hint summary { cursor: pointer; font-weight: 600; }

.newfirm { margin: 12px 0; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.newfirm summary { cursor: pointer; }

.login-box { max-width: 360px; margin: 80px auto; background: #fff; padding: 30px 28px; border: 1px solid var(--line); border-radius: var(--radius); }
.login-box h1 { margin: 0 0 6px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login-box input { padding: 9px; border: 1px solid var(--line); border-radius: 5px; }
.login-box button { padding: 10px; background: var(--accent); color: var(--accent-fg); border: none; border-radius: 5px; }

.pwd-row { display: flex; gap: 6px; align-items: stretch; }
.pwd-row input { flex: 1; }
.pwd-row button { flex: 0 0 auto; }

.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 18px; }
.status-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.status-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.status-card.ok { border-left: 3px solid var(--green); }
.status-card.warn { border-left: 3px solid var(--amber); }

.bulk-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-top: 12px; }
.bulk-firms .bulk-controls { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.bulk-side { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto; }
.bulk-side h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.bulk-side h3:first-child { margin-top: 0; }
.bulk-side ul { margin: 4px 0; padding-left: 18px; }
.bulk-side .warn { color: var(--amber); }
.preview-box { background: #fcfaf2; border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; font-size: 13px; max-height: 320px; overflow: auto; }
.preview-box pre { background: transparent; padding: 4px 0; font-family: var(--mono); font-size: 12px; }
.preview-box hr { border: 0; border-top: 1px dashed var(--line); margin: 6px 0; }

.job-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
.job-panel h2 { margin: 0 0 8px; }

@media (max-width: 720px) {
  .nav { flex-wrap: wrap; }
  .rows th:nth-child(3), .rows td:nth-child(3),
  .rows th:nth-child(5), .rows td:nth-child(5) { display: none; }
  .bulk-grid { grid-template-columns: 1fr; }
  .bulk-side { position: static; max-height: none; }
}
