:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #090909;
  --panel-raised: #0d0d0d;
  --border: #202020;
  --border-soft: #171717;
  --text: #f4f4f5;
  --muted: #8b8b93;
  --faint: #55555d;
  --accent: #ff8500;
  --green: #4ed17b;
  --red: #ff625c;
  --radius: 18px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

.page-shell {
  width: min(100%, 1020px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px clamp(12px, 4vw, 42px) 48px;
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  text-align: center;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.site-header h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -.035em;
}

.admin-link {
  position: absolute;
  right: 0;
  padding: 7px 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 11px;
  text-decoration: none;
}

.admin-link:hover {
  color: var(--text);
  background: #0b0b0b;
}

.brand-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 133, 0, .45);
}

.calendar-panel,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.calendar-panel { padding: clamp(14px, 3vw, 28px); }

.month-navigation {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.month-arrow {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 0;
  color: var(--accent);
  background: #0b0b0b;
  border: 1px solid var(--border);
  border-radius: 13px;
  font-size: 30px;
  line-height: 1;
}

.month-arrow:hover { background: #131313; }

.date-selectors {
  display: flex;
  justify-content: center;
  gap: 8px;
}

select,
input {
  min-height: 42px;
  color: var(--text);
  background: #0b0b0b;
  border: 1px solid var(--border);
  border-radius: 10px;
}

select { padding: 0 32px 0 13px; }
input { width: 100%; padding: 0 12px; }

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.public-weekday-row,
.public-calendar-grid {
  grid-template-columns: 28px repeat(7, minmax(0, 1fr));
}

.weekday-row { border-bottom: 1px solid var(--border); }
.weekday-row span {
  padding: 0 4px 11px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-grid { border-left: 1px solid var(--border-soft); }

.week-check-heading { padding-inline: 0 !important; }

.week-selector-cell {
  display: grid;
  min-width: 0;
  min-height: 126px;
  place-items: center;
  background: #030303;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.week-selector-cell input {
  width: 14px;
  min-height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.calendar-day {
  position: relative;
  min-width: 0;
  min-height: 126px;
  padding: 8px;
  overflow: hidden;
  background: #050505;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.calendar-day.blank { background: #020202; }
.public-calendar-grid .calendar-day:not(.blank) { cursor: pointer; }
.calendar-day.today { background: #0b0a08; }
.calendar-day.today::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 133, 0, .7);
  content: "";
  pointer-events: none;
}

.calendar-day.selected-date {
  background: #11100e;
  box-shadow: inset 0 0 0 1px rgba(255, 133, 0, .38);
}

.day-heading {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}

.day-number { color: var(--faint); font-size: 12px; }
.today .day-number { color: var(--accent); }

.today-label {
  padding: 2px 5px;
  color: #000;
  background: var(--accent);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.day-context {
  min-height: 16px;
  margin-top: 2px;
  overflow: hidden;
  color: #73737b;
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-context.holiday { color: var(--red); }

.calendar-day.weekend .day-number,
.calendar-day.weekend .day-context {
  color: var(--red);
}

.day-status {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  word-break: keep-all;
}

.past .worked.over-four { color: var(--accent); }
.past .worked.exact-four { color: var(--muted); }
.past .rest { color: var(--text); }
.current-future .scheduled { color: var(--green); }
.current-future .rest { color: var(--red); }
.current-future .worked { color: var(--muted); }

.overtime-label {
  min-height: 15px;
  color: #6f7f91;
  font-size: 10px;
  text-align: center;
}

.day-note {
  width: 100%;
  height: 24px;
  margin-top: 4px;
  padding: 4px 5px;
  overflow: hidden;
  color: #b7b7bd;
  background: #090909;
  border: 1px solid #1d1d1d;
  border-radius: 6px;
  font-size: 11px;
  line-height: 15px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-note.empty { color: #44444a; }

.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 11px;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.past-long { background: var(--accent); }
.legend-dot.past-four { background: var(--muted); }
.legend-dot.past-rest { background: var(--text); }
.legend-dot.future-work { background: var(--green); }
.legend-dot.future-rest { background: var(--red); }

.selection-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.selection-card {
  min-width: 0;
  padding: 15px 16px;
  background: #070707;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.selection-label {
  margin: 0 0 7px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .04em;
}

.selection-card > strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.selection-card > p:not(.selection-label) {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.calculation-formula { color: var(--accent) !important; }

.selected-week-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.selected-week-metrics span {
  display: grid;
  gap: 4px;
  color: var(--faint);
  font-size: 10px;
}

.selected-week-metrics b {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.metric-card {
  min-width: 0;
  padding: 22px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.metric-card p {
  min-height: 34px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}

.metric-card strong span {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}

.metric-card strong small { color: var(--muted); font-size: 13px; }
.point-card strong span { color: var(--accent); }
.metric-card em {
  display: block;
  margin-top: 10px;
  color: var(--faint);
  font-size: 11px;
  font-style: normal;
}

.load-message,
.form-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.manage-shell { max-width: 920px; }
.admin-card { max-width: 640px; margin: 0 auto; padding: 24px; }
.admin-card h2 { margin: 0 0 18px; font-size: 18px; }
.admin-description {
  margin: -7px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.admin-form { display: grid; gap: 14px; }
.admin-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.primary-button {
  min-height: 44px;
  color: #000;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.compact-calendar { margin-bottom: 14px; }
.selectable .calendar-day:not(.blank) { cursor: pointer; }
.selectable .calendar-day.selected { background: #151009; }
.editor-card { max-width: none; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wide-field { grid-column: 1 / -1; }
.check-label { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.check-label input { width: 18px; min-height: 18px; }
.overtime-preview {
  padding: 12px;
  color: var(--muted);
  background: #070707;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 12px;
}

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

@media (max-width: 680px) {
  .page-shell { padding: 24px 8px 36px; }
  .calendar-panel { padding: 12px 7px 16px; }
  .month-navigation { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 7px; }
  .month-arrow { width: 44px; height: 44px; }
  .date-selectors { gap: 5px; }
  .date-selectors select { padding-inline: 8px 22px; }
  .calendar-day { min-height: 114px; padding: 6px 3px; }
  .public-weekday-row,
  .public-calendar-grid { grid-template-columns: 22px repeat(7, minmax(0, 1fr)); }
  .week-selector-cell { min-height: 114px; }
  .week-selector-cell input { width: 12px; min-height: 12px; }
  .today-label { padding-inline: 3px; font-size: 9px; }
  .day-context, .overtime-label { font-size: 9px; }
  .day-status, .day-note { font-size: 10px; }
  .day-note { padding-inline: 2px; }
  .dashboard { grid-template-columns: 1fr; }
  .selection-details { grid-template-columns: 1fr; }
  .metric-card { padding: 18px; }
  .metric-card p { min-height: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
}
