/* ============================================================
   Procurement Portal — Stylesheet
   Palette : #F7F9FC (canvas) / #FFFFFF (cards) / #1C2A42 (navy/sidebar)
             #4C5E80 (muted navy) / #E3E8F0 (hairline) / #2F6F5E (positive)
             #B5482D (warning/clay) / #C9A227 (amber/pending)
   Type    : Space Grotesk (display) + IBM Plex Mono (data/labels)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root{
  --bg:            #F7F9FC;
  --card:          #FFFFFF;
  --navy:          #1C2A42;
  --navy-soft:     #26375A;
  --navy-muted:    #4C5E80;
  --line:          #E3E8F0;
  --line-strong:   #D3DAE6;
  --text:          #1C2A42;
  --text-muted:    #66748F;
  --accent:        #2F6F5E;   /* positive / active */
  --accent-soft:   #E3F0EC;
  --warn:          #B5482D;   /* clay / alert */
  --warn-soft:     #F7E7E1;
  --pending:       #C9A227;   /* amber */
  --pending-soft:  #FBF2DA;
  --info:          #2F5D8A;
  --info-soft:     #E5EEF7;
  --radius-sm:     6px;
  --radius-md:     10px;
  --sidebar-w:     248px;
  --header-h:      68px;
  --shadow-card:   0 1px 2px rgba(28,42,66,.04), 0 1px 12px rgba(28,42,66,.05);
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
  font-size:14px;
}
.mono{ font-family:'IBM Plex Mono', monospace; }
a{ color:inherit; text-decoration:none; }
ul{ list-style:none; margin:0; padding:0; }
button{ font-family:inherit; cursor:pointer; }
svg.icon{ width:18px; height:18px; stroke-width:1.75; flex-shrink:0; }

/* ---------- App shell ---------- */
#app{
  display:flex;
  min-height:100vh;
}

/* ---------- Sidebar ---------- */
#sidebar{
  width:var(--sidebar-w);
  flex-shrink:0;
  background:var(--navy);
  color:#CBD5E6;
  display:flex;
  flex-direction:column;
  position:sticky;
  top:0;
  height:100vh;
  z-index:20;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:20px 22px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.brand-mark{
  width:32px; height:32px;
  border-radius:8px;
  background:linear-gradient(145deg,#2F6F5E,#1C4B3E);
  display:flex; align-items:center; justify-content:center;
  color:#EAF4F0;
  font-family:'IBM Plex Mono',monospace;
  font-weight:600;
  font-size:13px;
}
.brand-text{ display:flex; flex-direction:column; line-height:1.15; }
.brand-text strong{ font-size:14.5px; color:#F2F5F9; font-weight:600; letter-spacing:.2px; }
.brand-text span{ font-size:10.5px; color:#8DA0BE; font-family:'IBM Plex Mono',monospace; letter-spacing:.5px; text-transform:uppercase; }

.side-scroll{
  flex:1;
  overflow-y:auto;
  padding:14px 12px 20px;
}
.nav-eyebrow{
  font-family:'IBM Plex Mono',monospace;
  font-size:10px;
  letter-spacing:1.2px;
  text-transform:uppercase;
  color:#5D6E8C;
  padding:14px 12px 8px;
}
.nav-item{
  position:relative;
}
.nav-link{
  display:flex;
  align-items:center;
  gap:11px;
  padding:10px 12px;
  border-radius:8px;
  color:#B9C6DD;
  font-size:13.5px;
  font-weight:500;
  transition:background .15s ease, color .15s ease;
  margin-bottom:2px;
}
.nav-link svg{ color:#7C8FB0; transition:color .15s ease; }
.nav-link:hover{ background:rgba(255,255,255,.06); color:#F2F5F9; }
.nav-link:hover svg{ color:#CBD5E6; }
.nav-item.active > .nav-link{
  background:rgba(47,111,94,.22);
  color:#EAF4F0;
}
.nav-item.active > .nav-link svg{ color:#5FAE97; }
.nav-item.active > .nav-link::before{
  content:"";
  position:absolute;
  left:-12px; top:6px; bottom:6px;
  width:3px;
  border-radius:2px;
  background:#5FAE97;
}
.nav-count{
  margin-left:auto;
  font-family:'IBM Plex Mono',monospace;
  font-size:10.5px;
  background:rgba(255,255,255,.08);
  color:#A9B9D3;
  padding:1px 6px;
  border-radius:20px;
}
.nav-item.active .nav-count{ background:rgba(95,174,151,.25); color:#D6EFE6; }

.nav-caret{ margin-left:auto; color:#7C8FB0; transition:transform .18s ease; }
.nav-item.expanded .nav-caret{ transform:rotate(90deg); }
.nav-sub{
  max-height:0;
  overflow:hidden;
  transition:max-height .2s ease;
  padding-left:30px;
}
.nav-item.expanded .nav-sub{ max-height:120px; }
.nav-sub .nav-link{ font-size:12.5px; padding:8px 12px; gap:9px; }
.nav-sub .nav-link svg{ width:14px; height:14px; }

.side-footer{
  padding:14px 20px 18px;
  border-top:1px solid rgba(255,255,255,.08);
  font-family:'IBM Plex Mono',monospace;
  font-size:10.5px;
  color:#5D6E8C;
  display:flex;
  justify-content:space-between;
}

/* ---------- Main column ---------- */
.main{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}

/* ---------- Header ---------- */
#header{
  height:var(--header-h);
  background:linear-gradient(135deg, #1C2A42 0%, #2F6F5E 50%, #2F5D8A 100%);
  border-bottom:1px solid rgba(255,255,255,.08);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
  position:sticky;
  top:0;
  z-index:10;
  gap:20px;
  box-shadow:0 2px 16px rgba(28,42,66,.15);
}
.header-left{ display:flex; align-items:center; gap:18px; min-width:0; }
.page-title{
  font-size:17px;
  font-weight:600;
  letter-spacing:.1px;
  white-space:nowrap;
  color:#FFFFFF;
}
.page-crumb{
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
  color:rgba(255,255,255,.65);
  white-space:nowrap;
}
.header-mid{
  display:flex;
  align-items:center;
  gap:14px;
  color:rgba(255,255,255,.7);
  font-family:'IBM Plex Mono',monospace;
  font-size:12px;
}
.chip{
  display:flex;
  align-items:center;
  gap:7px;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.15);
  padding:6px 11px;
  border-radius:20px;
  white-space:nowrap;
}
.chip svg{ width:14px; height:14px; color:rgba(255,255,255,.5); }
.chip strong{ color:#FFFFFF; font-weight:600; }
.weather-icon{ width:15px; height:15px; color:#FFD700; }

.header-right{ display:flex; align-items:center; gap:14px; flex-shrink:0; }
.icon-btn{
  position:relative;
  width:36px; height:36px;
  border-radius:9px;
  border:1px solid rgba(255,255,255,.15);
  background:rgba(255,255,255,.1);
  display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,.75);
  transition:background .15s;
}
.icon-btn:hover{ background:rgba(255,255,255,.2); color:#FFFFFF; }
.icon-btn .dot{
  position:absolute; top:6px; right:6px;
  width:7px; height:7px; border-radius:50%;
  background:#FF6B6B;
  border:1.5px solid transparent;
}
.avatar{
  width:36px; height:36px;
  border-radius:50%;
  background:linear-gradient(145deg,#FFD700,#FF8C00);
  color:#1C2A42;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px;
  font-family:'IBM Plex Mono',monospace;
  cursor:pointer;
}
.user-meta{ display:flex; flex-direction:column; line-height:1.2; }
.user-meta strong{ font-size:12.5px; font-weight:600; color:#FFFFFF; }
.user-meta span{ font-size:10.5px; color:rgba(255,255,255,.6); }

/* ---------- Content ---------- */
.content{
  padding:26px 28px 60px;
  flex:1;
}
.content-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  margin-bottom:20px;
  gap:16px;
  flex-wrap:wrap;
}
.content-head h1{
  margin:0 0 4px;
  font-size:21px;
  font-weight:600;
}
.content-head p{
  margin:0;
  color:var(--text-muted);
  font-size:13px;
}
.btn{
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:9px 16px;
  border-radius:8px;
  font-size:13px;
  font-weight:600;
  border:1px solid var(--line-strong);
  background:var(--card);
  color:var(--text);
  transition:background .15s, border-color .15s;
}
.btn svg{ width:15px; height:15px; }
.btn:hover{ background:var(--bg); }
.btn-primary{
  background:var(--navy);
  border-color:var(--navy);
  color:#F3F6FA;
}
.btn-primary:hover{ background:var(--navy-soft); }

/* ---------- Summary cards ---------- */
.grid-cards{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:24px;
}
.stat-card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  padding:18px 18px 16px;
  box-shadow:var(--shadow-card);
}
.stat-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:14px;
}
.stat-icon{
  width:34px; height:34px;
  border-radius:8px;
  display:flex; align-items:center; justify-content:center;
}
.stat-icon svg{ width:17px; height:17px; }
.stat-icon.i-amber{ background:var(--pending-soft); color:var(--pending); }
.stat-icon.i-teal{ background:var(--accent-soft); color:var(--accent); }
.stat-icon.i-clay{ background:var(--warn-soft); color:var(--warn); }
.stat-icon.i-blue{ background:var(--info-soft); color:var(--info); }
.stat-trend{
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
  padding:3px 7px;
  border-radius:20px;
}
.stat-trend.up{ color:var(--accent); background:var(--accent-soft); }
.stat-trend.down{ color:var(--warn); background:var(--warn-soft); }
.stat-value{
  font-family:'IBM Plex Mono',monospace;
  font-size:26px;
  font-weight:600;
  letter-spacing:-.5px;
  margin-bottom:3px;
}
.stat-label{ font-size:12.5px; color:var(--text-muted); }

/* ---------- Spreadsheet panel ---------- */
.panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-card);
  overflow:hidden;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 18px;
  border-bottom:1px solid var(--line);
  gap:14px;
  flex-wrap:wrap;
}
.panel-head h2{
  font-size:14.5px;
  font-weight:600;
  margin:0;
  display:flex;
  align-items:center;
  gap:8px;
}
.panel-head h2 svg{ width:16px; height:16px; color:var(--navy-muted); }
.panel-tools{ display:flex; align-items:center; gap:8px; }
.search-box{
  display:flex; align-items:center; gap:7px;
  background:var(--bg); border:1px solid var(--line);
  padding:7px 11px; border-radius:7px;
  font-size:12.5px; color:var(--text-muted);
}
.search-box svg{ width:14px; height:14px; }
.search-box input{
  border:none; background:transparent; outline:none;
  font-family:inherit; font-size:12.5px; color:var(--text); width:150px;
}
.tool-btn{
  width:32px; height:32px;
  border-radius:7px;
  border:1px solid var(--line);
  background:var(--card);
  display:flex; align-items:center; justify-content:center;
  color:var(--navy-muted);
}
.tool-btn svg{ width:15px; height:15px; }
.tool-btn:hover{ background:var(--bg); }

/* Spreadsheet-style table */
.sheet-wrap{ overflow-x:auto; }
table.sheet{
  width:100%;
  border-collapse:collapse;
  font-size:12.8px;
}
table.sheet thead th{
  text-align:left;
  font-family:'IBM Plex Mono',monospace;
  font-size:10.5px;
  letter-spacing:.6px;
  text-transform:uppercase;
  color:var(--text-muted);
  background:#FAFBFD;
  padding:10px 16px;
  border-bottom:1px solid var(--line-strong);
  border-right:1px solid var(--line);
  white-space:nowrap;
  position:sticky; top:0;
}
table.sheet thead th:first-child{ padding-left:18px; }
table.sheet thead th:last-child{ border-right:none; }
table.sheet tbody td{
  padding:11px 16px;
  border-bottom:1px solid var(--line);
  border-right:1px solid var(--line);
  white-space:nowrap;
  color:var(--text);
}
table.sheet tbody td:first-child{ padding-left:18px; }
table.sheet tbody td:last-child{ border-right:none; }
table.sheet tbody tr:hover{ background:#F9FBFD; }
table.sheet tbody tr:nth-child(even){ background:#FCFDFE; }
table.sheet tbody tr:nth-child(even):hover{ background:#F9FBFD; }
td.num, th.num{ font-family:'IBM Plex Mono',monospace; text-align:right; }
td.id-cell{ font-family:'IBM Plex Mono',monospace; color:var(--navy-muted); font-weight:500; }

/* ---------- Row-level status tints ---------- */
table.sheet tbody tr.row-pending{ background:#FBF2DA; }
table.sheet tbody tr.row-pending td{ border-bottom-color:#E8D89A; }
table.sheet tbody tr.row-pending:hover{ background:#F8EDCD; }

table.sheet tbody tr.row-approved{ background:#E3F0EC; }
table.sheet tbody tr.row-approved td{ border-bottom-color:#B5D4CA; }
table.sheet tbody tr.row-approved:hover{ background:#D6E8E2; }

table.sheet tbody tr.row-draft{ background:#E5EEF7; }
table.sheet tbody tr.row-draft td{ border-bottom-color:#B8CCE3; }
table.sheet tbody tr.row-draft:hover{ background:#D5E2F0; }

table.sheet tbody tr.row-hold{ background:#FDECEA; }
table.sheet tbody tr.row-hold td{ border-bottom-color:#E8B8B0; }
table.sheet tbody tr.row-hold:hover{ background:#FADDD9; }

/* Override nth-child(even) for status rows so they keep their tint */
table.sheet tbody tr.row-pending:nth-child(even),
table.sheet tbody tr.row-approved:nth-child(even),
table.sheet tbody tr.row-draft:nth-child(even),
table.sheet tbody tr.row-hold:nth-child(even){ background:inherit; }

.badge{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-family:'IBM Plex Mono',monospace;
  font-size:10.5px;
  font-weight:600;
  letter-spacing:.3px;
  text-transform:uppercase;
  padding:3px 9px;
  border-radius:20px;
}
.badge::before{ content:""; width:5px; height:5px; border-radius:50%; background:currentColor; }
.badge.b-pending{ color:var(--pending); background:var(--pending-soft); }
.badge.b-approved,.badge.b-active,.badge.b-received{ color:var(--accent); background:var(--accent-soft); }
.badge.b-hold,.badge.b-low{ color:var(--warn); background:var(--warn-soft); }
.badge.b-draft,.badge.b-transit{ color:var(--info); background:var(--info-soft); }

.row-actions{ display:flex; gap:6px; }
.row-actions button{
  width:26px; height:26px;
  border-radius:6px;
  border:1px solid var(--line);
  background:var(--card);
  display:flex; align-items:center; justify-content:center;
  color:var(--navy-muted);
}
.row-actions svg{ width:13px; height:13px; }
.row-actions button:hover{ background:var(--bg); }

.panel-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 18px;
  border-top:1px solid var(--line);
  font-family:'IBM Plex Mono',monospace;
  font-size:11.5px;
  color:var(--text-muted);
}
.pager{ display:flex; gap:6px; }
.pager button{
  width:26px; height:26px;
  border-radius:6px;
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text-muted);
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
}
.pager button.active{ background:var(--navy); color:#fff; border-color:var(--navy); }

.two-col{
  display:grid;
  grid-template-columns:1.6fr 1fr;
  gap:16px;
  margin-top:16px;
}
.side-panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-card);
  padding:18px;
}
.side-panel h3{
  margin:0 0 14px;
  font-size:13.5px;
  font-weight:600;
  display:flex; align-items:center; gap:8px;
}
.side-panel h3 svg{ width:15px; height:15px; color:var(--navy-muted); }
.alert-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:9px 0;
  border-bottom:1px solid var(--line);
  font-size:12.5px;
}
.alert-row:last-child{ border-bottom:none; }
.alert-name{ display:flex; flex-direction:column; }
.alert-name strong{ font-weight:600; font-size:12.5px; }
.alert-name span{ font-size:11px; color:var(--text-muted); font-family:'IBM Plex Mono',monospace; }
.alert-qty{ font-family:'IBM Plex Mono',monospace; font-weight:600; font-size:12.5px; }
.alert-qty.low{ color:var(--warn); }

/* ---------- Modal overlay ---------- */
.modal-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(28,42,66,.55);
  backdrop-filter:blur(2px);
  z-index:1000;
  justify-content:center;
  align-items:center;
}
.modal-overlay.open{ display:flex; }
.modal-panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  box-shadow:0 8px 40px rgba(28,42,66,.18);
  width:90%;
  max-width:960px;
  max-height:85vh;
  display:flex;
  flex-direction:column;
  animation:modalIn .2s ease;
}
@keyframes modalIn{
  from{ opacity:0; transform:translateY(12px) scale(.98); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 22px;
  border-bottom:1px solid var(--line);
}
.modal-head h2{
  margin:0;
  font-size:15px;
  font-weight:600;
  display:flex;
  align-items:center;
  gap:8px;
}
.modal-head h2 svg{ width:17px; height:17px; color:var(--navy-muted); }
.modal-close{
  width:30px; height:30px;
  border-radius:7px;
  border:1px solid var(--line);
  background:var(--card);
  display:flex; align-items:center; justify-content:center;
  color:var(--text-muted);
  cursor:pointer;
}
.modal-close svg{ width:16px; height:16px; }
.modal-close:hover{ background:var(--bg); color:var(--text); }
.modal-body{
  flex:1;
  overflow-y:auto;
  padding:20px 22px;
}
.modal-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 22px;
  border-top:1px solid var(--line);
}
.modal-foot .hint{ font-size:11px; color:var(--text-muted); }

/* Form inputs inside modal sheet */
.form-input{
  width:100%;
  padding:7px 9px;
  border:1px solid var(--line);
  border-radius:6px;
  font-family:'IBM Plex Mono',monospace;
  font-size:12px;
  color:var(--text);
  background:var(--card);
  outline:none;
  transition:border-color .15s;
}
.form-input:focus{ border-color:var(--navy-muted); }
.form-input.num{ text-align:right; }
select.form-input{ cursor:pointer; }
.row-add{ cursor:pointer; }
.form-sheet tbody td{ padding:8px 10px; vertical-align:middle; }

/* ---------- Responsive ---------- */
@media (max-width:1180px){
  .grid-cards{ grid-template-columns:repeat(2,1fr); }
  .two-col{ grid-template-columns:1fr; }
}
@media (max-width:900px){
  :root{ --sidebar-w:220px; }
  .header-mid{ display:none; }
}
@media (max-width:720px){
  #sidebar{ position:fixed; left:-260px; transition:left .2s ease; }
  #sidebar.open{ left:0; }
  .grid-cards{ grid-template-columns:1fr; }
  .content{ padding:18px; }
  #header{ padding:0 14px; }
}