:root {
  --navy: #10243d;
  --navy-deep: #0b192b;
  --navy-hover: #1c3858;
  --gold: #c6a66b;
  --gold-light: #e0c796;
  --gold-ink: #795a24;
  --paper: #f6f5f1;
  --surface: #ffffff;
  --ink: #172d46;
  --muted: #5e6c7b;
  --line: #d7dde3;
  --danger: #963f3b;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; }
header {
  min-height: 100px;
  padding: 23px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: var(--navy-deep);
  border-bottom: 2px solid var(--gold);
  color: white;
}
header div { display: flex; align-items: center; gap: 18px; }
header strong { font-family: Georgia, serif; font-weight: normal; font-size: 22px; letter-spacing: 3px; }
header strong span { display: block; margin-top: 5px; color: var(--gold-light); font-family: "Segoe UI", sans-serif; font-size: 9px; letter-spacing: 3.5px; }
header small { border-left: 1px solid #526074; padding-left: 20px; color: #d4dde7; }
.mark { border: 1px solid var(--gold); color: var(--gold-light); padding: 7px 15px; font: 31px Georgia, serif; }
#identity { color: #d4dde7; font-size: 13px; text-align: right; line-height: 1.6; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; color: var(--navy); }
h1 { font-size: 36px; margin: 5px 0 20px; line-height: 1.2; }
h2 { font-size: 26px; }
p { line-height: 1.7; }
.eyebrow { font-size: 10px; letter-spacing: 2.2px; color: var(--gold-ink); font-weight: 700; }
#login {
  max-width: 490px;
  margin: 8vh auto;
  padding: 38px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 16px 45px #10243d0b;
}
#login > p:not(.eyebrow) { color: var(--muted); margin-bottom: 28px; }
#login-form > button { width: 100%; margin-top: 8px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
input, select, textarea {
  width: 100%; padding: 12px; margin-top: 7px;
  border: 1px solid #adb9c6; border-radius: 4px;
  background: var(--surface); font: inherit; color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #667383; opacity: 1; }
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox] { width: auto; margin-right: 8px; accent-color: var(--navy); }
button, .download {
  display: inline-block; border: 1px solid transparent;
  background: var(--navy); color: white; border-radius: 4px;
  padding: 11px 18px; min-height: 43px; cursor: pointer;
  font: inherit; font-weight: 600; text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
button:hover, .download:hover { background: var(--navy-hover); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold-ink); outline-offset: 3px;
}
nav button:focus-visible { outline-color: var(--gold-light); }
button:disabled { opacity: .48; cursor: not-allowed; }
#new, #login-form > button, #edit-form > .actions > button[type=submit] { background: var(--gold); color: var(--navy-deep); }
#new:hover, #login-form > button:hover, #edit-form > .actions > button[type=submit]:hover { background: var(--gold-light); }
nav { display: flex; gap: 5px; padding: 10px 30px; background: var(--navy); flex-wrap: wrap; }
nav button { background: transparent; color: #d8e0e9; font-size: 13px; padding: 10px 15px; }
nav button:hover { background: var(--navy-hover); color: white; }
nav button.active { background: #263d56; color: var(--gold-light); border-bottom: 2px solid var(--gold); border-radius: 3px 3px 0 0; }
#password { margin-left: auto; }
main { padding: 34px 36px 50px; max-width: 1500px; margin: auto; }
#toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 14px; }
#new { white-space: nowrap; }
.search { display: flex; gap: 12px; align-items: center; max-width: 720px; margin-bottom: 24px; }
.search input { margin: 0; }
input[type=file] { font-size: 13px; }
input[type=file]::file-selector-button { border: 0; border-radius: 3px; background: #e9edf2; color: var(--navy); padding: 6px 10px; margin-right: 10px; cursor: pointer; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th { text-align: left; font-size: 11px; letter-spacing: .4px; color: #42536a; background: #eaf0f5; }
th, td { padding: 15px 17px; border-bottom: 1px solid #e2e6eb; }
td { max-width: 430px; overflow-wrap: anywhere; font-size: 14px; }
tr:has(td):hover { background: #faf9f6; }
td button { padding: 7px 11px; margin: 3px; min-height: 34px; font-size: 12px; }
.table-wrap { overflow: auto; border-radius: 5px; }
.muted { color: var(--muted); font-size: 13px; }
.cards { display: flex; gap: 16px; flex-wrap: wrap; margin: 22px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 4px; padding: 20px 24px; min-width: 145px; }
.card strong { display: block; font: 34px Georgia, serif; color: var(--navy); margin-bottom: 6px; }
.card span { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 10px; margin: 22px 0; flex-wrap: wrap; }
.danger { background: #fff; border-color: #d6b2af; color: #843a35; }
.danger:hover { background: var(--danger); border-color: var(--danger); color: white; }
.badge { display: inline-block; background: #eee7d9; color: #594620; padding: 6px 13px; border-radius: 4px; font-size: 12px; }
#message { position: fixed; bottom: 20px; right: 20px; max-width: min(600px,calc(100vw - 40px)); background: var(--navy); color: white; padding: 18px 22px; border-left: 3px solid var(--gold); border-radius: 4px; z-index: 5; white-space: pre-wrap; box-shadow: 0 8px 30px #0b192b26; }
#message:empty { display: none; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 7px; width: min(900px,95vw); max-height: 90vh; padding: 28px; box-shadow: 0 20px 100px #0b192b40; }
dialog::backdrop { background: #0b192bb0; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; }
.dialog-heading button { background: #edf0f4; color: var(--navy); }
.dialog-heading button:hover { background: #dbe3ec; }
#fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.wide { grid-column: 1/-1; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #eef1f5; padding: 16px; max-height: 350px; overflow: auto; font-size: 12px; border-radius: 4px; }
summary { cursor: pointer; color: var(--navy); padding: 10px 0; font-weight: 600; font-size: 13px; }
[hidden] { display: none !important; }
.pager { display: flex; align-items: center; gap: 15px; margin: 22px 0; color: var(--muted); font-size: 13px; }
.pager button { background: #e5eaf0; color: var(--navy); }
.pager button:hover:not(:disabled) { background: #d5dee9; }
@media (max-width: 900px) { #password { margin-left: 0; } header small { display: none; } }
@media (max-width: 700px) {
  header { padding: 18px; gap: 14px; min-height: 88px; }
  header div { gap: 12px; } header strong { font-size: 18px; }
  header strong span { font-size: 8px; letter-spacing: 2.5px; }
  .mark { font-size: 26px; padding: 6px 12px; }
  #identity { font-size: 11px; max-width: 42%; }
  main { padding: 24px 18px; } nav { padding: 8px 10px; gap: 3px; }
  nav button { padding: 9px 11px; min-height: 42px; }
  #fields { grid-template-columns: 1fr; } h1 { font-size: 29px; }
  #toolbar { flex-wrap: wrap; gap: 2px; margin-bottom: 22px; }
  .search { flex-wrap: wrap; } .search input { min-width: 0; }
  #login { margin: 28px 16px; padding: 28px 24px; max-width: none; }
  .card { min-width: 125px; flex: 1; } .pager { gap: 8px; flex-wrap: wrap; }
  dialog { padding: 22px 18px; } .dialog-heading h2 { font-size: 23px; }
  .batch { overflow-x: auto; }
  table { min-width: 680px; }
  td button { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { button, .download { transition: none; } }
.filters { display:flex; gap:16px; flex-wrap:wrap; }
.filters label { min-width:150px; flex:1; }
.calendar { display:grid; grid-template-columns:repeat(7,minmax(130px,1fr)); gap:8px; overflow-x:auto; }
.calendar-day { border:1px solid var(--line); background:var(--surface); padding:10px; min-height:110px; }
.calendar-day h3 { margin:0 0 12px; font-size:13px; }
.appointment-card { border-top:3px solid var(--gold); padding:9px 0; overflow-wrap:anywhere; }
.appointment-card strong { font-size:13px; }
.appointment-card p { font-size:12px; margin:6px 0; }
.appointment-card button { display:block; padding:5px 8px; min-height:30px; font-size:11px; margin:5px 0; }
.selected { border-color:var(--gold); background:var(--navy-hover); }
@media(max-width:900px){.calendar{grid-template-columns:repeat(2,minmax(140px,1fr))}}
@media(max-width:500px){.calendar{grid-template-columns:1fr}}
