:root {
  color-scheme: light;
  font-family: Arial, "Noto Sans KR", sans-serif;
  color: #18212f;
  background: #edf2f3;
  font-synthesis: none;
  --ink: #18212f;
  --muted: #637083;
  --line: #d8e0e4;
  --surface: #ffffff;
  --surface-soft: #f5f8f8;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --blue: #0369a1;
  --amber: #b45309;
  --red: #b91c1c;
  --green: #047857;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #edf2f3;
  color: var(--ink);
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(3, 105, 161, 0.28);
  outline-offset: 2px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 6px;
  background: #202020;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.34);
}
.login-intro .brand-logo { width: 58px; height: 58px; }
.brand strong { display: block; font-size: 19px; line-height: 1.05; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 520px);
  min-height: 100vh;
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8vw;
  background: #dce9e7;
  border-right: 1px solid #cad8d7;
}

.login-intro h1 {
  max-width: 620px;
  margin: 56px 0 18px;
  font-size: 42px;
  line-height: 1.24;
}

.login-intro p {
  max-width: 620px;
  margin: 0;
  color: #465466;
  font-size: 18px;
  line-height: 1.75;
}

.shift-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid #b9ccc9;
  color: #344153;
}

.shift-strip span { white-space: nowrap; }
.shift-strip b { color: var(--primary-dark); }

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
  background: var(--surface);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  margin-bottom: 32px;
  background: #e9eef0;
  border-radius: 7px;
}

.segmented button {
  min-height: 44px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5d6877;
  font-weight: 700;
  cursor: pointer;
}

.segmented button.active { background: white; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }

.login-form { display: grid; gap: 20px; }
.login-form h2 { margin: 0 0 4px; font-size: 24px; }
.dialog-lead { margin: 0; color: #344153; font-size: 16px; line-height: 1.65; }
.device-registration-points { display: grid; gap: 10px; margin: 0; padding-left: 22px; color: #536173; line-height: 1.6; }

label {
  display: grid;
  gap: 8px;
  color: #344153;
  font-size: 14px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5dc;
  border-radius: 6px;
  background: white;
  color: var(--ink);
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: white; border-color: #b9c5cc; color: #263444; }
.button.secondary:hover { background: #f2f6f7; }
.button.danger { background: #fff1f2; border-color: #fecdd3; color: var(--red); }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.button.large { min-height: 52px; margin-top: 6px; font-size: 17px; }
.button:disabled { cursor: not-allowed; opacity: 0.55; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px max(20px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.header-actions { display: flex; align-items: center; gap: 9px; }
.signed-user { color: #445164; font-size: 14px; font-weight: 700; }

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid #ccd6dc;
  border-radius: 6px;
  background: white;
  color: #344153;
  font-size: 22px;
  cursor: pointer;
}

.icon-button:hover { background: #f2f6f7; }

.app-main {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.today-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 28px;
  border-left: 5px solid var(--primary);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

h1, h2, h3 { letter-spacing: 0; }
.today-band h1, .admin-title-row h1 { margin: 0; font-size: 28px; }
.today-schedule { margin: 8px 0 0; color: var(--muted); }

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.neutral { background: #eef2f5; color: #526071; }
.status-badge.good { background: #ecfdf5; color: var(--green); }
.status-badge.warn { background: #fff7ed; color: var(--amber); }
.status-badge.bad { background: #fef2f2; color: var(--red); }
.status-badge.info { background: #eff6ff; color: var(--blue); }

.attendance-panel {
  display: grid;
  grid-template-columns: 180px minmax(420px, 1fr) minmax(230px, 300px);
  align-items: center;
  gap: 26px;
  margin-top: 14px;
  padding: 24px 28px;
  background: #172b35;
  color: white;
}

.live-clock span { display: block; color: #b8c7ce; font-size: 13px; }
.live-clock strong { display: block; margin-top: 5px; font-size: 30px; font-variant-numeric: tabular-nums; }

.attendance-times {
  display: grid;
  grid-template-columns: repeat(4, minmax(85px, 1fr));
  border-left: 1px solid #3b5059;
}

.attendance-times div { padding: 3px 18px; border-right: 1px solid #3b5059; }
.attendance-times span { display: block; color: #aebdc4; font-size: 12px; }
.attendance-times strong { display: block; margin-top: 6px; font-size: 17px; font-variant-numeric: tabular-nums; }
.attendance-action { min-height: 58px; font-size: 18px; }
.attendance-panel .panel-note { grid-column: 1 / -1; margin: -10px 0 0; color: #aebdc4; }

.panel-note { color: var(--muted); font-size: 13px; line-height: 1.55; }

.worker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  margin-top: 30px;
}

.plain-section, .admin-tab-panel {
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.section-heading, .admin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-heading h2 { margin: 0; font-size: 21px; }
.section-heading input { max-width: 230px; }
.month-input, .date-input { width: auto; min-width: 150px; }

.record-list, .request-list { display: grid; gap: 0; }
.record-row, .request-row {
  display: grid;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 4px;
  border-bottom: 1px solid #e6ebee;
}

.record-row { grid-template-columns: 110px 70px 1fr auto; }
.record-row:last-child, .request-row:last-child { border-bottom: 0; }
.record-row strong, .request-row strong { font-size: 14px; }
.record-row span, .request-row span { color: var(--muted); font-size: 13px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.admin-main { padding-top: 28px; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.stats-row div { min-height: 96px; padding: 19px 22px; border-right: 1px solid var(--line); }
.stats-row div:last-child { border-right: 0; }
.stats-row span { display: block; color: var(--muted); font-size: 13px; }
.stats-row strong { display: block; margin-top: 8px; font-size: 29px; font-variant-numeric: tabular-nums; }

.admin-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: white;
}

.admin-tabs button {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 11px 20px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: white;
  color: #536173;
  font-weight: 800;
  cursor: pointer;
}

.admin-tabs button.active { border-bottom-color: var(--primary); color: var(--primary-dark); }
.admin-tab-panel { border-top: 0; }

.monthly-toolbar, .monthly-filter-row, .monthly-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.monthly-toolbar { justify-content: space-between; margin-bottom: 18px; }
.monthly-toolbar h2 { margin: 0; font-size: 21px; }
.monthly-actions { flex-wrap: wrap; justify-content: flex-end; }
.monthly-filter-row { justify-content: space-between; margin: 20px 0 12px; }
.segmented.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: auto;
  min-width: 240px;
  margin-bottom: 0;
  padding: 3px;
}
.segmented.compact button { min-height: 34px; padding: 6px 14px; font-size: 13px; }
.monthly-stats { margin-bottom: 0; }
.monthly-table { min-width: 1080px; }

.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.employee-table { min-width: 900px; }
.employee-table th, .employee-table td { padding-right: 9px; padding-left: 9px; }
.data-table th {
  padding: 12px 14px;
  border-bottom: 2px solid #cfd8de;
  background: #f3f6f7;
  color: #334155;
  font-size: 13px;
  text-align: center;
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid #e3e9ec; font-size: 14px; text-align: center; }
.data-table td:nth-child(2) { text-align: left; }
.data-table tr:hover td { background: #fafcfc; }
#employeeTableBody td:first-child { text-align: left; }
.employee-section-heading { margin-bottom: 22px; }
.table-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; min-width: 108px; }

.split-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; }
.side-form { display: grid; align-content: start; gap: 14px; padding-right: 28px; border-right: 1px solid var(--line); }
.side-form h2, .settings-block h2 { margin: 0 0 4px; font-size: 20px; }

.request-row { grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) auto; }
.request-copy { display: grid; gap: 4px; }
.request-actions { display: flex; gap: 7px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.settings-block { display: grid; align-content: start; gap: 14px; }
.settings-list { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.settings-list div { padding: 13px 0; border-bottom: 1px solid #e4eaed; }
.settings-list dt { color: var(--muted); font-size: 12px; }
.settings-list dd { margin: 5px 0 0; font-weight: 800; }
.holiday-list { display: grid; margin-top: 4px; }
.holiday-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #e4eaed; }

.assignment-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
}
.assignment-dialog::backdrop { background: rgba(15, 23, 42, 0.58); }
.assignment-form { display: grid; gap: 20px; padding: 24px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.dialog-heading h2 { margin: 0; font-size: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.assignment-history-section { padding-top: 18px; border-top: 1px solid var(--line); }
.assignment-history-section h3 { margin: 0 0 10px; font-size: 16px; }
.assignment-history { display: grid; max-height: 220px; overflow-y: auto; }
.assignment-history-row {
  display: grid;
  grid-template-columns: minmax(125px, auto) 1fr auto;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid #e4eaed;
  font-size: 13px;
}
.assignment-history-row strong { font-size: 14px; }
.assignment-history-row span { color: var(--muted); }

.guide-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding: 12px max(24px, calc((100vw - 920px) / 2));
  border-bottom: 1px solid var(--line);
  background: white;
}
.guide-page {
  width: min(860px, calc(100% - 32px));
  margin: 32px auto 64px;
  padding: 52px 58px;
  background: white;
  border: 1px solid var(--line);
}
.guide-title { padding-bottom: 28px; border-bottom: 3px solid var(--primary); }
.guide-title .brand { margin-bottom: 34px; }
.guide-title h1 { margin: 0; font-size: 34px; line-height: 1.3; }
.guide-title > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.guide-identity {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 26px 0 6px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.guide-identity div { display: grid; gap: 9px; padding: 16px; border-right: 1px solid var(--line); }
.guide-identity div:last-child { border-right: 0; }
.guide-identity span { color: var(--muted); font-size: 12px; font-weight: 700; }
.guide-identity strong { font-size: 15px; }
.guide-section { padding: 30px 0; border-bottom: 1px solid var(--line); }
.guide-section h2 { margin: 0 0 18px; font-size: 22px; }
.guide-steps, .guide-warning ul { display: grid; gap: 13px; margin: 0; padding-left: 25px; line-height: 1.65; }
.guide-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.guide-columns div { padding-left: 16px; border-left: 4px solid #b8d3d0; }
.guide-columns strong { font-size: 17px; }
.guide-columns p { margin: 8px 0 0; color: #4f5d6e; line-height: 1.65; }
.guide-warning { margin-top: 6px; padding: 28px 26px; border: 1px solid #f2c8a6; background: #fffaf5; }
.guide-warning h2 { color: #92400e; }
.guide-footer { display: flex; gap: 18px; padding-top: 26px; color: #4f5d6e; line-height: 1.55; }
.guide-footer strong { flex: 0 0 auto; color: var(--ink); }

.loading-row, .empty-row { padding: 26px 8px; color: var(--muted); text-align: center; }
.muted { color: var(--muted); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 6px;
  background: #172b35;
  color: white;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.26);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }

@media (max-width: 980px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: 330px; padding: 48px 7vw; border-right: 0; border-bottom: 1px solid #cad8d7; }
  .login-intro h1 { margin-top: 38px; font-size: 34px; }
  .login-panel { padding: 44px 7vw 64px; }
  .attendance-panel { grid-template-columns: 150px 1fr; }
  .attendance-action { grid-column: 1 / -1; }
  .worker-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .stats-row div:nth-child(3) { border-right: 0; }
  .stats-row div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .split-layout, .settings-grid { grid-template-columns: 1fr; }
  .side-form { padding-right: 0; padding-bottom: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .login-intro { min-height: 290px; padding: 32px 22px; }
  .login-intro h1 { margin: 28px 0 12px; font-size: 28px; }
  .login-intro p { font-size: 15px; }
  .shift-strip { margin-top: 24px; font-size: 13px; }
  .login-panel { padding: 32px 22px 48px; }
  .app-header { min-height: 62px; padding: 8px 16px; }
  .signed-user { display: none; }
  .app-main { width: min(100% - 20px, 1320px); padding: 18px 0 42px; }
  .today-band { align-items: flex-start; padding: 20px; }
  .today-band h1, .admin-title-row h1 { font-size: 23px; }
  .attendance-panel { grid-template-columns: 1fr; gap: 18px; padding: 22px 18px; }
  .attendance-times { grid-template-columns: 1fr 1fr; border-left: 0; }
  .attendance-times div { padding: 10px 12px; border: 1px solid #3b5059; margin: -1px 0 0 -1px; }
  .attendance-action { grid-column: auto; min-height: 62px; }
  .plain-section, .admin-tab-panel { padding: 19px 15px; }
  .section-heading, .admin-title-row { align-items: flex-start; flex-direction: column; }
  .section-heading input, .admin-title-row input { width: 100%; max-width: none; }
  .record-row { grid-template-columns: 88px 58px 1fr; }
  .record-row > :last-child { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .assignment-dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); }
  .assignment-form { padding: 18px 15px; }
  .dialog-actions .button { flex: 1; }
  .assignment-history-row { grid-template-columns: 1fr; gap: 4px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row div { min-height: 84px; border-bottom: 1px solid var(--line); }
  .stats-row div:nth-child(2n) { border-right: 0; }
  .stats-row div:last-child { border-bottom: 0; }
  .request-row { grid-template-columns: 1fr; }
  .request-actions { width: 100%; }
  .request-actions .button { flex: 1; }
  .settings-list { grid-template-columns: 1fr; }
  .monthly-toolbar, .monthly-filter-row { align-items: stretch; flex-direction: column; }
  .monthly-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .monthly-actions .month-input { grid-column: 1 / -1; width: 100%; }
  .segmented.compact { width: 100%; }
  .guide-toolbar { padding: 10px 14px; }
  .guide-toolbar .brand { display: none; }
  .guide-page { width: 100%; margin: 0; padding: 32px 20px 48px; border: 0; }
  .guide-title h1 { font-size: 27px; }
  .guide-identity, .guide-columns { grid-template-columns: 1fr; }
  .guide-identity div { border-right: 0; border-bottom: 1px solid var(--line); }
  .guide-identity div:last-child { border-bottom: 0; }
  .guide-footer { flex-direction: column; gap: 6px; }
}

@media print {
  @page { size: A4; margin: 15mm; }
  body { min-width: 0; background: white; color: #111827; }
  .no-print, .toast { display: none !important; }
  .guide-page { width: auto; margin: 0; padding: 0; border: 0; }
  .guide-title { padding-bottom: 20px; }
  .guide-title .brand { margin-bottom: 22px; }
  .guide-title h1 { font-size: 28px; }
  .guide-section { padding: 21px 0; break-inside: avoid; }
  .guide-warning { padding: 20px; }
}
