:root {
  --navy-950: #0d1f45;
  --navy-900: #172f63;
  --navy-800: #1d3d73;
  --navy-700: #244d82;
  --blue-600: #2878d8;
  --blue-500: #3b8ce8;
  --blue-100: #e8f2ff;
  --blue-050: #f4f8ff;
  --orange-600: #d96a0b;
  --orange-100: #fff0df;
  --teal-700: #08766b;
  --teal-100: #e4f6f2;
  --green-700: #167653;
  --green-100: #e9f7f0;
  --red-700: #b33131;
  --red-100: #fdecec;
  --amber-700: #98600a;
  --amber-100: #fff5d8;
  --ink: #152033;
  --muted: #64748b;
  --line: #d9e3ef;
  --soft-line: #e9eef5;
  --canvas: #f3f7fb;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(15, 31, 60, 0.08);
  --shadow-strong: 0 28px 70px rgba(8, 28, 63, 0.18);
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(40, 120, 216, 0.28);
  outline-offset: 2px;
}

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.eyebrow,
.section-label {
  display: block;
  margin: 0 0 6px;
  color: var(--blue-600);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}

.button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #c9d7e8;
  border-radius: 8px;
  background: var(--white);
  color: var(--navy-900);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.button:hover { border-color: var(--blue-600); }
.button-primary { border-color: var(--navy-900); background: var(--navy-900); color: var(--white); }
.button-primary:hover { border-color: var(--navy-700); background: var(--navy-700); }
.button-outline { border-color: #b8cbe1; background: var(--white); }
.button-quiet { border-color: var(--line); background: #f8fbff; color: var(--muted); }
.button-block { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 10px; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 11px; }

/* Login */
.login-view {
  display: grid;
  grid-template-columns: minmax(420px, 1.18fr) minmax(430px, .82fr);
  min-height: 100vh;
  background: var(--white);
}

.login-visual {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: clamp(48px, 8vw, 120px);
  overflow: hidden;
  background:
    radial-gradient(circle at 76% 20%, rgba(68, 146, 239, .38), transparent 27%),
    radial-gradient(circle at 28% 78%, rgba(217, 106, 11, .19), transparent 23%),
    linear-gradient(145deg, #091938 0%, #102c61 51%, #1e5893 100%);
  color: var(--white);
}

.visual-grid {
  position: absolute;
  inset: 0;
  opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px);
  background-size: 52px 52px;
  transform: perspective(800px) rotateX(60deg) scale(1.5) translateY(20%);
  transform-origin: bottom;
}

.visual-orbit { position: absolute; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.orbit-one { width: 520px; height: 520px; right: -190px; top: -100px; }
.orbit-two { width: 280px; height: 280px; right: -50px; top: 20px; border-color: rgba(255,255,255,.28); }

.visual-copy { position: relative; z-index: 1; max-width: 620px; }
.visual-copy > p { margin: 0 0 28px; color: #9bc7ff; font-size: 12px; font-weight: 900; letter-spacing: .14em; }
.visual-copy h1 { margin: 0; font-size: clamp(48px, 6vw, 82px); line-height: 1.05; letter-spacing: -.05em; }
.visual-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 42px; }
.visual-points span { padding: 10px 14px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(255,255,255,.08); font-size: 12px; font-weight: 700; backdrop-filter: blur(8px); }

.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 42px; background: #fbfdff; }
.login-card { width: min(440px, 100%); padding: 42px 40px 36px; border: 1px solid #e2eaf4; border-radius: 16px; background: var(--white); box-shadow: var(--shadow-strong); }
.login-logo { width: 145px; height: auto; margin-bottom: 30px; }
.login-card h2 { margin: 0; color: var(--navy-950); font-size: 28px; letter-spacing: -.03em; }
.login-description { margin: 12px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.auth-state { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbff; }
.auth-state-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 9px; background: var(--blue-100); color: var(--blue-600); }
.auth-state-icon svg { width: 20px; height: 20px; }
.auth-state strong, .auth-state span { display: block; }
.auth-state strong { color: var(--navy-900); font-size: 12px; }
.auth-state span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.login-form { display: grid; gap: 11px; margin-top: 16px; }
.login-form label { display: grid; gap: 6px; color: var(--navy-900); font-size: 11px; font-weight: 800; }
.login-form input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); font-size: 14px; }
.login-form input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(40,120,216,.1); outline: 0; }
.integration-message { min-height: 18px; margin: 9px 2px 0; color: var(--red-700); font-size: 11px; line-height: 1.5; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 17px 0 10px; color: #8a99ab; font-size: 10px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.preview-entry { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 15px; border: 1px solid #f1c392; border-radius: 10px; background: #fff9f2; color: var(--navy-900); text-align: left; }
.preview-entry:hover { border-color: var(--orange-600); }
.preview-entry + .preview-entry { margin-top: 9px; }
.preview-entry.staff-preview { border-color: #cbdcf0; background: #f5f9ff; }
.preview-entry.manager-preview { border-color: #c9d6cf; background: #f5faf7; }
.preview-entry.manager-preview:hover { border-color: var(--green-700); }
.preview-entry.manager-preview .preview-entry-copy small { color: #557064; }
.preview-entry.manager-preview svg { color: var(--green-700); }
.preview-entry.staff-preview:hover { border-color: var(--blue-500); }
.preview-entry.staff-preview .preview-entry-copy small { color: #58718e; }
.preview-entry.staff-preview svg { color: var(--blue-600); }
.preview-entry-copy strong, .preview-entry-copy small { display: block; }
.preview-entry-copy strong { font-size: 13px; }
.preview-entry-copy small { margin-top: 4px; color: #8c6a47; font-size: 10px; }
.preview-entry svg { width: 20px; height: 20px; color: var(--orange-600); }
.security-note { display: flex; gap: 9px; align-items: flex-start; margin-top: 22px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.security-note svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--green-700); }
.login-footer { margin: 18px 0 0; color: #94a3b8; font-size: 10px; }

/* Shell */
.app-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 16px 18px; background: linear-gradient(180deg, var(--navy-950), #102b5a); color: var(--white); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.11); }
.sidebar-brand img { width: 84px; height: auto; padding: 6px; border-radius: 6px; background: var(--white); }
.sidebar-brand span, .sidebar-brand strong { display: block; }
.sidebar-brand span { color: #8db8ee; font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.sidebar-brand strong { margin-top: 4px; font-size: 12px; }
.sidebar-nav { display: grid; gap: 6px; margin-top: 24px; }
.nav-item { display: grid; grid-template-columns: 21px 1fr auto; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #adc4df; text-align: left; font-size: 12px; font-weight: 800; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item b { display: grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: 9px; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.1); color: var(--white); }
.nav-item.active { box-shadow: inset 3px 0 var(--blue-500); }
.admin-nav { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.1); border-radius: 0 0 8px 8px; padding-top: 4px; }
.sidebar-status { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(255,255,255,.06); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #f5a742; box-shadow: 0 0 0 4px rgba(245,167,66,.14); }
.sidebar-status strong, .sidebar-status span { display: block; }
.sidebar-status strong { font-size: 11px; }
.sidebar-status span { margin-top: 2px; color: #9eb5d0; font-size: 9px; }

.main-area { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 78px; padding: 14px 30px; border-bottom: 1px solid #e1e9f3; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.topbar h1 { margin: 0; color: var(--navy-950); font-size: 22px; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: var(--navy-700); }
.icon-button svg { width: 20px; height: 20px; }
.user-chip { display: grid; grid-template-columns: 34px 1fr 16px; align-items: center; gap: 9px; min-width: 190px; padding: 5px 9px 5px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); text-align: left; }
.user-chip > svg { width: 15px; height: 15px; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--navy-900); color: var(--white); font-size: 12px; font-weight: 900; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { color: var(--navy-950); font-size: 11px; }
.user-chip small { margin-top: 2px; color: var(--muted); font-size: 9px; }

.content-wrap { width: min(1450px, calc(100% - 52px)); margin: 26px auto 64px; }
.workspace-view { display: none; }
.workspace-view.active-view { display: block; }

/* Search */
.search-hero { position: relative; padding: 28px 30px 25px; border: 1px solid #dbe7f4; border-radius: 12px; background: linear-gradient(135deg, #fff 0%, #f5f9ff 100%); box-shadow: var(--shadow); }
.search-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.search-heading h2 { margin: 0; color: var(--navy-950); font-size: 22px; letter-spacing: -.03em; }
.search-heading p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.sample-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border: 1px solid #f0bd7f; border-radius: 999px; background: var(--orange-100); color: var(--orange-600); font-size: 10px; font-weight: 900; white-space: nowrap; }
.search-box { position: relative; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; margin-top: 22px; padding: 7px 8px 7px 16px; border: 2px solid var(--navy-900); border-radius: 10px; background: var(--white); box-shadow: 0 10px 22px rgba(23,47,99,.08); }
.search-box > svg { width: 22px; height: 22px; color: var(--blue-600); }
.search-box input { min-width: 0; min-height: 42px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.search-box input::placeholder { color: #96a6ba; }
.search-box > button { min-width: 82px; min-height: 42px; border: 0; border-radius: 7px; background: var(--navy-900); color: var(--white); font-size: 13px; font-weight: 900; }
.search-box > button:disabled { cursor: wait; opacity: .72; }
.suggestions { position: absolute; z-index: 30; top: calc(100% + 7px); left: 0; right: 0; max-height: min(520px, 62vh); overflow-y: auto; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); box-shadow: 0 18px 40px rgba(15,31,60,.16); }
.suggestion-message { margin: 2px 3px 6px; padding: 9px 10px; border-radius: 7px; background: var(--blue-050); color: var(--blue-600); font-size: 10px; font-weight: 800; }
.suggestion-empty { padding: 13px; color: var(--muted); }
.suggestion-empty strong, .suggestion-empty span { display: block; }
.suggestion-empty strong { color: var(--navy-900); font-size: 11px; }
.suggestion-empty span { margin-top: 4px; font-size: 10px; }
.suggestion { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 13px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; }
.suggestion:hover { background: var(--blue-050); }
.suggestion strong, .suggestion span { display: block; }
.suggestion strong { color: var(--navy-900); font-size: 12px; }
.suggestion span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.suggestion b { color: var(--blue-600); font-size: 9px; }
.quick-searches { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.quick-searches > span { margin-right: 3px; color: #8797aa; font-size: 10px; font-weight: 800; }
.quick-searches button { min-height: 27px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--muted); font-size: 10px; }
.quick-searches button:hover { border-color: var(--blue-600); color: var(--blue-600); }

.empty-state { display: grid; place-items: center; min-height: 380px; margin-top: 20px; padding: 40px; border: 1px dashed #c9d7e8; border-radius: 12px; background: rgba(255,255,255,.65); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 68px; height: 68px; margin-bottom: 16px; border-radius: 18px; background: var(--blue-100); color: var(--blue-600); }
.empty-icon svg { width: 35px; height: 35px; }
.empty-state h3 { margin: 0; color: var(--navy-900); font-size: 17px; }
.empty-state p { max-width: 470px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.result-view { margin-top: 20px; }
.result-banner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 23px 26px; border: 1px solid #dce6f1; border-radius: 11px; background: var(--white); box-shadow: var(--shadow); }
.result-title { display: flex; align-items: center; gap: 16px; min-width: 0; }
.result-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 auto; border-radius: 11px; background: var(--blue-100); color: var(--blue-600); }
.result-icon svg { width: 26px; height: 26px; }
.match-line { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.match-badge, .freshness-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 9px; font-weight: 900; }
.match-badge { background: var(--green-100); color: var(--green-700); }
.freshness-badge { background: var(--amber-100); color: var(--amber-700); }
.freshness-badge.current { background: var(--green-100); color: var(--green-700); }
.freshness-badge.stale { background: var(--red-100); color: var(--red-700); }
.freshness-badge.unknown { background: #f2f5f8; color: var(--muted); }
.result-title h2 { margin: 0; color: var(--navy-950); font-size: 21px; letter-spacing: -.03em; }
.result-title p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { display: flex; align-items: center; gap: 24px; }
.result-meta > div { padding-left: 20px; border-left: 1px solid var(--line); }
.result-meta span, .result-meta strong { display: block; }
.result-meta span { color: var(--muted); font-size: 9px; }
.result-meta strong { margin-top: 4px; color: var(--navy-900); font-size: 12px; }

.warning-strip { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 16px; border: 1px solid #ebc797; border-left: 4px solid var(--orange-600); border-radius: 8px; background: #fffaf3; color: #7f572c; }
.warning-strip > svg { width: 19px; height: 19px; }
.warning-strip strong, .warning-strip span { display: block; }
.warning-strip strong { font-size: 11px; }
.warning-strip span { margin-top: 2px; font-size: 9px; }
.warning-strip button { border: 0; background: transparent; color: var(--orange-600); font-size: 10px; font-weight: 900; }

.estimate-section, .panel { margin-top: 16px; padding: 22px; border: 1px solid #dfe8f2; border-radius: 11px; background: var(--white); box-shadow: 0 12px 32px rgba(15,31,60,.05); }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading h3, .panel-heading h3 { margin: 0; color: var(--navy-950); font-size: 17px; }
.estimate-total { text-align: right; }
.estimate-total span, .estimate-total small { display: block; color: var(--muted); font-size: 9px; }
.estimate-total strong { display: block; margin: 3px 0; color: var(--orange-600); font-size: 24px; font-variant-numeric: tabular-nums; }
.service-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.service-card { position: relative; min-height: 158px; padding: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; }
.service-card::after { content: ""; position: absolute; right: -24px; bottom: -28px; width: 90px; height: 90px; border-radius: 50%; background: rgba(40,120,216,.05); }
.service-card-top { display: flex; align-items: center; justify-content: space-between; }
.service-card-index { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--blue-100); color: var(--blue-600); font-size: 10px; font-weight: 900; }
.service-source { padding: 4px 7px; border-radius: 999px; background: var(--green-100); color: var(--green-700); font-size: 8px; font-weight: 900; }
.service-source.catalog { background: var(--blue-100); color: var(--blue-600); }
.service-source.partial { background: var(--amber-100); color: var(--amber-700); }
.service-card h4 { margin: 13px 0 4px; color: var(--navy-900); font-size: 13px; }
.service-card strong { display: block; color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.service-card p { margin: 7px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.service-card.drawing-card { border-color: #efcf9d; background: #fffaf3; }
.service-card .drawing-required { color: var(--orange-600); font-size: 17px; letter-spacing: -.02em; }
.panel-description { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.primary-grid { display: grid; grid-template-columns: 1.07fr .93fr; gap: 16px; }
.secondary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.count-badge, .permit-type, .conditional-badge, .history-source, .admin-badge, .rule-freshness { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: 9px; font-weight: 900; }
.count-badge { background: var(--blue-100); color: var(--blue-600); }
.permit-type { background: var(--green-100); color: var(--green-700); }
.permit-badges { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.rule-freshness { background: var(--amber-100); color: var(--amber-700); }
.rule-freshness.current { background: var(--green-100); color: var(--green-700); }
.rule-freshness.unknown { background: #f2f5f8; color: var(--muted); }
.conditional-badge { background: var(--amber-100); color: var(--amber-700); }
.history-source { color: var(--muted); background: #f2f5f8; }
.admin-badge { background: var(--navy-900); color: var(--white); }

.ownership-switch { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-top: 16px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #f5f8fc; }
.ownership-button { min-height: 34px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; }
.ownership-button.active { border-color: #c7d9ef; background: var(--white); color: var(--navy-900); box-shadow: 0 4px 10px rgba(23,47,99,.08); }
.contract-type-switch { display: grid; grid-template-columns: 1fr repeat(3, auto); align-items: center; gap: 5px; margin-top: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fbfdff; }
.contract-type-switch > span { color: var(--muted); font-size: 9px; font-weight: 800; }
.contract-type-button { min-height: 27px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 900; }
.contract-type-button.active { border-color: #c7d9ef; background: var(--white); color: var(--navy-900); box-shadow: 0 3px 8px rgba(23,47,99,.07); }
.document-summary { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.document-summary span { display: inline-flex; align-items: center; min-height: 27px; padding: 0 10px; border-radius: 999px; font-size: 9px; font-weight: 900; }
.document-summary .must { background: var(--red-100); color: var(--red-700); }
.document-summary .check { background: var(--amber-100); color: var(--amber-700); }
.document-summary .internal { background: var(--green-100); color: var(--green-700); }
.document-summary .info { background: var(--blue-100); color: var(--blue-600); }
.document-list { display: grid; gap: 8px; margin-top: 14px; }
.document-group { display: grid; gap: 8px; }
.document-group + .document-group { margin-top: 5px; padding-top: 11px; border-top: 1px solid var(--line); }
.document-group-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 2px 0; }
.document-group-title strong { color: var(--navy-900); font-size: 12px; }
.document-group-title span { color: var(--muted); font-size: 9px; }
.document-item { display: grid; grid-template-columns: 31px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 62px; padding: 12px 14px; border: 1px solid var(--soft-line); border-left-width: 4px; border-radius: 8px; background: var(--white); }
.document-item.required { border-left-color: var(--red-700); }
.document-item.conditional { border-left-color: var(--amber-700); }
.document-item.internal { border-left-color: var(--green-700); background: #f7fbf8; }
.document-item.info { border-left-color: #9fb0c4; background: #f8fafc; }
.document-status { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; font-size: 13px; font-weight: 900; }
.document-status.required { background: var(--red-100); color: var(--red-700); }
.document-status.conditional { background: var(--amber-100); color: var(--amber-700); }
.document-status.internal { background: var(--green-100); color: var(--green-700); }
.document-status.info { background: var(--blue-100); color: var(--blue-600); }
.document-item strong, .document-item span { display: block; }
.document-item strong { color: var(--navy-900); font-size: 13px; }
.document-item span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.document-item b { padding: 5px 8px; border-radius: 999px; background: #f0f4f8; color: var(--muted); font-size: 9px; white-space: nowrap; }
.document-item.required b { background: var(--red-100); color: var(--red-700); }
.document-item.conditional b { background: var(--amber-100); color: var(--amber-700); }
.document-item.internal b { background: var(--green-100); color: var(--green-700); }
.inspection-documents-panel { padding: 24px; }
.inspection-document-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.inspection-document-list .document-group { align-content: start; }
.inspection-document-list .document-group:last-child:nth-child(odd) { grid-column: 1 / -1; }
.inspection-send-summary { margin-top: 18px; }
.send-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 8px; background: var(--blue-050); }
.send-summary strong, .send-summary span { display: block; }
.send-summary strong { color: var(--navy-900); font-size: 10px; }
.send-summary span { margin-top: 2px; color: var(--muted); font-size: 9px; }

.decision-box { margin-top: 16px; padding: 16px; border-left: 4px solid var(--blue-600); border-radius: 8px; background: var(--blue-050); }
.decision-box strong, .decision-box span { display: block; }
.decision-box strong { color: var(--navy-900); font-size: 14px; }
.decision-box span { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.decision-box .permit-classification-basis { color: var(--blue-600); font-weight: 800; }
.rule-details { margin-top: 9px; border: 1px solid var(--soft-line); border-radius: 7px; background: #fbfdff; }
.rule-details summary { padding: 9px 11px; color: var(--blue-600); font-size: 9px; font-weight: 900; cursor: pointer; }
.rule-details p { margin: 0; padding: 0 11px 11px; color: var(--muted); font-size: 9px; line-height: 1.65; }
.rule-details-dark { border-color: #d2deed; background: #f7faff; }
.rule-rows { display: grid; gap: 8px; margin-top: 13px; }
.rule-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--soft-line); }
.rule-row:last-child { border-bottom: 0; }
.rule-row span { color: var(--muted); font-size: 10px; }
.rule-row strong { max-width: 210px; color: var(--navy-900); font-size: 10px; text-align: right; line-height: 1.4; }
.rule-row strong.confirmed { color: var(--green-700); }
.rule-row strong.review { color: var(--amber-700); }
.rule-row strong.blocked { color: var(--red-700); }
.partition-reference { margin-top: 16px; padding: 14px 15px; border: 1px solid #c9d9ee; border-radius: 8px; background: #f4f8fd; }
.partition-reference > span, .partition-reference > strong { display: block; }
.partition-reference > span { color: var(--blue-600); font-size: 9px; font-weight: 900; }
.partition-reference > strong { margin-top: 5px; color: var(--navy-900); font-size: 12px; }
.partition-reference > p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

.protection-visual { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 18px; padding: 16px; border-radius: 9px; background: #f7faff; }
.protection-step { text-align: center; }
.protection-step i { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 7px; border-radius: 10px; background: var(--white); color: var(--blue-600); box-shadow: 0 5px 14px rgba(23,47,99,.08); font-style: normal; font-size: 12px; font-weight: 900; }
.protection-step strong, .protection-step span { display: block; }
.protection-step strong { color: var(--navy-900); font-size: 10px; }
.protection-step span { margin-top: 3px; color: var(--muted); font-size: 8px; }
.protection-arrow { color: #a6b5c8; }
.fact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 12px; }
.protection-source-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 7px; background: var(--amber-100); color: var(--amber-700); font-size: 9px; line-height: 1.55; }
.fact { padding: 10px; border: 1px solid var(--soft-line); border-radius: 7px; }
.fact span, .fact strong { display: block; }
.fact span { color: var(--muted); font-size: 8px; }
.fact strong { margin-top: 4px; color: var(--navy-900); font-size: 11px; }

.inspection-rule { margin-top: 17px; padding: 15px; border-radius: 8px; background: var(--navy-900); color: var(--white); }
.inspection-rule strong, .inspection-rule span { display: block; }
.inspection-rule strong { font-size: 14px; }
.inspection-rule span { margin-top: 4px; color: #bfd7f3; font-size: 9px; }
.inspection-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 12px; }
.inspection-item { padding: 10px 7px; border: 1px solid var(--line); border-radius: 7px; text-align: center; }
.inspection-item strong, .inspection-item span { display: block; }
.inspection-item strong { color: var(--navy-900); font-size: 10px; }
.inspection-item span { margin-top: 4px; color: var(--muted); font-size: 8px; }
.insulation-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 11px; padding: 10px 12px; border-radius: 7px; background: var(--amber-100); color: var(--amber-700); font-size: 9px; }

.history-list { margin-top: 14px; border-top: 1px solid var(--line); }
.history-row { display: grid; grid-template-columns: 86px 110px 1fr 120px 95px; align-items: center; gap: 12px; min-height: 55px; padding: 9px 4px; border-bottom: 1px solid var(--soft-line); }
.history-row span { color: var(--muted); font-size: 9px; }
.history-row strong { color: var(--navy-900); font-size: 10px; }
.history-row .history-amount { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.history-row .history-chip { justify-self: end; padding: 5px 7px; border-radius: 999px; background: var(--green-100); color: var(--green-700); font-size: 8px; font-weight: 900; }
.history-row.hidden-history { display: none; }
.history-empty { padding: 22px 4px; text-align: center; }
.history-empty strong, .history-empty span { display: block; }
.history-empty strong { color: var(--navy-900); font-size: 11px; }
.history-empty span { margin-top: 5px; color: var(--muted); font-size: 9px; }

/* Secondary pages */
.simple-view-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 30px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: var(--shadow); }
.simple-view-heading h2 { margin: 0; color: var(--navy-950); font-size: 24px; }
.simple-view-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.rule-library-grid, .admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.rule-library-card, .admin-grid article { min-height: 180px; padding: 22px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); box-shadow: 0 10px 26px rgba(15,31,60,.05); }
.rule-library-card > span { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 8px; font-weight: 900; }
.rule-library-card.confirmed > span { background: var(--green-100); color: var(--green-700); }
.rule-library-card.review > span { background: var(--amber-100); color: var(--amber-700); }
.rule-library-card h3, .admin-grid h3 { margin: 18px 0 8px; color: var(--navy-900); font-size: 16px; }
.rule-library-card p, .admin-grid p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.rule-library-card small { display: block; margin-top: 18px; color: #8c9bad; font-size: 8px; }
.data-status-grid { display: grid; gap: 10px; margin-top: 16px; }
.data-status-grid article { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.source-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font-size: 11px; font-weight: 900; }
.source-icon.sheet { background: var(--green-100); color: var(--green-700); }
.source-icon.lock { background: var(--blue-100); color: var(--blue-600); }
.data-status-grid strong { color: var(--navy-900); font-size: 13px; }
.data-status-grid p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.state { padding: 5px 8px; border-radius: 999px; font-size: 8px; }
.state.current { background: var(--green-100); color: var(--green-700); }
.state.stale { background: var(--amber-100); color: var(--amber-700); }
.state.blocked { background: var(--red-100); color: var(--red-700); }
.architecture-note { margin-top: 16px; padding: 22px; border: 1px solid #bfd4ee; border-left: 4px solid var(--blue-600); border-radius: 9px; background: var(--blue-050); }
.architecture-note strong { color: var(--navy-900); font-size: 13px; }
.architecture-note p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.worker-search { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 12px 12px 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); box-shadow: 0 10px 26px rgba(15,31,60,.04); }
.worker-search svg { width: 20px; height: 20px; color: var(--blue-600); }
.worker-search input { width: 100%; min-height: 38px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.worker-search input::placeholder { color: #94a3b8; }
.worker-directory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 46px; margin-top: 12px; }
.worker-directory-toolbar p { margin: 0; color: var(--muted); font-size: 11px; }
.worker-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--white); box-shadow: 0 10px 26px rgba(15,31,60,.04); }
.worker-table { width: 100%; min-width: 820px; border-collapse: collapse; }
.worker-table th { padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f7faff; color: var(--muted); font-size: 9px; font-weight: 900; text-align: left; letter-spacing: .04em; }
.worker-table td { padding: 14px 16px; border-bottom: 1px solid var(--soft-line); color: var(--muted); font-size: 11px; line-height: 1.45; vertical-align: middle; }
.worker-table tbody tr:last-child td { border-bottom: 0; }
.worker-table tbody tr:hover td { background: #fbfdff; }
.worker-table .worker-name { color: var(--navy-900); font-size: 12px; font-weight: 900; }
.worker-table .worker-phone { color: var(--blue-600); font-weight: 800; white-space: nowrap; }
.worker-table .worker-vehicle { display: inline-flex; min-height: 25px; align-items: center; padding: 0 9px; border-radius: 999px; background: var(--blue-100); color: var(--navy-900); font-size: 10px; font-weight: 900; white-space: nowrap; }
.worker-table .worker-empty { padding: 42px 16px; color: var(--muted); text-align: center; }
.worker-security-note { margin: 12px 3px 0; color: var(--red-700); font-size: 9px; line-height: 1.55; }
.access-user-panel { margin-top: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); box-shadow: 0 10px 26px rgba(15,31,60,.05); }
.access-user-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.access-user-heading h3 { margin: 0; color: var(--navy-900); font-size: 18px; }
.access-user-heading p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.access-status, .access-permission { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 9px; font-weight: 900; }
.access-status.allowed { background: var(--green-100); color: var(--green-700); }
.access-status.blocked { background: var(--red-100); color: var(--red-700); }
.access-permission { margin: 2px 3px 2px 0; background: var(--blue-100); color: var(--blue-600); }
.access-user-table .button { min-height: 30px; padding: 0 10px; font-size: 9px; }
.region-rule-status { margin: 12px 2px; color: var(--muted); font-size: 11px; }
.region-rule-groups { display: grid; gap: 20px; }
.region-rule-group { display: grid; gap: 9px; }
.region-rule-group-heading { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.region-rule-group-heading h3 { margin: 0; color: var(--navy-900); font-size: 16px; }
.region-rule-group-heading span { padding: 4px 8px; border-radius: 999px; background: var(--blue-100); color: var(--blue-600); font-size: 9px; font-weight: 900; }
.region-rule-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--white); box-shadow: 0 6px 18px rgba(15,31,60,.04); }
.region-rule-card summary { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; gap: 12px; padding: 15px 17px; cursor: pointer; list-style: none; }
.region-rule-card summary::-webkit-details-marker { display: none; }
.region-rule-card summary strong { color: var(--navy-900); font-size: 13px; }
.region-rule-card summary span { color: var(--muted); font-size: 9px; }
.region-rule-card summary b { padding: 5px 8px; border-radius: 999px; background: var(--green-100); color: var(--green-700); font-size: 8px; }
.region-rule-card[open] summary { border-bottom: 1px solid var(--soft-line); background: #fbfdff; }
.region-rule-body { padding: 16px; }
.region-rule-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.region-rule-field { padding: 11px 12px; border: 1px solid var(--soft-line); border-radius: 8px; background: #fbfdff; }
.region-rule-field span, .region-rule-field strong { display: block; }
.region-rule-field span { color: var(--muted); font-size: 9px; }
.region-rule-field strong { margin-top: 5px; color: var(--navy-900); font-size: 10px; line-height: 1.55; }
.region-rule-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.admin-grid article > span { color: var(--blue-600); font-size: 10px; font-weight: 900; }
.admin-grid .button { margin-top: 18px; }
.role-matrix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.role-matrix > div { padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.role-matrix strong, .role-matrix span { display: block; }
.role-matrix strong { color: var(--navy-900); font-size: 11px; }
.role-matrix span { margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.55; }

/* Dialog and toast */
dialog { border: 0; padding: 0; }
dialog::backdrop { background: rgba(7,20,43,.58); backdrop-filter: blur(3px); }
.info-dialog, .edit-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 26px; overflow-y: auto; border-radius: 14px; color: var(--ink); box-shadow: var(--shadow-strong); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading h2 { margin: 0; color: var(--navy-950); font-size: 20px; }
.dialog-close { border: 0; background: transparent; color: var(--muted); font-size: 24px; }
.info-dialog ul { display: grid; gap: 10px; margin: 20px 0; padding: 0; list-style: none; }
.info-dialog li { padding: 13px; border: 1px solid var(--line); border-radius: 8px; }
.info-dialog li strong, .info-dialog li span { display: block; }
.info-dialog li strong { color: var(--navy-900); font-size: 11px; }
.info-dialog li span { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.edit-dialog > p { color: var(--muted); font-size: 11px; }
.edit-dialog label { display: grid; gap: 6px; margin-top: 13px; color: var(--navy-900); font-size: 10px; font-weight: 800; }
.edit-dialog input, .edit-dialog select, .edit-dialog textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); color: var(--ink); font-size: 11px; }
.edit-dialog input[readonly] { background: #f3f6fa; color: var(--muted); }
.rule-extra-options { display: grid; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.rule-extra-options legend { padding: 0 5px; color: var(--navy-900); font-size: 11px; font-weight: 800; }
.rule-extra-options label { display: flex; flex-direction: row; gap: 8px; align-items: center; font-weight: 600; }
.rule-extra-options input { width: 16px; min-height: 16px; margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; max-width: min(460px, calc(100% - 32px)); padding: 12px 16px; border-radius: 9px; background: var(--navy-950); color: var(--white); font-size: 11px; box-shadow: var(--shadow-strong); opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primary-grid, .secondary-grid { grid-template-columns: 1fr; }
  .result-banner { align-items: flex-start; flex-direction: column; }
  .result-meta { width: 100%; justify-content: flex-end; }
  .rule-library-grid, .admin-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .login-view { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 24px; }
  .app-layout { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 20px 10px; }
  .sidebar-brand { justify-content: center; padding: 0 0 20px; }
  .sidebar-brand img { width: 50px; }
  .sidebar-brand div, .nav-item span, .nav-item b, .sidebar-status div { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .sidebar-status { justify-content: center; padding: 13px 0; }
  .content-wrap { width: min(100% - 28px, 1450px); }
  .topbar { padding: 12px 16px; }
  .user-chip { min-width: 0; grid-template-columns: 34px; }
  .user-chip > span:not(.avatar), .user-chip > svg { display: none; }
  .search-hero { padding: 22px 18px; }
  .search-heading { align-items: flex-start; }
  .search-heading h2 { font-size: 19px; }
  .result-meta { display: grid; grid-template-columns: 1fr 1fr auto; }
  .result-meta > div { padding-left: 0; border: 0; }
  .rule-library-grid, .admin-grid { grid-template-columns: 1fr; }
  .role-matrix { grid-template-columns: 1fr; }
  .inspection-document-list { grid-template-columns: 1fr; }
  .inspection-document-list .document-group:last-child:nth-child(odd) { grid-column: auto; }
  .region-rule-fields { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .login-card { padding: 30px 22px; }
  .topbar h1 { font-size: 18px; }
  .search-heading { flex-direction: column; }
  .search-box { grid-template-columns: 22px 1fr; padding-right: 10px; }
  .search-box > button { grid-column: 1 / -1; }
  .service-grid { grid-template-columns: 1fr; }
  .result-title { align-items: flex-start; }
  .result-title p { white-space: normal; }
  .result-meta { grid-template-columns: 1fr 1fr; }
  .result-meta .button { grid-column: 1 / -1; }
  .warning-strip { grid-template-columns: 20px 1fr; }
  .warning-strip button { grid-column: 2; justify-self: start; padding: 0; }
  .estimate-section, .panel { padding: 18px; }
  .section-heading { align-items: flex-start; }
  .estimate-total { max-width: 160px; }
  .fact-grid, .inspection-items { grid-template-columns: repeat(2, 1fr); }
  .protection-visual { grid-template-columns: 1fr; }
  .protection-arrow { transform: rotate(90deg); text-align: center; }
  .history-row { grid-template-columns: 74px 90px 1fr; }
  .history-row .history-amount, .history-row .history-chip { grid-column: auto; text-align: left; justify-self: start; }
  .simple-view-heading { align-items: flex-start; flex-direction: column; }
  .document-item { grid-template-columns: 31px minmax(0, 1fr); }
  .document-item b { grid-column: 2; justify-self: start; }
  .worker-search { grid-template-columns: 20px minmax(0, 1fr); }
  .worker-search .button { grid-column: 1 / -1; }
  .worker-directory-toolbar { align-items: flex-start; flex-direction: column; }
  .access-user-heading { align-items: flex-start; flex-direction: column; }
  .region-rule-card summary { grid-template-columns: 1fr auto; }
  .region-rule-card summary span { grid-column: 1 / -1; }
}
