:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans JP", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  color: #163d34;
  background: #f4f7f4;
  --brand: #164f40;
  --brand-strong: #0c3a2f;
  --brand-soft: #e6f3ee;
  --mint: #f1faf6;
  --ink: #172a24;
  --muted: #718078;
  --line: #dbe5df;
  --line-strong: #bfd1c7;
  --warning: #9b6500;
  --warning-soft: #fff5d8;
  --danger: #a63832;
  --danger-soft: #fff0ee;
  --shadow: 0 18px 50px rgba(22, 61, 52, .08);
}

* { box-sizing: border-box; }
button, input, select { font: inherit; }
button { cursor: pointer; }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 80% 0%, #e9f5ef 0, transparent 28%), #f4f7f4; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px; overflow-y: auto; color: white; background: linear-gradient(180deg, #123f34, #0e3028); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--brand-strong); background: #bfe9d8; font-size: 13px; font-weight: 950; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: -.02em; }
.brand small { margin-top: 3px; color: #b8d0c7; font-size: 10px; }
.navigation { display: grid; gap: 24px; margin-top: 34px; }
.nav-group { --group-accent: #d9ad4d; --group-heading-bg: rgba(255, 206, 103, .17); --group-heading-text: #ffe4a8; --group-item-bg: rgba(255, 206, 103, .09); display: grid; gap: 3px; padding-left: 6px; border-left: 2px solid var(--group-accent); }
.nav-group:nth-child(2) { --group-accent: #52bd91; --group-heading-bg: rgba(82, 189, 145, .18); --group-heading-text: #bdf0d9; --group-item-bg: rgba(82, 189, 145, .1); }
.nav-group:nth-child(3) { --group-accent: #74a8ef; --group-heading-bg: rgba(116, 168, 239, .18); --group-heading-text: #cfe2ff; --group-item-bg: rgba(116, 168, 239, .1); }
.nav-group-title { margin: 0 3px 7px -2px; padding: 8px 10px; border-radius: 8px; color: var(--group-heading-text); background: var(--group-heading-bg); font-size: 15px; font-weight: 900; line-height: 1.45; letter-spacing: .02em; }
.nav-item { width: 100%; display: flex; align-items: center; border: 1px solid transparent; border-radius: 11px; padding: 9px 11px; color: #e1eee8; background: var(--group-item-bg); font-size: 14px; font-weight: 850; text-align: left; text-decoration: none; }
.nav-item:hover, .nav-item:focus-visible { color: white; border-color: rgba(255,255,255,.18); outline: none; }
.nav-item.active { color: var(--brand-strong); background: #dff2ea; }
.sidebar-note { margin-top: auto; display: grid; gap: 4px; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; padding: 13px; color: #c7d8d1; font-size: 9px; line-height: 1.6; }
.sidebar-note strong { color: white; font-size: 10px; }

.workspace { min-width: 0; }
.preview-warning { border-bottom: 1px solid #efcf76; padding: 10px 34px; color: #6f4900; background: #fff2c8; font-size: 11px; font-weight: 900; text-align: center; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 34px; color: var(--muted); background: rgba(255,255,255,.86); backdrop-filter: blur(14px); font-size: 11px; font-weight: 800; }
.topbar > div { display: flex; align-items: center; gap: 8px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.environment-dot { width: 8px; height: 8px; border-radius: 50%; background: #28a67d; box-shadow: 0 0 0 5px #e6f5ef; }
.timezone { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: white; }
#content { width: min(1260px, 100%); margin: 0 auto; padding: 38px 34px 70px; outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: #25816a; font-size: 10px; font-weight: 950; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; color: var(--ink); font-size: clamp(27px, 4vw, 40px); letter-spacing: -.045em; }
h2 { margin-bottom: 5px; color: var(--ink); font-size: 18px; letter-spacing: -.025em; }
h3 { margin-bottom: 5px; color: var(--ink); font-size: 13px; }
.page-description, .panel-description, .muted { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; color: #3a5c52; background: #e7f1ed; font-size: 9px; font-weight: 900; }
.badge.primary { color: white; background: var(--brand); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 13px; color: var(--ink); background: white; font-size: 10px; font-weight: 900; }
.button:hover, .button:focus-visible { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.button.primary { border-color: var(--brand); color: white; background: var(--brand); }
.button.danger { border-color: #efc8c5; color: var(--danger); background: var(--danger-soft); }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 9px; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-card { border: 1px solid var(--line); border-radius: 16px; padding: 17px; background: rgba(255,255,255,.85); box-shadow: 0 10px 26px rgba(22,61,52,.04); }
.summary-card span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; }
.summary-card strong { display: block; margin-top: 8px; color: var(--ink); font-size: 23px; }

.panel { border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding: 18px 20px; }
.panel-body { padding: 20px; }
.event-list { display: grid; gap: 11px; }
.event-card { width: 100%; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 15px; padding: 14px; color: var(--ink); background: white; text-align: left; transition: border-color .16s, transform .16s, box-shadow .16s; }
.event-card:hover, .event-card:focus-visible { transform: translateY(-1px); border-color: #72ac98; outline: none; box-shadow: 0 8px 24px rgba(22,61,52,.08); }
.event-date { display: grid; place-items: center; align-content: center; min-height: 64px; border-radius: 12px; color: var(--brand); background: var(--brand-soft); }
.event-date strong { font-size: 22px; line-height: 1; }
.event-date span { margin-top: 5px; font-size: 9px; font-weight: 900; }
.event-main { min-width: 0; }
.event-title { margin-bottom: 5px; font-size: 13px; font-weight: 950; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-course { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.event-arrow { color: #6d8e83; font-size: 20px; }
.empty { display: grid; place-items: center; min-height: 220px; border: 1px dashed var(--line-strong); border-radius: 14px; padding: 24px; color: var(--muted); font-size: 11px; text-align: center; }

.state-panel { width: min(560px, 100%); display: grid; justify-items: center; margin: 10vh auto 0; border: 1px solid var(--line); border-radius: 22px; padding: 48px 32px; background: white; box-shadow: var(--shadow); text-align: center; }
.state-panel h1 { margin-top: 18px; font-size: 23px; }
.state-panel p { max-width: 390px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.state-panel .button { margin-top: 20px; }
.state-panel.auth-panel { width: min(680px, 100%); margin-top: 5vh; }
.clerk-host { min-width: min(400px, 100%); margin-top: 20px; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.state-actions .button { margin-top: 20px; }
.spinner { width: 34px; height: 34px; border: 3px solid #d7ebe3; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { width: min(780px, calc(100% - 28px)); max-height: calc(100vh - 40px); border: 0; border-radius: 22px; padding: 0; color: var(--ink); background: white; box-shadow: 0 30px 90px rgba(10,36,29,.3); }
dialog::backdrop { background: rgba(9,31,25,.58); backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding: 22px 24px; }
.dialog-body { padding: 22px 24px 26px; overflow-y: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.detail-item { border-radius: 12px; padding: 12px; background: #f5f8f6; }
.detail-item span, .field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 8px; font-weight: 900; }
.detail-item strong { font-size: 11px; }
.resource-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.resource-links a { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; color: var(--brand); font-size: 9px; font-weight: 900; text-decoration: none; }
.participant-list { display: grid; gap: 8px; }
.participant { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: 11px; padding: 11px; }
.participant strong { font-size: 10px; }
.participant span { color: var(--muted); font-size: 9px; }

.availability-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.45fr); gap: 18px; align-items: start; }
.form-stack { display: grid; gap: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field input, .field select { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; color: var(--ink); background: white; font-size: 10px; }
.field input:focus, .field select:focus { border-color: var(--brand); outline: 3px solid var(--brand-soft); }
.checkbox-field { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--ink); font-size: 10px; font-weight: 800; }
.form-actions { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.save-status { min-height: 32px; display: flex; align-items: center; margin-left: auto; color: var(--muted); font-size: 9px; font-weight: 850; }
.save-status.dirty { color: var(--warning); }
.save-status.saved { color: #16805f; }
.save-status.error { color: var(--danger); }
.rule-list { display: grid; gap: 10px; }
.rule-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: white; }
.rule-card-title { margin-bottom: 6px; color: var(--ink); font-size: 11px; font-weight: 950; }
.rule-card-meta { color: var(--muted); font-size: 9px; line-height: 1.6; }
.rule-actions { display: flex; align-items: center; gap: 6px; }
.section-separator { height: 1px; margin: 20px 0; background: var(--line); }
.notice { border-radius: 11px; padding: 11px 13px; color: #48675d; background: var(--mint); font-size: 9px; line-height: 1.7; }

@media (max-width: 900px) {
  .sidebar-note { display: none; }
  .nav-item { padding-inline: 7px; }
  .availability-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 20; inset: 0 0 auto; width: 100%; height: auto; max-height: 220px; display: block; padding: 8px 10px; overflow: auto; }
  .brand, .sidebar-note { display: none; }
  .navigation { display: flex; gap: 12px; min-width: max-content; margin: 0; }
  .nav-group { min-width: 178px; }
  .nav-group-title { margin-bottom: 3px; }
  .nav-item { padding: 7px 9px; font-size: 13px; }
  .topbar { height: 58px; padding: 0 18px; }
  .preview-warning { padding: 9px 16px; font-size: 10px; }
  #content { padding: 26px 16px 42px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; }
  .summary-card strong { margin: 0; font-size: 19px; }
  .panel-head, .panel-body { padding: 15px; }
  .event-card { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; }
  .event-date { min-height: 58px; }
  .event-arrow { display: none; }
  .detail-grid, .form-grid { grid-template-columns: 1fr; }
  .participant { grid-template-columns: 1fr; gap: 4px; }
  .rule-card { grid-template-columns: 1fr; }
  .rule-actions { justify-content: flex-end; }
  dialog { max-height: calc(100vh - 20px); }
  .dialog-head, .dialog-body { padding: 18px; }
}
