:root {
  --sidebar-width: 280px;
  --sidebar-collapsed: 88px;

  --bg: #f7faf8;
  --surface: #ffffff;
  --surface-soft: #f8fbf8;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #cbd5cf;

  --primary: #0f7b3e;
  --primary-dark: #0b5f30;
  --primary-soft: #eaf6ef;

  --success: #15803d;
  --warning: #f47c20;
  --danger: #dc2626;

  --navy: #f3f8f4;
  --navy-2: #eaf6ef;

  --shadow: 0 12px 32px rgba(15,23,42,.08);
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:Inter,Arial,sans-serif;color:var(--text);background:var(--bg);overflow-x:hidden}
body{-webkit-text-size-adjust:100%;text-size-adjust:100%}
a{text-decoration:none;color:inherit}
button,input,select,textarea{font:inherit}

.app{display:flex;min-height:100vh}

.sidebar{
  position:fixed;
  left:0;
  top:0;
  bottom:0;
  width:var(--sidebar-width);
  background:linear-gradient(180deg,#eff6f1 0%,#f7faf8 100%);
  color:#1f2937;
  padding:14px 12px 16px;
  overflow:hidden;
  transition:width .2s ease, transform .2s ease;
  z-index:40;
}
.sidebar.collapsed{width:var(--sidebar-collapsed)}
.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .footer-user-copy,
.sidebar.collapsed .sidebar-section-title{display:none}
.sidebar.collapsed .nav-link{justify-content:center}
.sidebar.collapsed .nav-icon{margin-right:0}

.sidebar-header{
  min-height:86px;
  display:flex;
  align-items:center;
  padding:8px 6px;
}
.brand{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
}
.brand-logo{
  width:152px;
  max-width:100%;
  height:42px;
  object-fit:contain;
  display:block;
}
.brand-logo-fallback{
  display:none;
  font-size:26px;
  line-height:1;
  font-weight:800;
  letter-spacing:.01em;
  color:#0f7b3e;
}
.brand-copy h1{font-size:20px;margin:0 0 4px}
.brand-copy p{
  margin:0;
  color:#6b7280;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
.brand-copy{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  flex:1;
  text-align:center;
}
.brand-copy h1{font-size:20px;margin:4px 0 0;line-height:1.1;color:#1f2937}
.sidebar-toggle{
  margin-left:auto;
  width:38px;
  height:38px;
  border-radius:11px;
  border:1px solid var(--line);
  background:#f8fbf9;
  cursor:pointer;
  color:#1f2937;
}
.sidebar.collapsed .sidebar-toggle{margin-left:0}
.sidebar.collapsed .brand-mark{
  width:42px;
  height:42px;
  border-radius:14px;
  font-size:22px;
.sidebar.collapsed .brand-copy{display:none}
.sidebar.collapsed .sidebar-header{justify-content:center}

.sidebar-modules{
  margin-top:10px;
  height:calc(100vh - 124px);
  overflow:auto;
  border-right:1px solid #dfe7e2;
  padding-right:8px;
  scrollbar-width:thin;
  scrollbar-color:#9aa7a0 #eef4ef;
}
.sidebar-modules::-webkit-scrollbar{width:8px}
.sidebar-modules::-webkit-scrollbar-thumb{
  background:#9aa7a0;
  border-radius:10px;
}
.sidebar-modules::-webkit-scrollbar-track{
  background:#eef4ef;
}
.sidebar-section{margin-top:10px}
.sidebar-section + .sidebar-section{margin-top:4px}
.sidebar-section-title{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.1em;
  color:#6b7280;
  margin:0 0 6px 8px;
}

.nav{display:grid;gap:2px}
.nav-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:14px;
  color:#374151;
  border:1px solid transparent;
  position:relative;
}
.nav-link:hover{background:#eaf4ee}
.nav-link.active{
  background:linear-gradient(90deg,#dff2e7,#eef8f2);
  border-color:#b1dcbf;
  color:#0b5f30;
  box-shadow:0 10px 20px rgba(15,123,62,.14);
}
.nav-icon{
  width:32px;
  height:32px;
  border-radius:10px;
  background:#ffffff;
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.nav-label{
  font-size:15px;
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.tooltip{
  position:absolute;
  left:72px;
  top:50%;
  transform:translateY(-50%);
  background:#111827;
  color:#fff;
  padding:8px 10px;
  border-radius:10px;
  font-size:12px;
  display:none;
  white-space:nowrap;
}
.sidebar.collapsed .nav-link:hover .tooltip{display:block}

.sidebar-footer{
  margin-top:10px;
  padding-top:14px;
  border-top:1px solid var(--line);
}
.footer-user{
  display:flex;
  align-items:center;
  gap:10px;
  background:#ffffff;
  padding:12px;
  border-radius:14px;
  margin-bottom:12px;
  border:1px solid var(--line);
}
.avatar{
  width:40px;
  height:40px;
  border-radius:50%;
  background:linear-gradient(135deg,#0f7b3e,#15803d);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  font-weight:700;
}
.footer-user-copy strong{display:block;font-size:14px}
.footer-user-copy span{font-size:12px;color:#6b7280}
.logout{
  width:100%;
  background:#ef4444;
  color:#fff;
  border:none;
  border-radius:12px;
  padding:12px;
  font-weight:700;
  cursor:pointer;
}

.main{
  margin-left:var(--sidebar-width);
  width:calc(100% - var(--sidebar-width));
  transition:.2s ease;
  margin-left:.2s ease,width:.2s ease;
}
.main.collapsed{
  margin-left:var(--sidebar-collapsed);
  width:calc(100% - var(--sidebar-collapsed));
}

.topbar{
  position:sticky;
  top:0;
  z-index:30;
  background:#fff;
  border-bottom:1px solid var(--line);
  box-shadow:0 4px 18px rgba(15,23,42,.05);
  height:76px;
  padding:0 20px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
}
.topbar-left{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
  flex:0 0 auto;
}
.topbar-center{
  flex:1 1 520px;
  min-width:280px;
}
.icon-btn{
  width:44px;
  height:44px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  line-height:1;
  cursor:pointer;
  position:relative;
}
.mobile-sidebar-toggle{display:none}
.topbar-title h2{margin:0;font-size:24px}
.topbar-title p{margin:4px 0 0;color:var(--muted);font-size:14px}

.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
  min-width:0;
}
.topbar-right .icon-btn{font-size:14px}
.search-wrap{
  position:relative;
  min-width:220px;
  max-width:100%;
  flex:1 1 auto;
  min-width:420px;
  max-width:520px;
  flex:1 1 420px;
  display:flex;
  align-items:center;
  border:1px solid #d1d5db;
  border-radius:14px;
  background:#fff;
  height:46px;
}
.search-scope{
  min-width:145px;
  height:100%;
  border:none;
  border-right:1px solid var(--line);
  border-radius:14px 0 0 14px;
  padding:0 12px;
  background:transparent;
  color:#334155;
}
.search-wrap input{
  width:100%;
  height:100%;
  border:none;
  padding:0 38px 0 12px;
  background:transparent;
}
.search-wrap .left{display:none}
.search-wrap .clear-search{
  position:absolute;
  right:10px;
  top:9px;
  border:none;
  background:none;
  font-size:18px;
  color:var(--muted);
  cursor:pointer;
  display:none;
}
.search-wrap.has-value .clear-search{display:block}
.topbar-separator{margin-left:8px}
.topbar-right .create-btn{margin-left:2px}

.primary-btn,.secondary-btn,.ghost-btn,.danger-btn{
  min-height:44px;
  height:46px;
  border-radius:14px;
  padding:0 16px;
  border:none;
  cursor:pointer;
  font-weight:700;
}
.primary-btn{
  background:linear-gradient(90deg,var(--primary-dark),var(--primary));
  color:#fff;
}
.top-create-btn{
  background:linear-gradient(90deg,#f47c20,#fb923c);
}
.secondary-btn{background:#e2e8f0;color:var(--text)}
.ghost-btn{background:#fff;border:1px solid var(--line);color:var(--text)}
.danger-btn{background:#fee2e2;color:var(--danger)}

.dropdown-panel{
  position:absolute;
  right:0;
  top:54px;
  width:320px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
  display:none;
  overflow:hidden;
}
.dropdown-panel.open{display:block}
.panel-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
}
.panel-body{padding:14px 16px;max-height:360px;overflow:auto}

.badge-count{
  position:absolute;
  top:-4px;
  right:-4px;
  min-width:20px;
  height:20px;
  border-radius:999px;
  background:#ea001e;
  color:#fff;
  font-size:11px;
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 5px;
}
.notification-item{
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  margin-bottom:10px;
  background:#fff;
  display:flex;
  gap:10px;
}
.notification-item.unread{background:#f0f8ff}
.notification-meta{font-size:11px;color:var(--muted);margin-top:4px}
.notification-item.error{border-color:#fecaca}
.notification-item.warning{border-color:#fde68a}
.notification-item.success{border-color:#bbf7d0}

.profile-trigger{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  border:1px solid var(--line);
  border-radius:16px;
  padding:8px 10px;
  background:#fff;
  cursor:pointer;
  min-width:170px;
}

.profile-copy{
  min-width:0;
  overflow:hidden;
  border-radius:18px;
  padding:8px 12px;
  background:#fff;
  cursor:pointer;
  width:auto;
  min-width:58px;
  max-width:180px;
  overflow:hidden;
  transition:all .2s ease;
}

.profile-copy{
  width:auto;
  opacity:1;
  white-space:nowrap;
}
.profile-arrow{color:var(--muted);font-size:12px}

.profile-copy strong{
  display:block;
  font-size:14px;
}

.profile-copy span{
  font-size:12px;
  color:var(--muted);
}
.profile-trigger .caret{color:var(--muted);font-size:12px}
.create-menu{
  width:240px;
}
.page{padding:24px}
.info-banner{
  background:#eaf6ef;
  border:1px solid #b7e4c7;
  padding:14px 16px;
  border-radius:16px;
  color:#0f5132;
  margin-bottom:20px;
}

.kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px;
  margin-bottom:24px;
}
.card{
  background:var(--surface);
  border:1px solid #edf2f7;
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:20px;
}
.kpi-value{font-size:clamp(1.25rem,2vw + .6rem,1.9rem);font-weight:800;margin:8px 0;word-break:break-word}
.kpi-label{font-size:13px;color:var(--muted)}
.kpi-foot{font-size:12px;color:#475569}

.grid-2-1{display:grid;grid-template-columns:2fr 1fr;gap:20px}
.list{display:grid;gap:12px}
.list-item{
  background:var(--surface-soft);
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px;
}
.quick-link{
  display:block;
  padding:16px;
  border:1px solid #cfe7d5;
  background:linear-gradient(135deg,#eef8f1,#ffffff);
  color:#0f5132;
  border-radius:16px;
  font-weight:700;
}

.module-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:20px;
  flex-wrap:wrap;
}
.module-head h3{margin:0 0 6px;font-size:22px}
.module-head p{margin:0;color:var(--muted)}
.module-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}

.data-layout{display:grid;grid-template-columns:360px 1fr;gap:20px}
.form-section .section-title,.table-section .section-title{font-size:19px;font-weight:800;margin:0 0 6px}
.section-subtitle{font-size:14px;color:var(--muted);margin:0 0 18px}
.form-group{margin-bottom:14px}
.form-group label{display:block;font-size:13px;font-weight:700;margin-bottom:8px}
.required{color:#ea001e}
.input,.select,textarea{
  width:100%;
  border:1px solid var(--line-strong);
  border-radius:12px;
  background:#fff;
  padding:12px 14px;
  outline:none;
}
.input:focus,.select:focus,textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(15,123,62,.12);
}
textarea{min-height:90px;resize:vertical}

.form-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:6px}
.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.toolbar-left{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.rows-control{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted)}
.rows-control select{
  height:38px;
  border-radius:10px;
  border:1px solid var(--line);
  padding:0 10px;
  background:#fff;
}

.table-wrap{overflow:auto;border-radius:16px;border:1px solid var(--line)}
table{width:100%;border-collapse:collapse;background:#fff;min-width:900px}
th,td{
  padding:14px 12px;
  border-bottom:1px solid #f1f5f9;
  text-align:left;
  font-size:14px;
  vertical-align:top;
}
th{
  background:#f8fafc;
  color:#334155;
  font-size:12px;
  letter-spacing:.06em;
  text-transform:uppercase;
  position:sticky;
  top:0;
  z-index:1;
}
tr:hover td{background:#fbfdff}

.record-link{color:var(--primary-dark);font-weight:700;cursor:pointer}
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}
.badge-blue{background:#dff3e5;color:#0f5132}
.badge-green{background:#dcfce7;color:#15803d}
.badge-amber{background:#fff0dc;color:#c56a13}
.badge-red{background:#fee2e2;color:#dc2626}
.badge-violet{background:#ede9fe;color:#6d28d9}
.badge-slate{background:#f1f5f9;color:#475569}

.table-actions{display:flex;gap:8px;flex-wrap:wrap}
.mini-btn{
  border:none;
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
  font-weight:700;
  font-size:12px;
}
.mini-edit{background:#dff3e5;color:#0f5132}
.mini-read{background:#f1f5f9;color:#334155}
.mini-delete{background:#fee2e2;color:#dc2626}

.footer-bar{
  position:sticky;
  bottom:0;
  background:#fff;
  border:1px solid var(--line);
  border-top:none;
  border-radius:0 0 16px 16px;
  padding:12px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.selected-records{font-size:13px;color:#475569}
.pagination{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.page-btn,.page-input{
  height:36px;
  min-width:36px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 10px;
}
.page-btn.active{background:var(--primary);color:#fff;border-color:var(--primary)}
.page-btn[disabled]{opacity:.45;cursor:not-allowed}
.page-input{width:56px;text-align:center}

.recent-searches{
  position:absolute;
  top:52px;
  left:0;
  width:100%;
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:var(--shadow);
  display:none;
  z-index:20;
}
.recent-searches.open{display:block}
.recent-search-item{
  padding:12px 14px;
  border-bottom:1px solid #f1f5f9;
  cursor:pointer;
}
.recent-search-item:last-child{border-bottom:none}
.recent-search-item.active,.recent-search-item:hover{background:#f8fafc}
.empty-state{padding:24px;text-align:center;color:var(--muted)}

.drawer{
  position:fixed;
  top:0;
  right:-720px;
  width:680px;
  max-width:100%;
  height:100vh;
  background:#fff;
  box-shadow:-20px 0 40px rgba(15,23,42,.12);
  z-index:60;
  transition:right .25s ease;
  display:flex;
  flex-direction:column;
}
.drawer.open{right:0}
.drawer-header{
  position:sticky;
  top:0;
  background:#fff;
  padding:18px 20px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
.drawer-title h3{margin:0 0 4px;font-size:22px}
.drawer-title p{margin:0;color:var(--muted);font-size:14px}
.drawer-body{padding:20px;overflow:auto}
.drawer-section{margin-bottom:24px}
.drawer-grid{display:grid;grid-template-columns:170px 1fr;gap:10px 16px}
.drawer-grid .label{font-weight:700;color:#334155}
.drawer-grid .value{color:#0f172a}
.drawer-footer{
  padding:16px 20px;
  border-top:1px solid var(--line);
  display:flex;
  justify-content:flex-end;
  gap:10px;
}
.overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.35);
  z-index:55;
  display:none;
}
.overlay.open{display:block}

.export-step{display:grid;gap:10px}
.option-btn{
  width:100%;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  text-align:left;
  cursor:pointer;
}
.option-btn:hover{background:#f8fafc}
.option-btn[disabled]{opacity:.5;cursor:not-allowed}

.status-note{font-size:12px;color:var(--muted)}

@media (max-width:1200px){
  .topbar{padding:0 16px}
  .topbar-title h2{font-size:22px}
  .topbar-title p{font-size:13px}
  .topbar-right{gap:8px}
  .search-wrap{min-width:340px;max-width:380px;flex:1 1 340px}
  .search-scope{min-width:128px}
  .primary-btn,.secondary-btn,.ghost-btn,.danger-btn{height:42px}
  .icon-btn{width:40px;height:40px;border-radius:12px}
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .grid-2-1,.data-layout{grid-template-columns:1fr}
}
@media (max-width:1024px){
  :root{--sidebar-width:240px}
  .topbar{flex-wrap:wrap}
  .topbar-left,.topbar-right{width:100%}
  .search-wrap{max-width:none;min-width:280px}
  .profile-copy,.profile-trigger .caret{display:none}
  .profile-trigger{padding:8px}
}
@media (max-width:860px){
  .sidebar{position:fixed;transform:translateX(-100%)}
  .sidebar.mobile-open{transform:translateX(0)}
  .main,.main.collapsed{margin-left:0;width:100%}
  .search-wrap{min-width:100%}
  .topbar{align-items:flex-start;flex-direction:column}
  .topbar-center{width:100%;min-width:0}
  .topbar-right{width:100%;flex-wrap:wrap}
  .top-create-btn{margin-left:auto}
  .mobile-sidebar-toggle{display:flex}
  .profile-trigger{min-width:150px}
  .topbar-right{width:100%}
  .mobile-sidebar-toggle{display:flex}
  .sidebar-modules{
    height:calc(100vh - 134px);
  }
  .main,.main.collapsed{
    margin-left:0;
    width:100%;
  }
  .topbar{
    align-items:flex-start;
    flex-direction:column;
    gap:10px;
  }
  .topbar-left,.topbar-right{width:100%}
  .topbar-right{
    flex-wrap:wrap;
    justify-content:flex-start;
  }
  .search-wrap{
    min-width:100%;
    flex:1 1 100%;
  }
  .search-scope{min-width:120px}
  .module-actions{width:100%}
  .module-actions .search-wrap,.module-actions .primary-btn{width:100%}
  .primary-btn{width:100%}
  .profile-trigger{min-width:58px}
  .dropdown-panel{
    width:min(92vw,340px);
    right:0;
  }
}
@media (max-width:640px){
  .sidebar{padding:10px}
  .brand-copy h1{font-size:18px}
  .brand-logo{width:132px;height:36px}
  .topbar{padding:12px}
  .page{padding:16px}
  .card,.kpi-card,.data-card{border-radius:14px}
  .kpi-grid{grid-template-columns:1fr}
  .toolbar,.footer-bar{align-items:flex-start}
  .selected-records{width:100%}
  .table-wrap{overflow:visible;border:none;background:transparent}
  table{min-width:100%;border-collapse:separate;border-spacing:0 10px;background:transparent}
  thead{display:none}
  tbody,tr,td{display:block;width:100%}
  tr{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);padding:10px 12px}
  td{border-bottom:1px dashed #e5e7eb;padding:9px 0;text-align:right;position:relative}
  td:last-child{border-bottom:none;padding-bottom:2px}
  td::before{content:attr(data-label);float:left;color:var(--muted);font-weight:600;text-transform:none}
  .table-actions{justify-content:flex-end}
  .drawer-grid{grid-template-columns:1fr}
  .panel-body{max-height:58vh}
}
@media (max-width:420px){
  .brand{gap:8px}
  .sidebar-toggle{width:34px;height:34px}
  .topbar-title h2{font-size:20px}
  .topbar-title p{font-size:12px}
  .icon-btn{width:38px;height:38px}
  .primary-btn,.secondary-btn,.ghost-btn,.danger-btn{
    height:40px;
    border-radius:12px;
    padding:0 12px;
  }
}
