/* =============================================================
   Fresco F&B v2 — Stylesheet  ·  "Atelier" premium theme
   Ink sidebar · indigo→violet accent · warm paper canvas.
   Class names preserved from v1 — no JS changes required.
   ============================================================= */

:root {
    /* Brand / chrome */
    --ink:     #0c0f1d;      /* deepest sidebar */
    --ink-2:   #141833;      /* sidebar mid */
    --ink-3:   #1d2344;
    --navy:    #0c0f1d;      /* legacy alias */
    --navy2:   #4f46e5;      /* primary start */
    --navy3:   #6366f1;      /* primary / links */
    --accent:  #a5b4fc;      /* highlight (periwinkle) */
    --violet:  #7c3aed;
    --teal:    #0d9488;

    /* Surfaces */
    --bg:        #f4f5fa;
    --bg-2:      #eef0f8;
    --card:      #ffffff;
    --line:      #e9ecf5;
    --line-2:    #d7dcea;
    --text:      #14172b;
    --text-2:    #3b4066;
    --muted:     #6b7192;
    --muted-2:   #9aa0bd;

    /* Semantic (kept close to v1 so inline colors harmonise) */
    --ok:    #15a05a;
    --ok-bg: #e8f8ef;
    --warn:  #d97706;
    --warn-bg:#fef4e6;
    --bad:   #e11d48;
    --bad-bg:#fdeaef;
    --info:  #2563eb;
    --info-bg:#eaf1fe;

    /* Radius */
    --r-sm: 8px;
    --r:    12px;
    --r-lg: 16px;
    --r-xl: 22px;

    /* Elevation — layered, soft, premium */
    --shadow-sm: 0 1px 2px rgba(17,20,45,.05), 0 1px 1px rgba(17,20,45,.03);
    --shadow:    0 6px 20px -6px rgba(17,20,45,.14), 0 2px 6px -2px rgba(17,20,45,.08);
    --shadow-lg: 0 32px 64px -16px rgba(12,15,29,.32), 0 8px 24px -8px rgba(12,15,29,.20);
    --ring:      0 0 0 3.5px rgba(99,102,241,.18);

    --t: 220ms cubic-bezier(.4,.14,.3,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: 'Outfit', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(1200px 700px at 100% -10%, #eceafd 0%, transparent 55%),
        radial-gradient(900px 600px at -10% 110%, #e6f6f2 0%, transparent 50%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--navy3); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--violet); text-decoration: none; }
::selection { background: rgba(99,102,241,.22); }

/* Custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: padding-box; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background:
        radial-gradient(1000px 700px at 20% 10%, #2a2270 0%, transparent 55%),
        radial-gradient(900px 700px at 90% 90%, #0f766e 0%, transparent 50%),
        linear-gradient(160deg, #12132a 0%, #0a0b18 100%);
    position: relative; overflow: hidden;
}
.login-wrap::before {
    content: ''; position: absolute; inset: -40%;
    background: conic-gradient(from 0deg, transparent, rgba(124,58,237,.10), transparent 40%);
    animation: spin 22s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-card {
    position: relative; width: 400px; max-width: 100%;
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(255,255,255,.6);
    border-radius: var(--r-xl); padding: 40px 34px;
    box-shadow: var(--shadow-lg);
    animation: rise .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .brand {
    font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 34px; letter-spacing: -.5px;
    background: linear-gradient(120deg, #4f46e5, #7c3aed 60%, #0d9488);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-logo .sub { color: var(--muted); font-size: 13px; margin-top: 4px; letter-spacing: .2px; }

/* ── SHELL ─────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
    background: linear-gradient(185deg, var(--ink) 0%, var(--ink-2) 100%);
    color: #b8bee0; padding: 16px 12px 12px; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow: hidden;
    border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar::after { /* subtle top glow */
    content: ''; position: absolute; top: -120px; left: -40px; width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(124,58,237,.22), transparent 70%); pointer-events: none;
}
.sidebar .brand {
    font-family: 'Fraunces', Georgia, serif; font-size: 25px; font-weight: 600; color: #fff;
    letter-spacing: -.3px; padding: 6px 12px 16px; position: relative;
}
.sidebar .brand .dot { color: var(--accent); }
.sidebar nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px; margin: 0 -2px; }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 10px; cursor: pointer;
    color: #aab0d4; transition: color var(--t), background var(--t);
    font-size: 13.5px; font-weight: 500; user-select: none; margin-bottom: 2px;
}
.nav-item .icon { width: 20px; text-align: center; font-size: 15px; opacity: .7; transition: opacity var(--t), transform var(--t); }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item:hover .icon { opacity: 1; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(99,102,241,.30), rgba(124,58,237,.14));
    color: #fff; box-shadow: inset 0 0 0 1px rgba(165,180,252,.18);
}
.nav-item.active .icon { opacity: 1; transform: scale(1.05); }
.nav-item.active::before {
    content: ''; position: absolute; left: -2px; top: 18%; bottom: 18%; width: 3px;
    border-radius: 99px; background: linear-gradient(var(--accent), var(--violet));
    box-shadow: 0 0 12px rgba(165,180,252,.7);
}
.sidebar .user-box {
    border-top: 1px solid rgba(255,255,255,.08); padding: 14px 10px 4px;
    color: #aab0d4; font-size: 13px;
}
.sidebar .user-box .name { color: #fff; font-weight: 600; }
.sidebar .user-box .role {
    color: var(--accent); font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 600;
}
.sidebar .user-box button {
    margin-top: 10px; width: 100%; background: rgba(255,255,255,.04); color: #cdd2ee;
    border: 1px solid rgba(255,255,255,.12); padding: 8px; border-radius: 9px;
    cursor: pointer; font-size: 12px; font-weight: 500; transition: all var(--t);
}
.sidebar .user-box button:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }

.main { padding: 26px 30px 72px; max-width: 1560px; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-head h1 {
    margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 27px; font-weight: 600; letter-spacing: -.4px;
    color: var(--text);
}
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 18px;
    box-shadow: var(--shadow-sm); transition: box-shadow var(--t), transform var(--t);
}
.card + .card { margin-top: 16px; }
.card-title {
    font-weight: 600; font-size: 15px; margin-bottom: 12px; color: var(--text);
    letter-spacing: -.2px; display: flex; align-items: center; gap: 8px;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
    position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 16px 18px; box-shadow: var(--shadow-sm);
    transition: transform var(--t), box-shadow var(--t); overflow: hidden;
}
.stat::before { /* accent top edge */
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--navy2), var(--violet)); opacity: .9;
}
.stat.green::before { background: linear-gradient(90deg, #15a05a, #34d399); }
.stat.red::before   { background: linear-gradient(90deg, #e11d48, #fb7185); }
.stat.amber::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.stat.teal::before  { background: linear-gradient(90deg, #0d9488, #2dd4bf); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat .value {
    font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: -.6px;
    font-variant-numeric: tabular-nums; color: var(--text);
}
.stat .hint { margin-top: 2px; }
.stat.green .value { color: var(--ok); }
.stat.blue  .value { color: var(--navy3); }
.stat.red   .value { color: var(--bad); }
.stat.amber .value { color: var(--warn); }
.stat.teal  .value { color: var(--teal); }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--line-2); font-weight: 600; font-size: 13px;
    transition: all var(--t); user-select: none; white-space: nowrap;
    background: #fff; color: var(--text-2);
    box-shadow: var(--shadow-sm);
}
.btn:hover { background: #fbfbfe; border-color: var(--muted-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-primary {
    background: linear-gradient(135deg, var(--navy2) 0%, var(--violet) 100%);
    color: #fff; border: 0; box-shadow: 0 4px 14px -3px rgba(99,102,241,.5), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 8px 22px -4px rgba(99,102,241,.55), inset 0 1px 0 rgba(255,255,255,.22); }
.btn-success {
    background: linear-gradient(135deg, #0f9d58 0%, #15a05a 100%); color: #fff; border: 0;
    box-shadow: 0 4px 14px -3px rgba(21,160,90,.45), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-success:hover { filter: brightness(1.06); }
.btn-danger { background: var(--bad); color: #fff; border: 0; box-shadow: 0 4px 14px -3px rgba(225,29,72,.4); }
.btn-danger:hover { background: #be123c; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--navy3); padding: 7px 9px; box-shadow: none; }
.btn-ghost:hover { background: rgba(99,102,241,.08); box-shadow: none; transform: none; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

/* Compact row-action buttons */
.btn-action { padding: 5px 10px; font-size: 12px; font-weight: 600; line-height: 1.4; border: 1px solid var(--line-2); border-radius: 8px; box-shadow: none; }
.btn-action:hover { transform: none; }
.btn-action + .btn-action { margin-left: 5px; }
.actions { white-space: nowrap; }
.act-view     { color: var(--text-2); }
.act-edit     { color: #4338ca; border-color: #c7d2fe; background: #eef2ff; }
.act-edit:hover { background: #e0e7ff; }
.act-print    { color: #0f7a43; border-color: #a7f3d0; background: #ecfdf5; }
.act-print:hover { background: #d1fae5; }
.act-whatsapp { color: #fff; background: #25d366; border-color: #25d366; }
.act-whatsapp:hover { background: #1ebe57; }
.act-delete   { color: #fff; background: var(--bad); border-color: var(--bad); }
.act-delete:hover { background: #be123c; }

/* ── INPUTS ────────────────────────────────────────────────── */
.input, .select, .textarea {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--line-2); border-radius: 10px;
    background: #fff; transition: border-color var(--t), box-shadow var(--t), background var(--t);
    color: var(--text);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.select { cursor: pointer; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--navy3); box-shadow: var(--ring); background: #fff;
}
.textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; color: var(--text-2); font-weight: 600; letter-spacing: .1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ── TABLES ────────────────────────────────────────────────── */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.table thead th {
    background: #fafbff; font-weight: 600; color: var(--muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: .5px; position: sticky; top: 0;
}
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: #f7f8ff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { white-space: nowrap; text-align: right; }
.table th.num, .table td.num { white-space: nowrap; }
.empty { text-align: center; padding: 48px; color: var(--muted); }

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px;
    font-size: 11px; font-weight: 700; letter-spacing: .2px; line-height: 1.5;
    background: #eef0f8; color: var(--text-2);
}
.badge.walkin  { background: #fef4e6; color: #b45309; }
.badge.shop    { background: #eaf1fe; color: #1d4ed8; }
.badge.dealer  { background: #e8f8ef; color: #0f7a43; }
.badge.role-Admin   { background: linear-gradient(135deg,#4f46e5,#7c3aed); color: #fff; }
.badge.role-Manager { background: #eef2ff; color: #4338ca; }
.badge.role-Staff   { background: #eef0f8; color: #3b4066; }
.badge.made   { background: #eef2ff; color: #4338ca; }
.badge.trade  { background: #fdeaef; color: #be123c; }
.badge.kit    { background: #f3e8ff; color: #7c3aed; }
.badge.low    { background: var(--bad); color: #fff; }
.badge.zero   { background: var(--warn); color: #fff; }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(12,15,29,.5);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 100;
    display: grid; place-items: center; padding: 20px; animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff; border-radius: var(--r-xl); max-width: 720px; width: 100%;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.7);
    animation: rise .28s cubic-bezier(.2,.8,.2,1);
}
.modal.lg { max-width: 980px; }
.modal.sm { max-width: 480px; }
.modal-head {
    padding: 18px 22px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.modal-close {
    background: transparent; border: 0; font-size: 22px; cursor: pointer;
    color: var(--muted); padding: 2px 10px; border-radius: 8px; line-height: 1; transition: all var(--t);
}
.modal-close:hover { background: var(--bg-2); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-foot {
    padding: 16px 22px; border-top: 1px solid var(--line);
    display: flex; justify-content: flex-end; gap: 10px;
    background: #fafbff; border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ── TOAST ─────────────────────────────────────────────────── */
.toast-stack { position: fixed; top: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    padding: 12px 18px 12px 16px; border-radius: 12px; color: #fff; font-size: 13.5px; font-weight: 500;
    box-shadow: var(--shadow-lg); min-width: 250px; position: relative; overflow: hidden;
    background: #1f2440; animation: slideIn .25s cubic-bezier(.2,.8,.2,1);
    border: 1px solid rgba(255,255,255,.08);
}
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: currentColor; opacity: .9; }
.toast.ok   { color: #fff; background: linear-gradient(135deg,#0f9d58,#15a05a); }
.toast.err  { color: #fff; background: linear-gradient(135deg,#e11d48,#be123c); }
.toast.info { color: #fff; background: linear-gradient(135deg,#4f46e5,#6366f1); }
@keyframes slideIn { from { transform: translateX(28px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── TOOLBAR ───────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar > .input, .toolbar > .select { padding: 9px 13px; width: auto; min-width: 150px; flex: 0 0 auto; }
.toolbar > input[type="date"] { min-width: 155px; }

/* ── ALERTS ────────────────────────────────────────────────── */
.alert {
    border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px 13px 16px;
    background: #fff; margin-bottom: 16px; font-size: 13.5px; line-height: 1.5;
    display: flex; align-items: flex-start; gap: 10px; position: relative;
    box-shadow: var(--shadow-sm);
}
.alert::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 99px; background: var(--muted-2); }
.alert.ok    { border-color: #b9ecce; background: var(--ok-bg);  color: #0f6b3c; }
.alert.ok::before    { background: var(--ok); }
.alert.warn  { border-color: #fde3b8; background: var(--warn-bg); color: #92400e; }
.alert.warn::before  { background: var(--warn); }
.alert.error { border-color: #f8c6d2; background: var(--bad-bg); color: #a3123a; }
.alert.error::before { background: var(--bad); }
.alert.info  { border-color: #c3d8fc; background: var(--info-bg); color: #1e40af; }
.alert.info::before  { background: var(--info); }

/* ── GRID UTILS ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: column; }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .nav-item { padding: 7px 11px; font-size: 13px; }
    .main { padding: 18px 16px 60px; }
}

/* ── SALES POS ─────────────────────────────────────────────── */
.sale-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
@media (max-width: 1100px) { .sale-grid { grid-template-columns: 1fr; } }
.sale-lines table input { padding: 7px 9px; }
.held-bills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.held-bill {
    background: linear-gradient(135deg, #eef2ff, #f3e8ff); color: #4338ca; padding: 7px 13px; border-radius: 99px;
    cursor: pointer; font-size: 12.5px; font-weight: 600; border: 1px solid #ddd6fe;
    display: flex; align-items: center; gap: 6px; transition: all var(--t);
}
.held-bill:hover { background: linear-gradient(135deg,#6366f1,#7c3aed); color: #fff; border-color: transparent; }
.held-bill .x { opacity: .7; }

/* ── PAGINATION ────────────────────────────────────────────── */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding-top: 14px; }
.pager button { background: #fff; border: 1px solid var(--line-2); padding: 6px 11px; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 500; transition: all var(--t); }
.pager button:hover:not(:disabled) { border-color: var(--navy3); color: var(--navy3); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .page-info { color: var(--muted); font-size: 12.5px; margin: 0 8px; }

/* ── PRINT ─────────────────────────────────────────────────── */
@media print {
    body { background: #fff; }
    .sidebar, .page-head, .toolbar, .btn, .pager { display: none !important; }
    .main { padding: 0; max-width: none; }
    .shell { grid-template-columns: 1fr; }
    .table-wrap, .card, .stat { box-shadow: none; border: 1px solid #e5e7eb; }
    .stat::before, .alert::before { display: none; }
}

/* ── MISC ──────────────────────────────────────────────────── */
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.dim  { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.row-gap { display: flex; gap: 8px; align-items: center; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
