:root {
  color-scheme: light;
  --ink: #111827;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #d8dee8;
  --line-strong: #c7d0dd;
  --page: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --teal: #0f766e;
  --teal-dark: #0b4f4a;
  --blue: #1d4e89;
  --gold: #b7791f;
  --red: #b4233a;
  --shadow: 0 18px 44px rgba(17, 24, 39, 0.10);
  --small-shadow: 0 8px 22px rgba(17, 24, 39, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef4f8 0%, #f7f9fc 38%, #ffffff 100%),
    linear-gradient(90deg, rgba(29, 78, 137, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(15, 118, 110, 0.05) 0 1px, transparent 1px 100%);
  background-size: auto, 72px 72px, 72px 72px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid rgba(216, 222, 232, 0.86);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.brand,
.nav,
.action-row,
.inline-form,
.panel-head {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  font-weight: 850;
  color: var(--ink);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ink), var(--blue));
  color: white;
  font-size: 0.78rem;
}

.nav {
  gap: 12px;
  flex-wrap: wrap;
}

.nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 750;
}

.nav a:hover {
  background: rgba(15, 118, 110, 0.09);
  color: var(--teal-dark);
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--small-shadow);
  font-weight: 700;
}

.flash.success {
  border-color: rgba(15, 118, 110, 0.34);
  color: var(--teal-dark);
}

.flash.error {
  border-color: rgba(180, 35, 58, 0.30);
  color: var(--red);
}

.flash.info {
  border-color: rgba(29, 78, 137, 0.30);
  color: var(--blue);
}

.entry-layout {
  min-height: calc(100vh - 155px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  align-items: stretch;
  gap: clamp(18px, 3vw, 34px);
  padding: clamp(30px, 7vw, 90px) 0;
}

.entry-copy {
  min-height: 500px;
  display: grid;
  align-content: center;
  padding: clamp(26px, 5vw, 58px);
  border: 1px solid rgba(216, 222, 232, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.entry-kicker {
  width: fit-content;
  margin-bottom: 18px;
  padding: 8px 11px;
  border: 1px solid rgba(183, 121, 31, 0.26);
  border-radius: 8px;
  background: rgba(183, 121, 31, 0.10);
  color: #7a4d08;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.entry-copy h1,
.auth-card h1,
.page-head h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5.7vw, 5rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.entry-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.entry-visual {
  position: relative;
  min-height: 500px;
  display: grid;
  align-content: end;
  gap: 18px;
  overflow: hidden;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(29, 78, 137, 0.90) 52%, rgba(15, 118, 110, 0.92)),
    var(--ink);
  box-shadow: var(--shadow);
  color: white;
}

.entry-visual::before,
.entry-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.entry-visual::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.10) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 100%);
  background-size: 46px 46px;
  opacity: 0.42;
}

.entry-visual::after {
  inset: auto -16% -12% 18%;
  height: 46%;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, transparent 0 48%, rgba(255, 255, 255, 0.14) 48% 52%, transparent 52% 100%);
  transform: skewY(-8deg);
}

.entry-seal {
  position: relative;
  z-index: 1;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  font-size: 2.1rem;
  font-weight: 950;
}

.entry-year {
  position: relative;
  z-index: 1;
  font-size: clamp(3rem, 7vw, 6.6rem);
  line-height: 0.9;
  font-weight: 950;
}

.entry-rule {
  position: relative;
  z-index: 1;
  width: min(280px, 70%);
  height: 4px;
  border-radius: 999px;
  background: #f6c453;
}

.entry-dates {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 850;
}

.auth-layout {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(480px, 100%);
  display: grid;
  gap: 18px;
  padding: 30px;
  border: 1px solid rgba(216, 222, 232, 0.94);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: clamp(2rem, 8vw, 3.1rem);
}

.form-stack {
  display: grid;
  gap: 14px;
}

.found-person {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid rgba(15, 118, 110, 0.26);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.07);
}

.found-person span {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.found-person strong {
  font-size: 1.02rem;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-weight: 800;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--teal);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-button {
  padding: 0 18px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: white;
  box-shadow: 0 9px 18px rgba(15, 118, 110, 0.18);
}

.secondary-button {
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--ink);
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: rgba(17, 24, 39, 0.06);
  color: var(--ink);
}

.danger-button {
  padding: 0 12px;
  border: 1px solid rgba(180, 35, 58, 0.22);
  background: rgba(180, 35, 58, 0.10);
  color: var(--red);
}

.icon-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid rgba(180, 35, 58, 0.22);
  background: rgba(180, 35, 58, 0.10);
  color: var(--red);
  font-size: 1.2rem;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.compact {
  min-height: 38px;
  padding: 0 14px;
}

.tiny {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.84rem;
}

.full {
  width: 100%;
}

.text-link {
  color: var(--teal-dark);
  font-weight: 850;
}

.user-pill,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.10);
  color: var(--teal-dark);
  font-size: 0.84rem;
  font-weight: 850;
}

.status.full {
  background: rgba(180, 35, 58, 0.10);
  color: var(--red);
}

.status.mine {
  background: rgba(15, 118, 110, 0.16);
  color: var(--teal-dark);
  border: 1px solid rgba(15, 118, 110, 0.26);
}

.status.closed {
  border: 1px solid rgba(102, 112, 133, 0.24);
  background: rgba(102, 112, 133, 0.12);
  color: #475467;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-end;
  margin-bottom: 26px;
}

.page-head h1 {
  font-size: clamp(2rem, 5vw, 3.9rem);
}

.action-row {
  gap: 10px;
  flex-wrap: wrap;
}

.counts-band {
  padding: 22px 0 12px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title h2,
.panel h2,
.week-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.count-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(118px, 1fr));
  gap: 10px;
}

.count-item {
  min-height: 84px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(216, 222, 232, 0.94);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.04);
}

.count-item span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.count-item strong {
  color: var(--ink);
  font-size: 1.9rem;
}

.schedule {
  display: grid;
  gap: 28px;
  margin-top: 20px;
}

.week-section {
  padding: 22px 0 8px;
  border-top: 1px solid rgba(17, 24, 39, 0.14);
}

.week-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
}

.day-card {
  min-height: 250px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(216, 222, 232, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--small-shadow);
}

.day-card-mine {
  border-color: rgba(15, 118, 110, 0.42);
  background:
    linear-gradient(180deg, rgba(236, 253, 245, 0.96), rgba(255, 255, 255, 0.98)),
    var(--surface);
  box-shadow: 0 16px 36px rgba(15, 118, 110, 0.14);
}

.day-card-closed {
  border-color: rgba(102, 112, 133, 0.24);
  background:
    linear-gradient(180deg, rgba(242, 244, 247, 0.96), rgba(255, 255, 255, 0.92)),
    var(--surface);
  box-shadow: 0 8px 20px rgba(102, 112, 133, 0.08);
}

.day-top,
.assignment-row,
.approval-row,
.registry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.day-top h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
}

.assignment-list,
.stack {
  display: grid;
  gap: 10px;
}

.assignment-row {
  min-height: 52px;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid rgba(216, 222, 232, 0.82);
  border-radius: 8px;
  background: var(--surface-soft);
}

.assignment-row-mine {
  align-items: center;
  border-color: rgba(15, 118, 110, 0.34);
  background: rgba(255, 255, 255, 0.92);
}

.assignment-row strong {
  color: var(--ink);
}

.closed-day-note {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 10px;
  border: 1px dashed rgba(102, 112, 133, 0.34);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.86);
  color: #475467;
  font-weight: 850;
}

.self-day-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.10);
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.self-remove-form {
  width: 100%;
}

.remove-self-button {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(180, 35, 58, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--red);
  cursor: pointer;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(180, 35, 58, 0.08);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.remove-self-button::before {
  content: "";
  display: inline-grid;
  place-items: center;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(180, 35, 58, 0.10);
}

.remove-self-button:hover {
  transform: translateY(-1px);
  border-color: rgba(180, 35, 58, 0.42);
  background: rgba(255, 248, 249, 0.96);
}

.transfer-form,
.assign-form {
  display: grid;
  gap: 8px;
}

.transfer-form {
  grid-template-columns: minmax(150px, 1fr) auto;
  width: 100%;
}

.assign-form {
  grid-template-columns: 1fr auto;
}

.empty-text,
.locked-text {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.day-card > .locked-text {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 16px;
  margin-bottom: 18px;
}

.panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(216, 222, 232, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--small-shadow);
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.approval-row,
.registry-row {
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid rgba(216, 222, 232, 0.86);
  border-radius: 8px;
  background: var(--surface-soft);
}

.approval-row > div {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.approval-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.registry-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.7fr) auto;
}

.table-wrap {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.log-panel .table-wrap {
  max-height: calc(100vh - 210px);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ink);
  color: white;
}

.print-body {
  background: white;
}

.print-sheet {
  width: min(1100px, calc(100% - 32px));
  margin: 28px auto;
}

.print-sheet h1 {
  margin: 0 0 20px;
}

.print-week {
  break-inside: avoid;
  margin-bottom: 24px;
}

.print-week h2 {
  margin: 0 0 10px;
}

@media (max-width: 1180px) {
  .count-grid,
  .day-grid {
    grid-template-columns: repeat(3, minmax(190px, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar,
  .page-head,
  .week-heading,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .entry-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .entry-copy,
  .entry-visual {
    min-height: 360px;
  }

  .count-grid,
  .day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .registry-row,
  .assign-form,
  .transfer-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 22px;
  }

  .entry-copy h1,
  .auth-card h1,
  .page-head h1 {
    font-size: 2.15rem;
    line-height: 1.06;
  }

  .entry-copy,
  .entry-visual,
  .auth-card,
  .panel,
  .day-card {
    padding: 14px;
  }

  .entry-copy,
  .entry-visual {
    min-height: 300px;
  }

  .entry-seal {
    width: 96px;
    height: 96px;
    font-size: 1.55rem;
  }

  .count-grid,
  .day-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .topbar,
  .flash-stack {
    display: none;
  }

  body {
    background: white;
  }

  .print-sheet {
    width: 100%;
    margin: 0;
  }
}
