:root {
  --paper: #f7f2e8;
  --surface: #fffdf7;
  --surface-2: #f2ecdf;
  --ink: #1e2a23;
  --muted: #59635c;
  --green: #1f5a43;
  --green-dark: #174534;
  --green-tint: #e7efe9;
  --accent: #9a4c10;
  --accent-tint: #f6d9b8;
  --accent-soft: #f7ebdd;
  --line: #dcd3c2;
  --line-strong: #8c7f68;
  --danger: #a52a2a;
  --danger-tint: #f8e4e1;
  --warning: #8a5a00;
  --warning-tint: #f7ebcd;
  --ok: #1b6b48;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-pop: 0 18px 48px rgba(30, 42, 35, 0.2);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--accent-tint);
  color: var(--ink);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 300;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform 120ms ease;
}

.skip-link:focus {
  transform: none;
}

.noscript {
  margin: 24px;
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-tint);
}

.app-shell {
  min-height: 100dvh;
}

.shell-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(247, 242, 232, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-school {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  transition: background 120ms ease, border-color 120ms ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.icon-btn .btn-label {
  font-size: 14px;
}

.menu-btn {
  display: inline-flex;
}

.role-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.sidebar {
  display: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  flex-direction: column;
  gap: 22px;
  z-index: 60;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.sidebar-brand .brand-name {
  font-size: 20px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease;
}

.sidebar-link svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.sidebar-link:hover {
  background: var(--surface-2);
}

.sidebar-link[aria-current="page"] {
  background: var(--green);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
}

.sidebar-year {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 12px;
  color: var(--muted);
}

.sidebar-year strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  border: 0;
  padding: 0;
  background: rgba(30, 42, 35, 0.52);
}

.sidebar-backdrop[hidden] {
  display: none;
}

.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.page-heading {
  min-width: 0;
}

.page-header h1 {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-header h1:focus {
  outline: none;
}

.title-rule {
  width: 44px;
  height: 3px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--green);
}

.page-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.2;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn:hover {
  background: var(--surface-2);
}

.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--green);
}

.btn-ghost:hover {
  background: var(--green-tint);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #8b2222;
}

.btn-quiet-danger {
  background: transparent;
  border-color: var(--line);
  color: var(--danger);
}

.btn-quiet-danger:hover {
  background: var(--danger-tint);
}

.btn-sm {
  min-height: 44px;
  padding: 6px 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-icon {
  width: 44px;
  padding: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.card-tight {
  padding: 12px;
}

.stack {
  display: grid;
  gap: 16px;
}

.stack-sm {
  display: grid;
  gap: 8px;
}

.stack-lg {
  display: grid;
  gap: 24px;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.section-head h2,
.section h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  max-width: 60ch;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d9c7a4;
  border-radius: 10px;
  background: #fbf3e2;
  color: var(--ink);
  font-size: 13px;
}

.notice svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
  color: var(--accent);
}

.notice a {
  color: var(--green);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.notice-warning {
  border-color: #e2cb95;
  background: var(--warning-tint);
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.summary-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.summary-item:last-child {
  border-bottom: 0;
}

.summary-value {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.summary-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-note {
  color: var(--muted);
  font-size: 12px;
}

.day-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.day-tabs::-webkit-scrollbar {
  display: none;
}

.day-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: background 120ms ease, color 120ms ease;
}

.day-tab:hover {
  background: var(--surface-2);
}

.day-tab[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.schedule-row.own {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.schedule-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.schedule-time {
  flex: none;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  line-height: 1.3;
}

.schedule-time span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.schedule-main {
  min-width: 0;
  flex: 1;
}

.schedule-subject {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.schedule-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.own-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.schedule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.schedule-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.schedule-card.own {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.schedule-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.status-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.status-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 52px;
  padding: 6px 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.1;
  transition: background 120ms ease, border-color 120ms ease;
}

.status-btn:hover {
  background: var(--surface-2);
}

.status-letter {
  font-size: 16px;
  font-weight: 800;
}

.status-word {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.status-btn[aria-pressed="true"] .status-word {
  color: inherit;
}

.status-btn.is-h[aria-pressed="true"] {
  background: var(--green-tint);
  border-color: var(--ok);
  color: var(--ok);
}

.status-btn.is-th[aria-pressed="true"] {
  background: var(--danger-tint);
  border-color: var(--danger);
  color: var(--danger);
}

.status-btn.is-i[aria-pressed="true"] {
  background: var(--warning-tint);
  border-color: var(--warning);
  color: var(--warning);
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.period-block {
  display: grid;
  gap: 8px;
}

.period-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
}

.period-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 14px;
  font-weight: 800;
}

.period-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 180ms ease;
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-h {
  background: var(--green-tint);
  border-color: #b9d6c6;
  color: var(--ok);
}

.badge-th {
  background: var(--danger-tint);
  border-color: #e6bdb7;
  color: var(--danger);
}

.badge-i {
  background: var(--warning-tint);
  border-color: #e2cb95;
  color: var(--warning);
}

.badge-neutral {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
}

.badge-own {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.person-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.person-name {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.person-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-tint);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 2px 2px 10px;
  border: 1px solid #c9dcd0;
  border-radius: var(--radius-sm);
  background: var(--green-tint);
  font-size: 13px;
  font-weight: 600;
}

.chip-remove {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--green);
}

.chip-remove:hover {
  background: rgba(31, 90, 67, 0.12);
}

.chip-empty {
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  min-width: 620px;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #faf6ee;
}

.data-table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.form-row > .field {
  align-content: start;
}

.field > label,
.label {
  font-size: 14px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.3;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: #7c8279;
  opacity: 1;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--green);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fff7f6;
}

.help {
  color: var(--muted);
  font-size: 12px;
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.field-warning {
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--paper);
}.auth-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 32px 20px;
  background: var(--green);
  color: #fff;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
}

.auth-wordmark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.auth-intro h1 {
  max-width: 18ch;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.auth-intro p {
  max-width: 44ch;
  margin-top: 14px;
  color: #dce9e1;
  font-size: 15px;
}

.auth-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: #dce9e1;
  font-size: 13px;
}

.auth-meta strong {
  color: #fff;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px 16px 40px;
}

.auth-card {
  width: min(480px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-card .page-subtitle {
  margin-bottom: 18px;
}

.role-options {
  display: grid;
  gap: 8px;
}

.role-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.role-card:hover {
  background: var(--surface-2);
}

.role-card.is-selected {
  border-color: var(--green);
  background: #eff5f0;
}

.role-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.role-card:focus-within {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.role-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--green-tint);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.role-card.is-selected .role-mark {
  background: var(--green);
  color: #fff;
}

.role-title {
  display: block;
  font-weight: 700;
  line-height: 1.25;
}

.role-desc {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.auth-hint {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
}

.auth-divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: rgba(30, 42, 35, 0.55);
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.modal-wide {
  width: min(760px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  flex: 1;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px -8px -8px 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
}

.modal-close:hover {
  background: var(--surface-2);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(30, 42, 35, 0.24);
  animation: toast-in 160ms ease-out;
}

.toast-success {
  border-left: 4px solid #7bd3a8;
}

.toast-error {
  border-left: 4px solid #e88a82;
}

.toast-info {
  border-left: 4px solid #e7c27b;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.empty {
  padding: 30px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}

.empty-title {
  font-weight: 800;
}

.empty-text {
  max-width: 44ch;
  margin: 4px auto 0;
  color: var(--muted);
  font-size: 14px;
}

.empty .btn {
  margin-top: 14px;
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-box {
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 14px;
}

.list-rows {
  display: grid;
  gap: 8px;
}

.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.list-row-main {
  flex: 1;
  min-width: 180px;
}

.list-row-title {
  font-weight: 700;
}

.list-row-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.event-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.event-item.past {
  background: #f6f2e9;
}

.event-date {
  flex: none;
  display: grid;
  place-items: center;
  align-content: center;
  width: 58px;
  min-height: 62px;
  padding: 6px 4px;
  border-radius: 10px;
  background: var(--green-tint);
  color: var(--green);
  text-align: center;
}

.event-day {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.event-month {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
}

.event-main {
  flex: 1;
  min-width: 0;
}

.event-title {
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.event-desc {
  margin-top: 6px;
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-start;
}

.notif-list {
  display: grid;
  gap: 8px;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.notif-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
  color: var(--green);
}

.notif-title {
  font-weight: 700;
  font-size: 14px;
}

.notif-sub {
  color: var(--muted);
  font-size: 12px;
}

.two-col {
  display: grid;
  gap: 16px;
}

.flex-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 18px rgba(30, 42, 35, 0.07);
}

.bottomnav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 7px 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.bottomnav-link svg {
  width: 22px;
  height: 22px;
}

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

.app-shell.mobile .page {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.print-only {
  display: none;
}

@media (min-width: 640px) {
  .page {
    padding: 26px 24px 48px;
  }

  .summary-item {
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .summary-item:last-child {
    border-right: 0;
  }

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

  .two-col {
    grid-template-columns: 1fr 1fr;
  }

  .schedule-row {
    grid-template-columns: 104px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
  }

  .schedule-row-top {
    display: contents;
  }

  .schedule-actions {
    justify-content: flex-end;
  }
}

@media (min-width: 900px) {
  .auth {
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, 0.9fr);
  }

  .auth-intro {
    padding: 44px 48px;
    min-height: 100dvh;
  }

  .auth-body {
    padding: 48px;
    min-height: 100dvh;
  }

  .role-pill {
    display: inline-flex;
  }

  .bottomnav {
    left: 50%;
    right: auto;
    bottom: 20px;
    width: min(620px, calc(100% - 40px));
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    padding-bottom: 0;
  }

  .bottomnav-link {
    min-height: 62px;
  }

  .app-shell.mobile .page {
    padding-bottom: 104px;
  }
}

@media (min-width: 960px) {
  .app-shell.admin {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    grid-template-rows: 1fr;
  }

  .app-shell.admin .sidebar {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
    height: 100dvh;
  }

  .app-shell.admin .shell-main {
    grid-column: 2;
    grid-row: 1;
  }

  .app-shell.admin .menu-btn {
    display: none;
  }

  .app-shell.admin .topbar .brand {
    display: none;
  }

  .app-shell.admin .topbar {
    justify-content: flex-end;
  }

  .app-shell.admin .sidebar-backdrop {
    display: none;
  }

  .page {
    padding: 30px 32px 56px;
  }

  .modal-backdrop {
    padding: 28px;
  }
}

@media (max-width: 959px) {
  .app-shell.admin .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    display: flex;
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow-pop);
    overflow-y: auto;
  }

  .app-shell.admin .sidebar.is-open {
    transform: none;
  }
}

@media (max-width: 639px) {
  .page-header {
    align-items: flex-start;
  }

  .table-wrap {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .table-wrap .data-table {
    min-width: 0;
  }

  .table-wrap .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .table-wrap .data-table,
  .table-wrap .data-table tbody {
    display: grid;
    gap: 10px;
  }

  .table-wrap .data-table tr {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .table-wrap .data-table td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    padding: 0;
    border-bottom: 0;
    min-width: 0;
  }

  .table-wrap .data-table td::before {
    content: attr(data-label);
    flex: none;
    min-width: 76px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
  }

  .table-wrap .data-table td .person-name {
    overflow-wrap: anywhere;
  }

  .table-wrap .data-table .row-actions {
    justify-content: stretch;
  }

  .table-wrap .data-table .row-actions .btn {
    flex: 1;
  }

  .page-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .page-actions .btn {
    width: 100%;
    white-space: nowrap;
  }

  .page-actions .btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }

  .toast-region {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .event-item {
    flex-wrap: wrap;
  }

  .event-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@page {
  size: A4;
  margin: 12mm;
}

@page print-landscape {
  size: A4 landscape;
  margin: 10mm;
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12px;
  }

  body.printing-landscape .print-sheet {
    page: print-landscape;
  }

  .topbar,
  .sidebar,
  .bottomnav,
  .page-actions,
  .no-print,
  .toast-region,
  .modal-backdrop,
  .skip-link,
  .title-rule {
    display: none !important;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .card,
  .section,
  .schedule-row,
  .schedule-card,
  .summary,
  .event-item,
  .table-wrap {
    border: 1px solid #000;
    box-shadow: none;
    break-inside: avoid;
  }

  .data-table th,
  .data-table td {
    border-color: #000;
  }

  .badge,
  .status-btn {
    border: 1px solid #000;
    background: #fff;
    color: #000;
  }

  .print-only {
    display: block;
  }

  body.printing #app,
  body.printing #modal-root,
  body.printing #toast-region {
    display: none !important;
  }
}

.print-sheet {
  padding: 4mm 2mm;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
}

.print-sheet h1 {
  font-size: 17px;
  margin: 0 0 2px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.print-sheet .print-meta {
  margin: 0 0 10px;
  font-size: 11px;
  color: #333;
  text-align: center;
}

.print-sheet h2 {
  margin: 16px 0 6px;
  font-size: 14px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.print-table thead {
  display: table-header-group;
}

.print-table tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-table th,
.print-table td {
  border: 1px solid #333;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}

.print-table th {
  background: #eee;
  font-weight: 700;
  white-space: nowrap;
}

.print-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.print-table .print-total td {
  background: #f4f4f4;
}

.print-sub {
  color: #444;
  font-size: 10px;
  white-space: nowrap;
}

.print-note {
  margin: 8px 0 0;
  font-size: 10px;
  color: #333;
}

.print-sign {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  font-size: 11px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-sign p {
  margin: 0 0 2px;
}

.print-sign > div:last-child {
  text-align: right;
}

.print-sign-space {
  height: 52px;
}

/* Gaya lama print-sheet table tetap didukung untuk kompatibilitas. */
.print-sheet table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.print-sheet th,
.print-sheet td {
  border: 1px solid #555;
  padding: 5px 6px;
  text-align: left;
  vertical-align: top;
}

.print-sheet th {
  background: #eee;
}
