/* Resident Notices — a small tool used a few times a week, so it is built to
   be legible and boring rather than fashionable. Light and dark both defined
   from the same token set. */

:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --border: #dfe2e5;
  --border-strong: #c7ccd1;
  --text: #16191d;
  --muted: #666e76;
  --accent: #1f5f4b;
  --accent-hover: #17493a;
  --accent-soft: #e8f2ee;
  --danger: #a3261f;
  --danger-soft: #fbeceb;
  --warn-soft: #fdf4e3;
  --warn-border: #e8d29a;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --surface: #1d2125;
    --border: #2e343a;
    --border-strong: #414951;
    --text: #e8eaec;
    --muted: #98a1a9;
    --accent: #4fae8d;
    --accent-hover: #62c1a0;
    --accent-soft: #1c2f29;
    --danger: #f0837b;
    --danger-soft: #331e1d;
    --warn-soft: #2e2718;
    --warn-border: #574a2c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; font-weight: 600; }
h2:first-child { margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- login gate ---------- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.gate-card label { display: block; margin: 18px 0 6px; font-size: 13px; font-weight: 600; }
.gate-card button { width: 100%; margin-top: 16px; }

/* ---------- chrome ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.mark { font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.banner {
  padding: 10px 20px;
  background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-border);
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.panel { padding: 20px; max-width: 1280px; margin: 0 auto; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 0; }

/* ---------- form ---------- */

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .field { flex: 1 1 150px; }
.row .field-narrow { flex: 0 1 110px; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 90px; }

.hint { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- the violation checklist ---------- */

/* Twenty-five checkboxes. In one column they are a scroll; in a grid they are
   a form you can take in at a glance, which is what the paper version gets
   right by printing them in three columns. */
.checkgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2px 14px;
  margin-bottom: 6px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}

.check:hover { background: var(--accent-soft); }

/* The inputs above are width:100%; a checkbox must not be. */
.check input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.hint-block { margin: -4px 0 10px; }

#violationFilter { margin-bottom: 4px; }

/* The letterhead warning sits inside the form, not across the top like the
   dry-run banner, because it is about this notice and blocks this send. */
.banner-warn {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
}

.banner-warn ul { margin: 8px 0 0; padding-left: 20px; }
.banner-warn li { margin: 2px 0; }
.banner-warn code {
  padding: 1px 5px;
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ---------- resident picker ---------- */

/* The list is absolutely positioned over whatever follows it, so the form
   below does not jump every time someone types a digit. */
.field-find { position: relative; }

.combo-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}

.combo-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 5px;
  cursor: pointer;
}

.combo-item.is-active { background: var(--accent-soft); }

.combo-unit {
  flex: 0 0 auto;
  min-width: 66px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.combo-name { flex: 1 1 auto; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: 999px;
}


.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
  font-size: 13.5px;
}
.error ul { margin: 0; padding-left: 18px; }

.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

button {
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
button:disabled { opacity: .55; cursor: not-allowed; }

.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }

.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.ghost:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- preview ---------- */

.preview-card { position: sticky; top: 20px; }

.preview-meta {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
.preview-meta > div { display: flex; gap: 10px; padding: 3px 0; }
.preview-meta .label {
  flex: 0 0 60px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-top: 2px;
}

.preview-body {
  margin: 0;
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 14px/1.65 ui-serif, Georgia, "Times New Roman", serif;
  max-height: 62vh;
  overflow-y: auto;
}

/* ---------- history ---------- */

.table-scroll { overflow-x: auto; margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill-sent { background: var(--accent-soft); color: var(--accent); }
.pill-failed { background: var(--danger-soft); color: var(--danger); }
.pill-dry { background: var(--warn-soft); color: var(--muted); }

/* ---------- modal + toast ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 10;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 440px;
  width: 100%;
}
.modal-card h2 { margin-top: 0; font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--text); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 20;
  max-width: calc(100vw - 40px);
}
.toast.is-error { background: var(--danger); color: #fff; }

[hidden] { display: none !important; }
