@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

:root {
  --brand: #243570;
  --brand-2: #1689b1;
  --brand-soft: #edf4fb;
  --ink: #172033;
  --muted: #657087;
  --subtle: #8b95a7;
  --line: #e3e8ef;
  --line-dark: #cbd4e0;
  --canvas: #f6f8fb;
  --panel: #fff;
  --success: #16875d;
  --warning: #b76a10;
  --danger: #bf3d4d;
  --shadow: 0 12px 34px rgba(26, 43, 72, .055);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Pretendard, "Pretendard Variable", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  letter-spacing: -.02em;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
  padding: 0 8px 22px;
  border-bottom: 1px solid #eef2f7;
}
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand strong { display: block; font-size: 17px; font-weight: 850; letter-spacing: -.04em; }
.brand span {
  display: block;
  margin-top: 3px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}
.side-nav { display: grid; gap: 4px; }
.nav-item {
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  color: #59657a;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}
.nav-item:hover { background: #f7f9fc; color: var(--ink); }
.nav-item.active {
  color: var(--brand);
  border-color: #dce4f0;
  background: linear-gradient(90deg, #eef5fc 0%, #f8fbff 100%);
  font-weight: 800;
}
.nav-icon {
  width: 16px;
  height: 16px;
  position: relative;
  flex: 0 0 auto;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: .72;
}
.nav-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 5px;
  height: 1.5px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}
.nav-item[data-page="estimate"] .nav-icon::after {
  left: 4px; right: 4px; top: 8px; box-shadow: none;
}
.nav-item[data-page="estimate"] .nav-icon::before {
  content: "";
  position: absolute;
  top: 4px; bottom: 4px; left: 8px;
  width: 1.5px; background: currentColor;
}
.nav-item[data-page="reports"] .nav-icon::after {
  left: 3px; right: 3px; top: auto; bottom: 4px; height: 6px;
  background: linear-gradient(90deg, currentColor 0 20%, transparent 20% 38%, currentColor 38% 62%, transparent 62% 78%, currentColor 78%);
  box-shadow: none;
}
.nav-section {
  margin: 19px 10px 7px;
  color: #9aa3b2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}
.sidebar-foot {
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfcff 0%, #f5f8fc 100%);
}
.db-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}
.db-row strong { color: var(--ink); }
.sidebar-foot small { color: var(--subtle); font-size: 11px; }

.app-main { min-width: 0; }
.topbar {
  height: 78px;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.eyebrow {
  margin-bottom: 5px;
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .11em;
}
.topbar h1 { margin: 0; font-size: 23px; font-weight: 800; }
.mobile-menu-button {
  display: none;
  min-height: 39px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--brand);
  border: 1px solid #cfd8e6;
  border-radius: 2px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}
.mobile-menu-button img { width: 24px; height: 24px; object-fit: contain; }
.top-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: 52px;
  padding: 6px;
  border: 1px solid #edf1f6;
  border-radius: 14px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 8px 24px rgba(30,45,84,.055);
}
.icon-button {
  min-height: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--brand);
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #f9fbff;
  font-weight: 800;
}
.sync-state {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.sync-state i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--success);
}
.sync-state.checking i,
.sync-state.syncing i { background: #d89a2b; }
.sync-state.offline i,
.sync-state.error i { background: #c95f5f; }
.sync-state.synced {
  color: #17765b;
  border-color: #bddfd3;
  background: #f1faf7;
}
.sync-state.syncing {
  color: #8a641c;
  border-color: #ead6a7;
  background: #fffaf0;
}
.sync-state.offline,
.sync-state.error {
  color: #a14343;
  border-color: #ecc8c8;
  background: #fff5f5;
}
.profile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 0 0 10px;
  border-left: 1px solid #edf1f6;
}
.profile-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 8px;
  background: var(--brand);
  font-size: 12px;
  font-weight: 800;
}
.profile strong { display: block; font-size: 12px; }
.profile small { color: var(--subtle); font-size: 11px; }
.logout-button {
  min-height: 38px;
  height: 38px;
  padding: 0 11px;
  color: #59657a;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}
.logout-button:hover {
  color: var(--brand);
  border-color: #d5deea;
  background: #f8fbff;
}

.content {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 28px 32px 48px;
}
.page-intro {
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}
.page-intro h2 { margin: 0 0 7px; font-size: 22px; }
.page-intro p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.page-actions { display: flex; gap: 9px; }

.button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 2px;
  font-size: 15px;
  font-weight: 800;
}
.button.primary { color: #fff; border: 1px solid var(--brand); background: var(--brand); }
.button.primary:hover { background: #1b2859; }
.button.secondary { color: var(--ink); border: 1px solid var(--line-dark); background: #fff; }
.button.soft { color: var(--brand); border: 1px solid #cedaeb; background: var(--brand-soft); }
.button.danger { color: var(--danger); border: 1px solid #ebc8ce; background: #fff; }
.button.small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .45; }

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.step {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  position: relative;
  color: #7b8597;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.step:last-child { border-right: 0; }
.step-number {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid #cfd6e0;
  border-radius: 2px;
  background: #f7f8fa;
  font-size: 13px;
  font-weight: 850;
}
.step strong { display: block; color: inherit; font-size: 14px; }
.step small { display: block; margin-top: 3px; font-size: 11px; }
.step.active { color: var(--brand); background: #f5f8fc; }
.step.active .step-number { color: #fff; border-color: var(--brand); background: var(--brand); }
.step.done { color: var(--success); }
.step.done .step-number { color: var(--success); border-color: #acd5c5; background: #edf9f4; }

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 13px;
}
.panel-header {
  min-height: 68px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.panel-header > div { min-width: 0; }
.panel-header .button { flex-shrink: 0; }
.panel-header h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.025em; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 18px; }
.panel-footer {
  padding: 14px 19px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}
.estimate-layout {
  display: grid;
  grid-template-columns: 340px minmax(560px, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.two-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sticky { position: sticky; top: 104px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #3c4658;
  font-size: 12px;
  font-weight: 800;
}
.field label em { color: var(--brand-2); font-style: normal; font-size: 11px; }
.control {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  background: #fff;
  outline: none;
  font-size: 14px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea.control { height: 84px; padding-top: 10px; resize: vertical; }
.control:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(22,137,177,.1); }
.control[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
  color: #172033;
  font-weight: 700;
}
.control[type="number"]::-webkit-outer-spin-button,
.control[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
.money-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.inline-fields { display: grid; grid-template-columns: minmax(92px, .9fr) minmax(92px, 1.1fr); gap: 8px; }
.inline-fields input { min-width: 92px; font-variant-numeric: tabular-nums; }
.inline-fields select { min-width: 92px; }
.total-length {
  color: var(--brand);
  background: #f4f7fb;
  font-weight: 800;
}
.stage-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  overflow: hidden;
}
.stage-option {
  min-height: 41px;
  color: #657087;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 750;
}
.stage-option:last-child { border-right: 0; }
.stage-option:hover { color: var(--brand); background: #f6f8fb; }
.stage-option.active { color: #fff; background: linear-gradient(135deg, var(--brand), #31508d); }
.price-stage-panel {
  margin-bottom: 18px;
}
.price-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.price-stage-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
}
.price-stage-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.price-stage-selector {
  width: min(420px, 100%);
  flex-shrink: 0;
}
.stage-price-notice {
  margin-top: 10px;
  padding: 10px 11px;
  display: grid;
  gap: 3px;
  color: #24604e;
  border: 1px solid #bddfd3;
  border-left: 3px solid var(--success);
  border-radius: 0 7px 7px 0;
  background: #f1faf7;
  font-size: 11px;
  line-height: 1.45;
}
.stage-price-notice strong { color: #176349; font-size: 11px; }
.stage-price-notice span { color: #44665d; }
.stage-price-notice.warning {
  color: #855313;
  border-color: #efd3a8;
  border-left-color: var(--warning);
  background: #fff8ee;
}
.stage-price-notice.warning strong { color: #8d5510; }
.stage-price-notice.warning span { color: #75532d; }
.segment-card {
  padding: 14px;
  border: 1px solid #dbe3ed;
  border-left: 3px solid var(--brand-2);
  border-radius: 0 8px 8px 0;
  background: #f9fbfd;
}
.segment-head {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.segment-head strong { color: #344056; font-size: 13px; }
.segment-head span { color: var(--muted); }
.segment-head b { color: var(--success); font-size: 13px; }
.segment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.segment-field label {
  display: block;
  margin-bottom: 5px;
  color: #758096;
  font-size: 10px;
  font-weight: 750;
}
.segment-field .control { height: 38px; text-align: right; }
.segment-status {
  margin-top: 11px;
  padding: 9px 10px;
  color: #187759;
  border: 1px solid #b9dfd1;
  border-radius: 6px;
  background: #f0faf6;
  font-size: 11px;
  line-height: 1.45;
}
.lod-guide {
  margin-top: 15px;
  padding: 12px 13px;
  border: 1px solid #d8e2ef;
  border-radius: 7px;
  background: #f5f8fc;
}
.lod-guide strong { display: block; color: var(--brand); font-size: 12px; }
.lod-guide span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-box {
  margin-top: 17px;
  padding: 14px;
  color: #44516a;
  border-left: 3px solid var(--brand-2);
  border-radius: 0 7px 7px 0;
  background: #f2f7fb;
  font-size: 13px;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.search-control { min-width: 210px; flex: 1; }
.search-wrap { position: relative; min-width: 210px; flex: 1; }
.search-wrap .search-control { width: 100%; min-width: 0; }
.search-suggestions {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(22,36,62,.13);
}
.search-suggestions.open { display: grid; }
.suggestion-button {
  min-height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #3d4960;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
}
.suggestion-button:hover, .suggestion-button.active { color: var(--brand); background: #f1f6fb; }
.suggestion-button small { color: var(--subtle); font-size: 11px; }
.category-tabs {
  display: flex;
  gap: 7px;
  padding: 13px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.tab-button, .status-badge {
  white-space: nowrap;
  border-radius: 2px;
}
.tab-button {
  min-height: 34px;
  padding: 0 12px;
  color: #616d82;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 750;
}
.tab-button.active { color: #fff; border-color: var(--brand); background: var(--brand); }

.table-wrap { overflow: auto; }
.table-wrap.tall { max-height: 575px; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.35;
}
.data-table th {
  padding: 12px 14px;
  position: sticky;
  top: 0;
  z-index: 2;
  color: #47566f;
  border-bottom: 1px solid var(--line);
  background: #f4f7fb;
  text-align: left;
  font-size: 12.5px;
  font-weight: 800;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f4;
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: #fafcff; }
.data-table .right { text-align: right; }
.data-table .center { text-align: center; }
.item-name strong {
  display: block;
  color: #19243a;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 850;
}
.item-name small {
  display: block;
  margin-top: 3px;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.35;
}
.price-basis {
  color: #59657a;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.checkbox { width: 18px; height: 18px; accent-color: var(--brand); }
.table-input {
  width: 88px;
  height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  text-align: right;
  font-size: 14px;
}
.table-input.price-input { width: 120px; }
.status-badge {
  display: inline-block;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 800;
}
.status-badge.ready { color: var(--success); border: 1px solid #b8decf; background: #eef9f5; }
.status-badge.empty { color: var(--warning); border: 1px solid #efd2aa; background: #fff8ee; }
.status-badge.draft { color: #5c628c; border: 1px solid #d5d8ec; background: #f4f5ff; }
.status-badge.complete { color: var(--brand); border: 1px solid #c9d5e8; background: #f0f5fb; }

.summary-hero {
  padding: 22px 20px;
  color: #fff;
  background: linear-gradient(135deg, #1c2a5e, #1689b1);
}
.summary-hero span { display: block; margin-bottom: 9px; color: #cfdeed; font-size: 12px; }
.summary-hero strong { font-size: clamp(24px, 1.85vw, 30px); line-height: 1.08; letter-spacing: -.03em; }
.summary-list { padding: 8px 19px 17px; }
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid #edf0f4;
  font-size: 14px;
}
.summary-row span { color: var(--muted); }
.summary-row strong { font-size: 15px; text-align: right; white-space: nowrap; }
.summary-row.total { padding-top: 16px; border-bottom: 0; font-size: 15px; }
.summary-row.total strong { color: var(--brand); font-size: 18px; }
.warning-box {
  margin: 0 19px 18px;
  padding: 12px;
  color: #865314;
  border: 1px solid #efd3a8;
  border-radius: 7px;
  background: #fff8ee;
  font-size: 12px;
  line-height: 1.5;
}
.workflow-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
  align-items: stretch;
}
.metric-card {
  min-height: 118px;
  padding: 18px 19px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin-top: 9px; font-size: clamp(19px, 1.65vw, 23px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-card small { display: block; margin-top: 7px; color: var(--subtle); font-size: 11px; }

.review-panel { margin: 18px 0; }
.review-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 18px;
}
.review-item {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 0 8px 8px 0;
  background: #fffaf2;
}
.review-item strong { display: block; color: #29344a; font-size: 13px; }
.review-item span { display: block; margin-top: 5px; color: #7b5a2a; font-size: 11px; line-height: 1.45; }

.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rule-card {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.rule-card h4 { margin: 0 0 6px; font-size: 16px; }
.rule-card p { min-height: 40px; margin: 0 0 15px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.rate-control { display: flex; align-items: center; gap: 8px; }
.rate-control input { width: 100%; text-align: right; }
.rate-control b { font-size: 16px; }

.chart-list { padding: 6px 0; }
.chart-row {
  display: grid;
  grid-template-columns: minmax(135px, 165px) minmax(160px, 1fr) 92px;
  align-items: center;
  gap: 16px;
  min-height: 34px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.35;
}
.chart-row span { color: #566178; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-row strong { text-align: right; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-bar { height: 10px; border-radius: 0; background: #edf1f5; overflow: hidden; }
.chart-bar i { display: block; height: 100%; border-radius: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.report-panel .panel-body { padding: 15px 20px 18px; }
.empty-state { padding: 55px 20px; color: var(--muted); text-align: center; }

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  padding: 24px;
  background: rgba(16, 25, 43, .55);
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal-panel {
  width: min(650px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 25px 80px rgba(10,20,40,.28);
}
.modal-head, .modal-foot {
  padding: 17px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; }
.modal-foot { border-top: 1px solid var(--line); background: #fafbfd; justify-content: flex-end; }

.toast {
  position: fixed;
  right: 26px;
  bottom: 24px;
  z-index: 150;
  padding: 13px 17px;
  color: #fff;
  border-radius: 2px;
  background: #172033;
  box-shadow: 0 12px 34px rgba(17,32,51,.24);
  transform: translateY(80px);
  opacity: 0;
  transition: .22s ease;
  font-size: 13px;
}
.toast.show { transform: translateY(0); opacity: 1; }

.print-stage {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 0 0 35px;
  overflow-y: auto;
  background: #e9edf2;
}
.print-stage.open { display: block; }
.print-toolbar {
  min-height: 68px;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.print-toolbar strong { display: block; }
.print-toolbar span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.print-toolbar > div:last-child { display: flex; gap: 9px; }
.quote-document {
  width: 210mm;
  min-height: 297mm;
  margin: 28px auto;
  padding: 18mm 17mm;
  color: #151b28;
  background: #fff;
  box-shadow: 0 12px 38px rgba(20,32,54,.14);
  font-family: Pretendard, "Pretendard Variable", "Noto Sans KR", "Malgun Gothic", sans-serif;
  letter-spacing: -.025em;
}
.quote-titlebar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  align-items: end;
  gap: 18px;
  padding-bottom: 8px;
  border-bottom: 3px solid #252525;
}
.quote-logo { display: flex; align-items: center; gap: 9px; }
.quote-logo img { width: 36px; height: 36px; object-fit: contain; }
.quote-logo strong {
  display: block;
  color: #0f1727;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.08em;
}
.quote-titlebar h2 {
  margin: 0;
  color: #242424;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: .12em;
}
.quote-number {
  justify-self: end;
  padding-bottom: 3px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}
.quote-summary-table {
  width: 100%;
  margin: 0 0 16px;
  border-collapse: collapse;
  border-bottom: 2px solid #252525;
  table-layout: fixed;
}
.quote-summary-table th,
.quote-summary-table td {
  height: 31px;
  padding: 7px 12px;
  border-bottom: 1px solid #e1e5eb;
  border-right: 1px solid #dce1e8;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.35;
}
.quote-summary-table th {
  width: 92px;
  color: #4b5567;
  background: #fbfcfe;
  text-align: left;
  font-weight: 800;
}
.quote-summary-table td {
  color: #151b28;
  font-weight: 650;
}
.quote-summary-table th:nth-child(3) { border-left: 1px solid #dce1e8; }
.quote-summary-table td:last-child { border-right: 0; }
.quote-client-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 15px 0 9px;
  color: #3b4658;
  font-size: 12px;
}
.quote-client-line strong { color: #172033; font-size: 14px; }
.quote-client-line span { text-align: right; }
.quote-condition {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 3px solid #1689b1;
  background: #f5f9fc;
  color: #435069;
  font-size: 10px;
  line-height: 1.55;
}
.quote-table { width: 100%; border-collapse: collapse; font-size: 9.5px; }
.quote-table th { padding: 8px 6px; color: #fff; background: #243570; border: 1px solid #243570; }
.quote-table td { padding: 7px 6px; border: 1px solid #dce1e8; }
.quote-table .category-row td { background: #f0f3f7; font-weight: 800; }
.quote-table .number { text-align: right; }
.quote-bottom { display: grid; grid-template-columns: 1fr 290px; gap: 25px; margin-top: 18px; }
.quote-notes { color: #697383; font-size: 9.5px; line-height: 1.65; }
.quote-notes strong { display: block; margin-bottom: 6px; color: #252d3a; }
.quote-totals { border-top: 2px solid #243570; }
.quote-total {
  display: flex;
  justify-content: space-between;
  padding: 8px 3px;
  border-bottom: 1px solid #e0e4ea;
  font-size: 10.5px;
}
.quote-total.grand { padding: 12px 3px; border-bottom: 3px double #243570; font-size: 14px; }
.quote-footer {
  margin-top: 28px;
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  color: #87909e;
  border-top: 1px solid #e1e5eb;
  font-size: 8px;
}

@page { size: A4 portrait; margin: 0; }
@media print {
  body { background: #fff; }
  .app-shell, .print-toolbar, .toast, .modal-backdrop { display: none !important; }
  .print-stage { display: block !important; position: static; padding: 0; overflow: visible; background: #fff; }
  .quote-document { margin: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .estimate-layout { grid-template-columns: 310px minmax(500px, 1fr); }
  .estimate-layout > .sticky { grid-column: 1 / -1; position: static; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1050px) {
  .estimate-layout, .two-column, .two-equal { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .rule-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 20px; }
  .content { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    height: 100vh;
    box-shadow: 18px 0 45px rgba(17,32,51,.22);
  }
  body.mobile-nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(17,32,51,.42);
  }
  body.mobile-nav-open .sidebar { display: flex; z-index: 40; }
  .mobile-menu-button { display: flex; }
  .topbar { padding: 0 18px; }
  .topbar { gap: 10px; }
  .topbar > div:nth-of-type(1) { min-width: 0; flex: 1; }
  .topbar h1 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 19px; }
  .eyebrow { display: none; }
  .content { padding: 20px 14px 36px; }
  .top-actions { display: none; }
  .estimate-layout, .two-column, .two-equal, .rule-grid { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: 1fr 1fr; }
  .step { border-bottom: 1px solid var(--line); }
  .field-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .segment-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .quote-document { width: 100%; min-height: auto; margin: 0; padding: 24px 18px; }
  .quote-titlebar { grid-template-columns: 1fr; align-items: start; gap: 8px; }
  .quote-titlebar h2 { justify-self: start; }
  .quote-number { justify-self: start; }
  .quote-client-line, .quote-bottom { display: grid; grid-template-columns: 1fr; }
  .quote-client-line span { text-align: left; }
  .quote-summary-table th,
  .quote-summary-table td { padding: 7px 8px; font-size: 10px; }
  .print-stage { padding: 0; }
}
