:root{
  --green:#059669;
  --green-dark:#047857;
  --green-light:#D1FAE5;
  --accent:#D97706;
  --accent-light:#FEF3C7;
  --grey:#4E5052;
  --grey-soft:#F4F5F6;
  --border:#E5E7EA;
  --text:#1F2328;
  --text-muted:#6B7280;
  --amber:#B7791F;
  --amber-bg:#FDF3DF;
  --red:#C0392B;
  --red-bg:#FCEAE8;
  --blue:#2563EB;
  --blue-bg:#EAF1FE;
  --card-radius:12px;
  --shadow: 0 1px 2px rgba(16,24,32,.04), 0 1px 8px rgba(16,24,32,.04);
  --shadow-btn: 0 2px 8px rgba(5,150,105,.28);
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  background:var(--grey-soft);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}
.icon{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;}
.icon-sm{width:15px;height:15px;}
.icon-lg{width:22px;height:22px;}
.topbar{ display:flex; align-items:center; justify-content:space-between; background:#fff; border-bottom:1px solid var(--border); padding:14px 28px; }
.topbar-left{ display:flex; align-items:center; gap:18px; }
.logo{ display:flex; align-items:center; color:var(--green); }
.logo svg{ height:34px; width:auto; }
.portal-title h1{ font-size:19px; margin:0; font-weight:700; color:var(--green);}
.portal-title p{ font-size:12px; margin:1px 0 0; color:var(--text-muted);}
.topbar-right{ display:flex; align-items:center; gap:18px; }
.icon-btn{ background:none; border:none; cursor:pointer; color:var(--text-muted); position:relative; padding:4px; display:flex; align-items:center; }
.icon-btn:hover{ color:var(--text); }
.badge-dot{ position:absolute; top:-2px; right:-2px; background:var(--green); color:#fff; font-size:9px; font-weight:700; min-width:15px; height:15px; border-radius:50%; display:flex; align-items:center; justify-content:center; padding:0 2px; }
.user-chip{ display:flex; align-items:center; gap:9px; cursor:pointer; position:relative; }
.avatar{ width:34px; height:34px; border-radius:50%; object-fit:cover; background:#D9DCE0; }
.user-meta{ line-height:1.25; }
.user-meta .name{ font-size:13px; font-weight:600; }
.user-meta .role{ font-size:11px; color:var(--text-muted); }
.layout{ display:flex; align-items:flex-start; }
.sidebar{ width:220px; flex-shrink:0; background:#fff; border-right:1px solid var(--border); padding:18px 12px; }
.nav-item{ display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:8px; color:var(--text-muted); font-size:13.5px; font-weight:500; margin-bottom:2px; cursor:pointer; position:relative; }
.nav-item:hover{ background:var(--grey-soft); color:var(--text); }
.nav-item.active{ background:var(--green); color:#fff; }
.nav-item .nav-badge{ margin-left:auto; background:var(--red); color:#fff; font-size:10px; font-weight:700; min-width:17px; height:17px; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.nav-item.active .nav-badge{ background:rgba(255,255,255,.3); }
.nav-section-title{ font-size:10.5px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; padding:16px 12px 6px; margin-top:4px; }
.nav-section-title:first-of-type{ margin-top:0; }
.main{ flex:1; padding:24px 28px 60px; min-width:0; max-width:1440px; margin:0 auto; width:100%; }
.page-head{ margin-bottom:20px; }
.page-head h2{ font-size:18px; margin:0 0 4px; }
.page-head p{ font-size:13px; color:var(--text-muted); margin:0; }
.stat-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.stat-card{ background:#fff; border:1px solid var(--border); border-radius:var(--card-radius); padding:16px 18px; box-shadow:var(--shadow); }
.stat-card .stat-icon{ width:34px; height:34px; border-radius:9px; background:var(--green-light); color:var(--green); display:flex; align-items:center; justify-content:center; margin-bottom:10px; }
.stat-card .stat-label{ font-size:12px; color:var(--text-muted); font-weight:500; }
.stat-card .stat-value{ font-size:24px; font-weight:700; margin:2px 0; }
.stat-card .stat-sub{ font-size:11.5px; color:var(--text-muted); }
.card{ background:#fff; border:1px solid var(--border); border-radius:var(--card-radius); box-shadow:var(--shadow); overflow:hidden; min-width:0; }
.card-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 18px; border-bottom:1px solid var(--border); }
.card-head h3{ font-size:14.5px; margin:0; font-weight:700; }
.card-head a{ font-size:12.5px; color:var(--green); font-weight:600; text-decoration:none; cursor:pointer; }
.card-body{ padding:6px 0; overflow-x:auto; }
.card-body.pad{ padding:16px 18px; }
.empty-state{ text-align:center; padding:30px 18px; color:var(--text-muted); font-size:13px; }
.loading-state{ text-align:center; padding:30px 18px; color:var(--text-muted); font-size:13px; }
.loading-state-inner{ display:inline-flex; align-items:center; gap:8px; justify-content:center; }
.loading-spin{ color:var(--green); animation:h3cSpin 1.4s linear infinite; }
@keyframes h3cSpin{ to{ transform:rotate(360deg); } }
table{ width:100%; border-collapse:collapse; font-size:13px; }
th{ text-align:left; padding:9px 18px; color:var(--text-muted); font-weight:600; font-size:11.5px; text-transform:uppercase; letter-spacing:.03em; border-bottom:1px solid var(--border); }
td{ padding:12px 18px; border-bottom:1px solid #F0F1F2; vertical-align:middle; }
tr:last-child td{ border-bottom:none; }
.cell-title{ font-weight:600; font-size:13px; }
.cell-sub{ font-size:12px; color:var(--text-muted); }
.badge{ display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; }
.badge.pending{ background:var(--amber-bg); color:var(--amber); }
.badge.approved{ background:var(--green-light); color:var(--green-dark); }
.badge.declined{ background:var(--red-bg); color:var(--red); }
.badge.missing{ background:var(--amber-bg); color:var(--amber); }
.row-actions{ display:flex; gap:6px; }
.act-btn{ width:26px; height:26px; border-radius:7px; border:1px solid var(--border); background:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--text-muted); transition:.12s; }
.act-btn.approve:hover{ background:var(--green-light); border-color:var(--green); color:var(--green-dark); }
.act-btn.decline:hover{ background:var(--red-bg); border-color:var(--red); color:var(--red); }
.simple-item{ display:flex; align-items:flex-start; gap:12px; padding:11px 18px; border-bottom:1px solid #F0F1F2; }
.simple-item:last-child{ border-bottom:none; }
.simple-item .txt{ flex:1; }
.simple-item .title{ font-size:13px; font-weight:500; }
.simple-item .meta{ font-size:11.5px; color:var(--text-muted); margin-top:2px; display:flex; align-items:center; gap:8px;}
.prio{ padding:2px 7px; border-radius:5px; font-size:10px; font-weight:700; }
.prio.High{ background:var(--red-bg); color:var(--red); }
.prio.Medium{ background:var(--amber-bg); color:var(--amber); }
.prio.Low{ background:var(--green-light); color:var(--green-dark); }
.ai-card{ display:flex; flex-direction:column; height:100%; }
.ai-head{ display:flex; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--border); background:linear-gradient(180deg,#fff,#FCFDFC); }
.ai-head .ai-title{ display:flex; align-items:center; gap:8px; font-weight:700; font-size:14px; color:var(--green-dark); }
.ai-body{ padding:14px 16px; flex:1; display:flex; flex-direction:column; gap:10px; min-height:200px; max-height:460px; overflow-y:auto; }
.greet{ font-size:13.5px; font-weight:600; margin-bottom:2px; }
.greet-sub{ font-size:12.5px; color:var(--text-muted); margin-bottom:6px; }
.chip-row{ display:flex; flex-wrap:wrap; gap:7px; margin-bottom:4px; }
.chip{ border:1px solid var(--green); color:var(--green-dark); background:#fff; border-radius:8px; padding:7px 11px; font-size:12.5px; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:6px; transition:.12s; font-family:inherit; }
.chip:hover{ background:var(--green-light); }
.bubble{ border-radius:10px; padding:10px 12px; font-size:13px; line-height:1.5; max-width:92%; white-space:pre-wrap; }
.bubble.user{ background:var(--green); color:#fff; align-self:flex-end; border-bottom-right-radius:3px; }
.bubble.bot{ background:var(--grey-soft); color:var(--text); align-self:flex-start; border-bottom-left-radius:3px; }
.ai-input-row{ display:flex; align-items:flex-end; gap:8px; padding:12px 14px; border-top:1px solid var(--border); }
.ai-input-row input, .ai-input-row textarea{ flex:1; border:1px solid var(--border); border-radius:8px; padding:9px 12px; font-size:13px; font-family:inherit; background:var(--grey-soft); }
.ai-input-row textarea{ resize:none; min-height:38px; max-height:140px; line-height:1.4; overflow-y:auto; }
.ai-send{ width:36px; height:36px; border-radius:8px; border:none; background:var(--green); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0; }
.donut-row{ display:flex; align-items:center; gap:18px; }
.donut-legend{ font-size:12px; }
.legend-item{ display:flex; align-items:center; gap:7px; margin-bottom:6px; }
.legend-dot{ width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.legend-item b{ margin-left:auto; padding-left:12px; }
.bar-wrap{ margin-top:10px; }
.bar-track{ height:7px; background:#EDEEF0; border-radius:99px; overflow:hidden; margin:4px 0 10px; }
.bar-fill{ height:100%; background:var(--green); border-radius:99px; }
.kpi-row{ display:flex; justify-content:space-between; font-size:12px; color:var(--text-muted); }
.kpi-big{ font-size:26px; font-weight:800; color:var(--text); margin:2px 0; }
.modal-overlay{ position:fixed; inset:0; background:rgba(20,24,28,.45); z-index:150; display:none; align-items:center; justify-content:center; padding:40px 16px; overflow-y:auto; }
.modal-overlay.open{ display:flex; }
.modal{ background:#fff; border-radius:var(--card-radius); box-shadow:0 20px 60px rgba(0,0,0,.25); width:100%; max-width:560px; overflow:hidden; }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); }
.modal-head h3{ margin:0; font-size:16px; }
.modal-close{ background:none; border:none; cursor:pointer; color:var(--text-muted); padding:4px; }
.modal-body{ padding:18px 20px; display:flex; flex-direction:column; gap:14px; max-height:70vh; overflow-y:auto; }
.modal-foot{ padding:14px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }
.field{ display:flex; flex-direction:column; gap:5px; }
.field label{ font-size:11.5px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em; }
.field input, .field select, .field textarea{ padding:9px 11px; border:1px solid var(--border); border-radius:7px; font-family:inherit; font-size:13.5px; background:#fff; min-width:0; }
.field textarea{ resize:vertical; min-height:70px; }
.field-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field-row .field{ min-width:0; }
.dropzone{ border:1.5px dashed var(--border); border-radius:10px; padding:18px; text-align:center; cursor:pointer; font-size:12.5px; color:var(--text-muted); background:var(--grey-soft); }
.dropzone:hover{ border-color:var(--green); color:var(--green-dark); }
.inline-note{ font-size:12px; padding:9px 12px; border-radius:8px; }
.inline-note.warn{ background:var(--amber-bg); color:var(--amber); }
.inline-note.info{ background:var(--blue-bg); color:var(--blue); }
.btn-primary{ background:linear-gradient(135deg,var(--green),var(--green-dark)); color:#fff; border:none; border-radius:7px; padding:9px 18px; font-weight:700; font-size:13px; cursor:pointer; font-family:inherit; box-shadow:var(--shadow-btn); transition:transform .12s ease, box-shadow .12s ease; }
.btn-primary:hover{ transform:translateY(-1px); box-shadow:0 4px 14px rgba(5,150,105,.34); }
.btn-primary:active{ transform:translateY(0); }
.btn-primary:disabled{ background:#B7BEC4; cursor:default; box-shadow:none; transform:none; }
.btn-secondary{ background:#fff; border:1px solid var(--border); border-radius:7px; padding:9px 18px; font-weight:600; font-size:13px; cursor:pointer; font-family:inherit; color:var(--text); transition:border-color .12s ease, color .12s ease; }
.btn-secondary:hover{ border-color:var(--green); color:var(--green-dark); }
.removeBtn{ padding:6px 12px; cursor:pointer; border:1px solid var(--border); border-radius:7px; background:#fff; font-family:inherit; font-size:12.5px; color:var(--red); }
.removeBtn:hover{ background:var(--red-bg); border-color:var(--red); }
#toast{ position:fixed; bottom:22px; left:50%; transform:translateX(-50%) translateY(20px); background:var(--text); color:#fff; padding:12px 20px; border-radius:9px; font-size:13.5px; display:flex; align-items:center; gap:10px; opacity:0; pointer-events:none; transition:.25s; box-shadow:0 8px 24px rgba(0,0,0,.2); z-index:200; }
#toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
#toast svg{ color:var(--green); }
::-webkit-scrollbar{ width:8px; }
::-webkit-scrollbar-thumb{ background:#D6D9DC; border-radius:99px; }
.hamburger-btn{ display:none; background:none; border:none; cursor:pointer; color:var(--text); padding:4px; }
.sidebar-backdrop{ display:none; }

@media (max-width:1100px){ .stat-row{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:900px){
  .hamburger-btn{ display:flex; align-items:center; }
  .layout{ position:relative; }
  .sidebar{
    position:fixed; top:0; left:0; height:100dvh; z-index:120; overflow-y:auto;
    transform:translateX(-100%); transition:transform .2s ease;
  }
  .sidebar.open{ transform:translateX(0); box-shadow:0 0 40px rgba(0,0,0,.3); }
  .sidebar-backdrop.open{ display:block; position:fixed; inset:0; background:rgba(15,18,22,.4); z-index:110; }
  .main{ padding:18px 16px 60px; max-width:100%; }
}
@media (max-width:640px){
  .stat-row{ grid-template-columns:1fr; }
  table{ font-size:12px; min-width:560px; }
  .field-row{ grid-template-columns:1fr; }
  .topbar{ padding:12px 16px; }
  .card-head{ padding:13px 14px; flex-wrap:wrap; gap:8px; }
  .card-body.pad{ padding:14px; }
}
