/* Glotch Pharmacy System - golden theme */
:root {
  --gold: #c9a227;
  --gold-light: #e8c547;
  --gold-dark: #9a7a12;
  --gold-soft: #fbf3d6;
  --ink: #15120a;
  --ink-2: #1f1a0e;
  --cream: #faf6ea;
  --line: #eadfbd;
  --muted: #7a6f4f;
  --bs-primary: #c9a227;
  --bs-primary-rgb: 201, 162, 39;
  --bs-link-color: #8a6c0d;
  --bs-link-color-rgb: 138, 108, 13;
  --bs-link-hover-color: #5f4a06;
  --bs-link-hover-color-rgb: 95, 74, 6;
  --bs-body-bg: #faf6ea;
  --bs-body-color: #2b2515;
  --bs-border-color: #eadfbd;
  --bs-font-sans-serif: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
body { background: var(--cream); font-size: .92rem; }
a { text-decoration: none; }

/* buttons */
.btn-primary {
  --bs-btn-color: #1b1606; --bs-btn-bg: var(--gold); --bs-btn-border-color: var(--gold);
  --bs-btn-hover-color: #1b1606; --bs-btn-hover-bg: var(--gold-light); --bs-btn-hover-border-color: var(--gold-light);
  --bs-btn-active-color: #1b1606; --bs-btn-active-bg: var(--gold-dark); --bs-btn-active-border-color: var(--gold-dark);
  --bs-btn-disabled-color: #1b1606; --bs-btn-disabled-bg: var(--gold); --bs-btn-disabled-border-color: var(--gold);
  --bs-btn-focus-shadow-rgb: 201, 162, 39; font-weight: 600;
}
.btn-outline-primary {
  --bs-btn-color: var(--gold-dark); --bs-btn-border-color: var(--gold);
  --bs-btn-hover-color: #1b1606; --bs-btn-hover-bg: var(--gold); --bs-btn-hover-border-color: var(--gold);
  --bs-btn-active-color: #1b1606; --bs-btn-active-bg: var(--gold-light); --bs-btn-active-border-color: var(--gold-light);
  --bs-btn-focus-shadow-rgb: 201, 162, 39;
}
.text-primary { color: var(--gold-dark) !important; }
.bg-primary, .text-bg-primary { background-color: var(--gold) !important; color: #1b1606 !important; }
.form-control:focus, .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(201,162,39,.2); }
.form-check-input:checked { background-color: var(--gold); border-color: var(--gold); }
.form-check-input:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(201,162,39,.2); }
.page-link { color: var(--gold-dark); }
.page-item.active .page-link { background: var(--gold); border-color: var(--gold); color: #1b1606; }
.nav-tabs .nav-link.active { color: var(--gold-dark); border-bottom-color: var(--gold); font-weight: 600; }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex: 0 0 250px; background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #d9ccA0; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1030;
  border-right: 1px solid #000;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #3a3220; border-radius: 3px; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem; border-bottom: 1px solid #2c2512; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 1.35rem;
  color: #1b1606; background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-dark));
  box-shadow: 0 4px 14px rgba(201,162,39,.35);
}
.brand-text { line-height: 1.1; }
.brand-text b { display: block; color: var(--gold-light); font-size: 1.05rem; letter-spacing: .5px; }
.brand-text small { color: #9d9166; font-size: .68rem; text-transform: uppercase; letter-spacing: 1.4px; }
.menu { list-style: none; margin: 0; padding: .6rem .6rem 2rem; }
.menu .head { padding: .9rem .8rem .3rem; font-size: .66rem; text-transform: uppercase; letter-spacing: 1.6px; color: #7d7248; }
.menu a.item {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 9px; color: #d9ccA0;
  font-size: .9rem; margin-bottom: 2px; transition: .15s;
}
.menu a.item i { font-size: 1.05rem; width: 20px; text-align: center; color: #a89655; }
.menu a.item:hover { background: #2a2312; color: var(--gold-light); }
.menu a.item:hover i { color: var(--gold-light); }
.menu a.item.active { background: linear-gradient(90deg, rgba(201,162,39,.28), rgba(201,162,39,.06)); color: var(--gold-light); box-shadow: inset 3px 0 0 var(--gold); }
.menu a.item.active i { color: var(--gold-light); }
.menu a.pos-btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem; margin: .5rem .2rem 0; padding: .7rem; border-radius: 11px; font-weight: 700;
  color: #1b1606; background: linear-gradient(135deg, var(--gold-light), var(--gold)); box-shadow: 0 6px 16px rgba(201,162,39,.3);
}
.menu a.pos-btn:hover { filter: brightness(1.06); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line); padding: .55rem 1.2rem; display: flex; align-items: center; gap: .8rem;
  position: sticky; top: 0; z-index: 1020; box-shadow: 0 2px 10px rgba(120,95,20,.06);
}
.topbar .spacer { flex: 1; }
.topbar .pharm-switch { max-width: 260px; border-color: var(--gold); background-color: var(--gold-soft); font-weight: 600; }
.alert-pill { position: relative; }
.alert-pill .count { position: absolute; top: -4px; right: -6px; font-size: .62rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--gold-light); font-weight: 700; }
.content { padding: 1.3rem 1.4rem 2rem; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--ink); }
.page-head h1::after { content: ""; display: block; width: 42px; height: 3px; background: var(--gold); border-radius: 2px; margin-top: 5px; }
.foot { text-align: center; padding: .9rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); }

/* cards */
.card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 14px rgba(120,95,20,.06); background: #fff; }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 700; padding: .8rem 1.1rem; }
.stat { position: relative; overflow: hidden; padding: 1.05rem 1.2rem; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, var(--gold-light), var(--gold-dark)); }
.stat .label { font-size: .74rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.55rem; font-weight: 800; color: var(--ink); line-height: 1.2; }
.stat .icon { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-size: 2.2rem; color: var(--gold); opacity: .28; }
.stat.dark { background: linear-gradient(135deg, var(--ink), #2c2410); border-color: #000; }
.stat.dark .label { color: #b6a86f; } .stat.dark .value { color: var(--gold-light); }

/* tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th {
  background: var(--gold-soft); color: #5d4a0a; font-size: .74rem; text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 2px solid var(--gold); white-space: nowrap; font-weight: 700;
}
.table-hover tbody tr:hover { background: #fffaf0; }
.table td { vertical-align: middle; }
.table-sm td, .table-sm th { padding: .4rem .6rem; }
.form-label { font-weight: 600; font-size: .82rem; color: #4a3f1d; margin-bottom: .25rem; }
.req::after { content: " *"; color: #c0392b; }
.form-control, .form-select { border-color: #e2d6ac; }
.badge { font-weight: 600; }
.text-bg-warning { background-color: #f0b429 !important; color: #3b2a00 !important; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2.4rem; color: var(--gold); display: block; margin-bottom: .4rem; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(232,197,71,.35), transparent 60%), linear-gradient(160deg, #15120a, #2a2210 60%, #15120a); }
.login-card { width: 100%; max-width: 410px; border-radius: 18px; padding: 2rem 2rem 1.6rem; background: #fffdf5; border: 1px solid #e8d48a; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.login-card .brand-mark { width: 62px; height: 62px; font-size: 2rem; margin: 0 auto .8rem; border-radius: 16px; }

/* POS */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
.pos-results { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: none; position: absolute; z-index: 50; width: 100%; box-shadow: 0 10px 28px rgba(0,0,0,.15); }
.pos-results .row-item { padding: .5rem .8rem; border-bottom: 1px solid #f3ecd2; cursor: pointer; display: flex; justify-content: space-between; gap: .6rem; }
.pos-results .row-item:hover, .pos-results .row-item.sel { background: var(--gold-soft); }
.pos-cart { max-height: 52vh; overflow-y: auto; }
.pos-cart td { font-size: .85rem; }
.pos-cart input.form-control { padding: .15rem .35rem; font-size: .85rem; }
.pos-total { background: linear-gradient(135deg, var(--ink), #2c2410); color: var(--gold-light); border-radius: 14px; padding: 1rem 1.2rem; }
.pos-total .big { font-size: 2rem; font-weight: 800; }
.sticky-side { position: sticky; top: 76px; }
.kbd { font-size: .7rem; background: #efe5bf; padding: 1px 6px; border-radius: 4px; color: #5d4a0a; }

@media (max-width: 1100px) { .pos-grid { grid-template-columns: 1fr; } .sticky-side { position: static; } }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s; }
  .sidebar.open { left: 0; }
  .content { padding: 1rem .8rem; }
}

/* print */
@media print {
  .sidebar, .topbar, .foot, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
}
.receipt-wrap { max-width: 330px; margin: 0 auto; background: #fff; padding: 12px; font-family: "Courier New", monospace; font-size: 12px; color: #000; }
.receipt-wrap h3 { font-size: 15px; margin: 0; text-align: center; }
.receipt-wrap table { width: 100%; font-size: 11.5px; }
.receipt-wrap .hr { border-top: 1px dashed #000; margin: 5px 0; }
.invoice-a4 { background: #fff; padding: 28px 32px; max-width: 900px; margin: 0 auto; border-top: 6px solid var(--gold); }

.pos-cart .bsel { min-width: 165px; }
.pos-cart .usel { min-width: 82px; }
