:root{
  --bg:#0b0b10;
  --card:rgba(255,255,255,0.03);
  --border:rgba(255,255,255,0.07);
  --text:#f5f5f5;
  --muted:rgba(245,245,245,0.65);
  --accent:#d4af37;
  --accent2:#1e3a5f;
  --danger:#ff4d4d;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:radial-gradient(circle at top left,#151524,#050509);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
}

.topbar{
  position:sticky; top:0; z-index:50;
  padding:14px 14px 10px;
  display:flex; align-items:flex-end; justify-content:space-between;
  border-bottom:1px solid var(--border);
  background:rgba(10,10,14,0.72);
  backdrop-filter: blur(10px);
}
.topbar h1{margin:0; font-size:22px; font-weight:650; letter-spacing:0.02em}
.sub{font-size:12px; color:var(--muted); margin-top:4px}

.btn{
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.02);
  color:var(--text);
  padding:10px 12px;
  font-size:13px;
}
.btn.primary{
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:#000; border:none; font-weight:700;
}
.btn.danger{border-color:rgba(255,77,77,0.5); color:var(--danger)}
.btn.small{padding:7px 10px; font-size:12px}
.filebtn{display:inline-flex; align-items:center; gap:8px}

.main{padding:12px 12px 92px}

.view{display:none; gap:12px}
.view.active{display:flex; flex-direction:column}

@media(min-width:900px){
  .view.active{flex-direction:row}
  .panel{flex:1}
  .panel:first-child{max-width:320px}
  .panel.wide{max-width:720px}
}

.panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:18px;
  padding:12px;
  box-shadow:0 14px 40px rgba(0,0,0,0.35);
}
.panel-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:8px}
.panel h2{margin:0; font-size:12px; letter-spacing:0.14em; text-transform:uppercase; color:var(--muted)}

.item-list{
  list-style:none; padding:0; margin:0;
  border-radius:14px;
  border:1px solid var(--border);
  overflow:hidden;
  max-height:360px;
  overflow-y:auto;
}
.item-list li{
  padding:10px 10px;
  border-bottom:1px solid rgba(255,255,255,0.05);
  cursor:pointer;
}
.item-list li:last-child{border-bottom:none}
.item-list li.active{background:rgba(255,255,255,0.05)}
.meta{font-size:12px; color:var(--muted); margin-top:3px}

.form{display:flex; flex-direction:column; gap:10px}
.grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
}
@media(min-width:600px){
  .grid{grid-template-columns:1fr 1fr}
  .span2{grid-column:1 / -1}
}
.field label{display:block; font-size:12px; color:var(--muted); margin-bottom:5px}
input,select,textarea{
  width:100%;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(0,0,0,0.35);
  color:var(--text);
  padding:10px 10px;
  font-size:14px;
}
textarea{resize:vertical}

.lines{margin-top:6px}
.lines-head{display:flex; align-items:center; justify-content:space-between}
.lines-head h3{margin:0; font-size:13px; color:var(--muted); font-weight:700}
.table-wrap{
  margin-top:10px;
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
}
.lines-table{width:100%; border-collapse:collapse; font-size:13px}
.lines-table th,.lines-table td{padding:8px; border-bottom:1px solid rgba(255,255,255,0.05); text-align:right}
.lines-table th:first-child,.lines-table td:first-child{text-align:left}
.lines-table th{font-size:12px; color:var(--muted); font-weight:700}
.line-input{
  width:100%;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.06);
  background:rgba(0,0,0,0.25);
  padding:8px;
  color:var(--text);
}
.remove{
  border:none;
  background:rgba(255,255,255,0.04);
  color:var(--text);
  border-radius:10px;
  padding:6px 10px;
}
.totals{
  margin-top:10px;
  align-self:flex-end;
  min-width:240px;
  border-radius:14px;
  border:1px solid var(--border);
  padding:10px 12px;
  background:radial-gradient(circle at 30% 20%, rgba(212,175,55,0.10), transparent);
}
.totals div{display:flex; justify-content:space-between; gap:12px; margin:6px 0}
.totals span{color:var(--muted)}

.actions-row{display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; margin-top:6px}

.logo-preview img{max-height:46px; margin-top:8px; display:block}

.mobile-nav{
  position:fixed;
  left:12px; right:12px; bottom:12px;
  display:flex; gap:10px;
  padding:10px;
  border-radius:18px;
  background:rgba(10,10,14,0.88);
  border:1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  z-index:9999;
  overflow:hidden;
}
.mnav-btn{
  position:relative;
  flex:1;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.06);
  background:rgba(255,255,255,0.02);
  color:var(--text);
  padding:12px 10px;
  font-size:13px;
}
.mnav-btn.active{
  border-color:rgba(212,175,55,0.25);
  background:rgba(212,175,55,0.06);
  color:rgba(212,175,55,0.95);
  font-weight:800;
}
.badge{
  position:absolute; top:6px; right:10px;
  min-width:18px; height:18px; padding:0 6px;
  border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:#000; font-size:11px; font-weight:900;
}
.pill{
  position:absolute;
  top:8px; left:8px;
  height:44px;
  width:calc((100% - 30px)/4);
  border-radius:999px;
  background:radial-gradient(circle at 30% 20%, rgba(212,175,55,0.14), rgba(30,58,95,0.10));
  border:1px solid rgba(212,175,55,0.14);
  transform:translateX(0);
  transition:transform .26s cubic-bezier(.2,.9,.2,1);
  pointer-events:none;
}

