:root{
  --bg:#f4f7fb;
  --panel:#ffffff;
  --ink:#182230;
  --muted:#667085;
  --line:#dfe5ee;
  --green:#8dc63e;
  --lime:#c3dc29;
  --blue:#2563eb;
  --amber:#d97706;
  --red:#dc2626;
  --shadow:0 18px 45px rgba(15,23,42,.10);
  --radius:8px;
  --font:"Segoe UI",Arial,sans-serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background:var(--bg);
  color:var(--ink);
}

a{color:inherit}
button,input{font:inherit}

.app-shell{
  min-height:100%;
  display:grid;
  grid-template-columns:260px minmax(0,1fr);
}

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
  gap:24px;
  padding:22px;
  background:#111827;
  color:#fff;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
}

.brand-mark{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:linear-gradient(135deg,var(--lime),var(--green));
  color:#102f08;
  font-weight:900;
}

.brand strong,.brand small{display:block}
.brand small{color:#cbd5e1;margin-top:2px}

.sidebar nav{
  display:grid;
  gap:6px;
}

.sidebar nav a{
  padding:11px 12px;
  border-radius:8px;
  color:#dbeafe;
  text-decoration:none;
  font-weight:700;
}

.sidebar nav a:hover,
.sidebar nav a.active{
  background:rgba(255,255,255,.10);
  color:#fff;
}

.sidebar-footer{
  margin-top:auto;
  display:grid;
  gap:4px;
  padding:14px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:8px;
  background:rgba(255,255,255,.06);
}

.sidebar-footer span{font-weight:800}
.sidebar-footer small{color:#cbd5e1}

.main{
  min-width:0;
}

.topbar{
  position:sticky;
  top:0;
  z-index:5;
  min-height:72px;
  display:flex;
  align-items:center;
  gap:16px;
  padding:14px 24px;
  background:rgba(244,247,251,.92);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line);
}

.topbar strong,.topbar small{display:block}
.topbar small{color:var(--muted);margin-top:2px}

.topbar-actions{
  margin-left:auto;
  min-width:280px;
}

.search{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}

.search span{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
}

.search input{
  width:100%;
  min-width:0;
  border:0;
  outline:0;
}

.menu-button{
  display:none;
  width:40px;
  height:40px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}

.menu-button span{
  display:block;
  width:18px;
  height:2px;
  margin:4px auto;
  background:var(--ink);
}

.content{
  width:min(1440px,100%);
  margin:0 auto;
  padding:24px;
}

.central-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:20px;
  padding:28px;
  border:1px solid var(--line);
  border-radius:8px;
  background:
    linear-gradient(135deg,rgba(255,255,255,.98),rgba(245,251,239,.98)),
    #fff;
  box-shadow:var(--shadow);
}

.eyebrow{
  margin:0 0 8px;
  color:#557a16;
  font-size:12px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}

h1,h2{margin:0;letter-spacing:0}
h1{
  max-width:760px;
  font-size:42px;
  line-height:1.05;
}

h2{
  font-size:18px;
}

.hero-copy{
  max-width:720px;
  margin:12px 0 0;
  color:var(--muted);
  font-size:16px;
  line-height:1.55;
}

.hero-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.btn{
  min-height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:8px;
  text-decoration:none;
  font-weight:900;
  border:1px solid transparent;
}

.btn-primary{
  background:var(--green);
  color:#102f08;
}

.btn-secondary{
  background:#fff;
  color:var(--ink);
  border-color:var(--line);
}

.metric-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:18px 0;
}

.metric-card{
  display:grid;
  gap:8px;
  padding:18px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}

.metric-card span,
.metric-card small{
  color:var(--muted);
}

.metric-card strong{
  font-size:34px;
  line-height:1;
}

.metric-card[data-tone="good"]{border-top:4px solid var(--green)}
.metric-card[data-tone="info"]{border-top:4px solid var(--blue)}
.metric-card[data-tone="warn"]{border-top:4px solid var(--amber)}
.metric-card[data-tone="alert"]{border-top:4px solid var(--red)}

.central-grid{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(320px,.6fr);
  gap:18px;
}

.panel{
  min-width:0;
  padding:20px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  box-shadow:0 10px 28px rgba(15,23,42,.06);
}

.panel-wide{
  grid-row:span 2;
}

.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  margin-bottom:16px;
}

.icon-button{
  width:36px;
  height:36px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--ink);
  font-size:22px;
  line-height:1;
  cursor:pointer;
}

.table-wrap{
  overflow:auto;
}

table{
  width:100%;
  min-width:780px;
  border-collapse:collapse;
}

th,td{
  padding:13px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:middle;
}

th{
  color:var(--muted);
  font-size:12px;
  text-transform:uppercase;
}

.sort-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:inherit;
  text-decoration:none;
}

.sort-link:hover,
.sort-link.active{
  color:var(--ink);
}

.sort-link small{
  color:var(--blue);
  font-size:10px;
  font-weight:900;
  text-transform:uppercase;
}

.status-pill{
  display:inline-flex;
  min-height:28px;
  align-items:center;
  padding:5px 9px;
  border-radius:999px;
  background:#eef6df;
  color:#365314;
  font-size:12px;
  font-weight:900;
}

.logout-link{
  min-height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--ink);
  font-weight:800;
  text-decoration:none;
}

.login-page{
  min-height:100%;
  display:grid;
  place-items:center;
  padding:24px;
  background:
    linear-gradient(135deg,rgba(141,198,62,.14),rgba(37,99,235,.08)),
    var(--bg);
}

.login-shell{
  width:min(1040px,100%);
  display:grid;
  place-items:center;
}

.login-panel{
  width:min(520px,100%);
  display:grid;
  gap:22px;
  padding:28px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  box-shadow:var(--shadow);
}

.login-brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.login-brand strong,
.login-brand small{
  display:block;
}

.login-brand small{
  color:var(--muted);
  margin-top:2px;
}

.login-form,
.stack-form{
  display:grid;
  gap:14px;
}

.field{
  display:grid;
  gap:6px;
}

.field span{
  color:var(--muted);
  font-size:13px;
  font-weight:800;
}

.field input,
.field select,
.field textarea{
  width:100%;
  min-height:42px;
  padding:9px 11px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--ink);
  outline:0;
  resize:vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus{
  border-color:rgba(141,198,62,.8);
  box-shadow:0 0 0 4px rgba(141,198,62,.18);
}

.alert,
.notice{
  padding:12px 14px;
  border-radius:8px;
  border:1px solid rgba(220,38,38,.20);
  background:#fef2f2;
  color:#991b1b;
  font-weight:800;
}

.notice{
  border-color:rgba(37,99,235,.18);
  background:#eff6ff;
  color:#1d4ed8;
}

.notice-success{
  border-color:rgba(34,197,94,.20);
  background:#f0fdf4;
  color:#166534;
}

.page-heading{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:18px;
  margin-bottom:18px;
}

.page-heading h1{
  font-size:34px;
}

.central-grid-users{
  grid-template-columns:minmax(300px,.45fr) minmax(0,1fr);
}

.stock-forms,
.settings-forms{
  display:grid;
  grid-template-columns:repeat(2,minmax(280px,1fr));
  gap:18px;
  margin-bottom:18px;
}

.form-row{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.inline-form{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:420px;
}

.inline-form select,
.inline-form input{
  min-height:36px;
  padding:7px 9px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}

.inline-form select{
  min-width:190px;
}

.inline-form input{
  min-width:110px;
}

.inline-form-wide{
  min-width:760px;
}

.stock-table-wide{
  min-width:1380px;
}

.btn-compact{
  min-height:36px;
  padding:7px 10px;
}

.table-muted{
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-size:12px;
}

.status-pill-alert{
  background:#fef2f2;
  color:#991b1b;
}

body.menu-open .sidebar{
  transform:translateX(0);
}

@media (max-width:1100px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{
    position:fixed;
    z-index:20;
    left:0;
    transform:translateX(-100%);
    transition:transform .18s ease;
  }
  .menu-button{display:block}
  .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .central-grid{grid-template-columns:1fr}
  .stock-forms,
  .settings-forms{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (max-width:720px){
  .content{padding:16px}
  .topbar{padding:12px 16px}
  .topbar-actions{display:none}
  .central-hero{display:grid;padding:20px}
  h1{font-size:31px}
  .metric-grid{grid-template-columns:1fr}
  .stock-forms,
  .settings-forms{grid-template-columns:1fr}
  .form-row{grid-template-columns:1fr}
}

@media (max-width:900px){
  .central-grid-users{
    grid-template-columns:1fr;
  }
}
