/* SweetPOS — application styles. Palette: ink navy + saffron on a cool grey surface. */
:root {
  --ink: #1B2A41;
  --ink-2: #26395A;
  --ink-soft: #3E4C63;
  --saffron: #F2A93B;
  --saffron-deep: #D98F1C;
  --saffron-soft: #FDF1DC;
  --surface: #F4F6F9;
  --card: #FFFFFF;
  --line: #E3E8EF;
  --muted: #6B7A90;
  --text: #1F2937;
  --green: #2E8B57;
  --green-soft: #E4F3EA;
  --red: #C0392B;
  --red-soft: #FBE5E2;
  --amber-soft: #FFF4DC;
  --blue: #2B6CB0;
  --blue-soft: #E3EEFA;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--muted) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-7 { font-size: .85rem; }
.fs-8 { font-size: .78rem; }
.cursor-pointer { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(242,169,59,.55); outline-offset: 1px; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--ink); color: #fff; position: fixed; inset: 0 auto 0 0; z-index: 1040;
  display: flex; flex-direction: column; transition: transform .22s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .mark { width: 38px; height: 38px; border-radius: 10px; background: var(--saffron); color: var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; flex: none; }
.sidebar-brand .name { font-weight: 800; font-size: 1rem; line-height: 1.1; }
.sidebar-brand .sub { font-size: .72rem; opacity: .65; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px; }
.sidebar-nav .nav-group { font-size: .7rem; letter-spacing: .04em; color: rgba(255,255,255,.45); padding: 14px 10px 6px; font-weight: 700; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: rgba(255,255,255,.82); font-weight: 600; font-size: .92rem;
}
.sidebar-nav a i { width: 20px; text-align: center; font-size: 1.05rem; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--saffron); color: var(--ink); }
.sidebar-nav a.active i { opacity: 1; }
.sidebar-user { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.sidebar-user .role { color: rgba(255,255,255,.55); font-size: .75rem; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(27,42,65,.55); z-index: 1035; display: none; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 1020;
}
.topbar .page-title { font-weight: 800; font-size: 1.15rem; color: var(--ink); margin: 0; }
.topbar .btn-burger { display: none; }
.content { padding: 22px; flex: 1; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 1.35rem; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }

/* ---------- Cards, stats ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--ink); padding: 14px 18px; }
.card-body { padding: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; height: 100%; display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat .hint { font-size: .78rem; color: var(--muted); }
.stat.stat-accent { background: var(--ink); border-color: var(--ink); }
.stat.stat-accent .label, .stat.stat-accent .hint { color: rgba(255,255,255,.7); }
.stat.stat-accent .value { color: var(--saffron); }
.stat .ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 1rem; background: var(--surface); color: var(--ink-soft); }

.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); font-weight: 700; font-size: .9rem; min-height: 96px; text-align: center;
}
.quick-action i { font-size: 1.5rem; color: var(--ink-soft); }
.quick-action:hover { border-color: var(--saffron); text-decoration: none; background: var(--saffron-soft); }
.quick-action.primary { background: var(--saffron); border-color: var(--saffron); }
.quick-action.primary i { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn { font-weight: 700; border-radius: 8px; padding: .5rem .95rem; font-size: .92rem; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-lg { padding: .7rem 1.2rem; font-size: 1.02rem; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.btn-accent { background: var(--saffron); border-color: var(--saffron); color: var(--ink); }
.btn-accent:hover, .btn-accent:focus { background: var(--saffron-deep); border-color: var(--saffron-deep); color: var(--ink); }
.btn-outline-primary { color: var(--ink); border-color: var(--line); background: var(--card); }
.btn-outline-primary:hover { background: var(--surface); color: var(--ink); border-color: var(--ink-soft); }
.btn-light { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-outline-danger { color: var(--red); border-color: #F1C7C2; }
.btn-outline-danger:hover { background: var(--red); border-color: var(--red); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .85rem; color: var(--ink-soft); margin-bottom: 4px; }
.form-control, .form-select { border-color: var(--line); border-radius: 8px; padding: .5rem .75rem; font-size: .92rem; min-height: 40px; }
.form-control:focus, .form-select:focus { border-color: var(--saffron); box-shadow: 0 0 0 .2rem rgba(242,169,59,.25); }
.form-control-lg { min-height: 48px; font-size: 1.05rem; }
.input-group-text { background: var(--surface); border-color: var(--line); color: var(--muted); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-switch .form-check-input:checked { background-color: var(--green); border-color: var(--green); }
.form-text { color: var(--muted); font-size: .78rem; }
.required::after { content: " *"; color: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-wrap .table { margin: 0; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.table thead th { background: var(--surface); color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .02em; border-bottom: 1px solid var(--line); padding: 10px 14px; white-space: nowrap; }
.table td { padding: 11px 14px; vertical-align: middle; border-color: var(--line); font-size: .9rem; }
.table tbody tr:hover { background: #FAFBFD; }
.table .num, .table td.text-end { font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 800; background: var(--surface); }
.table-sm td { padding: 7px 10px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .5; }
.empty .btn { margin-top: 12px; }

/* ---------- Badges ---------- */
.badge { font-weight: 700; border-radius: 6px; padding: .35em .6em; font-size: .74rem; }
.badge-soft-success { background: var(--green-soft); color: var(--green); }
.badge-soft-danger { background: var(--red-soft); color: var(--red); }
.badge-soft-warning { background: var(--amber-soft); color: #9A6A00; }
.badge-soft-info { background: var(--blue-soft); color: var(--blue); }
.badge-soft-secondary { background: #ECEFF3; color: var(--muted); }
.badge-soft-dark { background: var(--ink); color: #fff; }

/* ---------- Misc ---------- */
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.filters .form-control, .filters .form-select { min-height: 38px; }
.pagination .page-link { color: var(--ink); border-color: var(--line); font-weight: 600; }
.pagination .page-item.active .page-link { background: var(--ink); border-color: var(--ink); }
.toast-container { z-index: 1090; }
.toast { border-radius: 10px; border: none; font-weight: 600; }
.modal-content { border-radius: 12px; border: 1px solid var(--line); }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-title { font-weight: 800; color: var(--ink); }
.dropdown-menu { border-radius: 10px; border-color: var(--line); box-shadow: 0 8px 24px rgba(27,42,65,.12); }
.list-clean { list-style: none; margin: 0; padding: 0; }
.list-clean li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.list-clean li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--saffron-soft); color: var(--ink); font-weight: 800; display: grid; place-items: center; flex: none; }
.progress { height: 6px; background: var(--line); }
.divider { border-top: 1px solid var(--line); margin: 14px 0; }
.chart-box { position: relative; height: 260px; }
.chart-box-sm { position: relative; height: 220px; }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.6); z-index: 2000; display: none; align-items: center; justify-content: center; }
.loading-overlay.show { display: flex; }
.stock-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .82rem; }
.stock-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.stock-pill.low::before { background: var(--saffron); }
.stock-pill.out::before { background: var(--red); }
.thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--surface); }
.thumb-ph { width: 42px; height: 42px; border-radius: 8px; background: var(--saffron-soft); color: var(--ink); display: grid; place-items: center; font-weight: 800; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.kbd { font-family: inherit; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: .74rem; font-weight: 700; color: var(--ink-soft); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 16px; padding: 34px 32px; }
.login-card .mark { width: 54px; height: 54px; border-radius: 14px; background: var(--saffron); color: var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; margin-bottom: 18px; }
.login-bg { position: fixed; inset: 0; background: radial-gradient(ellipse at 20% 10%, rgba(242,169,59,.18), transparent 50%), radial-gradient(ellipse at 90% 90%, rgba(255,255,255,.06), transparent 40%); pointer-events: none; }

/* Mobile cards for tables */
@media (max-width: 767.98px) {
  .table-cards thead { display: none; }
  .table-cards tbody tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin: 10px; background: var(--card); }
  .table-cards tbody td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; border: 0; border-bottom: 1px dashed var(--line); text-align: right !important; }
  .table-cards tbody td:last-child { border-bottom: 0; }
  .table-cards tbody td::before { content: attr(data-label); color: var(--muted); font-weight: 700; font-size: .74rem; text-align: left; flex: none; }
  .table-cards tbody td.td-actions { justify-content: flex-end; }
  .table-cards tbody td.td-actions::before { content: ""; }
  .table-cards tfoot { display: none; }
  .kv { grid-template-columns: 1fr; }
}

/* Responsive shell */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .topbar .btn-burger { display: inline-grid; }
  .content { padding: 14px; }
  .stat .value { font-size: 1.25rem; }
  html { font-size: 14.5px; }
}

/* ---------- Print (reports / generic) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .toast-container, .btn, .filters { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .card, .table-wrap { border: none; }
}
