/* Shared look for the public pages (calendar, request, subscribe, admin). */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16181d;
  --muted: #5f6675;
  --border: #e2e5ea;
  --accent: #2458d6;
  --accent-text: #ffffff;
  --accent-soft: #e8efff;
  --danger: #d23f3f;
  --danger-soft: #fdeaea;
  --ok: #1f9d55;
  --ok-soft: #e4f6ec;
  --warn: #c77d12;
  --warn-soft: #fff3df;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --surface: #171b23; --surface-2: #1f242e; --text: #eef1f6; --muted: #9aa3b2; --border: #2a303c;
    --accent: #6d95ff; --accent-text: #0b1020; --accent-soft: #1b2744; --danger: #ff7b7b; --danger-soft: #3a1d1d;
    --ok: #4fd38a; --ok-soft: #173427; --warn: #f3b35b; --warn-soft: #3a2b12; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218; --surface: #171b23; --surface-2: #1f242e; --text: #eef1f6; --muted: #9aa3b2; --border: #2a303c;
  --accent: #6d95ff; --accent-text: #0b1020; --accent-soft: #1b2744; --danger: #ff7b7b; --danger-soft: #3a1d1d;
  --ok: #4fd38a; --ok-soft: #173427; --warn: #f3b35b; --warn-soft: #3a2b12; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 10px; }
.brand img { height: 32px; width: auto; }
.nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: .925rem; }
.nav a:hover, .nav a.active { background: var(--surface-2); color: var(--text); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.narrow { max-width: 680px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.side { grid-template-columns: 1fr 340px; } }

label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
label .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=datetime-local], input[type=date], input[type=url], input[type=number], input[type=color], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; }
input[type=color] { padding: 2px; height: 40px; width: 60px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }

button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-link { border: none; background: none; color: var(--accent); padding: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid transparent; margin: 12px 0; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; color: var(--muted); padding: 36px 16px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 640px; padding: 24px; box-shadow: var(--shadow); position: relative; }
.modal .close { position: absolute; top: 12px; right: 12px; border: none; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; line-height: 1; padding: 0; }
.hidden { display: none !important; }

.msg-thread { display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); max-width: 90%; }
.msg.mine { align-self: flex-end; background: var(--accent-soft); }
.msg .who { font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
.msg.system { background: none; color: var(--muted); font-size: .85rem; align-self: center; font-style: italic; }
.msg.needs_info { border-left: 4px solid var(--warn); }
.msg.approved { border-left: 4px solid var(--ok); }
.msg.rejected { border-left: 4px solid var(--danger); }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px; }
