:root {
  --ink: #222222;
  --muted: #6d6d6d;
  --line: #c8c8c8;
  --blue: #1277b8;
  --card: #ffffff;
  --page: #f7f7f7;
  --footer: #1b1b1b;
  --danger: #a12626;
  --hold: #8a5a00;
  --settled: #0d7a43;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; }

.topbar {
  background: #fff;
  border-bottom: 1px solid #e4e4e4;
  padding: 14px 28px;
}

.brand {
  color: #1a1a1a;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand span {
  color: #b5b5b5;
  font-weight: 400;
  margin: 0 8px;
}

main {
  flex: 1;
  width: min(980px, calc(100% - 32px));
  margin: 36px auto 48px;
}

.card {
  background: var(--card);
  border: 1px solid #d5d5d5;
  padding: 28px 32px 24px;
}

.card.narrow { width: min(560px, 100%); margin: 0 auto; }
.card.wide { width: 100%; }

h1 {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
}

.subtitle, .local-note, .updated, .empty, .disclaimer, .hint, small {
  color: var(--muted);
  line-height: 1.45;
}

.subtitle { margin: 0; font-size: 0.98rem; }
.local-note { margin: 10px 0 0; font-size: 0.9rem; }

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.clock {
  margin: 4px 0 0;
  white-space: nowrap;
  color: #444;
  font-size: 0.95rem;
}

label { display: block; }

label > span, .note-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.req { color: var(--danger); font-style: normal; }

.line {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #222;
}

.line input { border-bottom: 0; }

input[type="text"], input[type="password"], input[type="email"], input[type="date"], select, textarea {
  width: 100%;
  border: none;
  border-bottom: 1px solid #222;
  background: transparent;
  border-radius: 0;
  padding: 8px 0 7px;
  outline: none;
}

textarea {
  border: 1px solid #cfcfcf;
  padding: 10px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus { border-color: var(--blue); }

.ref-field { margin-bottom: 8px; }
.email-field { margin-top: 18px; }

.info {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 2px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  cursor: pointer;
}

.hint, small {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  font-style: italic;
}

.trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 26px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.clear, .search, .linkish {
  cursor: pointer;
}

.clear, .search {
  min-width: 92px;
  padding: 8px 16px;
  border: 1px solid #bdbdbd;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 600;
}

.clear { background: #f3f3f3; color: #666; }
.search { background: #5f5f5f; color: #fff; border-color: #5f5f5f; }

.clear:hover, .search:hover, .linkish:hover, .info:hover { filter: brightness(0.95); }

.clear:focus-visible, .search:focus-visible, .linkish:focus-visible, .info:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.required-note { margin: 18px 0 8px; font-size: 0.82rem; }
.disclaimer { margin: 0 0 14px; font-size: 0.78rem; }

.ack {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.92rem;
}

.ack input { margin-top: 3px; }

.form-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.result {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.status {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.updated { margin: 4px 0 14px; font-size: 0.88rem; }

dl { margin: 0; }
dl div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; }

.note-label { margin: 16px 0 4px; color: var(--muted); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
#result-note { margin: 0; white-space: pre-wrap; }

.tone-review { color: var(--blue); }
.tone-hold { color: var(--hold); }
.tone-settled { color: var(--settled); }
.tone-rejected { color: var(--danger); }

.record-form textarea { margin-top: 4px; }
.gate-form { margin-top: 18px; }

.table-wrap { margin-top: 28px; overflow-x: auto; }
.empty { margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #ececec; vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.row-actions { white-space: nowrap; }

.linkish {
  border: 0;
  background: none;
  color: var(--blue);
  padding: 0 8px 0 0;
  font-weight: 600;
}
.linkish.danger { color: var(--danger); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 28px;
  background: var(--footer);
  color: #f2f2f2;
  font-size: 0.85rem;
}
.footer p { margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
.footer a, .footer button {
  color: #f2f2f2;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.footer a:hover, .footer button:hover { text-decoration: underline; }

.policy {
  width: min(420px, calc(100% - 32px));
  border: 1px solid #d5d5d5;
  padding: 22px;
}
.policy::backdrop { background: rgba(0, 0, 0, 0.45); }
.policy h2 { margin: 0 0 8px; color: var(--blue); font-size: 1.4rem; }
.policy p { margin: 0 0 16px; line-height: 1.45; }
.policy .search { width: 100%; }

@media (max-width: 760px) {
  .card { padding: 22px 16px; }
  .card-head, .footer { display: grid; }
  .trio { grid-template-columns: 1fr; gap: 18px; }
  dl div { grid-template-columns: 1fr; gap: 2px; }
  h1 { font-size: 1.7rem; }
  .clock { margin: 0; }
}
