:root {
  color-scheme: light;
  --ink: #10241c;
  --muted: #5c6f64;
  --paper: #f3efe6;
  --card: #fffcf7;
  --line: #e3d9c8;
  --green: #146b45;
  --green-deep: #0c3d28;
  --ball: #f0c14b;
  --ok: #146b45;
  --ok-bg: #e7f5ee;
  --warn: #9a4b12;
  --warn-bg: #fff4e8;
  --danger: #9f2d2d;
  --shadow: 0 16px 40px rgba(16, 36, 28, 0.08);
  --sans: "Avenir Next", "Segoe UI", "Noto Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: clip;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(240, 193, 75, 0.28), transparent 60%),
    var(--paper);
  color: var(--ink);
  line-height: 1.45;
}

[hidden] { display: none !important; }

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1.5rem;
  background: var(--green-deep);
  color: #f7f3ea;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.mark {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #fff 0 18%, var(--ball) 19% 100%);
  box-shadow: inset -3px -3px 0 rgba(16, 36, 28, 0.18);
}

.nav {
  display: flex;
  gap: 0.35rem;
}

.nav-narrow { display: none; }

.nav a,
.identity {
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: #f7f3ea;
}

.nav a[aria-current="page"] {
  background: var(--ball);
  color: var(--green-deep);
  font-weight: 700;
}

.account {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.account-link {
  color: #f7f3ea;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
}

.account-link[aria-current="page"] {
  background: var(--ball);
  color: var(--green-deep);
}

.identity {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.identity[aria-current="page"] {
  background: var(--ball);
  color: var(--green-deep);
}

button.nav-inbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #f7f3ea;
  font-weight: 600;
}

button.nav-inbox[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.14);
}

.chat-icon { width: 1.25rem; height: 1.25rem; display: block; }

.nav-badge {
  position: absolute;
  top: -0.28rem;
  right: -0.28rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: var(--ball);
  color: var(--green-deep);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
}

.inbox-panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  z-index: 4;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: 18rem;
  overflow: auto;
  padding: 0.8rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.inbox-panel-title { margin: 0 0 0.35rem; font-weight: 700; }

.inbox-panel ul { margin: 0.35rem 0 0; }

.inbox-panel li {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.inbox-panel li + li { margin-top: 0.4rem; }

.inbox-panel li.unread { border-color: var(--green); }

.inbox-panel .hint { margin: 0; }

main {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 4rem;
}

.page-head { max-width: 40rem; margin-bottom: 1.25rem; }

#view-cabinet,
#view-coach,
#view-requests,
#view-profile,
#view-admin {
  width: min(42rem, 100%);
  margin-inline: auto;
}

#view-requests {
  display: grid;
  gap: 1.35rem;
}

#view-requests .page-head,
#view-requests .inbox {
  margin-bottom: 0;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }

h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }

.lead, .hint, .muted { color: var(--muted); }
.lead { margin: 0.45rem 0 0; }
.hint { margin: 0; font-size: 0.92rem; }

.back {
  display: inline-block;
  margin-bottom: 0.7rem;
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}

.status {
  min-height: 0;
  margin: 0;
  padding: 0 1.5rem;
  font-weight: 600;
}

.status:not(:empty) {
  padding-top: 0.85rem;
  padding-bottom: 0.15rem;
}

.status.ok { color: var(--ok); }
.status.error { color: var(--danger); }

.split {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

form,
.panel,
.cabinet-card,
.gate,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

#time-form,
.form-card,
.panel,
.gate,
.cabinet-card {
  padding: 1.15rem 1.2rem 1.25rem;
}

form { display: grid; gap: 0.85rem; }

#time-form { gap: 0.65rem; }

#open-request { width: 100%; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.repeat {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.repeat legend,
.repeat input,
.weekdays input,
.preference-pills input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.repeat label,
.weekdays label,
.preference-pills label {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  border: 1px solid var(--line);
  font-weight: 600;
  cursor: pointer;
}

.repeat label {
  padding: 0.42rem 0.35rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
}

.weekdays label {
  padding: 0.42rem 0;
  border-radius: 10px;
  font-size: 0.78rem;
}

.preference-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.preference-pills label {
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  font-size: 0.86rem;
}

.repeat label:has(input:checked),
.weekdays label:has(input:checked),
.preference-pills label:has(input:checked) {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.any-hall {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.slot {
  display: grid;
  grid-template-columns: 1fr 1fr 4.8rem;
  gap: 0.5rem;
}

.form-card { width: 100%; }

.cabinet-card .form-card { margin-top: 1rem; }

.form-block {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.15rem 0 0;
  border: 0;
}

.form-block > legend {
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field { display: grid; gap: 0.35rem; }

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.halls {
  margin: 0;
  padding: 0.75rem 0.8rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.halls legend { font-weight: 600; padding: 0 0.25rem; }

.hall-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
}

.hall-option input { width: 1.05rem; height: 1.05rem; }

.hall-directory { display: grid; gap: 0.85rem; margin-bottom: 0.75rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hall-directory-list { display: grid; gap: 0.45rem; }

.hall-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.hall-summary p { margin: 0.15rem 0 0; }

.hall-editor {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

#view-admin .form-card { margin-bottom: 0.75rem; }

.admin-tools { display: flex; gap: 0.6rem; flex-wrap: wrap; }

label { font-size: 0.92rem; font-weight: 600; }

input, select {
  font: inherit;
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  flex: none;
}

input:focus, select:focus, a:focus-visible, button:focus-visible {
  outline: 3px solid rgba(240, 193, 75, 0.85);
  outline-offset: 2px;
}

button,
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font: inherit;
  font-weight: 700;
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: wait; }

button.secondary,
a.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.link {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--green);
  font-weight: 600;
  text-decoration: underline;
}

.gate { max-width: 28rem; display: grid; gap: 0.85rem; }
.gate h2 { font-size: 1.25rem; }
.gate p { margin: 0; color: var(--muted); }
.gate .button { justify-self: start; }

.cabinet-card { display: grid; gap: 1rem; }

.inbox {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.inbox h2 { font-size: 1.05rem; }

.inbox ul { margin: 0; }

.inbox li {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.inbox li.unread { border-color: var(--green); }

.inbox li.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

button.disclosure {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
}

button.disclosure::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  flex: none;
}

button.disclosure[aria-expanded="true"]::after {
  transform: translateY(0.12rem) rotate(-135deg);
}

.share-box { display: grid; gap: 0.45rem; }

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.share-row input {
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
}

.share-row button { flex: none; }

.public-requests { display: grid; gap: 0.55rem; }

.public-requests h2 { margin: 0; font-size: 1.05rem; }

.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }

.card-actions .hint { margin: 0; }

