:root {
  --bg: #f4f7fb;
  --surface: rgba(255,255,255,.78);
  --surface-strong: #ffffff;
  --text: #162033;
  --muted: #687287;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  --radius: 22px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(79,70,229,.12), transparent 25%),
    radial-gradient(circle at bottom right, rgba(124,58,237,.10), transparent 22%),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.sidebar {
  padding: 24px;
  background: rgba(16,24,40,.92);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display:flex; gap:14px; align-items:center; }
.brand-icon {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display:flex; align-items:center; justify-content:center;
  font-size: 26px; font-weight:700;
}
.brand span { display:block; color: rgba(255,255,255,.72); font-size:14px; margin-top:2px; }
.nav { display:flex; flex-direction:column; gap:10px; }
.nav a {
  padding: 13px 15px; border-radius: 14px; color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.04); transition: .2s ease;
}
.nav a:hover { background: rgba(255,255,255,.12); transform: translateX(2px); }
.user-box {
  margin-top: auto; padding: 16px; border-radius: 18px;
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.92);
}
.user-name { font-weight: 700; margin-bottom: 4px; }
.main-content { padding: 28px; }
.topbar {
  display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:22px;
}
.topbar h1 { margin:0; font-size: clamp(26px, 4vw, 36px); }
.topbar p { margin:8px 0 0; color: var(--muted); }
.alert {
  padding: 14px 16px; border-radius: 16px; margin-bottom: 18px; font-weight: 600;
}
.alert-success { background: #ecfdf5; color: #047857; }
.alert-danger { background: #fef2f2; color: #b91c1c; }
.stats-grid, .content-grid {
  display:grid; gap:18px; margin-bottom: 22px;
}
.stats-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.two-col { grid-template-columns: 1fr 1fr; }
.stat-card, .panel, .login-card, .item-card, .empty-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.stat-card { padding: 20px; }
.stat-card span { display:block; color: var(--muted); margin-bottom: 8px; }
.stat-card strong { font-size: 28px; }
.stat-card.highlight {
  background: linear-gradient(135deg, rgba(79,70,229,.95), rgba(124,58,237,.92));
  color: #fff;
}
.stat-card.highlight span { color: rgba(255,255,255,.75); }
.panel { padding: 22px; }
.panel-nested { padding: 18px; background: rgba(255,255,255,.45); box-shadow: none; }
.panel-head {
  display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:16px;
}
.panel-head h2, .panel-head h3 { margin:0; font-size: 22px; }
.panel-head h3 { font-size: 20px; }
.panel-head-stack { align-items:flex-start; flex-direction:column; }
.hint { color: var(--muted); font-size: 14px; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse: collapse; }
th, td { padding: 14px 12px; text-align:left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 14px; }
.empty { text-align:center; color: var(--muted); padding: 26px 12px; }
.form-grid {
  display:grid; gap:16px; grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid.single-col { grid-template-columns: 1fr; }
.stack-form { display:grid; gap:18px; }
label span {
  display:block; font-size: 14px; color: var(--muted); margin-bottom: 8px; font-weight:600;
}
input {
  width:100%; padding: 14px 15px; border-radius: 14px; border: 1px solid var(--border);
  background:#fff; font-size: 15px; color: var(--text);
}
input:focus {
  outline:none; border-color: rgba(79,70,229,.55); box-shadow: 0 0 0 4px rgba(79,70,229,.1);
}
.form-actions { grid-column: 1 / -1; }
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 12px 16px; border-radius: 14px; font-weight:700; border:none; cursor:pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color:#fff;
}
.btn-secondary { background: #eef2ff; color: #4338ca; }
.btn-danger { background: #fef2f2; color: var(--danger); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.list-cards {
  display:grid; gap:14px;
}
.item-card { padding: 18px; }
.item-card h3 { margin:0 0 10px; }
.item-card p { margin: 8px 0; color: var(--muted); }
.item-card-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.item-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top: 12px; }
.compact-form { display:grid; gap:14px; }
.empty-card {
  padding: 24px; text-align:center; color: var(--muted);
}
.badge {
  display:inline-flex; align-items:center; padding: 6px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge-success { background: #ecfdf5; color: var(--success); }
.badge-warning { background: #fff7ed; color: var(--warning); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.status-success { border-left: 5px solid rgba(5,150,105,.65); }
.status-warning { border-left: 5px solid rgba(217,119,6,.65); }
.status-danger { border-left: 5px solid rgba(220,38,38,.65); }
.row-warning td { background: rgba(255,247,237,.65); }
.row-danger td { background: rgba(254,242,242,.75); }
.search-form {
  width: 100%; display:flex; gap:10px; flex-wrap:wrap;
}
.search-form input { flex: 1 1 240px; }
.sticky-savebar {
  position: sticky; bottom: 12px; z-index: 10;
  display:flex; justify-content:flex-end; padding: 14px 0 0;
}
.sticky-savebar .btn { box-shadow: 0 16px 40px rgba(79,70,229,.28); }
.login-body {
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px;
}
.login-card {
  width:min(100%, 480px); padding:32px;
}
.login-card h1 { margin: 0 0 8px; }
.login-card p { color: var(--muted); margin-bottom: 20px; }
.login-logo {
  width:64px; height:64px; border-radius:20px; display:flex; align-items:center; justify-content:center;
  margin-bottom: 18px; font-size: 30px; color:#fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 840px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height:auto; border-radius: 0 0 26px 26px;
  }
  .main-content { padding: 18px; }
}
@media (max-width: 640px) {
  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .panel, .login-card { padding: 18px; }
  th, td { padding: 12px 10px; }
  .item-card-head, .panel-head { align-items:flex-start; flex-direction:column; }
  .sticky-savebar { justify-content:stretch; }
  .sticky-savebar .btn { width:100%; }
}

select {
  width:100%; padding: 14px 15px; border-radius: 14px; border: 1px solid var(--border);
  background:#fff; font-size: 15px; color: var(--text);
}
.stats-grid-six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.mini-stats-grid {
  display:grid; gap:14px; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cost-totals { margin-bottom: 20px; }
.mini-stat {
  background: rgba(255,255,255,.65); border:1px solid var(--border); border-radius: 18px;
  padding: 18px;
}
.mini-stat span { display:block; color: var(--muted); margin-bottom: 8px; }
.mini-stat strong { font-size: 24px; }
.section-switcher-wrap { padding: 10px; }
.section-switcher {
  display:flex; gap:10px; flex-wrap:wrap;
}
.section-switcher a {
  padding: 12px 16px; border-radius: 14px; background: #eef2ff; color: #4338ca; font-weight: 700;
}
.section-switcher a.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
}
.checkbox-row {
  display:flex; align-items:center; gap:10px; margin-top: 2px;
}
.checkbox-row input {
  width: 18px; height: 18px; margin: 0; flex: 0 0 auto;
}
.checkbox-row span { margin: 0; }
.checkbox-row-space { margin-top: 4px; }
.meta-line { font-size: 13px; color: var(--muted); }
@media (max-width: 1280px) {
  .stats-grid-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 840px) {
  .mini-stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats-grid-six { grid-template-columns: 1fr; }
}
