/* =====================================================================
   Mobiluc SaaS — Design System
   Mobile-first, responsive, dark/light via [data-theme]
   ===================================================================== */

:root {
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --brand-900: #172554;
  --brand-soft: #dbeafe;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f2;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0891b2;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.12);
  --shadow-lg: 0 12px 40px -12px rgba(15,23,42,.25);
  --sidebar-w: 250px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #131c31;
  --surface-2: #0f1728;
  --border: #24304b;
  --text: #e8edf7;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --brand-soft: #1e293b;
  --success-soft: #14321f;
  --warning-soft: #3a2a0c;
  --danger-soft: #3a1616;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { line-height: 1.2; color: var(--text); font-weight: 700; }
small { color: var(--text-muted); }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .15s; text-decoration: none; white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: var(--brand-600); text-decoration: none; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-light { background: #fff; color: var(--brand-700); }
.btn-light:hover { background: #f1f5f9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- Cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-header h3 { font-size: 16px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-row-3 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr 1fr; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
label .req { color: var(--danger); }
.input, input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 14px; font-family: inherit; transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { min-height: 92px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.input-group { display: flex; gap: 10px; align-items: center; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 700; background: var(--surface-2); white-space: nowrap;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Pills / badges ---- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
}
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge { background: var(--brand-soft); color: var(--brand-700); padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }

/* ---- Flash ---- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.flash-info { background: var(--brand-soft); color: var(--brand-700); border-color: transparent; }
.flash-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }

/* =====================================================================
   App shell (dashboard)
   ===================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .25s;
}
.sidebar.open { transform: translateX(0); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.sidebar-brand img { width: 34px; height: 34px; border-radius: 8px; }
.sidebar-brand span { font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 30px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); margin: 16px 12px 6px; font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 14px; margin-bottom: 2px;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.main { flex: 1; margin-left: 0; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 18px; position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.content { padding: 20px 18px 90px; flex: 1; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-muted); font-size: 14px; }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 64px; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; z-index: 45; padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-soft); font-size: 10.5px; font-weight: 600; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav svg { width: 21px; height: 21px; }

.backdrop { position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 49; display: none; }
.backdrop.show { display: block; }

/* ---- Stat cards ---- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stat .stat-icon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; background: var(--brand-soft); color: var(--brand); }
.stat .stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.stat .stat-value { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .stat-sub { font-size: 12px; margin-top: 4px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3,1fr); }

/* empty state */
.empty { text-align: center; padding: 46px 20px; color: var(--text-muted); }
.empty svg { width: 46px; height: 46px; opacity: .35; margin-bottom: 10px; }

/* toolbar / filters */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 150px; }

/* invoice line item builder */
.line-table { width: 100%; border-collapse: collapse; }
.line-table th, .line-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 13px; }
.line-table input, .line-table select { padding: 8px; }
.totals-box { max-width: 320px; margin-left: auto; }
.totals-box .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals-box .row.total { border-top: 2px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 800; font-size: 17px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* =====================================================================
   Public / marketing
   ===================================================================== */
.public-nav {
  position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border);
}
.public-nav .inner { display: flex; align-items: center; gap: 20px; height: 66px; }
.public-nav .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--text); }
.public-nav .logo img { width: 36px; height: 36px; border-radius: 8px; }
.public-nav .links { display: none; gap: 6px; margin-left: 12px; }
.public-nav .links a { padding: 8px 12px; border-radius: 8px; color: var(--text-muted); font-weight: 500; font-size: 14px; }
.public-nav .links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.public-nav .spacer { flex: 1; }

.hero { padding: 48px 0 40px; position: relative; overflow: hidden; }
.hero-grid { display: grid; gap: 34px; align-items: center; }
.hero h1 { font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
.hero p.lead { font-size: 17px; color: var(--text-muted); margin-top: 16px; }
.hero .cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-img { border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; background: var(--brand-soft); color: var(--brand-700); padding: 6px 14px; border-radius: 30px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }

.section { padding: 46px 0; }
.section-title { text-align: center; max-width: 640px; margin: 0 auto 34px; }
.section-title h2 { font-size: 27px; letter-spacing: -.02em; }
.section-title p { color: var(--text-muted); margin-top: 10px; font-size: 16px; }

.feature-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature .fi { width: 44px; height: 44px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.feature h3 { font-size: 16px; margin-bottom: 6px; }
.feature p { color: var(--text-muted); font-size: 14px; }

.pricing-grid { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: stretch; }
.price-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; }
.price-card.popular { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); position: relative; }
.price-card .tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 14px; border-radius: 20px; }
.price-card h3 { font-size: 19px; }
.price-card .price { font-size: 34px; font-weight: 800; margin: 12px 0 2px; letter-spacing: -.02em; }
.price-card .price small { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.price-card ul { list-style: none; margin: 18px 0; display: flex; flex-direction: column; gap: 9px; }
.price-card li { display: flex; gap: 9px; font-size: 14px; color: var(--text); align-items: flex-start; }
.price-card li svg { color: var(--success); flex-shrink: 0; margin-top: 2px; }
.price-card .btn { margin-top: auto; }

.footer { background: var(--surface); border-top: 1px solid var(--border); padding: 40px 0 24px; margin-top: 40px; }
.footer-grid { display: grid; gap: 26px; grid-template-columns: 1fr; }
.footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); margin-bottom: 12px; }
.footer a { display: block; color: var(--text-muted); font-size: 14px; padding: 4px 0; }
.footer a:hover { color: var(--brand); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 26px; padding-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--text-muted); font-size: 13px; }

.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-side { display: none; background: linear-gradient(160deg, var(--brand-700), var(--brand-900)); color: #fff; padding: 46px; flex-direction: column; justify-content: center; }
.auth-side h2 { color: #fff; font-size: 28px; }
.auth-side ul { list-style: none; margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-side li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.9); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 30px 18px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; font-weight: 800; font-size: 22px; }
.auth-card .logo img { width: 40px; height: 40px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-soft); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content:''; flex:1; height:1px; background: var(--border); }

.legal { max-width: 820px; margin: 0 auto; padding: 30px 0; }
.legal h1 { font-size: 30px; margin-bottom: 8px; }
.legal h2 { font-size: 20px; margin: 28px 0 10px; }
.legal p, .legal li { color: var(--text); margin-bottom: 10px; }
.legal ul { padding-left: 22px; margin-bottom: 12px; }

/* invoice print */
.invoice-sheet { background:#fff; color:#0f172a; max-width: 820px; margin: 0 auto; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.invoice-head { display:flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid #e5e9f2; padding-bottom: 20px; margin-bottom: 20px; }

/* =====================================================================
   Dashboard charts & rich components
   ===================================================================== */
/* KPI accent variants */
.stat.k-blue   { border-top: 3px solid var(--brand); }
.stat.k-green  { border-top: 3px solid var(--success); }
.stat.k-red    { border-top: 3px solid var(--danger); }
.stat.k-amber  { border-top: 3px solid var(--warning); }
.stat.k-purple { border-top: 3px solid #7c3aed; }
.stat.k-cyan   { border-top: 3px solid #0891b2; }
.stat .stat-trend { font-size: 12px; font-weight: 600; margin-top: 4px; }
.stat .up { color: var(--success); }
.stat .down { color: var(--danger); }

/* Grouped bar chart */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.chart-bars .grp { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.chart-bars .bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; width: 100%; justify-content: center; }
.chart-bars .bar { width: 30%; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 3px; transition: .3s; }
.chart-bars .bar.s { background: var(--brand); }
.chart-bars .bar.p { background: var(--success); }
.chart-bars .bar.e { background: var(--danger); opacity: .8; }
.chart-bars .lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* 7-day mini bars */
.spark { display: flex; align-items: flex-end; gap: 8px; height: 130px; }
.spark .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.spark .b { width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 4px; }

/* Donut (conic-gradient) */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0; position: relative; }
.donut::after { content: ''; position: absolute; inset: 26px; background: var(--surface); border-radius: 50%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.donut-center .v { font-size: 18px; font-weight: 800; }
.donut-center .l { font-size: 11px; color: var(--text-muted); }
.legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 160px; }
.legend .row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend .row i { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend .row .nm { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .row .vl { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ROI ring (SVG) */
.roi-ring { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.roi-ring svg { transform: rotate(-90deg); flex-shrink: 0; }
.roi-ring .ring-center { position: relative; width: 130px; height: 130px; }
.roi-ring .ring-center .lbl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.roi-ring .ring-center .lbl .v { font-size: 22px; font-weight: 800; }
.roi-ring .ring-center .lbl .s { font-size: 11px; color: var(--text-muted); }

/* progress */
.progress { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; border-radius: 6px; background: var(--brand); }
.mini-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.mini-row:last-child { border-bottom: none; }

/* =====================================================================
   Modal
   ===================================================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(2,6,23,.55); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 18px; backdrop-filter: blur(3px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 14px 18px; overflow-y: auto; }
.held-item { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.held-item .info { flex: 1; min-width: 0; }
.held-item .info .t { font-weight: 700; font-size: 14px; }
.held-item .info .s { font-size: 12px; color: var(--text-muted); }

/* =====================================================================
   Point of Sale (POS)
   ===================================================================== */
.pos-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; }
.pos-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pos-toolbar .grow { flex: 1; min-width: 160px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pos-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 10px; cursor: pointer; transition: .15s; text-align: left; user-select: none;
  display: flex; flex-direction: column; gap: 4px; min-height: 92px;
}
.pos-tile:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.pos-tile:active { transform: translateY(0); }
.pos-tile.oos { opacity: .45; pointer-events: none; }
.pos-tile .nm { font-size: 13px; font-weight: 600; line-height: 1.25; }
.pos-tile .mt { font-size: 11px; color: var(--text-muted); }
.pos-tile .pr { font-size: 14px; font-weight: 800; color: var(--brand); margin-top: auto; font-variant-numeric: tabular-nums; }
.pos-tile .st { font-size: 11px; font-weight: 600; }

.pos-cart { position: sticky; top: 78px; display: flex; flex-direction: column; max-height: calc(100vh - 130px); }
.pos-cart .cart-body { flex: 1; overflow-y: auto; padding: 6px; min-height: 120px; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 6px; }
.cart-line .nm { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-line .un { font-size: 11px; color: var(--text-muted); }
.qty { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.qty button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px; font-weight: 700; line-height: 1; }
.qty button:hover { border-color: var(--brand); color: var(--brand); }
.qty .q { width: 30px; text-align: center; font-weight: 700; font-size: 13px; }
.cart-line .lt { font-weight: 700; font-size: 13px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.cart-line .rm { border: none; background: none; color: var(--text-soft); cursor: pointer; font-size: 15px; flex-shrink: 0; }
.cart-line .rm:hover { color: var(--danger); }
.pos-foot { border-top: 1px solid var(--border); padding: 14px; }
.pos-foot .r { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 8px; }
.pos-foot .r.big { font-size: 20px; font-weight: 800; }
.pos-foot .r input, .pos-foot .r select { width: 120px; padding: 6px 8px; text-align: right; }
.pos-foot .r select { text-align: left; }
.change-pos { color: var(--success); font-weight: 700; }

@media (min-width: 900px) {
  .pos-wrap { grid-template-columns: 1fr 360px; align-items: start; }
}

/* =====================================================================
   Elegance refinements (layered on top)
   ===================================================================== */
body { background-image: radial-gradient(1200px 600px at 100% -10%, rgba(37,99,235,.06), transparent 60%); background-attachment: fixed; }
[data-theme="dark"] body { background-image: radial-gradient(1200px 600px at 100% -10%, rgba(37,99,235,.12), transparent 60%); }

.card { transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.stat { transition: box-shadow .2s ease, transform .2s ease; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
a.feature:hover, .feature[href]:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow-lg); }

.btn-primary, .btn:not(.btn-outline):not(.btn-ghost):not(.btn-light) { box-shadow: 0 6px 16px -8px rgba(37,99,235,.6); }
.btn:active { transform: translateY(1px); }

.topbar { backdrop-filter: saturate(1.2) blur(8px); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.public-nav { backdrop-filter: saturate(1.2) blur(8px); background: color-mix(in srgb, var(--surface) 90%, transparent); }

.nav-link.active { background: linear-gradient(135deg, var(--brand), var(--brand-700)); box-shadow: 0 6px 16px -8px rgba(37,99,235,.7); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.stat-value { letter-spacing: -.03em; }
.page-head h1 { letter-spacing: -.02em; }

.hero::before { content:''; position:absolute; top:-120px; right:-140px; width:420px; height:420px; border-radius:50%;
  background: radial-gradient(circle, rgba(37,99,235,.16), transparent 70%); pointer-events:none; }
[data-theme="dark"] .hero::before { background: radial-gradient(circle, rgba(37,99,235,.28), transparent 70%); }

/* Smooth theme transitions */
body, .card, .sidebar, .topbar, .stat, .btn, input, select, textarea { transition-property: background-color, border-color, color, box-shadow; transition-duration: .18s; }

/* ---- Responsive ---- */
@media (min-width: 620px) and (max-width: 999px) {
  /* Tablet: roomier stat grids */
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .content { padding: 22px 22px 90px; }
}
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  /* Stack all form fields vertically & in sequence on phones */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .chart-bars { gap: 5px; }
  .chart-bars .bar { max-width: 14px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head > div:last-child { width: 100%; }
  .page-head .btn { flex: 1; }
  .toolbar { gap: 8px; }
  .toolbar .btn, .toolbar select, .toolbar input { width: 100%; }
  .tabs { flex-wrap: nowrap; }
  .card-body { padding: 16px; }
  .content { padding: 16px 14px 88px; }
  table.table th, table.table td { padding: 10px 10px; }
  h1 { font-size: 20px; }
  .modal { max-width: 100%; }
  .totals-box { max-width: 100%; }
}
@media (min-width: 700px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .public-nav .links { display: flex; }
  .hero h1 { font-size: 44px; }
  .pricing-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.05fr .95fr; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .auth-wrap { grid-template-columns: 1fr 1fr; }
  .auth-side { display: flex; }
}
@media (min-width: 1000px) {
  .sidebar { transform: translateX(0); }
  .main { margin-left: var(--sidebar-w); }
  .bottom-nav { display: none; }
  .content { padding: 24px 26px 40px; }
  .menu-toggle { display: none; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
  .content { padding: 0 !important; }
}
