:root{
  --bg:#f4f7f6;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e2e8f0;
  --primary:#1a365d;
  --accent:#2dad83;
  --danger:#b91c1c;
  --shadow:0 10px 30px rgba(15,23,42,.08);
  --radius:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(45,173,131,.18), transparent 55%),
              radial-gradient(900px 500px at 100% 0%, rgba(26,54,93,.18), transparent 50%),
              var(--bg);
  color:var(--text);
}

a{color:inherit;text-decoration:none}

.header{
  position:sticky; top:0; z-index:10;
  background:rgba(244,247,246,.8);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}
.header-inner{
  max-width:1100px; margin:0 auto; padding:14px 16px;
  display:flex; gap:12px; align-items:center; justify-content:space-between;
}
.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:38px;height:38px;border-radius:12px;
  background: linear-gradient(135deg, var(--primary), #0b2550);
  display:grid; place-items:center; color:white; font-weight:800;
  box-shadow: var(--shadow);
}
.brand-title{font-weight:800; letter-spacing:.2px}
.brand-sub{font-size:12px; color:var(--muted)}
.header-actions{display:flex; gap:8px; align-items:center}

.container{max-width:1100px; margin:0 auto; padding:18px 16px 36px}

.grid.two{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
}
@media(min-width:980px){
  .grid.two{grid-template-columns: 1fr 1fr;}
}

.wrap{
  min-height:100%;
  display:grid;
  place-items:center;
  padding:24px 16px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card-head{
  padding:18px 18px 8px;
}
.card-head h2{margin:0 0 4px}
.card-head p{margin:0}

.top{padding:18px}
.kicker{
  display:inline-block;
  font-size:12px;
  color:var(--primary);
  background: rgba(26,54,93,.08);
  border:1px solid rgba(26,54,93,.15);
  padding:4px 10px;
  border-radius:999px;
  margin-bottom:10px;
}
h1{margin:0 0 6px}
.sub{margin:0;color:var(--muted); line-height:1.4}

.form{padding:18px}
.row{display:flex; gap:12px; flex-wrap:wrap; margin-bottom:12px}
.col{flex:1 1 220px; min-width:220px}
.label{display:block; font-size:12px; color:var(--muted); margin:0 0 6px}
.input{
  width:100%;
  padding:12px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  outline:none;
}
.input:focus{border-color: rgba(45,173,131,.55); box-shadow: 0 0 0 4px rgba(45,173,131,.12)}
textarea.input{resize:vertical}

.inline{display:flex; gap:10px; align-items:center}
.inline .input{flex:1}

.btn{
  border:1px solid var(--line);
  background:#fff;
  padding:11px 14px;
  border-radius:14px;
  cursor:pointer;
  display:inline-flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  font-weight:650;
}
.btn:hover{border-color:#cbd5e1}
.btn.primary{
  background: linear-gradient(135deg, var(--primary), #0b2550);
  color:#fff;
  border-color: transparent;
}
.btn.primary:hover{filter:brightness(1.03)}
.btn.ghost{
  background: transparent;
}
.btn.danger{
  background: rgba(185,28,28,.08);
  border-color: rgba(185,28,28,.25);
  color: var(--danger);
}
.btn.danger:hover{border-color: rgba(185,28,28,.4)}

.hint{font-size:12px;color:var(--muted); margin-top:6px}
.small{font-size:12px}
.muted{color:var(--muted)}

.alert{
  margin:0 18px 0;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(185,28,28,.25);
  background: rgba(185,28,28,.08);
  color: var(--danger);
}

.divider{height:1px; background:var(--line); margin:12px 0}

.seg{
  display:flex; gap:10px; flex-wrap:wrap;
  border:1px solid var(--line);
  padding:8px;
  border-radius:16px;
}
.seg label{
  display:flex; gap:8px; align-items:center;
  padding:8px 10px;
  border-radius:14px;
  background: rgba(26,54,93,.04);
  border:1px solid rgba(26,54,93,.08);
  cursor:pointer;
  user-select:none;
}

.pill{
  display:inline-flex; align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background: rgba(45,173,131,.10);
  border:1px solid rgba(45,173,131,.25);
  font-size:12px;
  margin-right:6px;
}

.list{padding:0 18px 18px}
.item{
  display:flex; justify-content:space-between; gap:12px;
  padding:12px 12px;
  border:1px solid var(--line);
  border-radius:16px;
  margin-top:10px;
}
.item:hover{border-color:#cbd5e1}
.item-title{font-weight:800; margin-bottom:6px}
.item-sub{font-size:12px; color:var(--muted); display:flex; gap:8px; flex-wrap:wrap; align-items:center}
.item-meta{font-size:12px; color:var(--muted); white-space:nowrap; padding-top:2px}
.empty{padding:14px; color:var(--muted); border:1px dashed var(--line); border-radius:16px; margin-top:10px}

.kv{
  padding:0 18px 12px;
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
@media(min-width:780px){
  .kv{grid-template-columns: 1fr 1fr;}
}
.k{font-size:12px; color:var(--muted); margin-bottom:4px}
.v{font-weight:650}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size:12px}

.note{padding:0 18px 14px}
.actions{
  padding:0 18px 14px;
  display:flex; gap:10px; flex-wrap:wrap; align-items:center;
}
.preview{padding:0 18px 18px}
.preview img{
  width:100%;
  border-radius:16px;
  border:1px solid var(--line);
}
.preview .pdf{
  width:100%;
  height:70vh;
  border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
}

.footnote{
  padding:0 18px 18px;
  color:var(--muted);
  font-size:12px;
}

.modal{
  position:fixed; inset:0;
  background: rgba(15,23,42,.45);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.modal.show{display:flex}
.modal-card{
  width:min(560px, 100%);
  background:var(--card);
  border-radius:18px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-head{
  padding:14px 14px 10px;
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
  border-bottom:1px solid var(--line);
}
.modal-body{padding:14px}
#scanVideo{
  width:100%;
  background:#000;
  border-radius:16px;
  border:1px solid var(--line);
  aspect-ratio: 4 / 3;
}
.iconbtn{
  border:1px solid var(--line);
  background:#fff;
  width:38px;height:38px;
  border-radius:14px;
  cursor:pointer;
  font-weight:900;
}
