:root {
  --ink: #17212b;
  --muted: #66717d;
  --line: #dce2e8;
  --soft: #f4f6f8;
  --blue: #1677d2;
  --blue-dark: #0e5fae;
  --green: #14845f;
  --red: #d13b45;
  --amber: #b76a08;
  --panel: #fff;
  --shadow: 0 8px 24px rgba(28, 42, 56, .08);
}
* { box-sizing: border-box; }
html { background: #eef1f4; color: var(--ink); font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; letter-spacing: 0; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef1f4; }
.auth-panel { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand small { color: var(--muted); margin-top: 2px; }
.auth-panel > #authCopy > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.6; }
.auth-form { display: grid; gap: 14px; margin-top: 22px; }
.auth-form label { display: grid; gap: 6px; color: #4c5864; font-size: 12px; }
.auth-form input { min-height: 42px; border: 1px solid #cbd3db; padding: 0 11px; }
.auth-form .primary-button { min-height: 42px; margin-top: 4px; }
.auth-hint { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 0; }
.text-button { display: block; border: 0; background: transparent; color: var(--blue-dark); margin: 18px auto 0; }
.activation-result { border: 1px solid #b9d5ef; background: #f2f8fd; padding: 14px; display: grid; gap: 6px; }
.activation-result span, .activation-result small { color: var(--muted); font-size: 11px; }
.activation-result code { padding: 10px; background: #fff; border: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar { height: 62px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: stretch; padding: 0 26px; position: sticky; top: 0; z-index: 20; }
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; min-width: 205px; padding: 0; color: var(--ink); text-align: left; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: #e52b37; color: #fff; font-weight: 800; border-radius: 4px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.desktop-nav { display: flex; align-items: stretch; gap: 8px; }
.nav-item { border: 0; border-bottom: 3px solid transparent; background: transparent; min-width: 96px; color: #4b5762; font-size: 14px; }
.nav-item.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
.user-tools { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.user-tools select, .head-actions select, .head-actions input { height: 36px; border: 1px solid var(--line); background: #fff; padding: 0 10px; }
.role-button { height: 30px; border: 1px solid #a9c8e8; background: #eef7ff; color: var(--blue-dark); padding: 0 10px; border-radius: 4px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #263a4e; color: #fff; display: grid; place-items: center; font-size: 13px; }
main { padding: 26px; max-width: 1600px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.page-head { min-height: 62px; display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; gap: 18px; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 700; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 26px; }
h2 { margin: 0; font-size: 20px; }
h3 { margin: 0; font-size: 15px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.primary-button, .secondary-button { min-height: 36px; border-radius: 4px; padding: 0 14px; border: 1px solid transparent; white-space: nowrap; }
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-dark); }
.primary-button.green { background: var(--green); }
.secondary-button { background: #fff; border-color: #c8d0d8; color: #33404d; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: #fff; color: #33404d; font-size: 21px; display: grid; place-items: center; border-radius: 4px; }
.month-switcher { display: grid; grid-template-columns: 36px minmax(122px, auto) 36px; height: 36px; align-items: center; background: #fff; border: 1px solid var(--line); }
.month-switcher .icon-button { border: 0; height: 34px; }
.month-switcher strong { text-align: center; font-size: 15px; }
.summary-strip { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); background: #fff; border: 1px solid var(--line); margin-bottom: 14px; }
.summary-item { min-height: 70px; padding: 13px 16px; border-right: 1px solid var(--line); }
.workforce-summary { grid-template-columns: repeat(8, minmax(90px, 1fr)); }
.workforce-date-actions { align-items: center; }
.workforce-date-actions .icon-button { flex: 0 0 36px; }
.workforce-date-actions input[type="date"] { min-width: 145px; }
.field-operations { width: 100%; margin-bottom: 10px; background: #fff; border: 1px solid var(--line); }
.field-operations > header { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.field-operations > header h2 { margin: 2px 0 0; }
.operation-count { display: flex; align-items: center; gap: 12px; }
.operation-count span { color: var(--muted); font-size: 11px; }
.operation-count strong { font-size: 20px; }
.template-only { color: var(--muted); font-size: 11px; }
.operation-table-wrap { width: 100%; overflow-x: auto; }
.operation-table { width: 100%; min-width: 1120px; table-layout: fixed; border-collapse: collapse; }
.operation-table th { height: 38px; background: #3f77a2; color: #fff; font-size: 11px; font-weight: 700; text-align: center; border-right: 1px solid #b8cad8; border-bottom: 1px solid #b8cad8; padding: 0 5px; }
.operation-table td { height: 31px; font-size: 11px; line-height: 1.25; text-align: center; border-right: 1px solid #d6dce1; border-bottom: 1px solid #d6dce1; padding: 4px 5px; overflow-wrap: anywhere; }
.operation-table th:nth-child(1) { width: 14%; }
.operation-table th:nth-child(2), .operation-table th:nth-child(3), .operation-table th:nth-child(4) { width: 9%; }
.operation-table th:nth-child(5) { width: 10%; }
.operation-table th:nth-child(6) { width: 12%; }
.operation-table th:nth-child(7) { width: 9%; }
.operation-table th:nth-child(8) { width: 15%; }
.operation-table th:nth-child(9), .operation-table th:nth-child(10) { width: 7%; }
.operation-table th:last-child, .operation-table td:last-child { border-right: 0; }
.operation-table tbody tr:last-child td { border-bottom: 0; }
.blank-operation-row td { height: 31px; }
.blank-operation-row:nth-child(even) td { background: #eef2f6; }
.blank-operation-row:nth-child(odd) td { background: #fff; }
.blank-operation-row .aircraft-model { background: #edf6fc; font-weight: 700; vertical-align: middle; }
.blank-operation-row .aircraft-number { font-weight: 700; }
.blank-operation-row .hmms-cell { font-weight: 600; color: #263746; }
.workforce-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; align-items: start; }
.workforce-zone, .unknown-zone { background: #fff; border: 1px solid var(--line); }
.workforce-zone > header, .unknown-zone > header { min-height: 67px; display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.workforce-zone > header > strong, .unknown-zone > header > strong { font-size: 19px; }
.workforce-rows { max-height: 590px; overflow-y: auto; }
.workforce-person { min-height: 58px; padding: 10px 13px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.workforce-person:last-child { border-bottom: 0; }
.person-main { min-width: 0; display: grid; gap: 4px; }
.person-main strong { font-size: 13px; }
.person-main span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta { flex: 0 0 auto; display: grid; justify-items: end; gap: 3px; color: #53606c; font-size: 10px; }
.aircraft-tag { color: #0e5fae; background: #eaf4fe; padding: 2px 5px; font-weight: 700; }
.zone-empty { min-height: 110px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.unknown-zone { margin-top: 14px; }
.unknown-rows { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 7px; }
.unknown-rows > span { border: 1px solid #d7dde3; background: #f6f7f8; padding: 5px 8px; font-size: 11px; }
.summary-item:last-child { border-right: 0; }
.summary-item span { color: var(--muted); font-size: 12px; display: block; margin-bottom: 6px; }
.summary-item strong { font-size: 20px; }
.calendar-layout { display: grid; grid-template-columns: minmax(680px, 1fr) 330px; gap: 14px; align-items: start; }
.calendar-panel, .detail-panel, .request-list, .table-wrap, .manager-table { background: #fff; border: 1px solid var(--line); }
.schedule-calendar-panel { width: 100%; }
.schedule-day { cursor: default; }
.schedule-day-content { min-height: 100px; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { height: 36px; align-items: center; text-align: center; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; }
.weekday-row span:first-child { color: var(--red); }
.weekday-row span:last-child { color: var(--blue); }
.day-cell { min-height: 118px; position: relative; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; padding: 6px 6px 6px 31px; text-align: left; overflow: hidden; }
.day-cell:nth-child(7n) { border-right: 0; }
.day-cell.outside { background: #fafbfc; color: #a3abb4; }
.day-cell.selected { box-shadow: inset 0 0 0 2px var(--blue); }
.day-cell.today .day-number { background: var(--blue); color: #fff; }
.day-number { width: 22px; height: 22px; position: absolute; top: 5px; left: 4px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; margin: 0; }
.day-badge { display: block; width: 100%; margin: 0 0 3px; padding: 4px 6px; border-left: 3px solid #7b8793; background: #eef1f4; color: #35414d; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-badge.office { border-color: var(--blue); background: #edf6ff; }
.day-badge.travel { border-color: #805ad5; background: #f5f0ff; }
.day-badge.leave { border-color: var(--green); background: #edf9f4; }
.day-badge.field { border-color: var(--amber); background: #fff6e8; }
.day-badge.shift { border-color: #3a7f93; background: #edf8fa; }
.lock-mark { position: absolute; top: 7px; right: 5px; color: var(--muted); }
.detail-panel { position: sticky; top: 78px; min-height: 390px; }
.detail-header { padding: 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.detail-body { padding: 16px; }
.empty-state { min-height: 390px; display: grid; place-content: center; text-align: center; padding: 30px; color: var(--muted); }
.empty-state strong { color: var(--ink); margin: 8px 0; }
.empty-state p { margin: 0; font-size: 12px; line-height: 1.6; }
.empty-icon { font-size: 28px; color: var(--blue); }
.source-note { background: #f2f7fb; border-left: 3px solid var(--blue); padding: 9px 11px; font-size: 12px; color: #3d5266; margin-bottom: 14px; }
.record-form { display: grid; gap: 12px; }
.record-form label, .form-grid label { display: grid; gap: 5px; color: #4c5864; font-size: 12px; }
.record-form input, .record-form select, .record-form textarea, .form-grid input, .form-grid select, .form-grid textarea { width: 100%; border: 1px solid #cbd3db; border-radius: 3px; padding: 9px 10px; background: #fff; color: var(--ink); }
.record-form textarea, .form-grid textarea { resize: vertical; }
.time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.detail-actions { display: flex; gap: 8px; margin-top: 4px; }
.status-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 12px; background: #eef1f4; font-size: 11px; color: #4d5965; }
.status-chip.submitted, .status-chip.waiting { background: #fff2d9; color: #8a5700; }
.status-chip.approved, .status-chip.locked { background: #e7f7ef; color: #126845; }
.status-chip.rejected, .status-chip.blocked { background: #fdebec; color: #a52b34; }
.filter-bar { display: flex; justify-content: space-between; margin-bottom: 12px; }
.segmented { display: inline-flex; border: 1px solid #c9d2da; background: #fff; }
.segmented button { height: 34px; border: 0; border-right: 1px solid #d7dee5; background: #fff; padding: 0 14px; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: #eaf4fe; color: var(--blue-dark); font-weight: 700; }
.request-card { display: grid; grid-template-columns: 110px minmax(0, 1fr) 160px 180px; gap: 16px; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.request-card:last-child { border-bottom: 0; }
.request-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.request-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mini-button { min-height: 30px; border: 1px solid #cbd3db; background: #fff; border-radius: 3px; padding: 0 10px; }
.mini-button.approve { border-color: var(--blue); color: var(--blue); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { height: 44px; padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #f5f7f9; color: #56626e; font-size: 12px; }
.modal { border: 0; padding: 0; width: min(620px, calc(100vw - 30px)); box-shadow: 0 20px 60px rgba(18, 30, 42, .25); }
.modal::backdrop { background: rgba(25, 34, 44, .45); }
.modal header, .modal footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal footer { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; }
.form-grid { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
.check-label { display: flex !important; grid-column: 1 / -1; grid-template-columns: 18px 1fr !important; align-items: center; }
.check-label input { width: 18px; height: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: #1d2b38; color: #fff; padding: 12px 16px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; z-index: 50; max-width: 360px; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-nav { display: none; }
.muted { color: var(--muted); }
.danger-text { color: var(--red); }

@media (max-width: 980px) {
  .topbar { padding: 0 16px; }
  .desktop-nav { display: none; }
  .brand { min-width: auto; }
  .user-tools select, .role-button { display: none; }
  main { padding: 18px 14px 82px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .head-actions { width: 100%; }
  .calendar-layout { grid-template-columns: 1fr; }
  .detail-panel { position: static; min-height: 0; order: -1; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-item { border-bottom: 1px solid var(--line); }
  .calendar-panel { overflow-x: auto; }
  .weekday-row, .calendar-grid { min-width: 700px; }
  .schedule-actions { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(194px, auto) auto; align-items: stretch; }
  .schedule-actions > select { flex: 1 1 180px; }
  .schedule-calendar-panel { overflow-x: hidden; }
  .schedule-calendar-panel .weekday-row, .schedule-calendar-grid { min-width: 0; }
  .schedule-calendar-grid .day-cell { min-height: 90px; }
  .day-cell { min-height: 102px; }
  .request-card { grid-template-columns: 85px 1fr; }
  .workforce-board { grid-template-columns: 1fr; }
  .workforce-rows { max-height: 360px; }
  .request-card > :nth-child(3), .request-card > :nth-child(4) { grid-column: 2; }
  .request-actions { justify-content: flex-start; }
  .mobile-nav { display: grid; grid-template-columns: repeat(var(--mobile-nav-count, 5), 1fr); position: fixed; bottom: 0; left: 0; right: 0; height: 64px; background: #fff; border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .mobile-nav button { border: 0; background: transparent; color: #6b7680; font-size: 11px; display: grid; place-content: center; gap: 3px; }
  .mobile-nav button span { font-size: 19px; }
  .mobile-nav button.active { color: var(--blue); font-weight: 700; }
}

@media (max-width: 560px) {
  .auth-shell { padding: 0; background: #fff; place-items: start stretch; }
  .auth-panel { width: 100%; min-height: 100vh; border: 0; box-shadow: none; padding: 28px 22px; }
  .topbar { height: 54px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 10px; }
  .avatar { width: 30px; height: 30px; }
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 12px; }
  .head-actions .primary-button { flex: 1; }
  .month-switcher { order: -1; width: 100%; grid-template-columns: 36px 1fr 36px; }
  .schedule-actions { grid-template-columns: 1fr auto; }
  .schedule-actions .month-switcher { grid-column: 1 / -1; }
  .schedule-actions > select { min-width: 0; width: 100%; }
  .schedule-calendar-panel .weekday-row { height: 30px; font-size: 10px; }
  .schedule-calendar-grid .day-cell { min-height: 70px; padding: 27px 3px 3px; }
  .schedule-calendar-grid .day-number { top: 3px; left: 3px; width: 20px; height: 20px; font-size: 10px; }
  .schedule-day-content { min-height: 38px; }
  #todayButton { display: none; }
  .summary-strip { display: flex; overflow-x: auto; scrollbar-width: none; }
  .summary-strip::-webkit-scrollbar { display: none; }
  .summary-item { min-width: 112px; min-height: 62px; padding: 10px 12px; border-bottom: 0; }
  .summary-item strong { font-size: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full, .check-label { grid-column: 1; }
  .request-card { grid-template-columns: 1fr; gap: 8px; }
  .request-card > :nth-child(3), .request-card > :nth-child(4) { grid-column: 1; }
}
