:root{
  --bg:#f5f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --text:#111827;
  --muted:#667085;
  --line:#e5e7eb;
  --line-2:#eef1f5;
  --primary:#111827;
  --primary-2:#262f40;
  --success:#0f9d73;
  --warning:#d97706;
  --danger:#d92d20;
  --info:#2563eb;
  --radius:18px;
  --radius-sm:12px;
  --shadow:0 10px 30px rgba(16,24,40,.06);
  --shadow-sm:0 4px 18px rgba(16,24,40,.05);
  --sidebar:248px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
body{font-size:14px}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
.shell{min-height:100vh;display:grid;grid-template-columns:var(--sidebar) 1fr}
.sidebar{
  position:sticky;top:0;height:100vh;background:#0d1117;color:#fff;padding:22px 16px;
  display:flex;flex-direction:column;gap:18px
}
.brand{display:flex;align-items:center;gap:12px;padding:4px 8px 14px}
.brand-mark{width:38px;height:38px;border-radius:12px;background:#fff;color:#111827;display:grid;place-items:center;font-weight:900;font-size:17px}
.brand strong{display:block;font-size:15px}
.brand small{color:#9aa4b2}
.nav{display:flex;flex-direction:column;gap:6px}
.nav a{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:12px;color:#cfd5df;transition:.15s}
.nav a:hover,.nav a.active{background:#1a2230;color:#fff}
.nav .icon{width:22px;text-align:center;opacity:.95}
.sidebar-foot{margin-top:auto;padding:12px 8px;color:#8994a3;font-size:12px}
.main{min-width:0}
.topbar{
  height:72px;background:rgba(255,255,255,.88);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);
  display:flex;align-items:center;justify-content:space-between;padding:0 28px;position:sticky;top:0;z-index:10
}
.topbar h1{font-size:18px;margin:0}
.userbox{display:flex;align-items:center;gap:10px}
.avatar{width:34px;height:34px;border-radius:50%;background:#eef2f6;display:grid;place-items:center;font-weight:800}
.content{padding:26px 28px 50px;max-width:1600px;margin:0 auto}
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:22px}
.page-head h2{margin:0 0 6px;font-size:24px;letter-spacing:-.02em}
.page-head p{margin:0;color:var(--muted)}
.actions{display:flex;gap:10px;flex-wrap:wrap}
.btn{border:0;border-radius:12px;padding:10px 14px;background:var(--primary);color:#fff;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:8px}
.btn:hover{background:var(--primary-2)}
.btn.secondary{background:#fff;color:#1f2937;border:1px solid var(--line)}
.btn.danger{background:var(--danger)}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow-sm)}
.card.pad{padding:20px}
.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:20px}
.stat{padding:18px;background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow-sm)}
.stat span{display:block;color:var(--muted);font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.stat strong{display:block;font-size:28px;margin-top:7px;letter-spacing:-.03em}
.stat small{color:var(--muted)}
.table-card{overflow:hidden}
.table-tools{padding:14px 16px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap}
.search{position:relative;min-width:320px}
.search input{width:100%;padding:10px 12px 10px 38px;border:1px solid var(--line);border-radius:12px;background:#fff;outline:none}
.search:before{content:"⌕";position:absolute;left:13px;top:8px;font-size:18px;color:#98a2b3}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:separate;border-spacing:0}
th,td{padding:12px 14px;border-bottom:1px solid var(--line-2);text-align:left;vertical-align:middle}
th{font-size:11px;text-transform:uppercase;letter-spacing:.045em;color:#7b8494;background:#fbfcfe;white-space:nowrap}
td{white-space:nowrap}
tr:hover td{background:#fbfcfe}
.badge{display:inline-flex;align-items:center;gap:6px;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:800}
.badge.ok{background:#e9f8f2;color:#087a59}
.badge.warn{background:#fff4df;color:#a65b00}
.badge.bad{background:#fff0ef;color:#b42318}
.badge.info{background:#eef4ff;color:#2757b8}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.field label{display:block;font-size:12px;font-weight:800;color:#475467;margin-bottom:6px}
.field input,.field select,.field textarea{
  width:100%;padding:11px 12px;border:1px solid var(--line);border-radius:12px;background:#fff;outline:none
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:#9ca3af;box-shadow:0 0 0 3px rgba(17,24,39,.05)}
.upload-zone{border:1.5px dashed #cfd5df;background:#fafbfc;border-radius:18px;padding:32px;text-align:center}
.upload-zone input{max-width:520px;width:100%;margin-top:14px}
.notice{padding:12px 14px;border-radius:12px;margin-bottom:14px;border:1px solid}
.notice.ok{background:#effaf6;border-color:#b7ead7;color:#0b6b50}
.notice.warn{background:#fff8ea;border-color:#f1d6a6;color:#965c0c}
.notice.bad{background:#fff2f1;border-color:#f2c4c0;color:#a6291f}
.doc-grid{display:grid;grid-template-columns:minmax(420px,.9fr) minmax(480px,1.1fr);gap:18px}
.preview-card{position:sticky;top:92px;height:calc(100vh - 120px);overflow:hidden}
.preview{width:100%;height:100%;border:0;object-fit:contain;background:#eef1f5}
.preview-wrap{height:calc(100% - 54px);background:#eef1f5}
.preview-head{height:54px;padding:0 16px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}
.mrz{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:#0d1117;color:#d9e2ef;padding:14px;border-radius:12px;overflow:auto;font-size:13px;line-height:1.6}
.empty{padding:38px;text-align:center;color:var(--muted)}
hr{border:0;border-top:1px solid var(--line);margin:20px 0}
.mobile-menu{display:none}
@media(max-width:1050px){
  .shell{grid-template-columns:1fr}
  .sidebar{position:fixed;left:-270px;z-index:30;width:248px;transition:.2s}
  .sidebar.open{left:0}
  .mobile-menu{display:inline-flex}
  .stats{grid-template-columns:repeat(2,1fr)}
  .doc-grid{grid-template-columns:1fr}
  .preview-card{position:relative;top:auto;height:65vh}
}
@media(max-width:640px){
  .content{padding:18px 12px 38px}
  .topbar{height:64px;padding:0 14px}
  .stats{grid-template-columns:1fr 1fr}
  .stat strong{font-size:23px}
  .page-head{flex-direction:column}
  .form-grid{grid-template-columns:1fr}
  .search{min-width:100%}
  .actions{width:100%}.actions .btn{flex:1}
}
