:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #20242a;
  background: #eef0f3;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --red-950: #4f1010;
  --red-900: #681515;
  --red-800: #8f1d1d;
  --red-700: #a92a2a;
  --red-100: #f8e8e8;
  --charcoal: #2f3338;
  --muted: #66707a;
  --line: #dfe3e8;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --good: #197547;
  --good-bg: #e8f6ef;
  --warn: #9b5a00;
  --warn-bg: #fff4dd;
  --danger: #a51e2a;
  --danger-bg: #fdebed;
  --info: #245d92;
  --info-bg: #eaf3fb;
  --purple: #614099;
  --purple-bg: #f1ecfa;
  --shadow: 0 12px 32px rgba(29, 35, 42, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #eef0f3; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--red-900), var(--red-950));
  color: #fff; padding: 22px 16px; display: flex; flex-direction: column; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; background: #fff; color: var(--red-900); border-radius: 10px; font-weight: 900; box-shadow: 0 7px 18px rgba(0,0,0,.2); }
.brand-title { font-weight: 780; font-size: 15px; line-height: 1.25; letter-spacing: .01em; }
.brand-subtitle { font-size: 11px; opacity: .74; margin-top: 3px; }
.nav { display: grid; gap: 5px; margin-top: 18px; }
.nav-button { width: 100%; border: 0; color: rgba(255,255,255,.83); background: transparent; border-radius: 9px; padding: 11px 12px; display: flex; align-items: center; gap: 11px; text-align: left; font-size: 14px; font-weight: 590; }
.nav-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-button.active { background: rgba(255,255,255,.15); color: #fff; box-shadow: inset 3px 0 #fff; }
.nav-icon { width: 18px; height: 18px; opacity: .95; }
.sidebar-spacer { flex: 1; }
.trial-box { margin: 18px 4px 0; padding: 14px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; }
.trial-box strong { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.trial-box p { margin: 7px 0 0; font-size: 11px; line-height: 1.45; opacity: .8; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; height: 68px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; }
.page-title { font-size: 17px; font-weight: 760; }
.page-subtitle { color: var(--muted); font-size: 12px; margin-top: 3px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 28px 30px 52px; max-width: 1560px; margin: 0 auto; }
.mobile-menu { display: none; }

.hero { background: linear-gradient(135deg, var(--red-900), var(--red-700)); color: #fff; border-radius: 18px; padding: 28px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; width: 330px; height: 330px; border: 65px solid rgba(255,255,255,.07); border-radius: 50%; right: -130px; top: -120px; }
.hero-grid { display: grid; grid-template-columns: 1.6fr .9fr; gap: 28px; position: relative; z-index: 1; align-items: center; }
.hero h1 { margin: 0; font-size: clamp(25px, 3vw, 40px); letter-spacing: -.03em; max-width: 760px; }
.hero p { margin: 12px 0 0; max-width: 760px; color: rgba(255,255,255,.83); line-height: 1.55; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hero-status { padding: 18px; background: rgba(0,0,0,.14); border: 1px solid rgba(255,255,255,.16); border-radius: 14px; }
.hero-status .big { font-size: 35px; font-weight: 820; }
.hero-status .label { font-size: 12px; opacity: .78; margin-top: 2px; }

.btn { border: 1px solid transparent; border-radius: 9px; padding: 9px 13px; font-weight: 660; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; min-height: 39px; }
.btn-primary { background: var(--red-800); color: #fff; }
.btn-primary:hover { background: var(--red-900); }
.btn-white { background: #fff; color: var(--red-900); }
.btn-white:hover { background: #f6f6f6; }
.btn-outline-white { border-color: rgba(255,255,255,.5); color: #fff; background: transparent; }
.btn-outline { border-color: #cfd5dc; color: #343a40; background: #fff; }
.btn-outline:hover { background: #f7f8fa; }
.btn-danger { background: #fff; border-color: #efb8be; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-small { min-height: 31px; padding: 6px 9px; font-size: 12px; }
.btn:disabled { cursor: not-allowed; opacity: .5; }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 30px 0 14px; }
.section-head h2 { margin: 0; font-size: 19px; letter-spacing: -.015em; }
.section-head p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 17px; box-shadow: 0 4px 12px rgba(25,30,36,.035); }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .055em; }
.kpi-value { font-size: 30px; font-weight: 810; margin-top: 7px; letter-spacing: -.04em; }
.kpi-note { font-size: 12px; color: var(--muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgba(25,30,36,.04); }
.card-head { padding: 17px 19px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 19px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.three-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }

.job-list { display: grid; gap: 10px; }
.job-row { display: grid; grid-template-columns: minmax(210px, 1.4fr) minmax(180px, 1fr) 125px 125px auto; gap: 14px; align-items: center; padding: 15px 17px; border: 1px solid var(--line); border-radius: 11px; background: #fff; transition: .15s ease; }
.job-row:hover { border-color: #c3c9d0; transform: translateY(-1px); box-shadow: 0 6px 15px rgba(30,35,40,.05); }
.job-number { font-weight: 780; color: var(--red-900); }
.job-name { font-weight: 680; margin-top: 3px; }
.job-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.job-actions { display: flex; gap: 7px; justify-content: flex-end; }
.empty-state { text-align: center; padding: 52px 24px; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; border-radius: 50%; background: var(--red-100); color: var(--red-800); display: grid; place-items: center; margin: 0 auto 14px; font-size: 24px; }
.empty-state h3 { color: var(--charcoal); margin: 0 0 7px; }
.empty-state p { max-width: 520px; margin: 0 auto 16px; line-height: 1.5; }

.badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 760; letter-spacing: .02em; white-space: nowrap; }
.badge-pass, .badge-present { color: var(--good); background: var(--good-bg); }
.badge-review, .badge-warning { color: var(--warn); background: var(--warn-bg); }
.badge-blocked, .badge-critical, .badge-missing { color: var(--danger); background: var(--danger-bg); }
.badge-locked { color: var(--purple); background: var(--purple-bg); }
.badge-info, .badge-not_triggered { color: var(--info); background: var(--info-bg); }
.badge-neutral { color: #56606a; background: #edf0f2; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; color: #4a5158; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #cfd5dc; border-radius: 9px; background: #fff; padding: 10px 11px; color: #252a30; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red-700); box-shadow: 0 0 0 3px rgba(143,29,29,.1); }
.field textarea { min-height: 88px; resize: vertical; }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.45; }
.form-actions { margin-top: 18px; display: flex; gap: 9px; justify-content: flex-end; }

.workspace-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 17px; }
.workspace-title { display: flex; gap: 13px; align-items: flex-start; }
.workspace-number { width: 48px; height: 48px; border-radius: 12px; background: var(--red-100); color: var(--red-900); display: grid; place-items: center; font-weight: 850; }
.workspace-head h1 { font-size: 24px; margin: 0; }
.workspace-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 11px 13px; color: var(--muted); font-weight: 680; font-size: 13px; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--red-900); border-bottom-color: var(--red-800); }

.dropzone { border: 2px dashed #c5cbd2; border-radius: 14px; padding: 30px; background: #fafbfc; text-align: center; transition: .15s; }
.dropzone.drag { border-color: var(--red-700); background: var(--red-100); }
.dropzone-icon { width: 52px; height: 52px; border-radius: 50%; background: #fff; box-shadow: 0 5px 15px rgba(0,0,0,.06); display: grid; place-items: center; margin: 0 auto 12px; color: var(--red-800); font-size: 22px; }
.dropzone h3 { margin: 0; font-size: 16px; }
.dropzone p { margin: 6px 0 14px; color: var(--muted); font-size: 12px; }
.file-input { display: none; }

.doc-list { display: grid; gap: 10px; }
.doc-card { display: grid; grid-template-columns: 82px minmax(200px, 1.4fr) minmax(190px, .9fr) minmax(220px, 1fr) auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.doc-thumb { width: 82px; height: 70px; object-fit: cover; object-position: top; border: 1px solid #dfe3e8; border-radius: 7px; background: #f3f4f6; }
.doc-thumb-placeholder { width: 82px; height: 70px; border-radius: 7px; background: #f0f2f5; display: grid; place-items: center; color: #78828c; font-size: 11px; font-weight: 760; }
.doc-name { font-weight: 690; overflow-wrap: anywhere; }
.doc-meta { display: flex; gap: 9px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 5px; }
.doc-select { width: 100%; border: 1px solid #cfd5dc; border-radius: 8px; padding: 8px; font-size: 12px; background: #fff; }
.doc-facts { font-size: 11px; color: var(--muted); line-height: 1.5; }
.doc-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.progress-panel { position: fixed; inset: 0; z-index: 100; background: rgba(26,29,33,.66); display: grid; place-items: center; padding: 24px; }
.progress-card { width: min(520px, 100%); background: #fff; border-radius: 16px; padding: 23px; box-shadow: 0 24px 80px rgba(0,0,0,.32); }
.progress-card h3 { margin: 0; }
.progress-card p { color: var(--muted); font-size: 13px; }
.progress-track { height: 9px; background: #edf0f2; border-radius: 999px; overflow: hidden; margin-top: 16px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--red-800), #d05353); transition: width .2s; }

.score-ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--red-800) calc(var(--score) * 1%), #e6e9ed 0); }
.score-ring::after { content: ''; position: absolute; inset: 11px; background: #fff; border-radius: 50%; }
.score-value { position: relative; z-index: 1; text-align: center; }
.score-value strong { display: block; font-size: 32px; line-height: 1; }
.score-value span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.analysis-summary { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center; }
.issue-list { display: grid; gap: 9px; }
.issue { border: 1px solid var(--line); border-left: 4px solid #9aa2aa; border-radius: 10px; padding: 13px 14px; background: #fff; }
.issue.critical { border-left-color: var(--danger); }
.issue.warning { border-left-color: #d48713; }
.issue.info { border-left-color: var(--info); }
.issue-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.issue h4 { margin: 0; font-size: 13px; }
.issue p { margin: 6px 0 0; color: #535c65; font-size: 12px; line-height: 1.5; }
.issue-action { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #d9dde2; font-size: 11px; color: var(--muted); }

.fact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border: 1px solid #e7eaee; border-radius: 9px; padding: 11px; }
.fact-label { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 720; letter-spacing: .045em; }
.fact-value { margin-top: 5px; font-size: 13px; font-weight: 680; }
.fact-source { margin-top: 4px; color: #8a929a; font-size: 10px; overflow-wrap: anywhere; }

.gate-list { display: grid; gap: 10px; }
.gate { display: grid; grid-template-columns: 54px minmax(170px,.8fr) 105px minmax(280px,1.5fr); align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.gate-id { font-weight: 850; color: var(--red-900); }
.gate-name { font-weight: 700; }
.gate-detail { color: var(--muted); font-size: 12px; line-height: 1.45; }

.requirement-table { width: 100%; border-collapse: collapse; }
.requirement-table th { text-align: left; padding: 10px 11px; background: #f3f5f7; color: #4c555f; font-size: 11px; text-transform: uppercase; letter-spacing: .045em; border-bottom: 1px solid var(--line); }
.requirement-table td { padding: 12px 11px; border-bottom: 1px solid #eceff2; font-size: 12px; vertical-align: middle; }
.requirement-table tr:last-child td { border-bottom: 0; }
.req-label { font-weight: 690; }
.req-guide { color: var(--muted); font-size: 11px; margin-top: 4px; line-height: 1.4; }

.notice { border-radius: 11px; padding: 13px 15px; display: flex; align-items: flex-start; gap: 11px; line-height: 1.5; font-size: 12px; }
.notice strong { display: block; margin-bottom: 2px; }
.notice-info { background: var(--info-bg); color: #244f75; border: 1px solid #c7ddf0; }
.notice-warning { background: var(--warn-bg); color: #714800; border: 1px solid #efd7a6; }
.notice-danger { background: var(--danger-bg); color: #7f1c27; border: 1px solid #f0c6cb; }
.notice-good { background: var(--good-bg); color: #165e3c; border: 1px solid #c6e9d6; }

.sample-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.sample-card { border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.sample-banner { height: 92px; display: flex; align-items: end; padding: 15px; color: #fff; background: linear-gradient(135deg, #5e1515, #bb3f3f); }
.sample-banner span { font-size: 24px; font-weight: 850; opacity: .9; }
.sample-body { padding: 16px; flex: 1; }
.sample-body h3 { margin: 0; font-size: 15px; }
.sample-body p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.sample-foot { padding: 0 16px 16px; }

.guide-layout { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 20px; }
.guide-nav { position: sticky; top: 88px; align-self: start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.guide-nav a { display: block; text-decoration: none; font-size: 12px; color: #525b64; border-radius: 7px; padding: 8px 9px; }
.guide-nav a:hover { background: #f3f5f7; color: var(--red-900); }
.guide-content { display: grid; gap: 15px; }
.guide-section { scroll-margin-top: 86px; background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 20px; }
.guide-section h2 { margin: 0 0 10px; font-size: 19px; }
.guide-section h3 { font-size: 14px; margin: 18px 0 7px; }
.guide-section p, .guide-section li { font-size: 12.5px; line-height: 1.6; color: #4d565f; }
.guide-section ul, .guide-section ol { padding-left: 20px; }
.code-block { background: #272b31; color: #f3f4f5; padding: 13px; border-radius: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; overflow-x: auto; white-space: pre-wrap; }

.storage-bar { height: 10px; background: #e8ebef; border-radius: 999px; overflow: hidden; }
.storage-fill { height: 100%; background: var(--red-800); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(20,23,26,.64); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal { width: min(720px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.close-btn { border: 0; background: #f2f4f6; border-radius: 50%; width: 32px; height: 32px; font-size: 18px; }

.toast-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; gap: 9px; width: min(390px, calc(100vw - 44px)); }
.toast { border-radius: 10px; padding: 12px 13px; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.22); font-size: 12px; display: flex; gap: 10px; align-items: flex-start; animation: toastIn .18s ease-out; }
.toast.info { background: #315f88; }
.toast.success { background: #1c7549; }
.toast.error { background: #9c2430; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .job-row { grid-template-columns: minmax(220px,1.4fr) minmax(170px,1fr) 100px auto; }
  .job-row > :nth-child(4) { display: none; }
  .doc-card { grid-template-columns: 70px 1fr 230px auto; }
  .doc-card > :nth-child(4) { display: none; }
  .fact-grid, .sample-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 850px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; width: 260px; transition: left .2s; box-shadow: 12px 0 40px rgba(0,0,0,.25); }
  .sidebar.open { left: 0; }
  .topbar { padding: 0 17px; }
  .mobile-menu { display: inline-flex; }
  .content { padding: 20px 16px 44px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-status { max-width: 280px; }
  .card-grid, .three-grid, .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-nav { position: static; display: flex; overflow-x: auto; }
  .guide-nav a { white-space: nowrap; }
  .workspace-head { flex-direction: column; }
  .gate { grid-template-columns: 45px 1fr 100px; }
  .gate-detail { grid-column: 2 / -1; }
}

@media (max-width: 650px) {
  .kpi-grid, .fact-grid, .sample-grid { grid-template-columns: 1fr; }
  .job-row { grid-template-columns: 1fr auto; }
  .job-row > :nth-child(2), .job-row > :nth-child(3), .job-row > :nth-child(4) { display: none; }
  .doc-card { grid-template-columns: 58px 1fr; }
  .doc-card > :nth-child(3), .doc-card > :nth-child(4) { grid-column: 1 / -1; }
  .doc-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .doc-thumb, .doc-thumb-placeholder { width: 58px; height: 58px; }
  .analysis-summary { grid-template-columns: 1fr; }
  .score-ring { margin: 0 auto; }
  .requirement-table { display: block; overflow-x: auto; }
  .top-actions .hide-mobile { display: none; }
}
