/* ============================================================
   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;
  --sidebar-collapsed-w: 64px;
  --header-h:      64px;
  --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%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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;
  overflow-y:auto;
}
.sidebar-header{
  padding:20px 22px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: linear-gradient(145deg, #2F6F5E, #1C4B3E);
  padding: 4px;
}
.brand-text{ display:flex; flex-direction:column; line-height:1.15; }
.brand-text h2{ font-weight:600; font-size:0.95rem; letter-spacing:.2px; color:#F2F5F9; line-height:1.15; }
.brand-subtitle{ font-size:0.68rem; color:#8DA0BE; opacity:1; font-family:'IBM Plex Mono',monospace; font-weight:400; letter-spacing:.5px; text-transform:uppercase; margin-top:2px; }

.side-scroll{
  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:fit-content; }
.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;
}


.sidebar-spacer{
  flex:1;
}

/* User Profile Section */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  flex-wrap: wrap;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #FFD700, #FF8C00);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #F2F5F9;
  line-height: 1.2;
}

.user-role {
  font-size: 0.65rem;
  color: #8DA0BE;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'IBM Plex Mono', monospace;
  margin-top: 1px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 8px;
  justify-content: center;
}

.logout-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #B5482D;
}

.logout-btn svg {
  flex-shrink: 0;
}

/* ---------- Collapsed Sidebar ---------- */
body.sidebar-collapsed #sidebar {
  width: var(--sidebar-collapsed-w);
  transition: width .2s ease;
}
body.sidebar-collapsed .sidebar-header {
  padding: 20px 10px;
  display: flex;
  justify-content: center;
}
body.sidebar-collapsed .brand-container {
  gap: 0;
  justify-content: center;
}
body.sidebar-collapsed .brand-text {
  display: none;
}
body.sidebar-collapsed .side-scroll {
  padding: 14px 6px 20px;
}
body.sidebar-collapsed .nav-eyebrow {
  display: none;
}
body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 10px 8px;
  gap: 0;
}
body.sidebar-collapsed .nav-link span {
  display: none;
}
body.sidebar-collapsed .nav-link .nav-caret {
  display: none;
}
body.sidebar-collapsed .nav-count {
  display: none;
}
body.sidebar-collapsed .nav-sub {
  display: none;
}
body.sidebar-collapsed .user-profile {
  justify-content: center;
  padding: 14px 8px 16px;
}
body.sidebar-collapsed .user-info {
  display: none;
}
body.sidebar-collapsed .logout-btn span {
  display: none;
}
body.sidebar-collapsed .logout-btn {
  justify-content: center;
  padding: 6px 8px;
  width: auto;
}
body.sidebar-collapsed .side-footer {
  display: none;
}

/* Transition for sidebar width */
#sidebar {
  transition: width .2s ease;
}

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

/* ---------- Content wrap (holds scrollable content + footer) ---------- */
.content-wrap{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  min-height:0;
}
.content-wrap > .content{
  flex:1 1 auto;
}
.content-wrap > footer.footer{
  flex-shrink:0;
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 28px;
  background: linear-gradient(180deg, var(--navy) 0%, #16223a 100%);
  border-top: 3px solid var(--accent);
  color: var(--text-muted);
  font-size: 12px;
}
.footer .footer-brand {
  color: #CBD5E6;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.footer .footer-brand span {
  color: var(--accent);
}
.footer .footer-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.footer .footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer .footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.footer .footer-links .footer-sep {
  color: var(--line-strong);
}
.footer .footer-copy {
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .footer {
    flex-direction: column;
    text-align: center;
    padding: 16px 20px;
  }
  .footer .footer-links { flex-direction: column; align-items: center; gap: 6px; }
  .footer .footer-links .footer-sep { display: none; }
  .footer .footer-brand { font-size: 11px; }
  .footer .footer-copy { font-size: 10px; }
}

/* ---------- 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:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  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; justify-self:start; }
.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;
  justify-content:center;
  gap:14px;
  color:rgba(255,255,255,.7);
  font-family:'IBM Plex Mono',monospace;
  font-size:12px;
  justify-self:center;
}
.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; }

.header-right{
  display:flex;
  align-items:center;
  gap:14px;
  flex-shrink:0;
  justify-self:end;
}
.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); }

/* Clickable stat cards */
.stat-card.clickable{ cursor:pointer; transition:transform .15s ease, box-shadow .15s ease; }
.stat-card.clickable:hover{ transform:translateY(-3px); box-shadow:0 4px 20px rgba(28,42,66,.12); }
.stat-card.clickable:active{ transform:translateY(-1px); }


/* ---------- 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); }

/* ---------- Chart area for dashboard ---------- */
.chart-area{
  display:flex;
  gap:18px;
  padding:18px;
  min-height:320px;
}
.chart-main{
  flex:1;
  min-width:0;
  position:relative;
  height:300px;
}
.chart-main canvas{
  width:100% !important;
  height:100% !important;
}
.chart-side{
  width:240px;
  flex-shrink:0;
  position:relative;
  height:300px;
  border-left:1px solid var(--line);
  padding-left:18px;
}
.chart-side canvas{
  width:100% !important;
  height:100% !important;
}
@media (max-width:900px){
  .chart-area{ flex-direction:column; }
  .chart-side{ width:100%; border-left:none; padding-left:0; padding-top:16px; border-top:1px solid var(--line); height:260px; }
}

/* ---------- 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; }

/* ---------- Enhanced Weather Chip (Glassmorphism) ---------- */
.weather-chip-enhanced {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  padding: 7px 16px 7px 14px;
  border-radius: 24px;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  cursor: default;
}

.weather-chip-enhanced:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.12) 100%);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.weather-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.weather-left strong {
  color: #ffffff;
  font-weight: 600;
  font-size: 0.85rem;
}

.weather-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.weather-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.2;
}

.weather-location {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.weather-humidity {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'IBM Plex Mono', monospace;
}

.humidity-icon {
  width: 11px;
  height: 11px;
  stroke-width: 2;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6);
}

.weather-chip-enhanced .weather-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
  color: #FFD700;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.3));
}

/* ---------- Nav Capsule (module links below header) ---------- */
.nav-capsule-inventory {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 20px;
  margin: 10px auto 6px;
  width: fit-content;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 40px;
  box-shadow: 0 2px 8px rgba(28, 42, 66, 0.06);
}

.nav-capsule-inventory .nav-capsule-btn {
  padding: 7px 26px;
  border-radius: 28px;
  text-decoration: none;
  white-space: nowrap;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px solid transparent;
  transition: all 0.25s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.nav-capsule-inventory .nav-capsule-btn:hover {
  color: var(--text);
  background: var(--bg);
  border-color: var(--line);
}

.nav-capsule-inventory .nav-capsule-btn.active {
  color: #ffffff;
  background: #259E8A;
  border-color: #259E8A;
  box-shadow: 0 2px 10px rgba(37, 158, 138, 0.35);
  font-weight: 600;
}

/* ---------- Expandable Invoice Detail Rows ---------- */
.invoice-detail-cell {
  padding: 0 !important;
  background: #F4F6FA;
}
.invoice-detail-inner {
  padding: 16px 18px 18px;
  border-top: 2px solid var(--line-strong);
}
.invoice-detail-inner h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.invoice-detail-inner h4 svg {
  width: 15px;
  height: 15px;
}
.invoice-detail-inner .items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.invoice-detail-inner .items-table thead th {
  background: var(--navy);
  color: #F2F5F9;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 8px 12px;
  text-align: left;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.invoice-detail-inner .items-table thead th:last-child { border-right: none; }
.invoice-detail-inner .items-table thead th.num { text-align: right; }
.invoice-detail-inner .items-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--card);
}
.invoice-detail-inner .items-table tbody td:last-child { border-right: none; }
.invoice-detail-inner .items-table tbody td.num { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.invoice-detail-inner .items-table tfoot td {
  padding: 8px 12px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  border-top: 2px solid var(--line-strong);
  background: #EDF1F7;
}
.invoice-detail-inner .items-table tfoot td.num { text-align: right; }
.invoice-detail-inner .items-table tfoot td:first-child { text-align: right; }

/* Expand indicator */
.expand-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  transition: transform 0.2s ease;
  color: var(--navy-muted);
}
.expand-indicator.expanded {
  transform: rotate(90deg);
}
/* Row hover effect for expandable rows */
table.sheet tbody tr.row-expandable {
  cursor: pointer;
}
table.sheet tbody tr.row-expandable:hover .expand-indicator {
  color: var(--accent);
}

/* ---------- Invoice Tab Switcher ---------- */
.invoice-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: var(--shadow-card);
  width: fit-content;
}

.invoice-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.invoice-tab svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.invoice-tab:hover {
  background: var(--bg);
  color: var(--text);
}

.invoice-tab.active {
  background: var(--navy);
  color: #F3F6FA;
  box-shadow: 0 2px 8px rgba(28,42,66,0.15);
}

.invoice-tab.active svg {
  color: #5FAE97;
}

@media (max-width:720px){
  .invoice-tabs{ width:100%; }
  .invoice-tab{ flex:1; justify-content:center; padding:10px 12px; font-size:12px; }
}

/* ---------- 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; z-index:30; }
  #sidebar.open{ left:0; }
  .grid-cards{ grid-template-columns:1fr; }
  .content{ padding:18px; }
  #header{ padding:0 14px; }

  /* Enable menu toggle button */
  #menuToggle{ display:flex !important; }

  /* Simplify header for mobile */
  #header{ grid-template-columns:1fr auto; gap:10px; }
  .header-mid{ display:none; }
  .header-right .icon-btn:nth-child(1){ display:none; } /* Hide search */
  .weather-chip-enhanced{ padding:5px 10px; gap:6px; }
  .weather-chip-enhanced .weather-right .weather-location{ display:none; }
  .weather-chip-enhanced .weather-left strong{ font-size:0.75rem; }
  .weather-divider{ height:16px; }
  .user-meta{ display:none; }

  /* Page title */
  .page-title{ font-size:14px; }
  .page-crumb{ font-size:10px; }

  /* Content head — stack buttons */
  .content-head{ flex-direction:column; align-items:flex-start; }
  .content-head > div:last-child{ width:100%; flex-wrap:wrap; }
  .content-head .btn{ flex:1; justify-content:center; font-size:12px; padding:8px 12px; }

  /* Responsive table */
  .sheet-wrap{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  table.sheet{ font-size:11.5px; }
  table.sheet thead th{ padding:8px 10px; font-size:9px; }
  table.sheet tbody td{ padding:8px 10px; }

  /* Panel tools — collapse */
  .panel-tools .search-box input{ width:100px; }
  .panel-tools .search-box{ font-size:11px; }
  .panel-tools .tool-btn{ width:28px; height:28px; }
  .panel-head{ padding:12px 14px; }
  .panel-head h2{ font-size:13px; }
  .panel-foot{ flex-direction:column; gap:8px; align-items:flex-start; font-size:10px; }

  /* Nav capsule */
  .nav-capsule-inventory{ flex-wrap:wrap; padding:5px 12px; gap:4px; }
  .nav-capsule-inventory .nav-capsule-btn{ padding:5px 14px; font-size:0.72rem; }

  /* User profile sidebar */
  .user-profile{ padding:10px 14px; }
  .user-name{ font-size:0.75rem; }
  .user-role{ font-size:0.6rem; }

  /* Stat cards */
  .stat-card{ padding:14px; }
  .stat-value{ font-size:20px; }

  /* Chart area */
  .chart-area{ min-height:auto; }
  .chart-main{ height:200px; }

  /* Invoice tabs */
  .invoice-tabs{ width:100%; overflow-x:auto; }
  .invoice-tab{ flex:1; justify-content:center; padding:8px 10px; font-size:11px; white-space:nowrap; }
  .invoice-tab svg{ width:14px; height:14px; }

  /* Modal */
  .modal-panel{ width:95%; max-height:90vh; }
  .modal-head{ padding:14px 16px; }
  .modal-body{ padding:14px 16px; }
  .modal-foot{ flex-direction:column; gap:10px; align-items:stretch; }
  .modal-foot > div{ flex-direction:column; gap:8px; }
  .modal-foot .btn{ width:100%; justify-content:center; }
}

@media (max-width:480px){
  #header{ height:auto; padding:10px 10px; gap:6px; grid-template-columns:1fr auto; }
  .header-left{ gap:10px; }
  .header-left .page-crumb{ display:none; }
  .page-title{ font-size:13px; white-space:normal; }

  /* Hide weather chip on very small screens */
  .header-right .weather-chip-enhanced{ display:none; }
  .header-right .icon-btn:nth-child(3){ display:none; } /* Hide bell */

  .content{ padding:12px; }
  .content-head h1{ font-size:17px; }
  .content-head p{ font-size:11px; }

  .grid-cards{ gap:10px; }
  .stat-card{ padding:12px; }
  .stat-value{ font-size:18px; }
  .stat-label{ font-size:11px; }
  .stat-top{ margin-bottom:10px; }
  .stat-icon{ width:28px; height:28px; }
  .stat-icon svg{ width:14px; height:14px; }

  .panel-head{ flex-direction:column; align-items:flex-start; gap:10px; }
  .panel-tools{ width:100%; justify-content:flex-start; flex-wrap:wrap; }
  .panel-tools .search-box{ flex:1; }
  .panel-tools .search-box input{ width:100%; }
  .panel-head h2{ font-size:12.5px; }

  table.sheet{ font-size:10.5px; }
  table.sheet thead th{ padding:6px 8px; font-size:8px; letter-spacing:0.3px; }
  table.sheet tbody td{ padding:6px 8px; }
  td.id-cell{ font-size:10px; }

  .badge{ font-size:9px; padding:2px 6px; gap:3px; }
  .badge::before{ width:4px; height:4px; }

  .row-actions{ gap:4px; }
  .row-actions button{ width:22px; height:22px; }
  .row-actions svg{ width:11px; height:11px; }

  .pager button{ width:22px; height:22px; font-size:10px; }
  .panel-foot{ font-size:9px; }

  .two-col{ gap:10px; margin-top:10px; }
  .side-panel{ padding:12px; }
  .side-panel h3{ font-size:12px; }

  .alert-row{ padding:7px 0; font-size:11px; }
  .alert-name strong{ font-size:11px; }
  .alert-name span{ font-size:10px; }
  .alert-qty{ font-size:11px; }

  .nav-capsule-inventory{ overflow-x:auto; flex-wrap:nowrap; justify-content:flex-start; padding:5px 10px; }
  .nav-capsule-inventory .nav-capsule-btn{ padding:5px 12px; font-size:0.68rem; flex-shrink:0; }

  /* Invoice detail inner */
  .invoice-detail-inner{ padding:10px 12px; }
  .invoice-detail-inner h4{ font-size:11px; }
  .invoice-detail-inner .items-table{ font-size:10.5px; }
  .invoice-detail-inner .items-table thead th{ font-size:8.5px; padding:5px 8px; }
  .invoice-detail-inner .items-table tbody td{ padding:5px 8px; }
  .invoice-detail-inner .items-table tfoot td{ font-size:10px; padding:5px 8px; }

  /* Chart panels */
  .chart-area{ padding:10px; gap:10px; }
  .chart-main{ height:180px; }
  .chart-side{ height:180px; }
}

