:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #687385;
  --line: #dfe4ea;
  --soft: #f7f9fb;
  --paper: #ffffff;
  --brand: #1f7a8c;
  --brand-dark: #155b69;
  --accent: #e05d3f;
  --danger: #a84031;
  --yellow: #f3b23a;
  --shadow: 0 12px 34px rgba(26, 38, 52, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f2f5f7;
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(340px, calc(100vw - 28px));
  padding: 20px;
  background: #ffffff;
  border-right: 1px solid rgba(223, 228, 234, 0.9);
  box-shadow: 20px 0 50px rgba(26, 38, 52, 0.12);
  transform: translateX(-104%);
  transition: transform 0.18s ease;
  overflow-y: auto;
}

.sidebar.is-open {
  transform: translateX(0);
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(23, 32, 42, 0.18);
}

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

.brand,
.panel-head,
.month-controls,
.month-strip,
.topbar,
.actions,
.tool-band,
.section-title {
  display: flex;
  align-items: center;
}

.brand,
.brand-main {
  gap: 12px;
  min-height: 56px;
}

.brand {
  justify-content: space-between;
}

.brand-main {
  display: flex;
  align-items: center;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 10px);
  gap: 5px;
  align-items: end;
  width: 42px;
  height: 42px;
  padding: 7px;
  border-radius: 8px;
  background: var(--ink);
}

.brand-mark span {
  border-radius: 4px;
}

.brand-mark span:nth-child(1) {
  height: 16px;
  background: #90d7e1;
}

.brand-mark span:nth-child(2) {
  height: 26px;
  background: #f7c55f;
}

.brand-mark span:nth-child(3) {
  height: 20px;
  background: #f08b72;
}

.brand h1,
.topbar h2,
.panel h3,
.summary-section h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 20px;
}

.eyebrow,
.label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(28, 43, 57, 0.05);
}

.panel-head,
.month-controls,
.topbar,
.section-title {
  justify-content: space-between;
}

.month-controls {
  gap: 10px;
}

.workspace {
  min-width: 0;
  padding: 22px;
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h2 {
  max-width: 680px;
  font-size: clamp(23px, 2.5vw, 32px);
  line-height: 1.2;
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.month-strip {
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 6px 18px rgba(28, 43, 57, 0.04);
}

.month-strip h3 {
  min-width: 130px;
  margin: 0;
  font-size: 20px;
}

.month-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.month-meta span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.full-width {
  width: 100%;
}

.primary-button {
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button,
.ghost-button {
  padding: 0 14px;
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button.is-active,
.secondary-button[aria-pressed="true"] {
  background: #e9f4f6;
  border-color: #9fcbd3;
  color: var(--brand-dark);
}

.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  border-color: #aeb9c5;
  transform: translateY(-1px);
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}

.icon-button.small {
  width: 34px;
  min-height: 34px;
}

.icon-button.tiny {
  width: 30px;
  min-height: 30px;
}

.stack {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.editable-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 48px auto;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafb;
}

.editable-row input,
.field input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  padding: 0 10px;
}

.person-select {
  width: 22px;
  height: 22px;
  border: 2px solid var(--person-color);
  border-radius: 50%;
  background: #fff;
}

.employee-row.is-selected {
  border-color: color-mix(in srgb, var(--person-color) 34%, white);
  background: #fff;
}

.employee-row.is-selected .person-select {
  background: var(--person-color);
  box-shadow: inset 0 0 0 3px #fff;
}

.employee-metric {
  min-width: 42px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.employee-metric.is-complete {
  background: #e8f5ee;
  color: #23704b;
}

.employee-metric.is-over {
  background: #fdebe6;
  color: var(--danger);
}

.remove {
  color: #9d2f21;
}

.field {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.db-status {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.db-status.ok {
  border-color: #cfe8d9;
  background: #f4fbf7;
  color: #23704b;
}

.db-status.warn {
  border-color: #f3c1bb;
  background: #fffafa;
  color: var(--danger);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: #eef4f6;
  font-weight: 800;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.insight-strip div {
  position: relative;
  min-height: 70px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(28, 43, 57, 0.04);
  overflow: hidden;
}

.insight-strip p {
  margin: 0 0 5px;
  color: var(--muted);
  font-weight: 800;
}

.insight-strip strong {
  font-size: 24px;
}

.tool-band {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.quick-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

body:not(.is-editing) .quick-people {
  display: none;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.person-chip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--person-color);
}

.person-chip.is-selected {
  border-color: color-mix(in srgb, var(--person-color) 45%, white);
  background: color-mix(in srgb, var(--person-color) 9%, white);
}

.today-panel {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #cfe8d9;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(28, 43, 57, 0.04);
}

.edit-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #9fcbd3;
  border-radius: 8px;
  background: #e9f4f6;
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 800;
}

.edit-notice[hidden] {
  display: none;
}

.edit-notice strong {
  font-weight: 950;
}

.panel-date {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.today-panel[hidden] {
  display: none;
}

.today-panel.is-low {
  border-color: #f3c1bb;
  background: #fffafa;
}

.today-panel h3 {
  margin: 0;
  font-size: 22px;
}

.today-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.today-lists div {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.today-lists span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.today-lists strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.selected-person {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-radius: 8px;
  background: #e9f4f6;
  color: var(--brand-dark);
  font-weight: 900;
}

.selected-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--person-color);
}

.selected-person small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calendar-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.calendar-legend {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-legend i {
  width: 16px;
  height: 10px;
  border: 2px solid;
  border-radius: 4px;
}

.legend-ok {
  border-color: #cfe8d9;
}

.legend-low {
  border-color: #f3c1bb;
}

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

.weekday-row span {
  padding: 10px;
  background: #f4f7f9;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.day-cell {
  position: relative;
  min-height: 116px;
  padding: 9px;
  border: 1px solid #cfe8d9;
  background: #fff;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.day-cell:hover {
  box-shadow: inset 0 0 0 2px rgba(31, 122, 140, 0.35);
}

.day-cell.is-low-staff {
  border-color: #f3c1bb;
  background: #fffafa;
}

.day-cell.is-staffed {
  border-color: #cfe8d9;
}

.day-cell.has-off {
  background: #fff;
}

.day-cell.is-muted {
  background: #f8fafb;
  border-color: var(--line);
  cursor: default;
}

.day-cell.is-today {
  box-shadow: inset 0 0 0 3px rgba(243, 178, 58, 0.65);
}

.day-cell.is-selected-off {
  box-shadow: inset 0 0 0 2px var(--person-color);
}

.day-cell.is-readonly {
  cursor: default;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.day-number {
  font-size: 18px;
  font-weight: 900;
}

.off-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
}

.off-chip {
  max-width: 100%;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--person-color);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-count {
  position: absolute;
  right: 9px;
  bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.work-count.is-low {
  color: var(--danger);
}

.empty-note {
  color: #aab4c0;
  font-size: 12px;
  font-weight: 800;
}

.summary-section {
  margin-top: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.summary-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: none;
}

.summary-card h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 15px;
}

.summary-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--person-color);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  color: var(--muted);
  font-weight: 800;
}

.summary-line strong {
  color: var(--ink);
}

.summary-line.warning strong {
  color: var(--danger);
}

@media (max-width: 1050px) {
  .sidebar {
    border-bottom: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  .calendar-panel {
    overflow-x: auto;
  }

  .weekday-row,
  .calendar {
    min-width: 850px;
  }
}

@media (max-width: 700px) {
  .sidebar,
  .workspace {
    padding: 16px;
  }

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

  .primary-button,
  .secondary-button {
    flex: 1 1 138px;
  }

  .today-panel,
  .today-lists {
    grid-template-columns: 1fr;
  }

  .hint {
    width: 100%;
    margin-left: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar .actions,
  .tool-band {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .calendar-panel {
    box-shadow: none;
  }

  .day-cell {
    min-height: 112px;
  }
}
