/* ==========================================================================
   DP Jewellers - Navy & Gold premium theme
   ========================================================================== */
:root {
  --navy-950: #070f20;
  --navy-900: #0b1730;
  --navy-800: #0e1f3d;
  --navy-700: #16305c;
  --navy-600: #1f3f75;
  --gold-500: #c9a227;
  --gold-400: #d4af37;
  --gold-300: #e6c867;
  --gold-100: #f8f0d6;
  --ink: #1b2233;
  --muted: #6b7489;
  --line: #e7e9ef;
  --bg: #f5f6fa;
  --card: #ffffff;
  --success: #198754;
  --danger: #c0392b;
  --sidebar-w: 268px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(14, 31, 61, .07);
  --shadow-hover: 0 12px 32px rgba(14, 31, 61, .14);
}

html, body { height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: .925rem;
}
h1, h2, h3, .brand-font { font-family: "Playfair Display", Georgia, serif; }
a { color: var(--navy-600); }
a:hover { color: var(--gold-500); }

/* ----------------------------------------------------------------- sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  color: #c9d1e3; display: flex; flex-direction: column;
  transition: width .25s ease, transform .25s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
}
.sidebar .brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: .7rem; padding: 0 1.25rem;
  border-bottom: 1px solid rgba(212,175,55,.18); white-space: nowrap; overflow: hidden;
}
.sidebar .brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  color: var(--navy-900); display: grid; place-items: center; font-weight: 800; font-family: "Playfair Display", serif; font-size: .95rem; letter-spacing: .5px;
}
.sidebar .brand-text { color: #fff; font-family: "Playfair Display", serif; font-size: 1.2rem; letter-spacing: .3px; }
.sidebar .brand-text small { display: block; font-family: "Inter", sans-serif; font-size: .68rem; color: var(--gold-300); letter-spacing: 2px; text-transform: uppercase; }
.sidebar nav { flex: 1; overflow-y: auto; padding: .75rem .6rem 2rem; }
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: 1.6px; color: #6f7c99; padding: 1rem .9rem .35rem; white-space: nowrap; }
.side-link, .side-group > button {
  display: flex; align-items: center; gap: .8rem; width: 100%; padding: .62rem .9rem; border-radius: 10px;
  color: #c9d1e3; text-decoration: none; background: none; border: 0; text-align: left; white-space: nowrap; font-size: .9rem;
  transition: background .18s, color .18s;
}
.side-link i, .side-group > button i.ico { font-size: 1.12rem; width: 22px; text-align: center; color: var(--gold-400); flex: 0 0 22px; }
.side-link:hover, .side-group > button:hover { background: rgba(212,175,55,.10); color: #fff; }
.side-link.active { background: linear-gradient(90deg, rgba(212,175,55,.22), rgba(212,175,55,.05)); color: #fff; box-shadow: inset 3px 0 0 var(--gold-400); }
.side-group > button .chev { margin-left: auto; font-size: .75rem; transition: transform .2s; color: #8592ad; }
.side-group.open > button .chev { transform: rotate(90deg); }
.side-sub { display: none; padding: .15rem 0 .35rem 2.6rem; }
.side-group.open .side-sub { display: block; }
.side-sub a { display: block; padding: .38rem .6rem; border-radius: 8px; color: #a8b3cb; text-decoration: none; font-size: .85rem; white-space: nowrap; }
.side-sub a:hover, .side-sub a.active { color: var(--gold-300); background: rgba(255,255,255,.04); }

/* collapsed */
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .label,
body.sidebar-collapsed .sidebar .chev,
body.sidebar-collapsed .sidebar .side-sub { display: none !important; }
body.sidebar-collapsed .side-link, body.sidebar-collapsed .side-group > button { justify-content: center; padding: .7rem 0; }

/* ----------------------------------------------------------------- main area */
.main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .25s ease; display: flex; flex-direction: column; }
body.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
.topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
}
.hamburger { width: 42px; height: 42px; border: 0; border-radius: 10px; background: var(--gold-100); display: grid; place-items: center; cursor: pointer; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--navy-800); border-radius: 2px; position: relative; }
.hamburger span::before, .hamburger span::after { content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--navy-800); border-radius: 2px; transition: transform .2s; }
.hamburger span::before { top: -6px; } .hamburger span::after { top: 6px; }
.topbar .page-title { font-family: "Playfair Display", serif; font-size: 1.25rem; color: var(--navy-800); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: .8rem; color: var(--navy-700); }
.topbar .chip select { border: 0; background: transparent; font-size: .8rem; color: var(--navy-700); outline: none; max-width: 170px; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--navy-700); background: var(--bg); border: 1px solid var(--line); text-decoration: none; }
.icon-btn .badge-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .65rem; display: grid; place-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); color: var(--gold-300); display: grid; place-items: center; font-weight: 700; }
.content { padding: 1.5rem; flex: 1; }
.footer { padding: .9rem 1.5rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); background: #fff; }

/* ----------------------------------------------------------------- cards */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: .9rem 1.2rem; font-weight: 600; color: var(--navy-800); display: flex; align-items: center; gap: .5rem; }
.card-header i { color: var(--gold-500); }
.stat-card { position: relative; overflow: hidden; padding: 1.15rem 1.2rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; height: 100%; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat-card .label { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.stat-card .value { font-size: 1.45rem; font-weight: 700; color: var(--navy-800); margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: .76rem; color: var(--muted); }
.stat-card .ico { position: absolute; right: 1rem; top: 1rem; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: var(--gold-100); color: var(--gold-500); }
.stat-card.navy { background: linear-gradient(135deg, var(--navy-800), var(--navy-950)); border-color: var(--navy-800); }
.stat-card.navy .label { color: #9fb0d3; } .stat-card.navy .value { color: #fff; } .stat-card.navy .sub { color: var(--gold-300); }
.stat-card.navy .ico { background: rgba(212,175,55,.16); color: var(--gold-300); }
.stat-card::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(212,175,55,.14), transparent 70%); }

/* ----------------------------------------------------------------- forms & buttons */
.form-label { font-size: .78rem; font-weight: 600; color: var(--navy-700); margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 10px; border-color: #dde1ea; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--gold-400); box-shadow: 0 0 0 .2rem rgba(212,175,55,.18); }
.btn { border-radius: 10px; font-weight: 500; }
.btn-gold { background: linear-gradient(135deg, var(--gold-300), var(--gold-500)); border: 0; color: var(--navy-900); font-weight: 600; }
.btn-gold:hover { filter: brightness(1.05); color: var(--navy-950); box-shadow: 0 6px 16px rgba(201,162,39,.35); }
.btn-navy { background: var(--navy-800); color: #fff; border: 0; }
.btn-navy:hover { background: var(--navy-700); color: var(--gold-300); }
.btn-outline-navy { border: 1px solid var(--navy-700); color: var(--navy-700); }
.btn-outline-navy:hover { background: var(--navy-700); color: #fff; }
.required::after { content: " *"; color: var(--danger); }

/* ----------------------------------------------------------------- tables */
.table { --bs-table-hover-bg: #fbf7ea; margin-bottom: 0; }
.table thead th { background: var(--navy-800); color: var(--gold-300); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .5px; border: 0; white-space: nowrap; }
.table thead th:first-child { border-top-left-radius: 10px; } .table thead th:last-child { border-top-right-radius: 10px; }
.table td { vertical-align: middle; border-color: var(--line); }
.table tfoot td { font-weight: 700; background: var(--gold-100); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.badge-status { padding: .35em .7em; border-radius: 999px; font-weight: 600; font-size: .72rem; }
.s-Active, .s-Paid, .s-Approved, .s-Received, .s-Matched, .s-Closed, .s-Delivered { background: #e3f4ea; color: #146c43; }
.s-Partial, .s-Pending, .s-Verified, .s-Dispatched, .s-Due, .s-Open, .s-Booked, .s-InProgress, .s-Ready { background: #fff4d6; color: #8a6400; }
.s-Unpaid, .s-Cancelled, .s-Rejected, .s-Inactive, .s-Mismatch, .s-Overdue { background: #fde7e5; color: #a5281b; }
.s-Adjusted, .s-Refunded { background: #e6edf9; color: #1f3f75; }

.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-actions h2 { font-size: 1.35rem; margin: 0; color: var(--navy-800); }

/* ----------------------------------------------------------------- billing */
.bill-totals { background: linear-gradient(135deg, var(--navy-800), var(--navy-950)); color: #dfe6f5; border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.bill-totals .row-t { display: flex; justify-content: space-between; padding: .25rem 0; font-variant-numeric: tabular-nums; }
.bill-totals .grand { border-top: 1px dashed rgba(212,175,55,.45); margin-top: .5rem; padding-top: .6rem; font-size: 1.45rem; color: var(--gold-300); font-weight: 700; }
.scan-box { position: relative; }
.scan-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gold-500); font-size: 1.2rem; }
.scan-box input { padding-left: 2.6rem; height: 48px; font-size: 1rem; border: 2px solid var(--gold-300); }
.item-table input { min-width: 80px; padding: .3rem .45rem; font-size: .85rem; }
.item-table select { min-width: 96px; padding: .3rem .45rem; font-size: .85rem; }
.search-results { position: absolute; z-index: 1050; width: 100%; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-hover); }
.search-results .r { padding: .55rem .8rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results .r:hover, .search-results .r.active { background: var(--gold-100); }

/* ----------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(circle at 30% 20%, rgba(212,175,55,.25), transparent 45%), linear-gradient(160deg, var(--navy-800), var(--navy-950)); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 4rem; position: relative; overflow: hidden; }
.login-art h1 { font-size: 2.6rem; color: #fff; } .login-art p { color: #b9c4dc; max-width: 440px; }
.login-art .ring { position: absolute; border: 2px solid rgba(212,175,55,.25); border-radius: 50%; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.login-form .box { width: 100%; max-width: 400px; }
@media (max-width: 991px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ----------------------------------------------------------------- responsive */
.sidebar-backdrop { display: none; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(7,15,32,.5); z-index: 1035; }
  .main, body.sidebar-collapsed .main { margin-left: 0; }
  body.sidebar-collapsed .sidebar .label, body.sidebar-collapsed .sidebar .brand-text, body.sidebar-collapsed .sidebar .nav-section { display: initial !important; }
  .content { padding: 1rem; }
  .topbar .hide-sm { display: none !important; }
}

/* ----------------------------------------------------------------- print */
@media print {
  .sidebar, .topbar, .footer, .no-print, .filter-bar { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
  .table thead th { background: #0e1f3d !important; color: #d4af37 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
