* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: #f3f6f4 !important;
  color: #16221b !important;
  font-family: Inter, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #bdc9c1; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

.app-shell { min-height: 100vh; }
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 248px;
  display: flex;
  flex-direction: column;
  background: #102318;
  color: #fff;
  box-shadow: 8px 0 24px rgba(22, 34, 27, .08);
}
.sidebar-brand {
  height: 82px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  color: #fff;
}
.sidebar-brand img { width: 38px; height: 38px; object-fit: contain; }
.brand-name { line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.brand-name span { display: block; }
.brand-name small { color: #b8d5c1; font-size: 11px; letter-spacing: .14em; }
.sidebar-nav { padding: 22px 14px; display: grid; gap: 8px; }
.nav-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #d7e4dc;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  transition: .18s ease;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: #006130; color: #fff; box-shadow: 0 10px 22px rgba(0,97,48,.28); }
.nav-item .material-symbols-outlined { font-size: 21px; }
.sidebar-footer { margin-top: auto; padding: 14px 12px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer .nav-item { color: #ffd9d4; }

.app-main { margin-left: 248px; min-height: 100vh; }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid #dfe7e1;
  backdrop-filter: blur(12px);
}
.topbar-title { font-size: 13px; color: #66736b; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 7px;
  border: 1px solid #dfe7e1;
  border-radius: 999px;
  background: #fff;
  color: #16221b;
  font-size: 13px;
  font-weight: 700;
}
.user-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #006130; color: #fff; }
.app-content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 32px 36px 48px; }

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(0,97,48,.18);
}
button, .nav-item, a { -webkit-tap-highlight-color: transparent; }

dialog {
  margin: auto;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
dialog::backdrop { backdrop-filter: blur(4px); }

table { width: 100%; }
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf2ee;
  white-space: nowrap;
}
tbody tr { background: #fff; }
tbody tr:nth-child(even) { background: #fbfcfb; }

input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
select, textarea {
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.flash-alert {
  border: 1px solid #dfe7e1 !important;
  border-left: 4px solid #006130 !important;
  border-radius: 8px !important;
  box-shadow: 0 5px 16px rgba(22,34,27,.05) !important;
  background: #fff !important;
  color: #16221b !important;
}
.rounded-xl { border-radius: 12px !important; }
.rounded-lg { border-radius: 8px !important; }
.shadow-sm, .shadow-md, .shadow-xl { box-shadow: 0 8px 24px rgba(22,34,27,.06) !important; }
.border { border-color: #dfe7e1 !important; }
.bg-surface-container-lowest { background: #fff !important; }
.bg-surface-container-low, .bg-surface { background: #f7f9f7 !important; }
.bg-surface-container, .bg-surface-container-high { background: #edf2ee !important; }
.bg-inverse-surface { background: #17251c !important; }
.bg-primary, .bg-primary-container { background: #006130 !important; }
.text-primary, .text-primary-container { color: #006130 !important; }
.text-on-primary, .text-on-secondary { color: #fff !important; }
.border-outline, .border-outline-variant { border-color: #dfe7e1 !important; }
.hover\:bg-primary:hover { background: #006130 !important; }
.hover\:bg-primary-container:hover { background: #004d27 !important; }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 560px);
  background: #fff;
}
.auth-story {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  padding: 56px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(0,97,48,.92), rgba(16,35,24,.96)),
    linear-gradient(135deg, #006130, #102318);
}
.auth-story::before {
  content: "";
  position: absolute;
  width: 420px; height: 420px;
  right: -180px; top: -180px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.018);
}
.auth-story-content { position: relative; max-width: 520px; }
.auth-story-logo { width: 72px; height: 72px; margin-bottom: 30px; object-fit: contain; }
.auth-story h2 { margin: 0 0 14px; font-size: clamp(36px, 5vw, 64px); line-height: 1; letter-spacing: -.05em; }
.auth-story p { max-width: 440px; margin: 0; color: #dbe8df; font-size: 16px; line-height: 1.7; }
.auth-form-side { display: grid; place-items: center; padding: 32px; background: #fff; }
.auth-card { width: min(100%, 430px); }
.auth-card h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.03em; }
.auth-card > p { margin: 0 0 28px; color: #66736b; }
.auth-card input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #dfe7e1 !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #16221b !important;
  padding: 11px 13px;
}
.auth-card input:focus { border-color: #006130 !important; outline: 3px solid rgba(0,97,48,.12) !important; }
.auth-card button[type="submit"], .auth-card .auth-submit {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: #006130 !important;
  color: #fff !important;
  font-weight: 750;
}

@media (max-width: 980px) {
  .app-sidebar { width: 72px; }
  .sidebar-brand { justify-content: center; padding: 0; }
  .sidebar-brand > div:last-child, .nav-item span:last-child { display: none; }
  .sidebar-nav { padding-inline: 10px; }
  .nav-item { justify-content: center; padding-inline: 0; }
  .sidebar-footer { padding-inline: 10px; }
  .app-main { margin-left: 72px; }
  .app-topbar { padding-inline: 20px; }
  .app-content { padding-inline: 20px; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-form-side { background: linear-gradient(145deg, #edf4ef, #fff); }
}

@media (max-width: 640px) {
  .app-sidebar { position: fixed; width: 100%; height: auto; min-height: 80px; inset: auto 0 0 0; flex-direction: row; }
  .sidebar-brand { display: none; }
  .sidebar-footer { display: none; }
  .sidebar-nav { width: 100%; min-width: 0; height: auto; min-height: 80px; grid-template-columns: repeat(4, 1fr); padding: 6px 4px; gap: 4px; background: #102318; flex: 1; }
  .nav-item { min-height: auto; height: auto; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 3px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; color: #d7e4dc; }
  .nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
  .nav-item.active { background: #006130; color: #fff; box-shadow: 0 10px 22px rgba(0,97,48,.28); }
  .nav-item .material-symbols-outlined { font-size: 20px; }
  .nav-item span:last-child { display: block !important; }
  .app-main { margin-left: 0; padding-bottom: 96px; }
  .app-topbar { height: 64px; padding-inline: 16px; }
  .topbar-title { font-size: 11px; }
  .app-content { padding: 18px 14px 32px; }
  .user-chip { width: 38px; height: 38px; padding: 3px; border: 0; }
  .user-chip > span:last-child { display: none; }
  .auth-form-side { padding: 18px; }
}

/* ===== 2026 Enterprise UI — Procurement Dashboard Refactor ===== */

/* Top Utility Toolbar */
.util-toolbar {
  height: 64px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.util-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #475569;
  text-transform: uppercase;
}
.util-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.util-search {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 220px;
}
.util-search-icon {
  color: #64748b;
  margin-right: 8px;
  font-size: 16px;
}
.util-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: #0f172a;
  width: 100%;
}
.util-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  border-radius: 10px;
  position: relative;
}
.util-bell:hover { background: #f1f5f9; color: #0f3d2e; }
.util-status-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #ffffff;
}
.util-profile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #0f3d2e;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}
.util-profile:hover { background: #0b3026; }
.util-avatar, .util-chevron { font-size: 16px; }

/* KPI Cards — Tonal gradients, soft elevation */
.kpi-card {
  padding: 24px;
  border-radius: 12px;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  position: relative;
  overflow: hidden;
}
.kpi-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.kpi-badge .material-symbols-outlined { font-size: 16px; }
.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-sub {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.85;
}
.kpi-amber { background: linear-gradient(135deg, #d97706, #b45309); }
.kpi-emerald { background: linear-gradient(135deg, #059669, #064e3b); }
.kpi-terracotta { background: linear-gradient(135deg, #c2410c, #7c2d12); }

/* Stock Table — Clean headers, softened dividers */
.stock-section-header {
  background: #0c2e22 !important;
  color: #ffffff !important;
}
.stock-table thead th {
  background: #0c2e22 !important;
  color: #ffffff !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 16px 20px !important;
  border: none !important;
}
.stock-table tbody tr { background: #ffffff; }
.stock-table td {
  padding: 16px 20px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}
.stock-table tr:last-child td { border-bottom: none !important; }

/* Action column cleanup */
.stock-actions-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.stock-action-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: #0f3d2e;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.stock-action-text:hover { text-decoration: underline; color: #006130; }
.stock-action-text.danger { color: #ba1a1a; }
.stock-action-text.danger:hover { color: #991b1b; }

/* Allocation row — single horizontal line */
.stock-allocate-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.stock-allocate-select {
  width: 170px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  font-size: 0.8rem;
  color: #0f172a;
}
.stock-allocate-qty {
  width: 64px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  font-size: 0.8rem;
  color: #0f172a;
  text-align: right;
}
.stock-allocate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: #006130;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.stock-allocate-btn:hover { background: #0b4a28; }

/* Stock item name styling */
.stock-item-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 1rem;
  display: block;
}
.stock-item-unit {
  font-size: 0.75rem;
  color: #64748b;
  margin-left: 6px;
  font-weight: 400;
  opacity: 0.7;
  display: block;
  margin-top: 1px;
}
