:root {
  font-family: 'Segoe UI', Arial, system-ui, sans-serif;
  color: #182b2b;
  background: #f3f6f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #182b2b;
  --muted: #687978;
  --line: #dce5e1;
  --surface: #ffffff;
  --deep: #102b2b;
  --accent: #147d68;
  --accent-strong: #0f6858;
  --soft: #e8f3ef;
  --danger: #b54742;
  --warning: #a66b1d;
  --shadow: 0 12px 32px rgba(21, 50, 43, .055);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f3f6f4; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.hidden { display: none !important; }

.shell { min-height: 100vh; }
.topbar { min-height: 76px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 13px clamp(18px, 4vw, 64px); background: var(--deep); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: #d6eee5; color: #105749; font-family: 'Segoe UI', Arial, sans-serif; font-weight: 800; letter-spacing: -.06em; }
.brand strong { display: block; font-family: 'Segoe UI', Arial, sans-serif; font-size: 15px; letter-spacing: -.02em; }
.brand small { display: block; color: #aec3bc; font-size: 11px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.connection-pill { padding: 7px 11px; border-radius: 999px; border: 1px solid rgba(196, 225, 213, .22); color: #d6eee5; font-size: 11px; white-space: nowrap; }
.connection-pill span { display: inline-block; width: 7px; height: 7px; background: #69cfaa; border-radius: 50%; margin-right: 6px; }
.user-email { color: #c1d2cd; font-size: 12px; }
.main-content { width: min(1240px, calc(100% - 36px)); margin: 0 auto; padding: 36px 0 55px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 7px 0 25px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); letter-spacing: .12em; font-size: 10px; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: 'Segoe UI', Arial, sans-serif; }
h1 { margin-bottom: 7px; font-size: clamp(25px, 4vw, 34px); line-height: 1.15; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
h3 { margin: 12px 0 7px; font-size: 15px; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.page-heading .muted { margin-bottom: 0; font-size: 13px; }
.model-indicator { color: #48635c; font-size: 11px; border: 1px solid #ccded6; background: #eaf4ef; border-radius: 999px; padding: 8px 12px; white-space: nowrap; }
.model-indicator.model-warning { color: #845517; border-color: #efd8af; background: #fbf3e5; }
.notice { border-radius: 10px; padding: 12px 14px; font-size: 12px; line-height: 1.5; }
.notice.warning { background: #fff5e8; color: #815015; border: 1px solid #f2dbb8; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin: 16px 0; box-shadow: var(--shadow); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-title > div:first-child { display: flex; align-items: center; gap: 11px; }
.step { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: #e5f2ed; color: #176d5b; font-size: 11px; font-weight: 700; }
.muted-step { background: #f1f4f2; color: #71827d; }
.counter { color: var(--accent); background: #e8f4ef; border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 700; }
.tiny { font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
label { display: grid; gap: 7px; color: #425653; font-size: 12px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"] { width: 100%; min-height: 43px; border: 1px solid #d8e2de; border-radius: 9px; background: #fbfcfb; color: var(--ink); padding: 10px 12px; outline: none; }
input:focus { border-color: #72ad9d; box-shadow: 0 0 0 3px rgba(20, 125, 104, .1); }
.documents-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.optional-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.document-card { min-width: 0; padding: 15px; border: 1px solid #e1e9e5; border-radius: 12px; background: #fcfdfc; transition: border-color .18s, background .18s; }
.document-card.has-file { border-color: #87b9a8; background: #f5fbf8; }
.doc-card-top { display: flex; justify-content: space-between; align-items: center; }
.doc-icon { width: 35px; height: 35px; display: grid; place-items: center; background: #e9f2ee; color: #246d5e; border-radius: 9px; font-size: 10px; font-weight: 800; }
.doc-state { font-size: 9px; letter-spacing: .06em; font-weight: 700; padding: 5px 7px; border-radius: 999px; }
.doc-state.required { background: #edf4f1; color: #537067; }
.doc-state.optional { background: #f2f3f3; color: #707f7c; }
.doc-description { min-height: 32px; margin: 0 0 12px; color: #768681; font-size: 11px; line-height: 1.45; }
.file-picker { cursor: pointer; display: flex; align-items: center; justify-content: center; min-height: 38px; border: 1px dashed #a9c4b9; border-radius: 8px; color: #236d5c; background: #f4faf7; font-size: 11px; font-weight: 700; }
.file-picker:hover { border-color: var(--accent); background: #edf7f2; }
.file-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 18px; margin-top: 9px; color: #52665f; font-size: 10px; }
.doc-meta { margin-top: 2px; min-height: 13px; color: #87958f; font-size: 9px; }
.divider { height: 1px; background: #e8eeeb; margin: 22px 0 19px; }
.optional-heading { margin-bottom: 14px; }
.actions-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #f8fbf9; }
.action-copy strong { display: block; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; }
.action-copy span { display: block; margin-top: 3px; }
.button { min-height: 40px; border: 0; border-radius: 9px; padding: 0 16px; font-size: 12px; font-weight: 700; transition: background .15s, transform .15s; }
.button:not(:disabled):active { transform: translateY(1px); }
.button.primary { background: var(--accent); color: white; }
.button.primary:not(:disabled):hover { background: var(--accent-strong); }
.button.ghost { background: rgba(255,255,255,.09); color: #e4eee9; border: 1px solid rgba(255,255,255,.17); }
.button.ghost:not(:disabled):hover { background: rgba(255,255,255,.16); }
.button.small { min-height: 32px; padding: 0 11px; font-size: 10px; }
.result-panel { scroll-margin-top: 15px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 17px; }
.summary-card { display: flex; align-items: center; justify-content: space-between; padding: 13px; border: 1px solid #e3e9e6; border-radius: 10px; background: #fbfcfb; }
.summary-card span { font-size: 11px; color: #64756f; }
.summary-card strong { font-family: 'Segoe UI', Arial, sans-serif; font-size: 21px; }
.summary-card.success strong { color: #16745f; }
.summary-card.danger strong { color: #b54742; }
.summary-card.warning strong { color: #a66b1d; }
.summary-card.neutral strong { color: #66736f; }
.results-list { display: grid; gap: 7px; }
.result-row { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 12px; padding: 13px 12px; border: 1px solid #e7ece9; border-radius: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: #9ba9a3; }
.status-dot.success { background: #25896e; }
.status-dot.danger { background: #c4554d; }
.status-dot.warning { background: #c18a34; }
.status-label { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 700; letter-spacing: .025em; }
.status-label.success { color: #176d5b; background: #e8f4ee; }
.status-label.danger { color: #9f3d38; background: #fbeceb; }
.status-label.warning { color: #875817; background: #fbf2e3; }
.status-label.neutral { color: #66736f; background: #f0f3f1; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-heading strong { font-size: 12px; }
.result-main p { margin: 6px 0; color: #64746f; font-size: 11px; line-height: 1.45; }
.result-main small { color: #909b97; font-size: 9px; }
.save-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #e7ece9; }
.croqui-review { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 14px; margin-bottom: 14px; border-radius: 10px; background: #f7faf8; border: 1px solid #dfeae4; }
.croqui-review p { margin: 4px 0 7px; }
.text-link { color: #16715e; text-decoration: none; font-size: 11px; font-weight: 700; }
.text-link:hover { text-decoration: underline; }
.check-label { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 11px; }
.check-label input { accent-color: #167d68; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; color: #87938e; font-size: 10px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at top left, #e5f1eb, transparent 42%), #f3f6f4; }
.login-card { width: min(420px, 100%); padding: 34px; background: white; border: 1px solid #dce6e1; border-radius: 18px; box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 23px; }
.login-card h1 { font-size: 26px; }
.login-card .muted { font-size: 12px; line-height: 1.5; }
.stack { display: grid; gap: 15px; margin: 25px 0 18px; }
.stack .button { width: 100%; }
.stack .button.ghost { background: white; color: #27695b; border-color: #cdded6; }
.form-error { min-height: 16px; margin: 0; color: var(--danger); font-size: 11px; }
.fatal-error { max-width: 600px; margin: 80px auto; padding: 25px; background: white; border-radius: 14px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(440px, calc(100vw - 40px)); padding: 12px 16px; color: white; background: #264b42; border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.16); font-size: 12px; }
.toast-error { background: #9d3935; }
.toast-warning { background: #8a621e; }
.toast-success { background: #176d5b; }

@media (max-width: 850px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .documents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .main-content { width: min(100% - 22px, 1240px); padding-top: 22px; }
  .panel { padding: 15px; border-radius: 13px; }
  .documents-grid, .optional-grid, .form-grid { grid-template-columns: 1fr; }
  .doc-description { min-height: 0; }
  .actions-panel, .save-row, .croqui-review { align-items: stretch; flex-direction: column; }
  .actions-panel .button, .save-row .button { width: 100%; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .section-title > div:first-child { width: 100%; }
  .result-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .footer { align-items: flex-start; flex-direction: column; }
  .connection-pill { order: 3; }
  .user-email { overflow-wrap: anywhere; }
}
