:root{--ink:#2b1c16;--muted:#8a7566;--line:#e6dcc4;--brand:#4a1015;--brand-dark:#2e0a0d;--bg:#f6efd6;--accent:#8c2a35;--accent-dark:#6e1f28;--blue:#4a6485;--danger:#c0392b;--ok:#1a8f4c}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--ink)}
a{color:var(--accent);text-decoration:none}
.topbar{background:var(--brand);color:#fff;padding:16px 24px;display:flex;align-items:center;justify-content:space-between;border-radius:0 0 22px 22px}
.topbar .brand{font-weight:800;font-size:19px;letter-spacing:-.01em}
.topbar nav a{color:rgba(255,255,255,.78);margin-left:4px;font-size:14px;padding:8px 15px;border-radius:20px;transition:background .15s,color .15s}
.topbar nav a:hover{background:rgba(255,255,255,.12);color:#fff}
.topbar nav a.active{color:var(--brand);background:#fff;font-weight:700}
.nav-toggle{display:none;background:none;border:none;color:#fff;font-size:22px;line-height:1;padding:4px 8px;cursor:pointer}
.wrap{max-width:1100px;margin:0 auto;padding:24px}
.card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:22px;margin-bottom:16px;box-shadow:0 1px 4px rgba(43,28,22,.06)}
.grid{display:grid;gap:16px}
.grid.cols-2{grid-template-columns:1fr 1fr}
.grid.cols-3{grid-template-columns:repeat(3,1fr)}
.grid.cols-4{grid-template-columns:repeat(4,1fr)}
@media (max-width:700px){.grid.cols-2,.grid.cols-3{grid-template-columns:1fr}.grid.cols-4{grid-template-columns:1fr 1fr}}
@media (max-width:480px){.grid.cols-4{grid-template-columns:1fr}}
label{display:block;font-size:12px;color:var(--muted);margin:10px 0 4px;font-weight:600}
input,select,textarea{width:100%;padding:10px 13px;border:1px solid var(--line);border-radius:10px;font-size:14px;font-family:inherit;background:#fff}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent)}
button{cursor:pointer;border:none;border-radius:10px;padding:11px 18px;font-weight:700;font-size:14px}
button.primary{background:var(--accent);color:#fff}
button.primary:hover{background:var(--accent-dark)}
button.ghost{background:#fff;border:1px solid var(--line);color:var(--ink)}
button.ghost:hover{background:var(--bg)}
button.danger{background:#fbe6e4;color:var(--danger)}
button.small{padding:6px 12px;font-size:12px}
table{width:100%;border-collapse:collapse;font-size:14px}
th,td{padding:10px;border-bottom:1px solid var(--line);text-align:left}
th{color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.03em}
.badge{display:inline-block;padding:3px 9px;border-radius:20px;font-size:11px;font-weight:700}
.badge.pending{background:#f6e9c9;color:#8a5a12}
.badge.confirmed{background:#e1f2ea;color:var(--ok)}
.badge.cancelled{background:#fbe6e4;color:var(--danger)}
.status-select{width:auto;padding:5px 8px;border-radius:20px;font-size:12px;font-weight:700;border:none;text-transform:capitalize}
.status-select.pending{background:#f6e9c9;color:#8a5a12}
.status-select.confirmed{background:#e1f2ea;color:var(--ok)}
.status-select.cancelled{background:#fbe6e4;color:var(--danger)}
.error{background:#fbe6e4;color:var(--danger);padding:10px 14px;border-radius:10px;font-size:13px;margin:10px 0;display:none}
.muted{color:var(--muted);font-size:13px}
.hero{text-align:center;padding:70px 20px}
.hero h1{font-size:38px;margin:0 0 12px}
.hero p{color:var(--muted);font-size:17px;max-width:560px;margin:0 auto 28px}
.stat{font-size:28px;font-weight:800;color:var(--brand)}
.stat-label{font-size:12px;color:var(--muted);text-transform:uppercase}
.item-card{border:1px solid var(--line);border-radius:14px;padding:12px;text-align:center;cursor:pointer;background:#fff}
.item-card img{width:100%;height:110px;object-fit:cover;border-radius:10px;background:#f2ede0}
.item-card .name{font-weight:700;font-size:13px;margin-top:8px}
.item-card .code{color:var(--muted);font-size:11px}
.cart-row{display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--line);font-size:13px}
.qty-ctrl{display:flex;align-items:center;gap:8px}
.qty-ctrl button{padding:2px 10px}

.tabs{display:flex;gap:4px;margin-bottom:16px;padding:4px;background:#ece0c2;border-radius:14px;overflow-x:auto;-webkit-overflow-scrolling:touch}
.tabs.subtabs{background:transparent;padding:0;border-bottom:2px solid var(--line);border-radius:0;margin-bottom:18px;gap:2px}
.tabs.subtabs .tab-btn{padding:8px 14px;font-size:13px;border-radius:8px 8px 0 0}
.tabs.subtabs .tab-btn.active{background:var(--bg);box-shadow:none;border-bottom:2px solid var(--accent);margin-bottom:-2px}
.tab-btn{background:none;border:none;border-radius:10px;padding:10px 16px;font-weight:700;color:var(--muted);font-size:14px;white-space:nowrap;flex:0 0 auto;transition:background .15s,color .15s}
.tab-btn.active{color:var(--brand);background:#fff;box-shadow:0 1px 3px rgba(43,28,22,.1)}
.tab-panel{display:none}
.tab-panel.active{display:block}
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.table-scroll table{white-space:nowrap}
td.thumb-cell img{width:44px;height:44px;object-fit:cover;border-radius:6px;background:#f0f0f0;display:block}
td.thumb-cell{width:56px}
.order-thumbs{display:flex;gap:8px;flex-wrap:wrap}
.order-thumbs img{width:120px;height:120px;object-fit:cover;border-radius:10px;background:#f0f0f0;display:block;cursor:pointer}

/* Order view: mobile card layout — swaps in below 640px instead of the
   normal wide table, which otherwise turns into a horizontally-scrolling
   mess on a phone once there are more than 2-3 columns. Sr. No. and Image
   always get their own compact slots; everything else configured for the
   table collapses into one "Details" column, one line per field. */
.mobile-order-view{display:none}
@media (max-width:640px){
  .desktop-order-view{display:none}
  .mobile-order-view{display:block}
}
.mobile-order-row{display:grid;grid-template-columns:104px 1fr;gap:8px;padding:12px 0;border-bottom:1px solid var(--line)}
.mobile-order-row:last-child{border-bottom:none}
.mobile-details{font-size:13px;line-height:1.7;padding-top:2px}

/* Clubbed variant layout — one photo per item, every color's size
   breakdown grouped underneath instead of repeating a row (and the photo)
   per color/size combination. Desktop: photo sits beside the whole
   content column. Mobile: photo shrinks into a header row above the
   (now full-width) color groups, since size chips need the width to
   wrap sensibly on a narrow screen. */
.clubbed-card{display:grid;grid-template-areas:"photo header" "photo groups";grid-template-columns:90px 1fr;gap:4px 14px;border:1px solid var(--line);border-radius:10px;padding:14px;margin-top:12px}
.clubbed-card:first-child{margin-top:0}
.clubbed-photo{grid-area:photo;width:90px;height:110px;object-fit:cover;border-radius:8px;background:var(--bg)}
.clubbed-photo-wrap{grid-area:photo}
.clubbed-header{grid-area:header;align-self:end}
.clubbed-groups{grid-area:groups}
.clubbed-color-label{font-size:12px;color:var(--muted);margin:10px 0 4px}
.clubbed-color-label:first-child{margin-top:0}
.clubbed-size-chips{display:flex;flex-wrap:wrap;gap:6px}
.clubbed-size-chip{border:1px solid var(--line);border-radius:6px;padding:4px 8px;font-size:12px}
.clubbed-total{display:flex;justify-content:space-between;align-items:baseline;margin-top:10px;padding-top:8px;border-top:1px solid var(--line);font-size:13px}
@media (max-width:640px){
  .clubbed-card{grid-template-areas:"photo header" "groups groups";grid-template-columns:56px 1fr;padding:12px}
  .clubbed-photo{width:56px;height:68px}
  .clubbed-photo-wrap .img-slider img{max-width:56px!important;max-height:68px!important}
}
.icon-btn{background:none;border:none;padding:4px 6px;font-size:15px;cursor:pointer;color:var(--muted)}
.best-sellers-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}
.best-seller-card{text-align:center}
.best-seller-thumb{width:100%;aspect-ratio:1;object-fit:cover;border-radius:8px;background:var(--bg);cursor:pointer;display:block}
.best-seller-thumb-empty{width:100%;aspect-ratio:1;border-radius:8px;background:var(--bg)}
.best-seller-label{font-size:12px;margin:6px 0 0;font-weight:500}
.best-seller-qty{font-size:11px;color:var(--muted);margin:1px 0 0}
.simple-lightbox{position:fixed;inset:0;background:rgba(10,6,4,.9);display:none;align-items:center;justify-content:center;z-index:1000;cursor:zoom-out}
.simple-lightbox.open{display:flex}
.simple-lightbox img{max-width:90vw;max-height:90vh;object-fit:contain;border-radius:8px}
.icon-btn:hover{color:var(--ink)}
.icon-btn:disabled{opacity:.25;cursor:default}
.field-row-edit input{margin:0}
.btn-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}

.lightbox{display:none;position:fixed;inset:0;background:rgba(10,6,4,.97);z-index:1000;align-items:center;justify-content:center}
.lightbox.open{display:flex}
.lightbox img{max-width:88vw;max-height:85vh;object-fit:contain;border-radius:8px}
.lightbox-close{position:absolute;top:18px;right:22px;background:none;color:#fff;font-size:22px;padding:6px 10px}
.lightbox-nav{position:absolute;top:50%;transform:translateY(-50%);background:rgba(255,255,255,.15);color:#fff;font-size:28px;padding:8px 16px;border-radius:8px}
.lightbox-prev{left:16px}
.lightbox-next{right:16px}
.lightbox-count{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);color:#fff;font-size:13px;background:rgba(255,255,255,.15);padding:4px 12px;border-radius:20px}
.crop-box{background:#fff;border-radius:12px;padding:18px;max-width:520px;width:92vw;max-height:85vh;overflow:auto}
.crop-canvas-wrap{max-height:60vh;overflow:hidden;background:#111;border-radius:8px}
/* Dynamic Order View columns have their own explicit character widths — the
   table must NOT be squeezed to fit the (often much narrower) phone screen,
   or the browser breaks every single character onto its own line trying to
   satisfy that. table-layout:fixed makes each column's declared width
   authoritative rather than content-shrunk, and width:max-content lets the
   table grow past the viewport so .table-scroll's horizontal scroll kicks
   in instead — exactly the same "scroll, don't crush" behavior every other
   wide table in this app already gets. */
.dynamic-order-table{table-layout:fixed;width:max-content;max-width:none}
.dynamic-order-table th,.dynamic-order-table td{overflow-wrap:break-word;word-break:normal;white-space:normal;vertical-align:middle;text-align:center}
.exo-toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,20px);background:var(--ink,#2b1c16);color:#fff;padding:12px 20px;border-radius:10px;font-size:14px;font-weight:600;box-shadow:0 6px 24px rgba(0,0,0,.25);z-index:2000;opacity:0;pointer-events:none;transition:opacity .2s ease,transform .2s ease}
.exo-toast.show{opacity:1;transform:translate(-50%,0)}
.exo-toast.success{background:#1b7f4c}
.exo-toast.error{background:#c0392b}
@media (max-width:640px){
  .lightbox-nav{font-size:22px;padding:6px 12px}
  .lightbox-close{top:10px;right:14px}
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width:640px){
  .topbar{flex-direction:row;align-items:center;justify-content:space-between;padding:12px 16px;position:relative;border-radius:0 0 14px 14px}
  .topbar .brand{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}
  .nav-toggle{display:block}
  .topbar nav{display:none;position:absolute;top:100%;left:0;right:0;background:var(--brand);flex-direction:column;padding:6px 12px 14px;border-radius:0 0 14px 14px;box-shadow:0 10px 24px rgba(0,0,0,.2);z-index:200}
  .topbar.nav-open nav{display:flex}
  .topbar nav a{margin-left:0;font-size:15px;padding:11px 12px;width:100%;box-sizing:border-box;border-radius:8px}
  .wrap{padding:14px}
  .card{padding:16px;border-radius:10px}
  .hero{padding:40px 16px}
  .hero h1{font-size:26px}
  .hero p{font-size:15px}
  table{font-size:13px}
  th,td{padding:8px 6px}
  button{padding:10px 14px;font-size:13px}
  .grid.cols-3 .grid.cols-3{grid-template-columns:1fr} /* nested grids (e.g. bulk import cards) */
  .item-card img{height:90px}
}
