:root{
  --headerH: 76px; /* auto updated by JS */
  --sidebarW: 300px;

  --text:#0b1220;
  --muted:rgba(11,18,32,.65);
  --line:rgba(11,18,32,.12);

  --brand:#0ea5e9;

  --shadow: 0 18px 40px rgba(11,18,32,.08);
  --shadow2: 0 10px 24px rgba(11,18,32,.10);

  --oswald: "Oswald", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --outfit: "Outfit", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ✅ make injected header NOT overlap */
#siteHeader .site-header{
  position: sticky !important;
  top: 0;
  z-index: 5000;
}

/* Layout */
.admin-app{
  display: grid;
  grid-template-columns: var(--sidebarW) 1fr;
  min-height: calc(100vh - var(--headerH));
}

/* Sidebar sticky under header */
.sidebar{
  position: sticky;
  top: var(--headerH);
  height: calc(100vh - var(--headerH));
  overflow: auto;
  background: #fff;
  border-right: 1px solid var(--line);
  margin-top:50px;
}

.main{
  padding: 40px 26px 26px 50px;
  min-height: calc(100vh - var(--headerH));
}

/* Sidebar header */
.side-head{
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.side-title{
  font-family: var(--oswald);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 18px;
}
.side-badge{
  display:inline-block;
  margin-top: 8px;
  font-family: var(--outfit);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(168, 85, 247, .14);
  color: #7c3aed;
  font-weight: 700;
}

/* Sidebar nav */
.side-nav{
  padding: 10px 10px 14px;
}
.nav-item,
.nav-group{
  width: 100%;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  font-family: var(--outfit);
  font-weight: 600;
  font-size: 14px;
}
.nav-item:hover,
.nav-group:hover{ background: rgba(14,165,233,.08); }

.nav-item.active{
  background: rgba(14,165,233,.10);
  border: 1px solid rgba(14,165,233,.20);
}

.nav-ico{
  width: 22px;
  display:inline-flex;
  justify-content:center;
  opacity:.8;
}
.nav-caret{
  margin-left: auto;
  opacity:.55;
}

/* Submenu */
.nav-sub{
  margin: 6px 0 12px 34px;
  padding-left: 10px;
  border-left: 1px solid rgba(11,18,32,.10);
  display:none;
}
.nav-sub.open{ display:block; }

.nav-subitem{
  display:block;
  padding: 9px 10px;
  border-radius: 10px;
  font-family: var(--outfit);
  font-size: 13px;
  font-weight: 600;
  color: rgba(11,18,32,.78);
  text-decoration: none;
}
.nav-subitem:hover{
  background: rgba(11,18,32,.04);
  color: var(--text);
}
.nav-subitem.active{
  background: rgba(14,165,233,.10);
  color: var(--text);
  border: 1px solid rgba(14,165,233,.18);
}

/* Sidebar footer */
.side-foot{
  padding: 12px;
  border-top: 1px solid var(--line);
}
.side-mini{
  width: 44px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.side-mini:hover{ box-shadow: var(--shadow2); }

/* Collapsed */
.sidebar.is-collapsed{
  width: 76px;
}
.sidebar.is-collapsed .nav-text,
.sidebar.is-collapsed .nav-caret,
.sidebar.is-collapsed .nav-sub,
.sidebar.is-collapsed .side-badge{ display:none; }

/* Admin header inside main (like screenshot) */
.admin-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 18px;
  padding: 6px 0 18px;
}
.admin-title{
  font-family: var(--oswald);
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 28px;
  text-transform: uppercase;
}
.admin-sub{
  font-family: var(--outfit);
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}
.admin-sub .role{
  color: var(--brand);
  font-weight: 800;
  margin-left: 6px;
}


.admin-head-right{
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;   /* 👈 end me le jaayega */
}


.admin-logout{
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--oswald);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.admin-logout:hover{ color: var(--brand); }

/* Avatar */
.avatar{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  overflow:hidden;
  position: relative;
  border: 2px solid rgba(14,165,233,.25);
}
.avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.avatar .dot{
  position:absolute;
  right: 2px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid #fff;
}

/* Pages */
.content{ padding-top: 4px; }
.page{ display:none; }
.page.show{ display:block; }

.page-head h2{
  font-family: var(--oswald);
  font-weight: 800;
  letter-spacing: .06em;
  font-size: 18px;
  margin: 0;
  text-transform: uppercase;
}
.page-head p{
  font-family: var(--outfit);
  color: var(--muted);
  margin: 4px 0 16px;
  font-size: 13px;
}

/* Cards */
.cards{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card{
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 16px 16px 14px;
  box-shadow: 0 10px 24px rgba(11,18,32,.06);
}
.card-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 8px;
}
.card-title{
  font-family: var(--oswald);
  font-weight: 800;
  letter-spacing:.06em;
  font-size: 12px;
  text-transform: uppercase;
  opacity:.9;
}
.card-ico{ opacity:.7; }
.card-value{
  font-family: var(--oswald);
  font-weight: 800;
  font-size: 28px;
}
.card-sub{
  font-family: var(--outfit);
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.ok{ color:#16a34a; font-weight:700; }
.bad{ color:#dc2626; font-weight:700; margin-left: 10px; }

.tint-blue{ background: linear-gradient(120deg, rgba(14,165,233,.12), rgba(255,255,255,1) 60%); border-color: rgba(14,165,233,.25); }
.tint-green{ background: linear-gradient(120deg, rgba(34,197,94,.12), rgba(255,255,255,1) 60%); border-color: rgba(34,197,94,.22); }
.tint-red{ background: linear-gradient(120deg, rgba(239,68,68,.12), rgba(255,255,255,1) 60%); border-color: rgba(239,68,68,.22); }

/* Panel */
.panel{
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-top: 14px;
}
.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-head h3{
  margin: 0;
  font-family: var(--oswald);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 16px;
}
.panel-actions{ display:flex; gap: 10px; }

/* Buttons */
.btn{
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  font-family: var(--oswald);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
}
.btn:hover{ box-shadow: var(--shadow2); }
.btn-outline{ background:#fff; }
.btn-mini{ padding: 8px 10px; }
.btn-danger{ border-color: rgba(239,68,68,.25); }
.btn-primary{
  border-color: rgba(14,165,233,.30);
  background: rgba(14,165,233,.12);
}

/* Empty */
.empty{
  padding: 36px 14px;
  text-align:center;
  font-family: var(--outfit);
  color: var(--muted);
}

/* Toolbar Search */
.toolbar{ margin: 10px 0 14px; }
.search{
  display:flex;
  align-items:center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  max-width: 520px;
  background: #fff;
}
.search input{
  width:100%;
  border: 0;
  outline: none;
  font-family: var(--outfit);
  font-size: 13px;
}

/* Table */
.table-wrap{ overflow:auto; }
.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
.table th{
  text-align:left;
  font-family: var(--oswald);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 11px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td{
  font-family: var(--outfit);
  font-size: 13px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(11,18,32,.06);
  white-space: nowrap;
}
.table tr.alt{ background: rgba(11,18,32,.02); }

.mini-select{
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--outfit);
  font-size: 13px;
  background:#fff;
}

/* Pills */
.pill{
  display:inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-family: var(--oswald);
}
.pill.success{ background: rgba(34,197,94,.14); color:#15803d; border: 1px solid rgba(34,197,94,.25); }

.muted-center{
  text-align:center;
  color: var(--muted);
  font-family: var(--outfit);
}

/* Forms */
.form-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.f label{
  display:block;
  font-family: var(--outfit);
  font-weight: 700;
  font-size: 12px;
  margin: 2px 0 6px;
  color: rgba(11,18,32,.75);
}
.f input, .f select, .f textarea{
  width:100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  font-family: var(--outfit);
  font-size: 13px;
  outline:none;
  background:#fff;
}
.f textarea{ resize: vertical; }

.span-2{ grid-column: span 2; }
.form-actions{ display:flex; justify-content:flex-end; }

.mini-cards2{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Responsive */
@media (max-width: 1200px){
  .cards{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px){
  .admin-app{ grid-template-columns: 1fr; }
  .sidebar{
    position: relative;
    top: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .form-grid{ grid-template-columns: 1fr; }
  .span-2{ grid-column: auto; }
  .form-actions{ justify-content: stretch; }
  .form-actions .btn{ width: 100%; }
}


/* =========================
   MOBILE OPTIMIZATION
   Add this at END of dashboard.css
========================= */

/* Mobile header height safety */
@media (max-width: 900px){
  :root{ --sidebarW: 1fr; }
}

/* Make main padding tighter on mobile */
@media (max-width: 900px){
  .main{ padding: 16px 14px 30px; }
  .admin-title{ font-size: 22px; }
}

/* ✅ Mobile: sidebar becomes off-canvas drawer */
@media (max-width: 900px){
  .admin-app{
    grid-template-columns: 1fr;
  }

  .sidebar{
    position: fixed;
    left: 0;
    top: var(--headerH);
    height: calc(100vh - var(--headerH));
    width: min(320px, 86vw);
    transform: translateX(-110%);
    transition: transform .22s ease;
    z-index: 6000;
    box-shadow: 0 18px 50px rgba(11,18,32,.18);
    border-right: 1px solid rgba(11,18,32,.10);
    border-bottom: 0;
  }

  .sidebar.is-open{
    transform: translateX(0);
  }

  /* Overlay behind drawer */
  .drawer-overlay{
    position: fixed;
    inset: 0;
    top: var(--headerH);
    background: rgba(0,0,0,.35);
    z-index: 5900;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .drawer-overlay.show{
    opacity: 1;
    pointer-events: auto;
  }

  /* Hide collapse button in sidebar footer on mobile */
  .side-foot{ display:none; }

  /* Admin header: stack */
  .admin-head{
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .admin-head-right{
    width: 100%;
    justify-content: space-between;
  }
}

/* ✅ Add a "Menu" button style (we will inject via JS) */
.admin-menu-btn{
  display:none;
  border: 1px solid rgba(11,18,32,.12);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--oswald);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
}
.admin-menu-btn:hover{ box-shadow: var(--shadow2); }

@media (max-width: 900px){
  .admin-menu-btn{ display:inline-flex; align-items:center; gap: 8px; }
}

/* ✅ Cards: single column on small mobile */
@media (max-width: 600px){
  .cards{ grid-template-columns: 1fr; }
  .mini-cards2{ grid-template-columns: 1fr; }
}

/* ✅ Tables: make scrolling smooth + sticky header */
.table-wrap{
  -webkit-overflow-scrolling: touch;
}
.table thead th{
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}

/* ✅ Forms: single column */
@media (max-width: 900px){
  .form-grid{
    grid-template-columns: 1fr;
  }
  .span-2{ grid-column: auto; }
  .form-actions{ justify-content: stretch; }
  .form-actions .btn{ width: 100%; }
}

/* ✅ Search input full width */
@media (max-width: 900px){
  .search{ max-width: 100%; }
}

/* ✅ Reduce table minimum width on small devices (still scrollable) */
@media (max-width: 600px){
  .table{ min-width: 720px; }
}

/* =========================
   MOBILE OPTIMIZATION
========================= */

/* Make sure the app uses full width */
.admin-app{
  width: 100%;
  max-width: 100%;
}

/* If header is fixed/sticky, push page down */
:root{ --headerH: 76px; }
body{ padding-top: var(--headerH); }

/* Prevent any horizontal overflow */
html, body{
  overflow-x: hidden;
}

/* Default grid widths (desktop) */
.main, .content, .panel, .cards{
  max-width: 100%;
}

/* -------- Mobile layout -------- */
@media (max-width: 900px){

  /* App becomes single column */
  .admin-app{
    display: block;
  }

  /* Sidebar turns into drawer */
  .sidebar{
    position: fixed;
    top: var(--headerH);
    left: 0;
    height: calc(100vh - var(--headerH));
    width: 86%;
    max-width: 320px;
    transform: translateX(-110%);
    transition: transform .22s ease;
    z-index: 9998;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    overflow-y: auto;
  }
  .sidebar.is-open{
    transform: translateX(0);
  }

  /* overlay */
  .drawer-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 9997;
  }
  .drawer-overlay.show{
    opacity: 1;
    pointer-events: auto;
  }

  /* Main takes full width */
  .main{
    width: 100%;
    margin-left: 0 !important;
  }

  /* Topbar layout */
  .topbar{
    position: sticky;
    top: var(--headerH);
    z-index: 10;
    padding: 14px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .top-left{
    width: 100%;
  }
  .top-title{
    font-size: 22px;
    line-height: 1.1;
  }
  .top-sub{
    font-size: 13px;
  }

  /* Menu button */
  .admin-menu-btn{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(11,18,32,.12);
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    font-family: "Oswald", sans-serif;
    font-weight: 600;
    letter-spacing: .5px;
  }

  /* Content padding */
  .content{
    padding: 14px !important;
  }

  /* Page headers */
  .page-head h2{
    font-size: 18px;
  }
  .page-head p{
    font-size: 13px;
  }

  /* Cards stack */
  .cards{
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .card{
    min-height: auto;
  }

  /* Mini cards too */
  .mini-cards2{
    grid-template-columns: 1fr !important;
  }

  /* Panels full width */
  .panel{
    padding: 14px;
    border-radius: 14px;
  }

  /* Toolbar / Search */
  .toolbar{
    flex-wrap: wrap;
    gap: 10px;
  }
  .search{
    width: 100%;
    max-width: 100%;
  }
  .search input{
    width: 100%;
  }

  /* Tables become scrollable */
  .table-wrap{
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .table{
    min-width: 760px; /* keeps columns readable */
  }

  /* Forms stack nicely */
  .form-grid{
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .form-grid .span-2{
    grid-column: auto !important;
  }
  .form-actions{
    justify-content: stretch;
  }
  .form-actions .btn{
    width: 100%;
  }
}
@media (max-width: 900px) {
    .admin-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-top: 20px;
    }
}


/* ===============================
   QUOTE TABLE HORIZONTAL SCROLL FIX
   Paste at the VERY END of dashboard.css
================================ */
/* ✅ CRITICAL for CSS grid: allow right column to shrink */
.admin-app > .main,
.main,
.panel,
.tab-content,
.tab-pane{
  min-width: 0 !important;
}

/* ✅ Desktop + Mobile horizontal scroll wrapper */
.table-scroll-x{
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  display: block;
}

/* ✅ Force table wider than wrapper */
#quoteTable{
  width: max-content !important;
  min-width: 1200px !important;
}

/* ✅ Prevent cell wrapping */
#quoteTable th,
#quoteTable td{
  white-space: nowrap !important;
}










/* =========================
   MOBILE SIDEBAR DRAWER
========================= */

/* menu button default hidden */
.admin-menu-btn{
  display:none;
  align-items:center;
  gap:10px;
  height:44px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid rgba(11,18,32,.18);
  background:#fff;
  color:#0b1220;
  font-weight:700;
  font-size:14px;
  line-height:1;
  cursor:pointer;
}

/* overlay hidden */
.drawer-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  z-index:6000;
  opacity:0;
  visibility:hidden;
  transition:opacity .25s ease, visibility .25s ease;
}
.drawer-overlay.show{
  opacity:1;
  visibility:visible;
}

/* mobile behavior */
@media (max-width: 900px){

  .admin-menu-btn{ display:inline-flex; }

  /* sidebar becomes off-canvas */
  .sidebar{
    position:fixed !important;
    top:0;
    left:0;
    height:100vh;
    z-index:7000;
    transform:translateX(-105%);
    transition:transform .28s ease;
    box-shadow: 0 18px 40px rgba(11,18,32,.18);
  }
  .sidebar.is-open{
    transform:translateX(0);
  }

  /* main should be full width */
  .admin-app{
    grid-template-columns: 1fr !important;
  }
}







/* =========================
   SIDEBAR MOBILE FIX
========================= */

@media (max-width: 900px){

  /* sidebar full height + internal scroll */
  .sidebar{
    display:flex;
    flex-direction:column;
    height:100vh;
    overflow:hidden; /* important: scroll will be inside nav */
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* make top header visible & not cut */
  .side-head{
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;            /* change if your sidebar bg is different */
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(11,18,32,.12);
  }

  .side-title{
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 6px;
    word-break: break-word;
  }

  .side-badge{
    display:inline-flex;
    align-items:center;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(11,18,32,.12);
    background: rgba(11,18,32,.04);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* THIS is the scroll area */
  .side-nav{
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 16px;
  }

  /* keep bottom collapse area visible */
  .side-foot{
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #fff;
    padding: 10px 12px;
    border-top: 1px solid rgba(11,18,32,.12);
  }
}
