:root {
  color-scheme: light;
  --ink: #101827;
  --muted: #6f7480;
  --line: #dfe3e8;
  --line-strong: #ccd3dc;
  --panel: #ffffff;
  --field: #f6f3f4;
  --surface: #fbf7f8;
  --navy: #061527;
  --green: #079447;
  --green-soft: #dff8ea;
  --orange: #ff6b00;
  --orange-soft: #fff0e7;
  --red: #df1f26;
  --red-soft: #fff4f4;
  font-family:
    Inter, Pretendard, "Segoe UI", "Noto Sans KR", system-ui, -apple-system,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f6f8fa;
}

body.modal-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
ol {
  margin: 0;
}

.app-shell {
  position: relative;
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  overflow: clip;
  border: 0;
  border-radius: 0;
  background: #f6f8fa;
  box-shadow: none;
}

.app-header {
  display: grid;
  min-height: 74px;
  place-items: center;
  border-bottom: 1px solid var(--line);
  background: #fffafa;
}

.app-header h1 {
  font-size: 1.26rem;
  font-weight: 950;
  letter-spacing: 0;
}

.tab-panels {
  min-height: calc(100vh - 74px);
  padding-bottom: 96px;
}

.tab-panel {
  display: none;
  padding: 16px 18px 24px;
}

.tab-panel.is-active {
  display: block;
}

.summary-card,
.profile-card,
.settings-card,
.emergency-card {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(16, 24, 39, 0.08);
}

.date-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  font-weight: 900;
}

.date-card span {
  text-align: right;
}

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

.qr-card {
  display: grid;
  min-height: 122px;
  place-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  font-weight: 850;
}

.qr-card:active,
.tab-button:active,
.modal-action:active {
  transform: translateY(1px);
}

.qr-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.weather-card,
.progress-card,
.rules-card {
  margin-top: 14px;
  padding: 18px 16px;
}

.section-title-row,
.stage-head,
.progress-label,
.timeline-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-title-row h2,
.stage-head h2,
.schedule-heading h2,
.safety-section h2,
.settings-card h2,
.emergency-card h2 {
  font-size: 1rem;
  font-weight: 950;
}

.section-title-row p,
.weather-risk p,
.profile-zone small {
  color: var(--muted);
}

.warning-pill,
.success-pill,
.emergency-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.82rem;
  font-weight: 950;
}

.warning-pill {
  color: #6b3b00;
  background: #ffddb0;
}

.success-pill {
  color: #fff;
  background: var(--green);
}

.weather-risk {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 14px;
  margin: 24px 0;
  padding-bottom: 18px;
  border-bottom: 1px solid #eceff2;
}

.sun-icon {
  color: #0b1320;
  font-size: 3rem;
  line-height: 1;
}

.weather-risk strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 950;
}

.weather-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.weather-metric {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 66px;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #f1ecef;
}

.weather-metric span {
  font-size: 1.3rem;
  font-weight: 950;
  text-align: center;
}

.weather-metric small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-weight: 850;
}

.weather-metric strong {
  font-size: 1.05rem;
}

.weather-metric.green strong,
.weather-metric.green span {
  color: var(--green);
}

.weather-metric.red strong,
.weather-metric.red span {
  color: var(--red);
}

.weather-metric.orange strong,
.weather-metric.orange span {
  color: #ff8a00;
}

.stage-head {
  margin-bottom: 20px;
}

.stage-head span:not(.success-pill) {
  color: var(--muted);
  font-weight: 850;
}

.progress-label {
  margin-bottom: 8px;
  color: var(--muted);
}

.progress-label strong {
  color: var(--ink);
}

.progress-track,
.timeline-progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #ebe8eb;
}

.progress-track span,
.timeline-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--navy);
}

.timeline li.done .timeline-progress span {
  background: var(--green);
}

.stage-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 26px;
}

.stage-breakdown div {
  display: grid;
  min-height: 48px;
  place-items: center;
  gap: 2px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.stage-breakdown div:last-child {
  border-right: 0;
}

.stage-breakdown strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-rule-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mini-rule-list article {
  display: grid;
  grid-template-columns: 34px 1fr 24px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
}

.mini-rule-list span {
  color: #61748c;
  font-size: 1.2rem;
}

.mini-rule-list em {
  color: var(--green);
  font-style: normal;
  font-size: 1.05rem;
}

.schedule-heading {
  margin: 4px -18px 20px;
  padding: 18px 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.schedule-heading p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1.12rem;
  font-weight: 650;
}

.timeline {
  display: grid;
  gap: 14px;
  padding: 0 0 0 4px;
  list-style: none;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 4px;
}

.timeline li::before {
  position: absolute;
  top: 0;
  bottom: -14px;
  left: 55px;
  width: 2px;
  background: #dbeeff;
  content: "";
}

.timeline li:last-child::before {
  bottom: 0;
}

.timeline time {
  padding-top: 11px;
  color: #5b6069;
  font-weight: 900;
}

.timeline article {
  position: relative;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 39, 0.08);
}

.timeline li.active article {
  border-left: 4px solid var(--orange);
}

.timeline li.todo article {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.timeline h3 {
  font-size: 1rem;
  font-weight: 950;
}

.timeline p {
  margin-top: 12px;
  color: #5b6069;
  font-size: 1.14rem;
}

.timeline-title span {
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 0.72rem;
  font-weight: 950;
}

.timeline li.active .timeline-title span {
  color: #c34800;
  background: var(--orange-soft);
}

.timeline li.break .timeline-title span {
  color: #9aa0a7;
  background: transparent;
  font-size: 1.4rem;
}

.timeline li.todo .timeline-title span {
  color: #8c8589;
  background: #eee9eb;
}

.timeline-progress-label {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  color: #4f5967;
  font-size: 0.82rem;
  font-weight: 900;
}

.timeline-progress {
  margin-top: 8px;
}

.timeline li.active .timeline-progress span {
  background: var(--orange);
}

.alert-box {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px;
  margin: 6px 4px 20px;
  padding: 18px;
  border: 1px solid #ff7676;
  border-radius: 4px;
  background: #fff;
}

.alert-box > span,
.alert-box strong {
  color: var(--red);
}

.alert-box > span {
  font-size: 2rem;
}

.alert-box strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.alert-box p {
  color: #444b55;
  font-weight: 700;
}

.safety-section h2 {
  margin-bottom: 16px;
}

.safety-rule-list {
  display: grid;
  gap: 14px;
}

.safety-rule-list article {
  display: grid;
  grid-template-columns: 52px 1fr 28px;
  align-items: center;
  gap: 16px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 39, 0.06);
}

.rule-icon,
.profile-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #fff;
  background: #182436;
  font-size: 1.35rem;
}

.safety-rule-list strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.safety-rule-list p {
  color: #4a5260;
  font-size: 0.86rem;
  font-weight: 750;
}

.safety-rule-list em {
  color: #7c8da5;
  font-style: normal;
  font-size: 1.45rem;
}

.emergency-card {
  margin-top: 20px;
  padding: 18px;
  background: #f4eff1;
}

.emergency-badge {
  color: #fff;
  background: var(--red);
}

.manager-call {
  display: grid;
  grid-template-columns: 52px 1fr 62px;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.manager-call .profile-icon {
  border-radius: 12px;
  color: var(--ink);
  background: #ebe9eb;
}

.manager-call strong {
  display: block;
  margin-bottom: 3px;
}

.manager-call p {
  font-weight: 800;
}

.manager-call a {
  display: grid;
  height: 62px;
  place-items: center;
  border-radius: 4px;
  color: #fff;
  background: var(--navy);
  text-decoration: none;
  font-size: 1.35rem;
}

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

.emergency-actions button {
  min-height: 74px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
}

.profile-card {
  display: grid;
  margin-bottom: 16px;
  padding: 22px 18px;
}

.profile-card:first-child {
  place-items: center;
  gap: 6px;
}

.profile-card:first-child strong {
  font-size: 1.45rem;
}

.profile-card:first-child span {
  font-size: 1.22rem;
  font-weight: 900;
}

.profile-zone {
  grid-template-columns: 60px 1fr;
  align-items: center;
  gap: 16px;
}

.profile-zone .profile-icon {
  color: #3c4655;
  background: #f0ecef;
}

.profile-zone small {
  display: block;
  margin-bottom: 4px;
  font-weight: 850;
}

.profile-zone strong {
  font-size: 1.2rem;
}

.settings-card {
  margin-bottom: 28px;
  padding: 18px;
}

.settings-card button {
  display: flex;
  width: 100%;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  border: 0;
  color: #333943;
  background: transparent;
  text-align: left;
}

.settings-card button span {
  font-weight: 850;
}

.settings-card button strong {
  font-size: 2rem;
}

.secondary-action,
.logout-button {
  width: 100%;
  min-height: 72px;
  margin-top: 0;
  border-radius: 4px;
  background: #fff;
  font-size: 1.05rem;
  font-weight: 950;
}

.secondary-action {
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  color: var(--navy);
}

.secondary-action[hidden] {
  display: none;
}

.logout-button {
  border: 1px solid #ff6f6f;
  color: var(--red);
}

.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  min-height: 86px;
  transform: none;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 250, 0.96);
  z-index: 6;
}

.tab-button {
  display: grid;
  place-items: center;
  gap: 4px;
  border: 0;
  color: #6f7480;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 950;
}

.tab-button span {
  display: grid;
  width: 48px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  font-size: 1.45rem;
}

.tab-button.is-active {
  color: var(--navy);
}

.tab-button.is-active span {
  color: #fff;
  background: var(--navy);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10;
}

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

.qr-modal {
  position: relative;
  width: min(100%, 398px);
  padding: 26px 24px 28px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(6, 21, 39, 0.32);
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  color: #4f5663;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
}

.qr-modal > p:first-of-type {
  color: #555d6a;
  font-size: 0.86rem;
  font-weight: 900;
}

.qr-modal h2 {
  margin: 6px 0 20px;
  font-size: 1.55rem;
  font-weight: 950;
}

.qr-frame {
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  width: min(100%, 292px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #f3f4f6;
}

.qr-frame span {
  background: #fff;
}

.qr-frame span.dark {
  background: #111;
}

.qr-help {
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.modal-action {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: var(--navy);
  font-weight: 900;
}

@media (min-width: 680px) {
  body {
    padding: 0;
    background: #f6f8fa;
  }

  .app-shell {
    width: 100%;
    min-height: 100vh;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #f6f8fa;
    box-shadow: none;
  }

  .app-header {
    min-height: 78px;
    background: #fff;
  }

  .tab-panels {
    min-height: calc(100vh - 78px);
    padding-bottom: 108px;
  }

  .tab-panel {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 24px;
  }

  #panel-dashboard.is-active {
    display: grid;
    grid-template-columns: 0.82fr 1.18fr;
    align-items: start;
    gap: 16px;
  }

  #panel-dashboard .date-card,
  #panel-dashboard .qr-actions {
    grid-column: 1;
  }

  #panel-dashboard .weather-card {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  #panel-dashboard .progress-card {
    grid-column: 1 / -1;
  }

  #panel-dashboard .rules-card {
    grid-column: 1 / -1;
  }

  .date-card,
  .weather-card,
  .progress-card,
  .rules-card {
    margin-top: 0;
  }

  .qr-actions {
    margin-top: 0;
  }

  .qr-card {
    min-height: 150px;
  }

  .weather-risk {
    min-height: 118px;
  }

  .weather-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stage-breakdown {
    max-width: 620px;
    margin-right: auto;
    margin-left: auto;
  }

  #panel-schedule,
  #panel-safety,
  #panel-profile {
    width: min(100%, 880px);
  }

  .bottom-tabs {
    left: 0;
    width: 100%;
    min-height: 82px;
    transform: none;
    box-shadow: 0 -10px 26px rgba(16, 24, 39, 0.08);
  }
}

@media (max-width: 380px) {
  .tab-panel {
    padding-right: 12px;
    padding-left: 12px;
  }

  .weather-metrics,
  .qr-actions,
  .emergency-actions {
    grid-template-columns: 1fr;
  }

  .timeline li {
    grid-template-columns: 58px 1fr;
  }

  .timeline li::before {
    left: 46px;
  }
}
