:root{
  --bg:#f4f7fb;
  --sidebar:#ffffff;
  --panel:#ffffff;
  --panel-2:#f8fbff;
  --line:#dfe7f2;
  --line-soft:#edf2f8;
  --text:#263241;
  --muted:#7e8fa8;
  --blue:#2f8cff;
  --blue-2:#0f6fe8;
  --cyan:#2aa8bd;
  --green:#18a058;
  --red:#ef5350;
  --shadow:0 18px 45px rgba(55,80,112,.08);
  --radius:20px;
}

*{box-sizing:border-box}
html,body{min-height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:"Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size:14px;
}
a{color:inherit}

.topbar{
  position:fixed;
  inset:0 auto 0 0;
  width:238px;
  z-index:50;
  background:var(--sidebar);
  border-right:1px solid var(--line-soft);
  box-shadow:8px 0 30px rgba(65,91,130,.04);
}
.topbar-inner{
  height:100%;
  padding:26px 18px;
  display:flex;
  flex-direction:column;
  gap:28px;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  color:var(--text);
  text-decoration:none;
  font-weight:800;
  letter-spacing:.02em;
}
.brand-badge{
  width:38px;
  height:38px;
  border-radius:14px;
  background:linear-gradient(135deg,#1e9ec9,#2f8cff);
  box-shadow:0 14px 28px rgba(47,140,255,.22);
}
.nav{
  display:grid;
  gap:8px;
}
.nav a,.userlink{
  display:flex;
  align-items:center;
  min-height:42px;
  padding:10px 12px;
  border-radius:13px;
  color:#6f82a1;
  text-decoration:none;
  font-weight:700;
  transition:background .15s ease,color .15s ease,transform .15s ease;
}
.nav a::before{
  content:"";
  width:18px;
  height:18px;
  margin-right:12px;
  border:2px solid currentColor;
  border-radius:6px;
  opacity:.65;
}
.nav a:hover,.userlink:hover{
  background:#f2f7ff;
  color:var(--blue-2);
}
.nav a.active{
  color:var(--blue-2);
  background:#eef6ff;
}
.spacer{flex:1}
.side-status{
  padding:13px;
  border:1px solid var(--line-soft);
  border-radius:16px;
  background:#f8fbff;
}
.side-status-title{
  margin-bottom:10px;
  color:#8a9bb4;
  font-size:11px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.side-status-row{
  display:grid;
  grid-template-columns:10px 1fr auto;
  align-items:center;
  gap:8px;
  color:#607491;
  font-size:12px;
  font-weight:800;
}
.side-status-row + .side-status-row{margin-top:8px}
.side-status-row strong{
  color:#2f4156;
  font-size:12px;
}
.status-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#f5b84b;
  box-shadow:0 0 0 4px rgba(245,184,75,.14);
}
.status-dot.ok{
  background:var(--green);
  box-shadow:0 0 0 4px rgba(24,160,88,.14);
}
.status-dot.warn{
  background:#f5b84b;
}
.userlink{
  border:1px solid var(--line-soft);
  justify-content:center;
}

.container{
  max-width:1180px;
  margin:0 auto;
  padding:30px 28px 50px;
  margin-left:calc(238px + max(24px, (100vw - 1418px)/2));
}

h1,h2,h3,p{margin:0}
h1{
  font-size:34px;
  line-height:1.1;
  letter-spacing:0;
  color:#263241;
}
h2{
  font-size:22px;
  line-height:1.2;
  color:#2c3646;
}
.muted{color:var(--muted)}
.small{font-size:13px}

.btn,button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  padding:0 18px;
  border:0;
  border-radius:16px;
  background:linear-gradient(135deg,var(--blue),#41bfd2);
  color:#fff;
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
  box-shadow:0 12px 24px rgba(47,140,255,.22);
}
.btn:hover,button:hover{filter:brightness(1.03)}
.btn:active,button:active{transform:translateY(1px)}
.btn.secondary,.btn.ghost{
  background:#fff;
  color:#41617f;
  border:1px solid var(--line-soft);
  box-shadow:none;
}
.btn.ghost{background:#f8fbff}

input,textarea,select{
  width:100%;
  min-height:42px;
  padding:10px 13px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  color:var(--text);
  outline:none;
  font:inherit;
}
input:focus,textarea:focus,select:focus{
  border-color:rgba(47,140,255,.55);
  box-shadow:0 0 0 4px rgba(47,140,255,.12);
}
label{
  display:block;
  margin:0 0 6px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

.alert{
  margin:0 0 18px;
  padding:13px 16px;
  border-radius:16px;
  background:#fff;
  border:1px solid var(--line-soft);
  box-shadow:var(--shadow);
}
.alert.ok{border-color:rgba(24,160,88,.25);color:#0f7d47}
.alert.bad{border-color:rgba(239,83,80,.25);color:#b63330}

.dash-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:18px;
  margin-bottom:24px;
}
.page-kicker{
  margin-bottom:8px;
  color:var(--blue-2);
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  font-size:12px;
}
.date-picker{
  display:grid;
  grid-template-columns:160px auto;
  align-items:end;
  gap:10px;
}
.date-picker label{
  grid-column:1/-1;
  margin-bottom:-2px;
}

.balance-strip{
  display:grid;
  grid-template-columns:1.35fr .8fr .8fr;
  gap:16px;
  margin-bottom:18px;
}
.balance-main,.balance-side,.stat-card,.chart-panel,.manual-card,.table-panel{
  background:var(--panel);
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.balance-main,.balance-side{
  padding:22px 26px;
}
.balance-main span,.balance-side span{
  display:block;
  color:#7f91ad;
  font-weight:800;
  margin-bottom:8px;
}
.balance-main strong{
  display:block;
  font-size:42px;
  line-height:1;
  letter-spacing:0;
  color:#293544;
}
.balance-main em,.balance-side em{
  display:block;
  margin-top:8px;
  color:var(--muted);
  font-style:normal;
  font-weight:700;
}
.balance-side strong{
  display:block;
  font-size:22px;
  color:#344254;
}

.stat-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
  margin-bottom:18px;
}
.stat-card{
  display:flex;
  gap:14px;
  padding:18px;
  min-height:118px;
}
.stat-card p{
  color:var(--muted);
  font-weight:800;
  margin-bottom:8px;
}
.stat-card strong{
  display:block;
  font-size:25px;
  line-height:1.15;
  color:#2d3948;
}
.stat-card em{
  display:block;
  margin-top:5px;
  color:var(--muted);
  font-style:normal;
  font-weight:700;
}
.stat-icon{
  flex:0 0 42px;
  width:42px;
  height:42px;
  border-radius:15px;
  position:relative;
  background:#eef6ff;
}
.stat-icon::before,.stat-icon::after{
  content:"";
  position:absolute;
  inset:12px;
  border:2px solid var(--blue);
  border-radius:6px;
}
.stat-icon.money::before{border-radius:50%}
.stat-icon.money::after{inset:19px 11px auto; height:2px; border:0; background:var(--blue)}
.stat-icon.avg::before{inset:11px 18px 11px 10px}
.stat-icon.avg::after{inset:20px 10px 10px 22px}
.stat-icon.month::before{border-radius:4px}
.stat-icon.month::after{inset:10px 12px auto; height:5px; border:0; background:var(--blue); border-radius:3px}

.delta{
  display:inline-flex;
  margin-top:8px;
  padding:4px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
}
.delta.up{color:#0f8f50;background:#e9f8ef}
.delta.down{color:#d53b3b;background:#fff0f0}
.delta.flat{color:#6f82a1;background:#eef3f8}

.chart-panel,.manual-card,.table-panel{
  padding:24px 28px;
  margin-bottom:18px;
}
.panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}
.panel-head p,.manual-card p{
  margin-top:7px;
  color:var(--muted);
  font-weight:700;
}
.legend{
  display:flex;
  gap:18px;
  color:#7385a0;
  font-weight:800;
}
.legend span{display:flex;align-items:center;gap:8px}
.legend i{
  width:13px;
  height:13px;
  border-radius:50%;
  display:inline-block;
}
.legend .blue{background:var(--blue)}
.legend .gray{background:#b6c4d7}

.selected-summary{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin:0 0 18px;
}
.selected-summary div{
  padding:14px 16px;
  border:1px solid var(--line-soft);
  border-radius:16px;
  background:var(--panel-2);
}
.selected-summary span{
  display:block;
  color:var(--muted);
  font-weight:800;
  margin-bottom:6px;
}
.selected-summary strong{
  display:block;
  font-size:24px;
  color:#2d3948;
}

.line-chart{
  width:100%;
  height:260px;
  overflow:visible;
}
.line-chart line{
  stroke:#dfe7f2;
  stroke-width:1;
}
.line-chart polyline{
  fill:none;
  stroke-linecap:round;
  stroke-linejoin:round;
  stroke-width:5;
}
.line-chart .today{stroke:var(--blue)}
.line-chart .yesterday{stroke:#b6c4d7;stroke-width:4}
.line-chart.small{height:230px}
.chart-axis{
  display:flex;
  justify-content:space-between;
  color:#9aabc2;
  font-size:12px;
  font-weight:800;
}

.two-col{
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(300px,.65fr);
  gap:18px;
  align-items:stretch;
}
.manual-card h2{margin-bottom:8px}
.manual-card form{
  display:grid;
  gap:10px;
  margin-top:22px;
}

.clean-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
.clean-table th{
  padding:0 14px 12px;
  color:#8da0bb;
  text-align:left;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.clean-table td{
  padding:15px 14px;
  border-top:1px solid var(--line-soft);
  vertical-align:middle;
  background:#fff;
}
.clean-table tr:hover td{background:#f9fcff}
.tag{
  display:inline-flex;
  align-items:center;
  padding:5px 11px;
  border-radius:999px;
  background:#eef6ff;
  color:var(--blue-2);
  font-size:12px;
  font-weight:900;
}
.stock-table td:nth-child(2){
  width:62%;
  font-weight:750;
}
.deliveries-table td:nth-child(2){min-width:360px}
.deliveries-table td:nth-child(5){white-space:nowrap}
.deliveries-table small{
  display:block;
  margin-top:5px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
.order-id{
  display:block;
  font-weight:900;
  color:#2f4156;
}
code{
  display:inline-block;
  padding:7px 10px;
  border-radius:10px;
  background:#f3f7fc;
  color:#27415f;
  font-family:Consolas,"Courier New",monospace;
  font-size:12px;
  white-space:pre-wrap;
  word-break:break-word;
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
th{
  color:#8da0bb;
  text-align:left;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  padding:0 10px 10px;
}
td{
  padding:13px 10px;
  border-top:1px solid var(--line-soft);
  vertical-align:top;
}
.card{
  background:var(--panel);
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
  margin-bottom:18px;
}

@media (max-width:1180px){
  .container{margin-left:238px}
  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .balance-strip{grid-template-columns:1fr}
  .two-col{grid-template-columns:1fr}
}
@media (max-width:760px){
  .topbar{
    position:static;
    width:auto;
    border-right:0;
    border-bottom:1px solid var(--line-soft);
  }
  .topbar-inner{
    height:auto;
    padding:14px;
    gap:14px;
  }
  .nav{display:flex;overflow:auto}
  .nav a{white-space:nowrap}
  .spacer{display:none}
  .container{
    margin-left:0;
    padding:18px 14px 36px;
  }
  .dash-top{display:grid}
  .date-picker{grid-template-columns:1fr}
  .stat-grid{grid-template-columns:1fr}
  .selected-summary{grid-template-columns:1fr}
  .balance-main strong{font-size:32px}
  .panel-head{display:grid}
  .clean-table{display:block;overflow-x:auto;white-space:nowrap}
}
