/* ClickRango v3 — UI (light, professional, mobile-first)
   Apple-like: soft corners + subtle shadows + system font
   iFood-inspired: clean sidebar, clear status chips, strong hierarchy
*/

:root{
  --bg:#F6F7FB;
  --panel:#FFFFFF;
  --panel2:#FBFBFD;
  --text:#0F172A;
  --muted:#64748B;
  --muted2:#94A3B8;
  --border:#E5E7EB;
  --shadow:0 10px 26px rgba(15,23,42,.10);
  --shadow-sm:0 6px 14px rgba(15,23,42,.08);
  --radius:18px;
  --radius-sm:14px;

  --brand:#F43F5E;
  --brand-ink:#FFFFFF;

  --ok:#22C55E;
  --warn:#F59E0B;
  --danger:#EF4444;
  --info:#3B82F6;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:var(--bg);
  color:var(--text);
  line-height:1.45;
}
a{ color:inherit; text-decoration:none; }
img{ max-width:100%; display:block; }
code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(15,23,42,.06);
  padding: 2px 6px;
  border-radius: 10px;
}

/* Layout */
.container{ width:min(1180px, calc(100% - 36px)); margin:0 auto; }
.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns: 290px 1fr;
}
.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  padding:18px;
  background:rgba(255,255,255,.92);
  backdrop-filter:saturate(180%) blur(10px);
  border-right:1px solid var(--border);
  overflow:auto;
}
.main{ min-width:0; }
.content{ padding:22px 0 26px; }

/* Mobile overlay & responsive sidebar */
.sidebar-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
  z-index:50;
}
body.sidebar-open .sidebar-overlay{ opacity:1; pointer-events:auto; }

@media (max-width: 980px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position:fixed;
    left:0; top:0; bottom:0;
    width: 86vw;
    max-width: 360px;
    transform: translateX(-105%);
    transition: transform .2s ease;
    z-index:60;
  }
  body.sidebar-open .sidebar{ transform: translateX(0); }
  .content{ padding: 16px 0 90px; } /* room for mobile tabbar */
}

/* Topbar */
.topbar{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(246,247,251,.85);
  backdrop-filter:saturate(180%) blur(10px);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  height:72px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.topbar-left{ display:flex; align-items:center; gap:14px; min-width:0; }
.topbar-right{ display:flex; align-items:center; gap:10px; }
.page-title{ margin:0; font-size:18px; font-weight:1000; letter-spacing:-.02em; }
.page-sub{ font-size:12px; color:var(--muted); margin-top:2px; }

/* Branding */
.sidebar-brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:8px 6px 14px;
}
.brand-mark{
  width:42px;height:42px;
  border-radius:14px;
  display:grid; place-items:center;
  font-weight:900;
  color:#fff;
  background: radial-gradient(120% 120% at 0% 0%, #fb7185 0%, #f43f5e 40%, #f97316 100%);
  box-shadow: var(--shadow-sm);
}
.brand-title{ font-size:16px; font-weight:1000; letter-spacing:-.02em; }
.brand-sub{ font-size:12px; color:var(--muted); margin-top:1px; }

/* Navigation */
.sidebar-section-title{
  margin:14px 6px 8px;
  font-size:11px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--muted2);
  font-weight:900;
}
.nav{ display:flex; flex-direction:column; gap:6px; }
.nav a{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid transparent;
  color:var(--text);
}
.nav a:hover{
  background:rgba(15,23,42,.04);
  border-color:rgba(15,23,42,.06);
}
.nav a.active{
  background:rgba(244,63,94,.10);
  border-color:rgba(244,63,94,.22);
  color: #b31234;
}
.ic{ width:20px; height:20px; display:inline-grid; place-items:center; }
.svg-ic{ width:20px; height:20px; }
.lbl{ font-weight:900; font-size:13px; }
.tag{
  margin-left:auto;
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.10);
  color:var(--muted);
  background:rgba(255,255,255,.6);
}

/* Sidebar footer */
.sidebar-footer{
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.user-chip{
  display:flex;
  align-items:center;
  gap:12px;
}
.user-chip .avatar{
  width:38px;height:38px;
  border-radius:14px;
  background:rgba(15,23,42,.08);
  display:grid;
  place-items:center;
  font-weight:1000;
}
.user-chip .meta{ min-width:0; }
.user-chip .name{ font-weight:1000; font-size:13px; }
.user-chip .role{ font-size:12px; color:var(--muted); margin-top:2px; }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.8);
  color:var(--text);
  font-weight:900;
  font-size:13px;
  cursor:pointer;
  transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
  user-select:none;
}
.btn:hover{ background:rgba(255,255,255,1); box-shadow: var(--shadow-sm); }
.btn:active{ transform: translateY(1px); box-shadow:none; }
.btn-primary{
  background:var(--brand);
  color:var(--brand-ink);
  border-color: rgba(244,63,94,.4);
}
.btn-primary:hover{ background:#f12c52; }
.btn-ghost{
  background:transparent;
  border-color: rgba(15,23,42,.10);
}
.icon-btn{
  width:44px;height:44px;
  border-radius:16px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.85);
  display:grid;
  place-items:center;
  cursor:pointer;
}
.icon-btn:hover{ box-shadow: var(--shadow-sm); }
.mobile-only{ display:none; }
@media (max-width:980px){ .mobile-only{ display:inline-grid; } }

/* Badges */
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.75);
}
.badge.brand{
  background:rgba(244,63,94,.10);
  border-color: rgba(244,63,94,.22);
  color:#b31234;
}

/* Cards */
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card + .card{ margin-top: 14px; }
.pad{ padding: 16px; }
.section{
  margin-top: 18px;
}
.section-title{
  font-size: 13px;
  font-weight:1000;
  letter-spacing:-.01em;
  margin: 0 0 10px;
  color: var(--text);
}

/* KPIs */
.kpi-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1100px){ .kpi-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 520px){ .kpi-grid{ grid-template-columns: 1fr; } }
.kpi{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.kpi .label{ font-size:12px; color:var(--muted); font-weight:900; }
.kpi .value{ font-size:22px; font-weight:1100; letter-spacing:-.03em; margin-top:4px; }
.kpi .hint{ font-size:12px; color:var(--muted); margin-top:6px; }

/* Forms */
.form-grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px){ .form-grid{ grid-template-columns: 1fr; } }
.label{ display:block; font-size:12px; color:var(--muted); font-weight:900; margin-bottom:6px; }
.input, select, textarea{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.92);
  outline: none;
  font-size: 14px;
  color: var(--text);
}
textarea{ min-height: 110px; resize: vertical; }
.input:focus, select:focus, textarea:focus{
  border-color: rgba(244,63,94,.45);
  box-shadow: 0 0 0 4px rgba(244,63,94,.10);
}
.help{ font-size:12px; color:var(--muted); margin-top:6px; }

/* Tables */
.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow:hidden;
}
.table th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  font-weight:1000;
  padding: 12px;
  border-bottom:1px solid var(--border);
  background: rgba(15,23,42,.02);
}
.table td{
  padding: 12px;
  border-bottom:1px solid var(--border);
  vertical-align: top;
}
.table tr:hover td{ background: rgba(15,23,42,.02); }
.table .nowrap{ white-space:nowrap; }

/* Responsive table -> cards */
@media (max-width: 720px){
  .table thead{ display:none; }
  .table, .table tbody, .table tr, .table td{ display:block; width:100%; }
  .table tr{
    border:1px solid var(--border);
    border-radius: var(--radius);
    overflow:hidden;
    margin-bottom:12px;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
  }
  .table td{
    border-bottom:1px solid var(--border);
    display:flex;
    justify-content:space-between;
    gap:12px;
  }
  .table td:last-child{ border-bottom:0; }
  .table td::before{
    content: attr(data-label);
    font-weight:1000;
    color: var(--muted);
    font-size:12px;
  }
}

/* Status pills */
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.10);
  font-size:12px;
  font-weight:1000;
  background: rgba(255,255,255,.8);
}
.pill.ok{ border-color: rgba(34,197,94,.25); background: rgba(34,197,94,.10); color: #0a7a2e; }
.pill.warn{ border-color: rgba(245,158,11,.25); background: rgba(245,158,11,.12); color: #8a5a00; }
.pill.danger{ border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.12); color: #a10f0f; }
.pill.info{ border-color: rgba(59,130,246,.25); background: rgba(59,130,246,.12); color: #124b9a; }
.dot{
  width:8px;height:8px;border-radius:50%;
  background: currentColor;
  opacity:.9;
}

/* Toast */
.toast-wrap{
  position:fixed;
  right:16px;
  bottom:16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:100;
}
.toast{
  width:min(360px, calc(100vw - 32px));
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.toast b{ display:block; font-size:13px; margin-bottom:4px; }
.toast span{ color: var(--muted); font-size:12px; }

/* Modal (simple) */
.modal-overlay{
  position:fixed;
  inset:0;
  background: rgba(15,23,42,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index:120;
}
.modal-overlay.show{ display:flex; }
.modal{
  width:min(520px, 100%);
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.modal h3{ margin: 0 0 8px; font-size:16px; }
.modal p{ margin: 0 0 14px; color: var(--muted); }
.modal .actions{ display:flex; gap:10px; justify-content:flex-end; }

/* Mobile tabbar */
.mobile-tabbar{
  display:none;
}
@media (max-width: 980px){
  .mobile-tabbar{
    position:fixed;
    left:0; right:0; bottom:0;
    height:72px;
    background: rgba(255,255,255,.92);
    backdrop-filter:saturate(180%) blur(10px);
    border-top: 1px solid var(--border);
    display:flex;
    justify-content:space-around;
    align-items:center;
    z-index:40;
  }
  .mobile-tabbar a{
    width:25%;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:6px;
    font-size:11px;
    color: var(--muted);
    font-weight:900;
  }
  .mobile-tabbar a svg{ width:20px; height:20px; }
  .mobile-tabbar a.active{ color: #b31234; }
}

/* ---------- Storefront (public) ---------- */
.store{
  background: var(--bg);
  min-height: 100vh;
}
.store .wrap{ width:min(980px, calc(100% - 28px)); margin:0 auto; padding: 16px 0 96px; }
.store-hero{
  border-radius: 22px;
  overflow:hidden;
  border:1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: radial-gradient(120% 120% at 0% 0%, rgba(244,63,94,.18) 0%, rgba(249,115,22,.12) 60%, rgba(255,255,255,.7) 100%);
}
.store-hero .bar{
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background: rgba(255,255,255,.75);
  border-bottom:1px solid var(--border);
}
.store-hero .title{
  font-weight:1100;
  letter-spacing:-.03em;
  font-size:18px;
}
.store-hero .subtitle{ color: var(--muted); font-size:12px; margin-top:2px; }
.store-hero .actions{ display:flex; gap:10px; align-items:center; }
.store-search{ margin-top: 12px; }
.pills{
  display:flex;
  gap:10px;
  overflow:auto;
  padding: 12px 0 2px;
  -webkit-overflow-scrolling: touch;
}
.pills a{
  flex:0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  border:1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.85);
  font-size:12px;
  font-weight:1000;
  color: var(--muted);
}
.pills a.active{
  border-color: rgba(244,63,94,.25);
  background: rgba(244,63,94,.10);
  color: #b31234;
}

.menu-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 620px){ .menu-grid{ grid-template-columns: 1fr; } }

.item-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow:hidden;
  box-shadow: var(--shadow-sm);
  display:flex;
  gap:12px;
  padding: 12px;
}
.item-thumb{
  width:84px;height:84px;
  border-radius: 16px;
  background: rgba(15,23,42,.05);
  overflow:hidden;
  flex:0 0 auto;
}
.item-thumb img{ width:100%; height:100%; object-fit:cover; }
.item-body{ min-width:0; flex:1; }
.item-name{
  font-weight:1100;
  letter-spacing:-.02em;
}
.item-desc{
  margin-top:4px;
  color: var(--muted);
  font-size:12px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}
.item-row{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.item-price{ font-weight:1100; color:#b31234; }

.cartbar{
  position:fixed;
  left:0; right:0; bottom:0;
  padding: 12px 14px;
  background: rgba(255,255,255,.92);
  border-top: 1px solid var(--border);
  backdrop-filter:saturate(180%) blur(10px);
  z-index: 45;
}
.cartbar .inner{
  width:min(980px, calc(100% - 28px));
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.cartbar .summary{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.cartbar .bubble{
  width:34px;height:34px;
  border-radius: 12px;
  background: rgba(244,63,94,.12);
  color:#b31234;
  display:grid;
  place-items:center;
  font-weight:1100;
}
.cartbar .sumtext{ min-width:0; }
.cartbar .sumtext b{ display:block; }
.cartbar .sumtext span{ display:block; font-size:12px; color: var(--muted); }

/* KDS can opt-in to dark */
.theme-dark{ background:#0b1220; color:#e5e7eb; }
