:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --line: #d9e2ec;
  --line-strong: #b7c7d8;
  --text: #16212f;
  --muted: #66778b;
  --primary: #1f6f8b;
  --primary-dark: #15516a;
  --holiday: #FF0000;
  --holiday-bg: #fff0f2;
  --saturday: #0000FF;
  --work: #1f6f8b;
  --dayoff: #1d8f68;
  --holiday-work: #b45309;
  --substitute: #6d5bd0;
  --monthly: #0d9488;
  --need: #ba2d65;
  --memo: #5f6f82;
  --date-line-height: 22px;
  --event-row-height: 20px;
  --event-row-gap: 4px;
  --cell-padding: 8px;
  font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
}

.maintenance-page-body {
  min-height: 100vh;
  background: #edf2f6;
}

.maintenance-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.maintenance-panel {
  width: min(660px, 100%);
  padding: 44px 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(24, 43, 63, 0.1);
  text-align: center;
}

.maintenance-symbol {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: #e3edf3;
  color: var(--primary);
}

.maintenance-symbol svg {
  width: 36px;
  height: 36px;
  fill: currentColor;
}

.maintenance-panel h1 {
  margin-bottom: 14px;
}

.maintenance-panel > p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.maintenance-line {
  max-width: 100%;
  white-space: nowrap;
}

.maintenance-warning {
  margin: 22px auto 0 !important;
  padding: 14px 18px;
  border: 1px solid #e6b85c;
  border-radius: 10px;
  background: #fff8e8;
  color: #7a5310 !important;
  font-weight: 700;
}

.maintenance-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 22px;
  padding: 10px 15px;
  border-radius: 999px;
  background: #e9f3f7;
  color: #175d74;
}

.maintenance-state-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6f8793;
  box-shadow: 0 0 0 5px rgba(111, 135, 147, 0.16);
}

@keyframes maintenance-status-spin {
  to { transform: rotate(360deg); }
}

.maintenance-panel.is-checking[data-state] .maintenance-state-dot {
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(23, 93, 116, 0.24);
  border-top-color: currentColor;
  background: transparent;
  box-shadow: none;
  animation: maintenance-status-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .maintenance-panel.is-checking[data-state] .maintenance-state-dot {
    animation: none;
  }
}

.maintenance-panel[data-state="active"] .maintenance-state-dot {
  background: #e49b23;
  box-shadow: 0 0 0 5px rgba(228, 155, 35, 0.18);
}

.maintenance-panel[data-state="disconnected"] .maintenance-state {
  background: #eef1f3;
  color: #64737c;
}

.maintenance-panel[data-state="completed"] .maintenance-state {
  background: #e7f4ec;
  color: #17643d;
}

.maintenance-panel[data-state="completed"] .maintenance-state-dot {
  background: #238653;
  box-shadow: 0 0 0 5px rgba(35, 134, 83, 0.16);
}

.maintenance-last-checked {
  margin-top: 10px !important;
  color: #72818a !important;
  font-size: 12px;
}

.maintenance-continue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 18px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.maintenance-continue[hidden] {
  display: none;
}

@media (max-width: 700px) {
  .maintenance-panel {
    padding: 36px 12px;
  }

  .maintenance-panel h1 {
    font-size: clamp(20px, 6vw, 28px);
  }

  .maintenance-panel > p:not(.eyebrow) {
    font-size: clamp(9px, 2.7vw, 14px);
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

#lockBtn {
  border-color: #e8aaaa;
  background: #f9dddd;
  color: #9e3434;
  box-shadow: 0 2px 7px rgba(158, 52, 52, 0.08);
}

#lockBtn:hover {
  border-color: #dc9191;
  background: #f5cccc;
  color: #832727;
}

#lockBtn.security-key-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
}

.security-key-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.security-key-button .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;
}

.security-key-button[aria-busy="true"] svg {
  opacity: 0.58;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.top-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

html.session-locked .app-shell {
  visibility: hidden;
}

.security-page {
  display: grid;
  place-items: start center;
  max-width: 1480px;
  margin: 0 auto;
  padding-top: 70px;
}

.security-panel {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.security-intro {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-shell {
  display: grid;
  align-content: start;
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 520px;
  width: 100%;
  margin: 56px auto 18px;
}

.login-page {
  display: grid;
  place-items: start center;
  width: 100%;
}

.login-panel {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-intro {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auto-unlock-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cbd9eb;
  border-radius: 8px;
  background: #f4f8fd;
  cursor: pointer;
}

.auto-unlock-option input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.auto-unlock-option span {
  display: grid;
  gap: 4px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
}

.auto-unlock-option small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.trusted-pc-name-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.trusted-pc-name-field[hidden] {
  display: none;
}

.passkey-login-area {
  display: grid;
  gap: 9px;
  text-align: center;
}

.passkey-login-area[hidden] {
  display: none;
}

.passkey-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.passkey-divider::before,
.passkey-divider::after {
  height: 1px;
  background: var(--line);
  content: "";
}

.passkey-button {
  width: 100%;
  min-height: 46px;
  gap: 8px;
  border-color: #6d9ca4;
  color: #174752;
  background: #f2f8f8;
}

.passkey-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.passkey-login-area small {
  color: var(--muted);
  line-height: 1.45;
}

.form-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e1a9b1;
  border-radius: 8px;
  color: #8f1f2f;
  background: #fff3f5;
  font-size: 13px;
  line-height: 1.45;
}

.form-message[hidden] {
  display: none;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.button {
  min-height: 38px;
  padding: 8px 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button.full-width {
  width: 100%;
}

.button.danger {
  color: #aa1e32;
}

.button.ghost:hover,
.icon-button:hover {
  background: #edf4f8;
  border-color: var(--line-strong);
}

.icon-button:disabled {
  color: #a8b3c1;
  background: #f4f6f8;
  cursor: not-allowed;
}

.button.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.icon-button {
  width: 42px;
  height: 42px;
  font-size: 26px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.calendar-area,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.calendar-area {
  min-width: 0;
  padding: 16px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.calendar-month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.construction-toggle {
  border-color: #e5a675;
  background: #fff4ea;
  color: #8a3f0b;
}

.construction-toggle.is-active {
  border-color: #b54708;
  background: #b54708;
  color: #fff;
}

.construction-toggle:disabled {
  border-color: var(--line);
  background: #f2f4f7;
  color: var(--muted);
  cursor: not-allowed;
}

.schedule-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.calendar-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.calendar-filter-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.calendar-filter-button strong {
  color: var(--text);
  font-size: 13px;
}

.calendar-filter-button.is-active {
  border-color: var(--primary);
  background: #eaf5f9;
  color: var(--primary-dark);
}

.calendar-filter-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.construction-sync-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.construction-sync-status.error {
  color: #aa1e32;
}

.work-summary-details {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.work-summary-details > summary {
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.work-summary-details[open] > summary {
  border-bottom: 1px solid var(--line);
}

.work-summary-details .summary-strip {
  margin: 0;
  padding: 10px;
}

.month-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
}

.summary-strip {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.summary-group {
  display: grid;
  align-items: stretch;
}

.summary-items {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-divider {
  display: flex;
  align-items: center;
  color: #9aa8b6;
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
}

.summary-item {
  width: 92px;
  min-height: 58px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  text-align: center;
}

.summary-item.compact {
  width: 76px;
  min-height: 50px;
  padding: 6px 7px;
  align-self: flex-end;
}

.summary-item.compact .summary-label {
  font-size: 10px;
  white-space: nowrap;
}

.summary-item.compact strong {
  font-size: 19px;
}

.summary-item.earned-leave {
  border-color: #c8d8ec;
  background: #f3f8ff;
}

.summary-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.summary-item strong {
  display: block;
  color: var(--text);
  font-size: 21px;
  line-height: 1;
  white-space: nowrap;
}

.summary-item strong.positive-count {
  color: #107c10;
}

.summary-item strong.negative-count {
  color: #aa1e32;
}

.summary-main {
  display: inline-block;
}

.summary-delta {
  display: inline-block;
  margin-left: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  vertical-align: 2px;
}

.summary-delta.positive-count {
  color: #107c10;
}

.summary-delta.negative-count {
  color: #aa1e32;
}

.summary-item.remaining {
  min-width: 112px;
  border-color: #f2b8c0;
  background: #fff4f6;
}

.summary-item.remaining strong {
  font-size: 30px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #eef4f8;
}

.weekday-row span {
  padding: 9px 6px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.weekday-row .sunday {
  color: var(--holiday);
}

.weekday-row .saturday {
  color: var(--saturday);
}

.calendar-grid {
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 160px;
  padding: var(--cell-padding);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  vertical-align: top;
  overflow: hidden;
}

.day-cell:hover {
  background: #f7fbfd;
}

.day-cell.other-month {
  background: #eef1f4;
  color: #a3afbd;
}

.day-cell.today {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.day-cell.selected {
  background: #eef8fc;
}

.day-cell.sunday,
.day-cell.public-holiday {
  background: var(--holiday-bg);
}

.day-cell.other-month,
.day-cell.other-month:hover,
.day-cell.other-month.public-holiday {
  background: #eef1f4;
}

.day-cell.other-month .date-number,
.day-cell.other-month.sunday .date-number,
.day-cell.other-month.saturday .date-number,
.day-cell.other-month.public-holiday .date-number {
  color: #a9b4c1;
}

.day-cell.other-month .holiday-inline,
.day-cell.other-month .today-mark {
  opacity: 0.5;
}

.day-cell.other-month .event-chip {
  background: #c8d0da;
  color: #f8fafc;
  filter: grayscale(1);
  opacity: 0.58;
}

.day-cell.out-of-range {
  opacity: 0.45;
  cursor: not-allowed;
}

.date-line {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  min-height: var(--date-line-height);
  height: var(--date-line-height);
  flex: 0 0 auto;
  overflow: hidden;
}

.date-number {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}

.day-cell.sunday .date-number {
  color: var(--holiday);
}

.day-cell.saturday .date-number {
  color: var(--saturday);
}

.day-cell.public-holiday .date-number {
  color: var(--holiday);
}

.today-mark {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}

.holiday-inline {
  min-width: 0;
  max-width: calc(100% - 56px);
  color: var(--holiday);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  align-items: stretch;
  justify-content: flex-start;
}

.event-slots {
  display: grid;
  grid-template-rows: repeat(5, var(--event-row-height));
  gap: var(--event-row-gap);
  margin-top: 6px;
  margin-right: calc(var(--cell-padding) * -1);
  margin-left: calc(var(--cell-padding) * -1);
  min-height: calc((var(--event-row-height) * 5) + (var(--event-row-gap) * 4));
}

.event-slot {
  display: block;
  min-width: 0;
  height: var(--event-row-height);
}

.holiday-chip,
.event-chip,
.mini-pill,
.status-pill {
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.25;
}

.holiday-chip {
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  background: #ffe0e5;
  color: #a51f31;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holiday-chip.observance {
  background: #eef4f8;
  color: #516174;
}

.event-chip {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 7px;
  border: 0;
  background: var(--event-color, var(--primary));
  color: var(--event-text, #fff);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.event-chip.construction-event {
  border: 1px solid #d98245;
  background: #fff0e2;
  color: #7a3508;
}

.event-chip.planned-event {
  border: 1px dashed #6e48b8;
  background: #f4efff;
  color: #533690;
}

.event-chip.single-day {
  width: calc(100% - 12px);
  margin: 0 6px;
  border-radius: 999px;
}

.event-chip.range-day {
  border-radius: 0;
}

.event-chip.range-start {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.event-chip.range-end {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.event-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overflow-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.side-panel {
  min-width: 0;
  padding: 16px;
}

.calendar-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.calendar-quick-actions .button {
  width: 100%;
}

.status-pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  background: #edf4f8;
  color: var(--muted);
  font-weight: 800;
}

.mini-pill.limit-full {
  color: #9f1239;
  background: #ffe4e9;
}

.status-pill.saving {
  color: #9a5b00;
  background: #fff3d7;
}

.status-pill.saved {
  color: #146c43;
  background: #dff5e8;
}

.status-pill.error {
  color: #9f1239;
  background: #ffe4e9;
}

.detail-block {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.detail-block.subtle {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-heading h3 {
  margin: 0;
}

.calendar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1480px;
  min-height: 22px;
  margin: 5px auto 0;
  padding: 2px 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.calendar-footer span {
  flex: 0 0 auto;
  font-weight: 800;
}

.calendar-footer code {
  overflow: hidden;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-form {
  display: grid;
  gap: 9px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.date-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.event-main-fields {
  position: relative;
  display: grid;
  grid-template-columns: 52px 106px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.color-picker {
  position: relative;
  display: grid;
  gap: 5px;
}

.color-picker-button {
  width: 42px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-popover {
  position: absolute;
  z-index: 20;
  top: 44px;
  right: 0;
  left: auto;
  display: none;
  grid-template-columns: repeat(3, max-content);
  gap: 8px 7px;
  width: max-content;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.color-popover.open {
  display: grid;
}

.color-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 86px;
  height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.color-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-swatch {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--swatch-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.color-name {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.color-option:has(input:checked) {
  border-color: var(--primary);
  background: #eef8fc;
  box-shadow: 0 0 0 2px rgba(31, 111, 139, 0.16);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--text);
  background: #fff;
}

textarea {
  resize: vertical;
}

.event-list,
.holiday-list {
  display: grid;
  gap: 8px;
}

.event-list {
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.selected-date-event.construction-event {
  border-left: 4px solid #b54708;
  background: #fff8f1;
}

.selected-date-event.planned-event {
  border-left: 4px dashed #6e48b8;
  background: #faf7ff;
}

.selected-date-event .event-title {
  line-height: 1.4;
}

.selected-date-empty {
  padding: 18px 8px;
  text-align: center;
}

.label-summary-item {
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.label-summary-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
}

.label-summary-main .event-color-dot {
  flex: 0 0 auto;
}

.label-summary-main strong {
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.label-summary-main span:last-child {
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
}

.label-summary-titles {
  color: #334155;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-item,
.holiday-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.event-item-header,
.holiday-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-title,
.holiday-title {
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.event-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--event-color);
  vertical-align: middle;
}

.event-meta,
.hint,
.path-text,
.empty-text {
  color: var(--muted);
  font-size: 13px;
}

.event-memo,
.holiday-memo {
  margin: 7px 0 0;
  color: #334155;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mini-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--text);
  cursor: pointer;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.mini-button.danger {
  color: #aa1e32;
}

.path-text {
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}

.hint {
  margin-bottom: 0;
  line-height: 1.5;
}

.history-shortcut {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.history-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-item .button {
  min-height: 32px;
  padding: 6px 10px;
}

.history-empty {
  padding: 4px 2px;
}

.settings-page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-section {
  padding: 18px 0;
}

.settings-section + .settings-section {
  border-top: 1px solid var(--line);
}

.settings-section-heading {
  margin-bottom: 14px;
}

.settings-section-heading h3 {
  margin-bottom: 4px;
}

.settings-section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-export {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.settings-export .settings-section-heading {
  max-width: 760px;
  margin-bottom: 0;
}

.settings-export .button {
  flex: 0 0 auto;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.settings-color-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.settings-color-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-color-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #edf4f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-color-preview {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--swatch-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.settings-color-inputs {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 6px;
}

.settings-native-color {
  min-height: 36px;
  padding: 3px;
}

.settings-hex-input {
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .workspace {
    display: block;
  }

  .top-actions {
    margin-top: 12px;
  }

  .side-panel {
    margin-top: 14px;
  }
}

@media (max-width: 700px) {
  :root {
    --cell-padding: 6px;
    --event-row-height: 18px;
  }

  .calendar-area,
  .side-panel {
    padding: 12px;
  }

  .month-title {
    font-size: 20px;
  }

  .day-cell {
    min-height: 148px;
  }

  .holiday-chip,
  .event-chip {
    font-size: 11px;
  }

  .date-fields {
    grid-template-columns: 1fr;
  }

  .event-main-fields {
    grid-template-columns: 52px 1fr;
  }

  .color-popover {
    right: auto;
    left: 0;
    grid-template-columns: repeat(2, max-content);
  }

  .title-field {
    grid-column: 1 / -1;
  }

  .history-item {
    display: grid;
  }

  .settings-header {
    display: grid;
  }

  .settings-export {
    display: grid;
  }

  .settings-export .button {
    justify-self: start;
  }

  .settings-color-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .login-header {
    margin-top: 24px;
  }

  .login-panel {
    padding: 18px;
  }

  .settings-color-grid {
    grid-template-columns: 1fr;
  }
}
/* 서버 데이터 수신과 화면 반영이 모두 끝났는지 공통으로 표시합니다. */
.mts-data-load-status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: min(390px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid #b8c8ce;
  border-radius: 9px;
  background: rgba(255, 255, 255, .97);
  color: #405963;
  box-shadow: 0 8px 24px rgba(22, 49, 59, .18);
}
.mts-data-load-status[hidden] { display: none; }

.mts-data-load-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7d9098;
  box-shadow: 0 0 0 3px rgba(125, 144, 152, .16);
}

.mts-data-load-copy { display: grid; min-width: 0; gap: 2px; }
.mts-data-load-copy strong { color: #2d4853; font-size: 13px; }
.mts-data-load-copy small { color: #687d85; font-size: 12px; overflow-wrap: anywhere; }
.mts-data-load-retry { min-height: 30px; padding: 5px 8px; border: 1px solid #bdcbd0; border-radius: 6px; background: #fff; color: #425d67; font: inherit; font-size: 10px; font-weight: 850; cursor: pointer; }
.mts-data-load-logs { grid-column: 2 / -1; justify-self: end; }
.mts-data-load-status[data-state="error"] .mts-data-load-copy small,
.mts-data-load-status[data-state="partial"] .mts-data-load-copy small { white-space: normal; overflow-wrap: anywhere; }
.mts-data-load-status[data-state="loading"] .mts-data-load-indicator { background: #287b91; animation: mts-data-load-pulse 1s ease-in-out infinite; }
.mts-data-load-status[data-state="received"] .mts-data-load-indicator { background: #b27a22; }
.mts-data-load-status[data-state="ready"] { border-color: #a8cdbd; }
.mts-data-load-status[data-state="ready"] .mts-data-load-indicator { background: #277055; box-shadow: 0 0 0 3px rgba(39, 112, 85, .15); }
.mts-data-load-status[data-state="partial"] { border-color: #d8bb82; background: #fffaf0; }
.mts-data-load-status[data-state="partial"] .mts-data-load-indicator { background: #b57618; }
.mts-data-load-status[data-state="error"] { border-color: #d9a6a6; background: #fff5f5; }
.mts-data-load-status[data-state="error"] .mts-data-load-indicator { background: #a43d3d; }

@keyframes mts-data-load-pulse {
  0%, 100% { opacity: .45; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 640px) {
  .mts-data-load-status { right: 10px; bottom: 82px; width: calc(100vw - 20px); }
}
@media print { .mts-data-load-status { display: none !important; } }
