:root {
  --paper: #f4efe6;
  --paper-deep: #e6dece;
  --card: #fffdf8;
  --ink: #1d2430;
  --muted: #5e675f;
  --line: #ddd3c2;
  --teal: #0f5f5b;
  --teal-deep: #0b4542;
  --amber: #8a5310;
  --amber-bg: #f6e4c4;
  --green: #1c6844;
  --green-bg: #d7efe2;
  --red: #8a3434;
  --red-bg: #f8dcdc;
  --shadow: 0 18px 50px rgba(48, 36, 18, 0.08);
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 95, 91, 0.08), transparent 32rem),
    var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--teal-deep); }
h1, h2, .brand {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 { font-size: 2.4rem; line-height: 1.1; margin: 0 0 0.4rem; }
h2 { font-size: 1.35rem; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  position: sticky;
  top: 0;
  z-index: 2;
}
.brand { color: var(--ink); text-decoration: none; font-size: 1.25rem; white-space: nowrap; }
.brand-note { margin: 0 0 0 auto; color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--teal); }
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
}
.menu-toggle-icon,
.menu-toggle-icon::before,
.menu-toggle-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}
.menu-toggle-icon { position: relative; }
.menu-toggle-icon::before,
.menu-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.menu-toggle-icon::before { top: -6px; }
.menu-toggle-icon::after { top: 6px; }
.topbar.is-open .menu-toggle-icon { background: transparent; }
.topbar.is-open .menu-toggle-icon::before { top: 0; transform: rotate(45deg); }
.topbar.is-open .menu-toggle-icon::after { top: 0; transform: rotate(-45deg); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.signout { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.signout span { color: var(--muted); }

.page { width: min(1120px, calc(100% - 2rem)); margin: 1.5rem auto 3rem; }
.narrow { width: min(640px, calc(100% - 2rem)); }
.page-intro { margin-bottom: 1rem; }
.eyebrow {
  margin: 0 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--teal);
}
.lede { max-width: 42rem; color: var(--muted); margin-top: 0; }
.panel, .login-card, .stats article, .stats a {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.panel { padding: 1.1rem; }
.stack { display: grid; gap: 0.85rem; }
.stack-lg { display: grid; gap: 1rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr); gap: 1rem; align-items: start; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; }
input, select, textarea {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
textarea { resize: vertical; }
.primary, .danger, .quiet, .text-button {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.65rem 1rem;
  text-decoration: none;
}
.primary { background: var(--teal); color: white; }
.primary:hover { background: var(--teal-deep); }
.danger { background: transparent; color: var(--red); border-color: #e3b4b4; }
.quiet, .text-button { background: transparent; color: var(--teal-deep); border-color: var(--line); }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }
a.quiet { display: inline-block; }
tr.is-editing td { background: #e7f3f2; }
label .optional { font-size: 0.8rem; }
.optional, .hint { color: var(--muted); }
.hint { margin: 0; }
.flash { padding: 0.75rem 0.9rem; border-radius: 12px; margin: 0 0 1rem; }
.flash-error { background: var(--red-bg); color: var(--red); }
.flash-ok { background: var(--green-bg); color: var(--green); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: min(460px, 100%); padding: 1.6rem; }
.login-card h1 { font-size: 2rem; }

.filters { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; align-items: end; margin-bottom: 1rem; }
.filters label { flex: 1 1 11rem; }
.filters .actions { padding-bottom: 0.1rem; }
a.text-button { display: inline-block; }
.panel h2 { margin-bottom: 0.75rem; }
.panel + .panel { margin-top: 1rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats article, .stats a { padding: 1rem 1.1rem; }
.stats a { display: block; color: inherit; text-decoration: none; }
.stats a:hover { border-color: var(--teal); }
.stats p { margin: 0; color: var(--muted); }
.stats strong { display: block; font-family: var(--serif); font-size: 2.2rem; }

.calendar-card { }
.month-bar, .weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month-bar { grid-template-columns: auto 1fr auto; align-items: center; margin-bottom: 0.8rem; }
.month-bar h2 { text-align: center; }
.weekdays { margin-bottom: 6px; color: var(--muted); font-size: 0.78rem; text-align: center; }
.day, .day-empty {
  min-height: 86px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 6px;
  text-align: left;
}
.day-empty { background: transparent; border-color: transparent; }
.day-number { font-size: 0.85rem; }
.day.is-past { color: var(--muted); background: #f7f4ee; }
.day.is-closed { color: var(--muted); background: #f3efe8; cursor: not-allowed; }
.holiday {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.62rem;
  line-height: 1.15;
  color: var(--amber);
}
.day.is-in-range { background: #e7f3f2; border-color: #b7d9d6; }
.day.is-selected { outline: 2px solid var(--teal); }
.pill {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-size: 0.72rem;
}
.pill-pending { background: var(--amber-bg); color: var(--amber); }
.pill-approved { background: var(--green-bg); color: var(--green); }
.pill-rejected, .pill-cancelled { background: var(--red-bg); color: var(--red); }
.more { font-size: 0.72rem; color: var(--muted); }
.legend { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.plain-list li { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.request-card header p { margin: 0.2rem 0 0; color: var(--muted); }

@media (max-width: 860px) {
  .split, .stats, .stats-4 { grid-template-columns: 1fr; }
  .topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.8rem;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.9rem 0.75rem;
    background: #fffdf8;
  }
  .brand { flex: 1 1 auto; min-width: 0; font-size: 1.05rem; white-space: normal; }
  .menu-toggle { display: inline-flex; flex: 0 0 auto; }
  .nav {
    display: none;
    order: 4;
    flex: 1 0 100%;
    flex-direction: column;
    gap: 0.15rem;
    overflow: visible;
    padding: 0.35rem 0 0.1rem;
  }
  .topbar.is-open .nav { display: flex; }
  .nav a {
    flex: 0 0 auto;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    background: transparent;
  }
  .nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: #e7f3f2; box-shadow: none; }
  .signout { margin-left: 0; }
  .signout button { min-height: 44px; padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: #fffdf8; }
  .signout span { display: none; }
  h1 { font-size: 1.75rem; }
  .page { width: min(1120px, calc(100% - 1.25rem)); margin-top: 1rem; }
  .login-card h1 { font-size: 1.7rem; }
  .eyebrow { letter-spacing: 0.08em; }
  .primary, .danger, .quiet, .text-button { min-height: 44px; }
  .month-bar { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .month-bar h2 { grid-column: 1 / -1; grid-row: 1; font-size: 1.15rem; }
  .month-bar a:first-child { grid-column: 1; grid-row: 2; }
  .month-bar a:last-child { grid-column: 2; grid-row: 2; }
  .month-bar .text-button { padding: 0.45rem 0.55rem; text-align: center; }
  .calendar-grid, .weekdays { gap: 3px; }
  .weekdays { font-size: 0.68rem; }
  .day, .day-empty { min-height: 48px; border-radius: 8px; }
  .day { align-items: center; padding: 3px 2px; gap: 2px; }
  .day-number { font-size: 0.78rem; }
  .day .holiday {
    width: 6px;
    height: 6px;
    border-radius: 99px;
    background: var(--amber);
    font-size: 0;
    color: transparent;
    padding: 0;
  }
  .day .pill {
    width: 8px;
    height: 8px;
    min-height: 0;
    padding: 0;
    border-radius: 99px;
    font-size: 0;
  }
  .day .more { font-size: 0.62rem; }
  .legend { font-size: 0.85rem; }
  .filters .actions { width: 100%; }
  .filters .actions > * { flex: 1 1 auto; text-align: center; }
  input, select, textarea { max-width: 100%; }
  input[type="date"] { min-width: 0; }
  .table-wrap { overflow: visible; }
  table.responsive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table.responsive,
  table.responsive tbody,
  table.responsive tr,
  table.responsive td { display: block; width: 100%; }
  table.responsive tr { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
  table.responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border: 0;
    padding: 0.18rem 0;
    text-align: right;
    overflow-wrap: anywhere;
  }
  table.responsive td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    text-align: left;
    flex: 0 0 auto;
  }
  table.responsive td.actions-cell { justify-content: flex-start; }
  table.responsive td.actions-cell::before { content: none; }
  tr.is-editing td { background: transparent; }
  tr.is-editing { background: #e7f3f2; border-radius: 12px; }
}
