/* ============================================================
   Larissa — Админ хэсгийн загвар
   Фонт: Inter (assets/fonts дотор суусан)
   ============================================================ */

@import url('../assets/fonts/inter.css');

:root {
  --rose:        #c98a8e;   /* логоны үндсэн өнгө */
  --rose-dark:   #a96a6f;
  --rose-light:  #f9efef;
  --rose-mid:    #eed7d8;
  --plum:        #4a3a3c;   /* хажуугийн цэсний гүн саарал-сарнай */
  --plum-soft:   #5b4749;
  --gold:        #c0906f;   /* зөөлөн шампань аяс */
  --cream:       #fdfbfa;
  --ink:         #3d3132;
  --muted:       #94807f;
  --line:        #efe4e3;
  --white:       #fff;

  --ok:     #3f8f5c;
  --ok-bg:  #eaf6ee;
  --warn:   #b7801f;
  --warn-bg:#fdf4e5;
  --danger: #b4423f;
  --danger-bg:#fdecec;
  --info:   #3a6fa8;
  --info-bg:#eaf1f9;

  --radius: 14px;
  --shadow: 0 2px 14px rgba(45,36,36,.06);
  --shadow-lg: 0 12px 40px rgba(45,36,36,.14);
  --sidebar-w: 246px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { letter-spacing: -.2px; }

/* Тоо, мөнгөн дүн — тэгш өргөнтэй цифр */
table.data td.num, table.data th.num, .stat .value, .badge, .pay-line,
input[type=number], .money { font-variant-numeric: tabular-nums; }

a { color: var(--rose-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--plum);
  color: #e9dfdc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 40;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #57474c; border-radius: 3px; }

.brand {
  padding: 20px 20px 16px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand .mark {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--rose); color: var(--rose);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 300; flex-shrink: 0;
}
.brand .logo-img {
  background: #fff; border-radius: 13px; padding: 12px 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; width: 100%;
}
.brand .logo-img img { height: 96px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.brand.has-logo { flex-direction: column; align-items: stretch; gap: 11px; }
.brand.has-logo .brand-text { text-align: center; }
.brand-text b { display: block; font-size: 14px; color: #fff; letter-spacing: .4px; }
.brand-text span { font-size: 11px; color: #a9979a; }

.nav { padding: 12px 10px 20px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px;
  color: #8b767b; padding: 0 12px 6px; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  color: #d6c8c5; font-size: 13.5px; text-decoration: none;
  margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--rose); color: #fff; font-weight: 600; }
.nav a .ic { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav a .badge-count {
  margin-left: auto; background: var(--gold); color: #3a2c05;
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}

.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: #9b8a8d;
}

/* ── Main ──────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 0 26px;
  height: 62px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.topbar .crumb { font-size: 12px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar .today { font-size: 12.5px; color: var(--muted); }

.userbox { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}
.userbox .u-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.userbox .u-role { font-size: 11px; color: var(--muted); }

.content { padding: 24px 26px 60px; flex: 1; }

.menu-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink); }

/* ── Page header ───────────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-start; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.page-head .titles h2 { margin: 0; font-size: 20px; font-weight: 600; }
.page-head .titles p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ── Stat tiles ────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -18px; top: -18px;
  width: 74px; height: 74px; border-radius: 50%; background: var(--rose-light); opacity: .5;
}
.stat .label { font-size: 12px; color: var(--muted); position: relative; z-index: 1; }
.stat .value { font-size: 23px; font-weight: 700; margin-top: 4px; position: relative; z-index: 1; letter-spacing: -.3px; }
.stat .foot { font-size: 11.5px; color: var(--muted); margin-top: 5px; position: relative; z-index: 1; }
.stat.green .value { color: var(--ok); }
.stat.red .value { color: var(--danger); }
.stat.gold .value { color: #a8871b; }
.stat.rose .value { color: var(--rose-dark); }

/* ── Tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.3px; }
table.data th {
  text-align: left; padding: 11px 14px; background: #fbf7f5;
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 12px;
  color: #6f5f5c; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid #f4ecea; vertical-align: middle; }
table.data tbody tr:hover { background: #fdfaf9; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data td.center, table.data th.center { text-align: center; }
table.data .strong { font-weight: 600; }
table.data .sub { font-size: 11.5px; color: var(--muted); display: block; }
tr.total-row td { background: #fbf7f5; font-weight: 700; border-top: 2px solid var(--line); }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  font-family: inherit; transition: filter .15s, background .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(.95); }
.btn.primary { background: var(--rose); color: #fff; }
.btn.dark { background: var(--plum); color: #fff; }
.btn.ghost { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #fbf7f5; }
.btn.soft { background: var(--rose-light); color: var(--rose-dark); }
.btn.success { background: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.warn { background: var(--warn); color: #fff; }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-icon {
  width: 30px; height: 30px; padding: 0; border-radius: 8px;
  background: #f6efed; color: #7d6a67; border: 0; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn-icon:hover { background: var(--rose-light); color: var(--rose-dark); text-decoration: none; }
.btn-icon.del:hover { background: var(--danger-bg); color: var(--danger); }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.ok     { background: var(--ok-bg);     color: var(--ok); }
.badge.warn   { background: var(--warn-bg);   color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info   { background: var(--info-bg);   color: var(--info); }
.badge.muted  { background: #f0eae8;          color: var(--muted); }
.badge.rose   { background: var(--rose-light); color: var(--rose-dark); }

/* ── Forms ─────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: #5f5150; }
.field .help { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=email], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 13.5px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(183,110,121,.13);
}
textarea { resize: vertical; min-height: 82px; line-height: 1.6; }
input[type=file] { font-size: 12.5px; padding: 7px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid.c2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 9px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 9px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--rose); }

/* ── Filter bar ────────────────────────────────────────── */
.filters {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.filters form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; flex: 0 1 auto; }
.filters .grow { flex: 1 1 220px; }

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  padding: 11px 15px; border-radius: 10px; margin-bottom: 15px; font-size: 13.3px;
  border-left: 3px solid transparent;
}
.alert.ok      { background: var(--ok-bg);     color: #2c6b45; border-color: var(--ok); }
.alert.success { background: var(--ok-bg);     color: #2c6b45; border-color: var(--ok); }
.alert.danger  { background: var(--danger-bg); color: #93332f; border-color: var(--danger); }
.alert.warn    { background: var(--warn-bg);   color: #8a6520; border-color: var(--warn); }
.alert.info    { background: var(--info-bg);   color: #2f5c8c; border-color: var(--info); }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 16px; font-size: 13.3px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; text-decoration: none; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--rose-dark); border-bottom-color: var(--rose); }

/* ── Modal ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(45,36,36,.45);
  display: none; align-items: flex-start; justify-content: center; z-index: 100;
  padding: 40px 16px; overflow-y: auto; backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 620px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease-out;
}
.modal.wide { max-width: 880px; }
@keyframes pop { from { transform: translateY(-14px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-head .close { margin-left: auto; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; }

/* ── Misc ──────────────────────────────────────────────── */
.promo-note { font-size: 11px; margin-top: 3px; line-height: 1.35; }
.img-preview {
  width: 100%; max-height: 150px; object-fit: contain; border: 1px solid var(--line);
  border-radius: 10px; background: var(--rose-light); padding: 6px; margin-bottom: 8px;
}
.pill-row { display: flex; gap: 7px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt0 { margin-top: 0 } .mb0 { margin-bottom: 0 }
.text-ok { color: var(--ok) } .text-danger { color: var(--danger) } .text-rose { color: var(--rose-dark) }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--rose-light); }
.thumb.round { border-radius: 50%; }
.thumb.lg { width: 74px; height: 74px; }
.ph-avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--rose-light);
  color: var(--rose-dark); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; flex-shrink: 0;
}

.pagination { display: flex; gap: 5px; padding: 14px 18px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 11px; border-radius: 8px; font-size: 12.5px; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; background: #fff;
}
.pagination .current { background: var(--rose); color: #fff; border-color: var(--rose); font-weight: 600; }
.pagination .info { border: 0; color: var(--muted); background: none; margin-left: auto; }

.progress { height: 7px; background: #f0e8e6; border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--rose); border-radius: 4px; }
.progress.ok > span { background: var(--ok); }
.progress.warn > span { background: var(--warn); }
.progress.danger > span { background: var(--danger); }

/* Before / after зураг */
.ba-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.ba-item { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; position: relative; }
.ba-item img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; }
.ba-item .tag {
  position: absolute; top: 8px; left: 8px; padding: 2px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; color: #fff; letter-spacing: .4px;
}
.ba-item .tag.before { background: rgba(45,36,36,.8); }
.ba-item .tag.after  { background: rgba(63,143,92,.9); }
.ba-item .rm {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(180,66,63,.9); color: #fff; border: 0; cursor: pointer; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

.ba-grid.preview { margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.ba-grid.preview:empty { display: none; }
.ba-grid.preview .ba-item img { height: 100px; }
.ba-item .cap { padding: 4px 8px; font-size: 10.5px; color: var(--muted); }

/* Лайтбокс */
.lightbox {
  position: fixed; inset: 0; background: rgba(20,14,15,.92); display: none;
  align-items: center; justify-content: center; z-index: 200; padding: 30px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92%; max-height: 92%; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }

/* Календарь / хуваарь */
.schedule { display: grid; gap: 10px; }
.slot-row { display: flex; gap: 10px; align-items: stretch; }
.slot-time { width: 60px; flex-shrink: 0; font-size: 12px; color: var(--muted); padding-top: 10px; font-weight: 600; }
.slot-items { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; border-top: 1px dashed var(--line); padding: 8px 0; }
.appt-chip {
  border-left: 3px solid var(--rose); background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--rose); border-radius: 9px; padding: 7px 11px; font-size: 12.5px; min-width: 190px;
}
.appt-chip.pending   { border-left-color: var(--warn); }
.appt-chip.confirmed { border-left-color: var(--info); }
.appt-chip.arrived   { border-left-color: var(--rose); background: var(--rose-light); }
.appt-chip.completed { border-left-color: var(--ok); }
.appt-chip.cancelled { border-left-color: var(--danger); opacity: .6; }
.appt-chip.no_show   { border-left-color: #b9a7a5; opacity: .6; }
.appt-chip b { display: block; font-size: 12.8px; }
.appt-chip span { color: var(--muted); font-size: 11.5px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 92px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px;
  background: #fff; font-size: 12px;
}
.cal-cell.dim { background: #fbf8f7; color: #c3b6b3; }
.cal-cell.today { border-color: var(--rose); box-shadow: 0 0 0 2px rgba(183,110,121,.15); }
.cal-cell .d { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.cal-cell .ev { background: var(--rose-light); color: var(--rose-dark); border-radius: 5px; padding: 1px 5px; margin-bottom: 2px; font-size: 10.8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head div { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* Мөрийн зурвас график */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.bars .bar i { display: block; width: 100%; background: linear-gradient(180deg, var(--rose), #d29aa2); border-radius: 5px 5px 0 0; min-height: 2px; }
.bars .bar i.exp { background: linear-gradient(180deg, #d68b88, #e8b5b3); }
.bars .bar small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* Харьцуулалтын өөрчлөлт */
.delta {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.delta.up   { background: var(--ok-bg);     color: var(--ok); }
.delta.down { background: var(--danger-bg); color: var(--danger); }
.delta.flat { background: #f0eae8;          color: var(--muted); }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

/* ── Toast мэдэгдэл ────────────────────────────────────── */
.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 300;
  display: flex; flex-direction: column-reverse; gap: 9px; max-width: min(400px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; line-height: 1.5;
  opacity: 0; transform: translateY(12px); transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: none; }
.toast .ic {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  background: var(--ok-bg); color: var(--ok);
}
.toast .msg { flex: 1; min-width: 0; }
.toast .x { border: 0; background: none; color: #c3b2b0; cursor: pointer; font-size: 17px; line-height: 1; padding: 0 2px; }
.toast .x:hover { color: var(--ink); }
.toast.danger  { border-left-color: var(--danger); }
.toast.danger .ic { background: var(--danger-bg); color: var(--danger); }
.toast.warn    { border-left-color: var(--warn); }
.toast.warn .ic { background: var(--warn-bg); color: var(--warn); }
.toast.info    { border-left-color: var(--info); }
.toast.info .ic { background: var(--info-bg); color: var(--info); }

/* ── Толгойн глобал хайлт ──────────────────────────────── */
.topsearch { position: relative; display: flex; align-items: center; }
.topsearch input {
  width: 240px; padding: 8px 62px 8px 34px; border-radius: 30px; font-size: 13px;
  background: #fbf7f6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394807f' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.2-4.2'/%3E%3C/svg%3E") no-repeat 11px center / 15px;
}
.topsearch input:focus { width: 300px; background-color: #fff; }
.topsearch .hint {
  position: absolute; right: 11px; font-size: 10.5px; color: #b9a7a5;
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; pointer-events: none;
}
.topsearch input:focus + .hint { display: none; }

/* ── Багана дарж эрэмбэлэх ─────────────────────────────── */
table.data th.th-sort { cursor: pointer; user-select: none; position: relative; padding-right: 22px; }
table.data th.th-sort:hover { color: var(--rose-dark); }
table.data th.th-sort::after {
  content: '⇅'; position: absolute; right: 8px; opacity: .32; font-size: 11px;
}
table.data th.th-sort.asc::after  { content: '▲'; opacity: .9; color: var(--rose); font-size: 9px; }
table.data th.th-sort.desc::after { content: '▼'; opacity: .9; color: var(--rose); font-size: 9px; }

/* ── Огнооны түргэн товч ───────────────────────────────── */
.date-presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.date-presets .preset {
  padding: 7px 13px; border-radius: 20px; border: 1px solid var(--line); background: #fff;
  font-family: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink); white-space: nowrap;
}
.date-presets .preset:hover { border-color: var(--rose); color: var(--rose-dark); }
.date-presets .preset.active { background: var(--rose-light); border-color: var(--rose); color: var(--rose-deep); font-weight: 600; }

/* ── POS — түргэн бүртгэл ──────────────────────────────── */
.pos-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }

.pos-toolbar { margin-bottom: 14px; }
.pos-toolbar input[type=search] {
  font-size: 15px; padding: 12px 16px; border-radius: 12px; margin-bottom: 10px;
}
.pos-cats { display: flex; gap: 7px; flex-wrap: wrap; }
.pos-cat {
  padding: 8px 15px; border-radius: 30px; border: 1px solid var(--line); background: #fff;
  font-family: inherit; font-size: 13px; cursor: pointer; color: var(--ink); white-space: nowrap;
}
.pos-cat:hover { border-color: var(--rose); }
.pos-cat.active { background: var(--rose); color: #fff; border-color: var(--rose); }

.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 11px; }
.pos-tile {
  position: relative; text-align: left; cursor: pointer; font-family: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px 12px;
  display: flex; flex-direction: column; gap: 5px; min-height: 116px;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.pos-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--rose-mid); }
.pos-tile:active { transform: scale(.97); }
.pos-tile b { font-size: 13.5px; line-height: 1.35; color: var(--ink); }
.pos-tile small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.pos-tile .price {
  margin-top: auto; font-size: 16px; font-weight: 700; color: var(--rose-dark);
  font-variant-numeric: tabular-nums;
}
.pos-tile .price i { font-style: normal; font-size: 11.5px; color: var(--muted); text-decoration: line-through; margin-left: 6px; }
.pos-tile .tag {
  position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; background: var(--rose-light); color: var(--rose-dark);
}
.pos-tile .tag.sale { background: var(--danger); color: #fff; }
.pos-tile.pkg { background: linear-gradient(150deg, #fff, var(--rose-light)); border-color: var(--rose-mid); }

.pos-cart {
  position: sticky; top: 78px;
  display: flex; flex-direction: column; gap: 12px;
  /* Самбарын дээд байрлалыг JS (--pos-top) өгнө, өндрийг CSS бодно —
     ингэснээр цонхны хэмжээ өөрчлөгдөхөд автоматаар тохирно */
  max-height: calc(100vh - var(--pos-top, 150px) - 14px);
  overflow-y: auto;              /* багтахгүй бол бүхэлдээ гүйлгэнэ */
  overscroll-behavior: contain;
  padding-right: 3px;
}
.pos-cart::-webkit-scrollbar { width: 7px; }
.pos-cart::-webkit-scrollbar-thumb { background: #ded0ce; border-radius: 4px; }
.pos-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden;
  flex: 0 0 auto;                /* агшихгүй — агуулга нь бүтэн харагдана */
}
.pos-card-head {
  padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px;
}
.pos-card-body { padding: 12px 14px; }

.pos-hint { font-size: 12.5px; padding: 8px 11px; border-radius: 9px; background: var(--info-bg); color: var(--info); margin-bottom: 10px; line-height: 1.6; }
.pos-hint.new { background: var(--warn-bg); color: var(--warn); }
.pos-hint.gift { background: var(--ok-bg); color: var(--ok); }

.pos-lines { max-height: 46vh; overflow-y: auto; }
.pos-empty-cart { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.pos-line { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid #f6efee; }
.pos-line:last-child { border-bottom: 0; }
.pl-name { flex: 1; font-size: 13px; line-height: 1.3; min-width: 0; }
.pl-name span { display: block; font-size: 11px; color: var(--muted); }
.pl-name s { color: #bba9a7; }
.pl-qty { display: flex; align-items: center; gap: 4px; }
.pl-qty button {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line);
  background: #fbf7f6; cursor: pointer; font-size: 15px; line-height: 1; color: var(--ink);
}
.pl-qty button:hover { background: var(--rose-light); border-color: var(--rose); }
.pl-qty span { min-width: 18px; text-align: center; font-weight: 600; font-size: 13px; }
.pl-total { min-width: 74px; text-align: right; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.pl-del { border: 0; background: none; color: #c9b4b1; cursor: pointer; font-size: 13px; padding: 2px 4px; }
.pl-del:hover { color: var(--danger); }

.pos-sum { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pos-sum.sale { color: var(--rose-dark); }
.pos-sum.total {
  border-top: 2px solid var(--rose-mid); margin-top: 6px; padding-top: 10px; font-size: 16px;
}
.pos-sum.total b { font-size: 23px; color: var(--rose-dark); letter-spacing: -.5px; }

.pos-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 10px; }
.pay-btn {
  padding: 11px 4px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  font-family: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink);
}
.pay-btn:hover { border-color: var(--rose); }
.pay-btn.active { background: var(--rose); color: #fff; border-color: var(--rose); font-weight: 600; }

/* Сул байгаа мастерууд */
.free-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.free-chip {
  display: flex; align-items: center; gap: 6px; padding: 6px 11px 6px 9px;
  border: 1px solid var(--line); border-radius: 30px; background: #fff;
  font-family: inherit; font-size: 12px; cursor: pointer; color: var(--ink); text-align: left;
}
.free-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.free-chip.busy i { background: var(--danger); }
.free-chip.off  i { background: #cdbebc; }
.free-chip small { color: var(--muted); font-size: 10.5px; }
.free-chip:hover { border-color: var(--rose); }
.free-chip.picked { background: var(--rose); border-color: var(--rose); color: #fff; }
.free-chip.picked small { color: rgba(255,255,255,.85); }
.free-chip.picked i { background: #fff; }
.free-chip.off { opacity: .6; }

/* Урьдчилгаа / бэлгийн картын хайрцаг */
.balance-box {
  background: var(--rose-light); border-radius: 11px; padding: 10px 12px; margin: 10px 0 4px;
}
.balance-box .bl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.balance-box b { color: var(--rose-deep); font-variant-numeric: tabular-nums; }
.balance-box .field label { font-size: 11.5px; }

/* Төлбөрийн товч — самбарын доод талд наалттай */
.pos-submit {
  position: sticky; bottom: 0; z-index: 3; padding: 10px 0 2px;
  background: linear-gradient(to bottom, rgba(253,251,250,0), var(--cream) 45%);
}
.pos-submit .btn {
  padding: 15px; font-size: 15px; box-shadow: 0 6px 18px rgba(201,138,142,.35);
}
.pos-submit .btn b { font-weight: 700; font-variant-numeric: tabular-nums; }
.pos-submit .btn:disabled { box-shadow: none; }

.pos-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 10px; }
.pos-quick button {
  padding: 7px 2px; border-radius: 8px; border: 1px solid var(--line); background: #fbf7f6;
  font-family: inherit; font-size: 11.5px; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums;
}
.pos-quick button:hover { background: var(--rose-light); border-color: var(--rose); }

@media (max-width: 1100px) {
  .pos-wrap { grid-template-columns: 1fr; }
  .pos-cart { position: static; max-height: none; overflow: visible; }
  .pos-lines { max-height: none; }
  .pos-submit { position: sticky; bottom: 0; }
}

/* Хэвлэх */
@media print {
  .sidebar, .topbar, .page-head .actions, .filters, .no-print { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* Responsive */
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 0 14px; }
  .form-grid.c2, .form-grid.c3 { grid-template-columns: 1fr; }
  .topsearch input { width: 150px; }
  .topsearch input:focus { width: 190px; }
  .topsearch .hint { display: none; }
  .userbox .u-name, .userbox .u-role, .topbar .today { display: none; }
}

/* ── Таблет / утас: хүснэгтийг картаар ─────────────────── */
@media (max-width: 760px) {
  .content { padding: 14px 10px 60px; }
  .page-head .titles h2 { font-size: 18px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .value { font-size: 20px; }

  /* Товч, талбарыг хуруунд тохируулах */
  .btn { padding: 11px 17px; font-size: 13.5px; }
  .btn.sm { padding: 9px 14px; font-size: 12.5px; }
  .btn-icon { width: 38px; height: 38px; font-size: 16px; }
  input[type=text], input[type=password], input[type=number], input[type=date], input[type=time],
  input[type=email], input[type=tel], input[type=search], select, textarea { padding: 11px 13px; font-size: 15px; }

  .table-wrap { overflow-x: visible; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tbody tr {
    border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px;
    padding: 6px 4px; background: #fff; box-shadow: var(--shadow);
  }
  table.data tbody tr:hover { background: #fff; }
  table.data td {
    border: 0; padding: 7px 12px; text-align: left !important;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
  }
  table.data td::before {
    content: attr(data-label);
    font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
    font-weight: 600; flex-shrink: 0;
  }
  table.data td:empty { display: none; }
  table.data td.num { justify-content: space-between; }
  table.data .row-actions { justify-content: flex-end; width: 100%; }
  tr.total-row td { background: var(--rose-light); }
  table.data th.th-sort::after { content: none; }

  .filters form { flex-direction: column; align-items: stretch; }
  .filters .field { min-width: 0; width: 100%; }
  .date-presets { overflow-x: auto; padding-bottom: 4px; }
  .modal { max-width: none; margin: 0; border-radius: 14px; }
  .toasts { right: 10px; left: 10px; bottom: 10px; max-width: none; }
}
