/* =============================================================================
   OZ Book It — Admin Panel
   -----------------------------------------------------------------------------
   An operations tool, not a marketing site. Owners live here at 9am with a full
   diary and a client waiting, so the priorities are density, legibility and
   speed of scanning — never decoration.

   Design system aligned with the ozmeals admin: Manrope, a single spacing
   rhythm, one control-height baseline so every form row lines up, refined muted
   semantic colours, custom switch, full-page form sections + sticky save bar.

   Works in both directions: every offset uses logical properties
   (margin-inline, inset-inline) so the RTL build needs almost no overrides.
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand accent — OZ Book It indigo (shared with the staff app). */
    --oz-primary:        #4f46e5;
    --oz-primary-dark:   #4338ca;
    --oz-primary-light:  #eef2ff;
    --oz-primary-soft:   #eef2ff;
    --oz-primary-line:   #d6dbf7;
    --oz-accent:         #14b8a6;

    /* Neutrals — paper/surface stack + ink ramp. */
    --oz-bg:             #f6f7f8;
    --oz-surface:        #ffffff;
    --oz-surface-2:      #f1f2f4;
    --oz-surface-3:      #e9ebee;
    --oz-border:         #e4e6ea;
    --oz-border-strong:  #d2d6dc;
    --oz-row-hover:      #f8f9fa;

    --oz-text:           #15181d;
    --oz-text-muted:     #6b7280;
    --oz-text-faint:     #7e858f;

    /* Semantic — each with a soft fill + line, muted rather than neon. */
    --oz-success:        #1f6b47;  --oz-success-soft: #e8f3ec;  --oz-success-line: #c6e0d1;
    --oz-warning:        #b7791f;  --oz-warning-soft: #fbf4e4;  --oz-warning-line: #eadfc0;
    --oz-danger:         #c0344e;  --oz-danger-soft:  #fceaee;  --oz-danger-line:  #f3cfd8;
    --oz-info:           #2a6f97;  --oz-info-soft:    #e9f2f8;  --oz-info-line:    #cbdeeb;

    --oz-sidebar-w:      248px;
    --oz-topbar-h:       54px;
    --oz-radius:         10px;
    --oz-radius-sm:      6px;
    --oz-radius-lg:      14px;
    --oz-shadow-sm:      0 1px 1px rgba(19,22,28,.03), 0 1px 2px rgba(19,22,28,.05);
    --oz-shadow:         0 1px 2px rgba(19,22,28,.04), 0 6px 18px -4px rgba(19,22,28,.10);
    --oz-shadow-lg:      0 2px 4px rgba(19,22,28,.04), 0 18px 44px -10px rgba(19,22,28,.18);
    --oz-ring:           0 0 0 3px rgba(79,70,229,.16);

    /* The single form-row baseline: 14px×1.5 line + 9px×2 padding + 1px×2 border.
       Every control (input, select, button, switch box) is built to it so rows
       in a grid never stagger. */
    --oz-control-h:      41px;
    --oz-gap:            18px;
    --oz-ease:           cubic-bezier(.2,.7,.3,1);

    --oz-font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html[dir="rtl"] {
    --oz-font: "Tajawal", "Segoe UI", system-ui, sans-serif;
}

/* ---------------------------------------------------------------- base --- */

* { box-sizing: border-box; }

body {
    font-family: var(--oz-font);
    background: var(--oz-bg);
    color: var(--oz-text);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    padding-block-start: var(--oz-topbar-h);
    padding-inline-start: var(--oz-sidebar-w);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -.022em; font-weight: 800; }

a { color: var(--oz-primary); text-decoration: none; }
a:hover { color: var(--oz-primary-dark); }

/* Visible focus everywhere — this panel is used with a keyboard all day. */
:focus-visible {
    outline: 2px solid var(--oz-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

#preloader {
    position: fixed; inset: 0; z-index: 2000;
    background: var(--oz-bg);
    display: flex; align-items: center; justify-content: center;
}
#preloader.done { display: none; }

/* -------------------------------------------------------------- topbar --- */

.topbar {
    position: fixed; inset-block-start: 0; inset-inline: 0;
    height: var(--oz-topbar-h);
    background: rgba(255,255,255,.82);
    backdrop-filter: saturate(180%) blur(14px);
    border-block-end: 1px solid var(--oz-border);
    display: flex; align-items: center; gap: 12px;
    padding-inline: 16px;
    z-index: 1030;
}

.topbar-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; color: var(--oz-text); font-size: 15px;
    letter-spacing: -.02em; min-width: 0;
}
.topbar-brand img { height: 28px; width: auto; border-radius: 6px; }
.topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-branch { margin-inline-start: 8px; min-width: 150px; }

.topbar-right {
    margin-inline-start: auto;
    display: flex; align-items: center; gap: 4px;
}

.topbar-icon {
    position: relative;
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; background: transparent; border-radius: var(--oz-radius-sm);
    color: var(--oz-text-muted); font-size: 15px;
    transition: background .12s var(--oz-ease), color .12s var(--oz-ease);
}
.topbar-icon:hover { background: var(--oz-surface-2); color: var(--oz-text); }
.topbar-icon .badge {
    position: absolute; inset-block-start: 3px; inset-inline-end: 2px;
    font-size: 10px; padding: 2px 5px; border-radius: 20px;
}

.topbar-user {
    display: flex; align-items: center; gap: 8px;
    border: 0; background: transparent; padding: 5px 8px;
    border-radius: var(--oz-radius-sm); color: var(--oz-text); font-weight: 600;
}
.topbar-user:hover { background: var(--oz-surface-2); }
.topbar-user img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.sidebar-toggle { display: inline-flex; align-items: center; border: 0; background: none; font-size: 18px; color: var(--oz-text-muted); cursor: pointer; }
.sidebar-toggle:hover { color: var(--oz-primary); }

/* Collapsed state (desktop only): sidebar slides away, content goes full-width.
   Persisted in localStorage; applied inline before paint to avoid a flash. */
@media (min-width: 992px) {
  body.sidebar-collapsed { padding-inline-start: 0; }
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  html[dir="rtl"] body.sidebar-collapsed .sidebar { transform: translateX(100%); }
  body.sidebar-collapsed:has(.impersonation-bar) .sidebar { transform: translateX(-100%); }
}

.impersonation-bar {
    position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 1040;
    background: #7c2d12; color: #fff; text-align: center;
    padding: 6px 12px; font-size: 13px;
}
body:has(.impersonation-bar) { padding-block-start: calc(var(--oz-topbar-h) + 34px); }
body:has(.impersonation-bar) .topbar { inset-block-start: 34px; }
body:has(.impersonation-bar) .sidebar { inset-block-start: calc(var(--oz-topbar-h) + 34px); }

/* ------------------------------------------------------------- sidebar --- */

.sidebar {
    position: fixed;
    inset-block-start: var(--oz-topbar-h); inset-block-end: 0;
    inset-inline-start: 0;
    width: var(--oz-sidebar-w);
    background: var(--oz-surface);
    border-inline-end: 1px solid var(--oz-border);
    overflow-y: auto;
    z-index: 1020;
    transition: transform .22s var(--oz-ease);
}
.sidebar-inner { padding: 12px 10px 40px; }

.sidebar-group { margin-block-end: 16px; }
.sidebar-group-title {
    font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
    color: var(--oz-text-faint);
    padding: 0 10px; margin-block-end: 6px;
}

.sidebar-menu { list-style: none; margin: 0; padding: 0; }
.sidebar-menu a {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--oz-radius-sm);
    color: var(--oz-text-muted); font-weight: 600; font-size: 13.5px;
    transition: background .12s var(--oz-ease), color .12s var(--oz-ease);
}
.sidebar-menu a:hover { background: var(--oz-surface-2); color: var(--oz-text); }
.sidebar-menu a.active {
    background: var(--oz-primary-soft); color: var(--oz-primary-dark); font-weight: 700;
}
.sidebar-menu a.active::before {
    content: ''; position: absolute; inset-inline-start: 0; inset-block: 6px;
    width: 3px; border-radius: 3px; background: var(--oz-primary);
}
.sidebar-menu a i:first-child { width: 18px; text-align: center; font-size: 14px; flex: none; }
.sidebar-menu a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-menu a.locked { color: var(--oz-text-faint); }
.sidebar-lock { margin-inline-start: auto; font-size: 10px; opacity: .7; }

/* ---------------------------------------------------------------- page --- */

.main-content { padding: 22px 22px 60px; max-width: 1600px; }
/* One vertical rhythm — direct children of a page get the block gap, so no
   page needs per-block mb-* utilities that drift out of step. */
.main-content > * + * { margin-block-start: var(--oz-gap); }

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-block-end: var(--oz-gap);
}
.page-title { font-size: 21px; font-weight: 800; margin: 0 0 2px; letter-spacing: -.028em; }
.page-sub { font-size: 13px; color: var(--oz-text-muted); }
.page-head .breadcrumb { margin: 0; font-size: 12.5px; }
.page-head .breadcrumb-item { color: var(--oz-text-faint); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Fixed-height chat screens (Copilot, Inbox) ---------------------------
   Opt-in via `body.screen-fixed`. These screens pin to the viewport: the page
   itself never scrolls, only the inner message list / thread does. Every other
   admin page is untouched and keeps normal page scroll. The topbar is a constant
   54px (--oz-topbar-h) at every width, so the same calc holds on mobile too. */
body.screen-fixed { overflow: hidden; }
body.screen-fixed .main-content {
    height: calc(100vh - var(--oz-topbar-h));
    height: calc(100dvh - var(--oz-topbar-h));   /* dvh: account for mobile browser chrome */
    max-width: none;
    display: flex;
    flex-direction: column;
    padding-block-end: 18px;   /* trim the tall 60px page footer gutter */
    overflow: hidden;
}
/* The page's chat/inbox shell: grows to fill the leftover height and hands the
   scroll to its own inner list. min-height:0 is the flexbox scroll fix. */
body.screen-fixed .screen-fill {
    flex: 1 1 auto;
    min-height: 0;
    margin-block-end: 0;
}
/* When impersonating, the 34px bar sits above the topbar (see body:has rule). */
body.screen-fixed:has(.impersonation-bar) .main-content {
    height: calc(100vh - var(--oz-topbar-h) - 34px);
    height: calc(100dvh - var(--oz-topbar-h) - 34px);
}

/* --------------------------------------------------------------- cards --- */

.card {
    background: var(--oz-surface);
    border: 1px solid var(--oz-border);
    border-radius: var(--oz-radius);
    box-shadow: var(--oz-shadow-sm);
    margin-block-end: var(--oz-gap);
    transition: box-shadow .2s var(--oz-ease), transform .2s var(--oz-ease), border-color .2s var(--oz-ease);
}
.card:hover { box-shadow: var(--oz-shadow); border-color: var(--oz-border-strong); }
.main-content > * + * .card { margin-block-end: var(--oz-gap); }
.card-header {
    padding: 12px 16px;
    border-block-end: 1px solid var(--oz-border);
    background: transparent;
    font-weight: 800; letter-spacing: -.015em;
    border-start-start-radius: var(--oz-radius);
    border-start-end-radius: var(--oz-radius);
    display: flex; align-items: center; gap: 10px;
}
.card-header h5 { font-size: 13.5px; font-weight: 800; margin: 0; }
.card-header .ms-auto { margin-inline-start: auto; }
.card-body { padding: 16px; }

/* A card with a leading tinted icon tile (section anchor). */
.card-header > i.head-ico {
    flex: none; width: 26px; height: 26px; display: grid; place-items: center;
    border-radius: var(--oz-radius-sm); background: var(--oz-primary-soft);
    color: var(--oz-primary); font-size: 12px;
}

/* ---------------------------------------------------------- stat cards --- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 14px; margin-block-end: var(--oz-gap);
}
.stat-card {
    background: var(--oz-surface);
    border: 1px solid var(--oz-border);
    border-radius: var(--oz-radius);
    box-shadow: var(--oz-shadow-sm);
    padding: 15px 16px; min-height: 74px;   /* even tile heights across the row */
    display: flex; align-items: center; gap: 13px;
    animation: oz-rise .4s var(--oz-ease) both;
    transition: box-shadow .2s var(--oz-ease), transform .2s var(--oz-ease), border-color .2s var(--oz-ease);
}
.stat-card:hover { box-shadow: var(--oz-shadow); transform: translateY(-2px); border-color: var(--oz-border-strong); }
/* Stagger the tiles as they rise in. */
.stat-grid > :nth-child(1) { animation-delay: 0s; }
.stat-grid > :nth-child(2) { animation-delay: .05s; }
.stat-grid > :nth-child(3) { animation-delay: .1s; }
.stat-grid > :nth-child(4) { animation-delay: .15s; }
.stat-grid > :nth-child(5) { animation-delay: .2s; }
.stat-grid > :nth-child(6) { animation-delay: .25s; }
.stat-card .stat-icon { transition: transform .2s var(--oz-ease); }
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-3deg); }
.stat-icon {
    width: 38px; height: 38px; flex: none;
    border-radius: var(--oz-radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    background: var(--oz-primary-soft); color: var(--oz-primary);
}
.stat-icon.bg-success-subtle { background: var(--oz-success-soft) !important; color: var(--oz-success) !important; }
.stat-icon.bg-warning-subtle { background: var(--oz-warning-soft) !important; color: var(--oz-warning) !important; }
.stat-icon.bg-danger-subtle  { background: var(--oz-danger-soft) !important;  color: var(--oz-danger) !important; }
.stat-icon.bg-info-subtle    { background: var(--oz-info-soft) !important;    color: var(--oz-info) !important; }
.stat-body { min-width: 0; }
.stat-label { font-size: 10.5px; color: var(--oz-text-faint); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.stat-value { font-size: 21px; font-weight: 800; line-height: 1.25; letter-spacing: -.032em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--oz-text-faint); }
.stat-sub .up   { color: var(--oz-success); font-weight: 700; }
.stat-sub .down { color: var(--oz-danger);  font-weight: 700; }

@keyframes oz-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- charts --- */

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 220px; }

/* -------------------------------------------------------------- tables --- */

table.dataTable { font-size: 13.5px; border-collapse: collapse !important; }
table.dataTable thead th {
    background: #fafbfc;
    font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
    text-transform: uppercase; color: var(--oz-text-faint);
    border-block-end: 1px solid var(--oz-border) !important;
    padding: 10px 12px !important;
    white-space: nowrap;
}
table.dataTable tbody td {
    padding: 10px 12px !important;
    vertical-align: middle;
    border-block-end: 1px solid #f1f3f5 !important;
}
table.dataTable tbody tr:hover { background: var(--oz-row-hover); }
.table-img { border-radius: var(--oz-radius-sm); object-fit: cover; background: var(--oz-surface-2); }

/* Row actions cell — kill inter-button whitespace, one button size. */
.row-actions { white-space: nowrap; font-size: 0; }
.row-actions > * { font-size: 13.5px; }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--oz-border-strong);
    border-radius: var(--oz-radius-sm);
    padding: 6px 10px; font-size: 13px; min-height: 34px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--oz-primary) !important;
    border-color: var(--oz-primary) !important;
    color: #fff !important;
}

/* Numbers line up for scanning. */
.num, .money { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.money-neg { color: var(--oz-danger); }

/* -------------------------------------------------------------- badges --- */

.badge { font-weight: 700; font-size: 11px; padding: 4px 8px; border-radius: 20px; }
.avatar-ini {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; color: #fff; font-weight: 700; flex: none;
}

/* Refined pill — token-driven, replaces ad-hoc bg-*-subtle where used directly. */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 700; line-height: 1;
    padding: 5px 9px; border-radius: 20px;
    background: var(--oz-surface-2); color: var(--oz-text-muted);
    border: 1px solid var(--oz-border);
}
.pill-good { background: var(--oz-success-soft); color: var(--oz-success); border-color: var(--oz-success-line); }
.pill-warn { background: var(--oz-warning-soft); color: var(--oz-warning); border-color: var(--oz-warning-line); }
.pill-bad  { background: var(--oz-danger-soft);  color: var(--oz-danger);  border-color: var(--oz-danger-line); }
.pill-info { background: var(--oz-info-soft);     color: var(--oz-info);    border-color: var(--oz-info-line); }

.cell-main   { display: flex; align-items: center; gap: 9px; }
.cell-title  { font-weight: 700; color: var(--oz-text); }
.cell-sub    { font-size: 12px; color: var(--oz-text-muted); }

/* ------------------------------------------------------------- buttons --- */

.btn { font-size: 13.5px; font-weight: 600; border-radius: var(--oz-radius-sm); padding: 8px 14px; transition: transform .1s var(--oz-ease), background .12s var(--oz-ease), box-shadow .12s var(--oz-ease); }
.btn:active { transform: translateY(1px); }
.btn-sm { font-size: 12.5px; padding: 5px 10px; }
.btn-primary { background: var(--oz-primary); border-color: var(--oz-primary); }
.btn-primary:hover { background: var(--oz-primary-dark); border-color: var(--oz-primary-dark); }
.btn-primary:hover { box-shadow: 0 4px 12px -3px rgba(79,70,229,.5); }
.btn-group-sm > .btn { padding: 4px 8px; }
.btn-ghost { background: var(--oz-surface); border: 1px solid var(--oz-border-strong); color: var(--oz-text); }
.btn-ghost:hover { background: var(--oz-surface-2); }

/* A loading button — label hidden, spinner shown, clicks off. */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ''; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px;
    border: 2px solid currentColor; border-inline-start-color: transparent; border-radius: 50%;
    color: #fff; animation: oz-spin .6s linear infinite;
}
@keyframes oz-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- forms --- */

.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--oz-text); letter-spacing: -.005em; margin-block-end: 5px; }
.form-control, .form-select {
    font-size: 14px; border-radius: var(--oz-radius-sm);
    border: 1px solid var(--oz-border-strong); padding: 9px 12px;
    min-height: var(--oz-control-h); color: var(--oz-text);
    background-color: var(--oz-surface);
    box-shadow: 0 1px 1px rgba(19,22,28,.02) inset;
    transition: border-color .14s var(--oz-ease), box-shadow .14s var(--oz-ease);
}
.form-control:focus, .form-select:focus {
    border-color: var(--oz-primary);
    box-shadow: var(--oz-ring);
}
textarea.form-control { min-height: 84px; line-height: 1.55; resize: vertical; }
.form-control-sm, .form-select-sm { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.form-text, .form-hint { font-size: 12px; color: var(--oz-text-faint); margin-block-start: 4px; }
.form-control.is-invalid { border-color: var(--oz-danger); }
.field-error { font-size: 12px; color: var(--oz-danger); margin-block-start: 4px; }

.field-help {
    font-size: 12px; color: var(--oz-text-muted);
    background: var(--oz-surface-2); border: 1px solid var(--oz-border);
    padding: 8px 11px; border-radius: var(--oz-radius-sm); margin-block-start: 6px;
}

/* Full-page form: equal-height columns, hints sink to the bottom so a short
   field next to a tall one still bottom-aligns and the row reads as one band. */
.form-page .row > [class*="col-"] { display: flex; flex-direction: column; }
.form-page .row > [class*="col-"] > .form-hint:last-child,
.form-page .row > [class*="col-"] > .form-text:last-child { margin-block-start: auto; padding-block-start: 4px; }

/* A grouped section within a full-page form. */
.form-section {
    background: var(--oz-surface); border: 1px solid var(--oz-border);
    border-radius: var(--oz-radius); box-shadow: var(--oz-shadow-sm);
    margin-block-end: var(--oz-gap);
}
.form-section-head {
    padding: 12px 16px; border-block-end: 1px solid var(--oz-border);
    display: flex; align-items: center; gap: 10px;
}
.form-section-head h3 { font-size: 13.5px; font-weight: 800; letter-spacing: -.015em; margin: 0; }
.form-section-head > i {
    flex: none; width: 26px; height: 26px; display: grid; place-items: center;
    border-radius: var(--oz-radius-sm); background: var(--oz-primary-soft);
    color: var(--oz-primary); font-size: 12px;
}
.form-section-body { padding: 18px 16px; }
.form-section-body > .row { --bs-gutter-y: 14px; }

/* Sticky save bar for full-page forms. */
.form-bar {
    position: sticky; inset-block-end: 0; margin-block-start: 4px;
    padding: 11px 14px; display: flex; gap: 9px; align-items: center;
    background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(12px);
    border: 1px solid var(--oz-border); border-radius: var(--oz-radius);
    box-shadow: var(--oz-shadow-sm); z-index: 20;
}
.form-bar.is-stuck { box-shadow: var(--oz-shadow-lg); border-color: var(--oz-border-strong); }
.form-bar .spacer { margin-inline-start: auto; }

/* ------------------------------------------------------ custom switch --- */
/* Replaces Bootstrap's .form-switch. Hidden real checkbox + 38×22 track. */

.oz-switch {
    position: relative; display: inline-flex; align-items: center; gap: 10px; margin: 0;
    min-height: 22px; cursor: pointer; user-select: none; vertical-align: middle;
    font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--oz-text);
}
.oz-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.oz-switch-track {
    position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px;
    background: var(--oz-border-strong); transition: background-color .16s var(--oz-ease);
}
.oz-switch-track::after {
    content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
    width: 16px; height: 16px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 2px rgba(19,22,28,.3), 0 0 0 1px rgba(19,22,28,.04);
    transition: transform .16s var(--oz-ease);
}
.oz-switch:hover .oz-switch-track { background: #c3c9d1; }
.oz-switch input:checked ~ .oz-switch-track { background: var(--oz-primary); }
.oz-switch:hover input:checked ~ .oz-switch-track { background: var(--oz-primary-dark); }
.oz-switch input:checked ~ .oz-switch-track::after { transform: translateX(16px); }
[dir="rtl"] .oz-switch input:checked ~ .oz-switch-track::after { transform: translateX(-16px); }
.oz-switch:active .oz-switch-track::after { width: 18px; }
.oz-switch input:focus-visible ~ .oz-switch-track { outline: 2px solid var(--oz-primary); outline-offset: 2px; }
.oz-switch input:disabled ~ .oz-switch-track { opacity: .5; }
.oz-switch-label { flex: 1 1 auto; }
/* Grid-aligned wrapper: a switch column is exactly as tall as an input column. */
.oz-switch-field .oz-switch-spacer { display: block; visibility: hidden; }
.oz-switch-box { display: flex; align-items: center; font-size: 14px; line-height: 1.5;
    min-height: max(var(--oz-control-h), calc(1.5em + 20px)); }
@media (prefers-reduced-motion: reduce) { .oz-switch-track, .oz-switch-track::after { transition: none; } }

/* -------------------------------------------------------------- modals --- */
/* Kept for dialogs that remain modal by nature (the cropper, confirmations).
   Add/edit forms now live on their own pages, not here. */

.modal-content { border: 0; border-radius: var(--oz-radius); box-shadow: var(--oz-shadow-lg); }
.modal-header { border-block-end: 1px solid var(--oz-border); padding: 14px 18px; }
.modal-title { font-size: 15px; font-weight: 800; }
.modal-body { padding: 18px; }

/* --------------------------------------------------------- empty state --- */

.empty-state { text-align: center; padding: 44px 20px; color: var(--oz-text-muted); }
.empty-state i { font-size: 34px; color: var(--oz-border-strong); margin-block-end: 12px; display: block; }
.empty-state h5 { font-size: 15px; font-weight: 800; color: var(--oz-text); margin-block-end: 5px; }
.empty-state p { font-size: 13px; max-width: 380px; margin: 0 auto 14px; }

/* --------------------------------------------------------------- login --- */

.login-page {
    min-height: 100vh; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f6f7f8 55%, #ecfdf5 100%);
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--oz-surface);
    border: 1px solid var(--oz-border);
    border-radius: 14px;
    box-shadow: var(--oz-shadow-lg);
    padding: 32px 30px;
}
.login-logo { text-align: center; margin-block-end: 22px; }
.login-logo img { height: 46px; }
.login-logo .mark {
    width: 52px; height: 52px; margin: 0 auto 12px;
    border-radius: 14px; background: var(--oz-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.login-title { font-size: 18px; font-weight: 800; text-align: center; margin-block-end: 4px; }
.login-sub { font-size: 13px; color: var(--oz-text-muted); text-align: center; margin-block-end: 22px; }
.login-foot { text-align: center; font-size: 12px; color: var(--oz-text-faint); margin-block-start: 20px; }

/* ------------------------------------------------------------ upgrade --- */

.upgrade-box {
    text-align: center; padding: 46px 24px; max-width: 480px; margin: 40px auto;
    background: var(--oz-surface); border: 1px solid var(--oz-border);
    border-radius: var(--oz-radius); box-shadow: var(--oz-shadow-sm);
}
.upgrade-box i { font-size: 34px; color: var(--oz-warning); margin-block-end: 14px; display: block; }

/* ------------------------------------------------------------- copilot --- */

.copilot-panel {
    position: fixed; inset-block: 0; inset-inline-end: 0;
    width: 420px; max-width: 100vw;
    background: var(--oz-surface);
    border-inline-start: 1px solid var(--oz-border);
    box-shadow: var(--oz-shadow-lg);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .22s var(--oz-ease);
    z-index: 1050;
}
html[dir="rtl"] .copilot-panel { transform: translateX(-100%); }
.copilot-panel.open { transform: none; }

.copilot-head {
    padding: 13px 16px; border-block-end: 1px solid var(--oz-border);
    display: flex; align-items: center; gap: 9px; font-weight: 800;
}
.copilot-body { flex: 1; overflow-y: auto; padding: 16px; }
.copilot-foot { padding: 12px 14px; border-block-start: 1px solid var(--oz-border); }

.chat-msg { margin-block-end: 14px; display: flex; gap: 9px; }
.chat-msg .who {
    width: 27px; height: 27px; border-radius: 7px; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.chat-msg.user .who      { background: var(--oz-surface-2);      color: var(--oz-text-muted); }
.chat-msg.assistant .who { background: var(--oz-primary-soft); color: var(--oz-primary); }
.chat-bubble { font-size: 13.5px; line-height: 1.6; min-width: 0; }
.chat-bubble p:last-child { margin-block-end: 0; }
.chat-bubble table { width: 100%; font-size: 12.5px; margin: 8px 0; }
.chat-bubble th, .chat-bubble td { padding: 4px 7px; border-block-end: 1px solid var(--oz-border); }
.chat-tool {
    font-size: 11.5px; color: var(--oz-text-faint);
    display: flex; align-items: center; gap: 6px; margin-block-end: 7px;
}
.chat-suggest {
    display: block; width: 100%; text-align: start;
    border: 1px solid var(--oz-border); background: var(--oz-surface);
    border-radius: var(--oz-radius-sm); padding: 9px 11px;
    font-size: 13px; color: var(--oz-text); margin-block-end: 7px;
}
.chat-suggest:hover { background: var(--oz-primary-soft); border-color: var(--oz-primary); }

.ai-note {
    font-size: 11.5px; color: var(--oz-text-faint);
    text-align: center; margin-block-start: 8px;
}

/* --------------------------------------------------------- call list --- */

.call-card {
    background: var(--oz-surface); border: 1px solid var(--oz-border);
    border-radius: var(--oz-radius); padding: 14px 16px; margin-block-end: 11px;
    display: flex; gap: 13px; align-items: flex-start;
}
.call-rank {
    width: 27px; height: 27px; border-radius: 50%; flex: none;
    background: var(--oz-primary-soft); color: var(--oz-primary-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 12px;
}
.call-body { flex: 1; min-width: 0; }
.call-name { font-weight: 800; font-size: 14.5px; }
.call-reason { font-size: 13px; color: var(--oz-text-muted); margin-block: 3px 8px; }
.call-msg {
    background: var(--oz-surface-2); border-radius: var(--oz-radius-sm);
    padding: 9px 11px; font-size: 12.5px; color: var(--oz-text);
    white-space: pre-wrap; margin-block-end: 9px;
}
.call-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* -------------------------------------------------------------- misc --- */

/* Insight cards carry a severity, shown as a small colour-coded dot beside the
   title rather than a full-height left stripe (which read as a template accent
   with no meaning). Dot colour = severity: info / warning / danger. */
.insight-card {
    position: relative;
    background: var(--oz-surface); border: 1px solid var(--oz-border);
    border-radius: var(--oz-radius-sm);
    padding: 12px 14px; margin-block-end: 10px; box-shadow: var(--oz-shadow-sm);
}
.insight-title { font-weight: 800; font-size: 13.5px; padding-inline-start: 16px; }
.insight-title::before {
    content: ''; position: absolute; inset-inline-start: 14px; inset-block-start: 17px;
    width: 8px; height: 8px; border-radius: 50%; background: var(--oz-info);
}
.insight-card.sev-2 .insight-title::before { background: var(--oz-warning); }
.insight-card.sev-3 .insight-title::before { background: var(--oz-danger); }
.insight-detail { font-size: 13px; color: var(--oz-text-muted); margin-block-start: 3px; }

/* Cropper widget. */
.crop-preview {
    width: 130px; height: 130px; border: 1px dashed var(--oz-border-strong);
    border-radius: var(--oz-radius-sm); overflow: hidden; background: var(--oz-surface-2);
    display: flex; align-items: center; justify-content: center;
}
.crop-preview img { width: 100%; height: 100%; object-fit: cover; }
.crop-stage {
    height: min(56vh, 420px); display: flex; align-items: center; justify-content: center;
    background: var(--oz-surface-3); border: 1px solid var(--oz-border);
    border-radius: var(--oz-radius); overflow: hidden;
}
.crop-stage .cropper-view-box { outline-color: var(--oz-primary); }
.crop-tools { display: flex; align-items: center; gap: 8px; margin-block-start: 12px; }
.crop-zoom { flex: 1; accent-color: var(--oz-primary); height: 4px; }

.section-sub {
    font-size: 11.5px; font-weight: 800; letter-spacing: .05em;
    text-transform: uppercase; color: var(--oz-text-faint);
    margin: 20px 0 10px;
}

/* ------------------------------------------------ interactivity & motion --- */
/* Tasteful life for an operations tool — orchestrated entrance, hover feedback
   and smooth state changes. Nothing decorative; it makes the panel feel modern
   and responsive to the touch. Motion is disabled under prefers-reduced-motion
   (see the block at the very end). */

/* Orchestrated page entrance: each top-level block rises in, lightly staggered.
   Cheap (opacity + transform only) and finishes visible even if JS never runs. */
@keyframes oz-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.main-content > * { animation: oz-enter .42s var(--oz-ease) both; }
.main-content > :nth-child(1) { animation-delay: .02s; }
.main-content > :nth-child(2) { animation-delay: .07s; }
.main-content > :nth-child(3) { animation-delay: .12s; }
.main-content > :nth-child(4) { animation-delay: .17s; }
.main-content > :nth-child(5) { animation-delay: .22s; }
.main-content > :nth-child(n+6) { animation-delay: .26s; }
/* The stat grid runs its own per-tile stagger, so don't double-animate it. */
.main-content > .stat-grid { animation: none; }

/* Sidebar: a subtle nudge on hover and a springy active rail. */
.sidebar-menu a { transition: background .14s var(--oz-ease), color .14s var(--oz-ease), padding-inline-start .14s var(--oz-ease); }
.sidebar-menu a:hover { padding-inline-start: 13px; }
.sidebar-menu a i:first-child { transition: transform .16s var(--oz-ease); }
.sidebar-menu a:hover i:first-child { transform: scale(1.12); }
.sidebar-menu a.active::before { animation: oz-rail .28s var(--oz-ease) both; }
@keyframes oz-rail { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Table rows: smooth hover, and the row lifts its actions in gently. */
table.dataTable tbody tr { transition: background .14s var(--oz-ease), box-shadow .14s var(--oz-ease); }
table.dataTable tbody tr:hover { box-shadow: inset 3px 0 0 var(--oz-primary); }
.row-actions .btn { transition: transform .12s var(--oz-ease), background .12s var(--oz-ease), color .12s var(--oz-ease), border-color .12s var(--oz-ease); }
table.dataTable tbody tr:hover .row-actions .btn { transform: translateY(-1px); }

/* Form sections lift a touch on focus-within, so the active section stands out. */
.form-section { transition: box-shadow .2s var(--oz-ease), border-color .2s var(--oz-ease); }
.form-section:focus-within { box-shadow: var(--oz-shadow); border-color: var(--oz-primary-line); }

/* Stat / section icon tiles get a gentle press response through their card. */
.form-section-head > i, .card-header > i.head-ico { transition: transform .18s var(--oz-ease); }
.form-section:focus-within .form-section-head > i { transform: scale(1.06); }

/* Empty-state icon breathes so a blank screen doesn't feel dead. */
.empty-state i { animation: oz-float 3.2s var(--oz-ease) infinite; }
@keyframes oz-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* Primary action buttons get a soft glow lift on hover (refines the base rule). */
.btn-primary { transition: transform .12s var(--oz-ease), background .14s var(--oz-ease), box-shadow .2s var(--oz-ease); }
.btn-primary:hover { transform: translateY(-1px); }

/* Pills/badges pop slightly on row hover for scannability. */
table.dataTable tbody tr:hover .pill { transform: translateY(-1px); }
.pill { transition: transform .12s var(--oz-ease); }

/* ------------------------------------------------------------ bold theme --- */
/* The premium/modern pass, applied to every admin + super-admin page: rounder
   cards with a soft floating shadow, gradient-washed KPI tiles (icon on top,
   big number, an accent glow auto-tinted to each tile's own colour via :has),
   chip header icons, and slightly larger titles. Layered after the base rules
   so it overrides them; delete this block to return to the flat look. */

.page-title { font-size: 24px; }

/* Cards: rounder + a deeper, soft floating shadow. */
.card { border-radius: 16px; box-shadow: 0 1px 2px rgba(19,22,28,.04), 0 16px 36px -18px rgba(19,22,28,.16); }
.card:hover { box-shadow: 0 2px 4px rgba(19,22,28,.05), 0 22px 46px -18px rgba(19,22,28,.22); }
.card-header { padding: 15px 18px; }
.card-header h5 { font-size: 14px; }
.card-body { padding: 18px; }
/* Soft rounded chip behind a card-header's leading icon. */
.card-header h5 > i:first-child {
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border-radius: 10px; background: var(--oz-surface-2);
    font-size: 13px; margin-inline-end: 9px !important; vertical-align: -8px;
}

/* KPI tiles: icon on top, big number, accent glow tinted to the tile's colour. */
.stat-grid { gap: 16px; }
.stat-card {
    flex-direction: column; align-items: flex-start; gap: 14px;
    padding: 18px; min-height: 118px; border-radius: 16px;
    box-shadow: 0 1px 2px rgba(19,22,28,.04), 0 14px 32px -16px rgba(19,22,28,.18);
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; z-index: 0;
    inset-block-start: -55px; inset-inline-end: -35px;
    width: 150px; height: 150px; border-radius: 50%;
    background: radial-gradient(closest-side, var(--oz-primary-soft), transparent);
    opacity: .85; pointer-events: none;
}
.stat-card:has(.stat-icon.bg-success-subtle)::after { background: radial-gradient(closest-side, var(--oz-success-soft), transparent); }
.stat-card:has(.stat-icon.bg-info-subtle)::after    { background: radial-gradient(closest-side, var(--oz-info-soft), transparent); }
.stat-card:has(.stat-icon.bg-warning-subtle)::after { background: radial-gradient(closest-side, var(--oz-warning-soft), transparent); }
.stat-card:has(.stat-icon.bg-danger-subtle)::after  { background: radial-gradient(closest-side, var(--oz-danger-soft), transparent); }
.stat-card > * { position: relative; z-index: 1; }   /* content above the glow */
.stat-icon { width: 46px; height: 46px; font-size: 19px; border-radius: 13px; }
.stat-body { width: 100%; }
.stat-value { font-size: 28px; letter-spacing: -.04em; }

/* Forms adopt the same rounder language. */
.form-section { border-radius: 14px; }

/* Insight cards + tappable list rows pick up the rounder, tactile treatment. */
.insight-card { border-radius: 12px; }
.card-body > a.d-flex { border-radius: 10px; padding-inline: 8px; transition: background .14s var(--oz-ease); }
.card-body > a.d-flex:hover { background: var(--oz-surface-2); }

/* Balanced rows: a card that is the ONLY card in its column fills the column's
   height, so side-by-side cards in a `.row` match the tallest and the page
   reads as an even grid instead of a ragged one. Columns that stack several
   cards are untouched (the :only-child guard), and a lone card in a full-width
   row simply keeps its content height. */
.main-content .row > [class*="col-"] > .card:only-child { height: 100%; margin-block-end: 0; }
.main-content .row > [class*="col-"] > .form-section:only-child { height: 100%; margin-block-end: 0; }

/* --------------------------------------------------- overflow safety --- */
/* Content grows over time — long names, big numbers, more branches. None of it
   may change a card's height relative to its siblings or spill past its box.
   Names/titles ellipsize; multi-line copy clamps; numbers stay on one line and
   scale down rather than reflow. Purely defensive — no visual change until
   something would actually have overflowed. */

/* Flex children must be allowed to shrink before their text can ellipsize. */
.cell-main, .call-card, .call-body, .stat-card, .stat-body,
.form-section-head, .page-head > div, .insight-card { min-width: 0; }
.cell-main > *, .call-body > *, .stat-body > * { min-width: 0; }

/* Single-line labels: ellipsize instead of wrapping or overflowing. */
.cell-title, .cell-sub, .call-name,
.stat-label, .form-section-head h3, .card-header h5 {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}

/* Big numbers stay on one line; if a value ever outgrows its cell it clips
   cleanly at the edge rather than breaking the grid row. */
.stat-value, .num, .money { white-space: nowrap; }
.stat-value { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Pills/badges never wrap mid-label. */
.pill, .badge { white-space: nowrap; }

/* Titles can be long — wrap them rather than pushing the action buttons off. */
.page-title { overflow-wrap: anywhere; }

/* Two-line clamp for descriptive copy (reason lines, insight detail, notes). */
.call-reason, .insight-detail, .clamp-2 {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.clamp-1 {
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Table cells: a long value truncates within the cell instead of stretching
   the column and shoving the row's other cells around. */
table.dataTable td .cell-main { max-width: 320px; }

/* Some list columns render a bare .cell-title straight into the cell (a name,
   number or label with no .cell-main avatar wrapper). Cap it too, otherwise its
   nowrap+ellipsis still lets the column grow to the text's full width. Block-
   level cell-titles only — inline anchors are unaffected and unchanged. */
table.dataTable td > .cell-title,
table.dataTable td > .cell-sub { max-width: 320px; }

/* Insight cards (dashboard insights, stock alerts, growth panels): the text
   column must be allowed to shrink and a long unbroken value must break rather
   than push the card's trailing action buttons out of the box. */
.insight-card > * { min-width: 0; }
.insight-title { overflow-wrap: anywhere; }

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 991.98px) {
    body { padding-inline-start: 0; }
    .sidebar { transform: translateX(-100%); }
    html[dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.show { transform: none; }
    .sidebar-toggle { display: inline-flex; }
    .topbar-branch { display: none; }
    .main-content { padding: 16px 14px 60px; --oz-gap: 14px; }
    .copilot-panel { width: 100%; }
}

@media (max-width: 575.98px) {
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .stat-value { font-size: 18px; }
    .page-title { font-size: 18px; }
}

@media print {
    .topbar, .sidebar, .page-actions, .copilot-panel, .impersonation-bar, .form-bar { display: none !important; }
    body { padding: 0; background: #fff; }
    .card { box-shadow: none; border-color: #ccc; }
}

/* Respect a user's reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* -----------------------------------------------------------------------------
   Widget kit — KPI card with sparkline (statSpark), token-themed ApexCharts.
   The sparkline sits flush at the bottom of the card; value + trend on top.
--------------------------------------------------------------------------- */
.stat-card--spark { position: relative; display: block; padding-bottom: 4px; overflow: hidden; }
.stat-card--spark .stat-body { position: relative; z-index: 1; }
.stat-card--spark .stat-spark { margin: 6px -6px -14px; min-height: 56px; }
.stat-trend { font-size: 12px; font-weight: 700; margin-inline-start: 4px; }
.stat-trend.text-success::before { content: "\2197\FE0E"; margin-inline-end: 2px; }
.stat-trend.text-danger::before  { content: "\2198\FE0E"; margin-inline-end: 2px; }
/* Apex tooltip: match the card surface + hairline, not Apex's default white box. */
.apexcharts-tooltip { background: var(--oz-surface) !important; border: 1px solid var(--oz-border) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.12) !important; color: var(--oz-text) !important; border-radius: 10px !important; }
.apexcharts-tooltip-title { background: var(--oz-surface-2) !important; border-bottom: 1px solid var(--oz-border) !important;
  font-family: var(--oz-font) !important; font-weight: 700 !important; }

/* =============================================================================
   WIDGET KIT — pricing · invoice · product · timeline · chat
   Token-themed, RTL-safe, enhanced over the source template. See admin/widgets.php
============================================================================= */

/* ---- Pricing / plan cards ------------------------------------------------- */
.oz-pricing { display: grid; grid-template-columns: repeat(var(--pcols,3), minmax(0,1fr)); gap: 18px; }
@media (max-width: 900px){ .oz-pricing { grid-template-columns: 1fr; } }
.oz-price-card { position: relative; background: var(--oz-surface); border: 1px solid var(--oz-border);
  border-radius: 18px; padding: 26px 22px; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s, border-color .2s; }
.oz-price-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(20,20,40,.10); }
.oz-price-card.is-popular { border-color: var(--oz-primary); box-shadow: 0 18px 44px rgba(79,70,229,.16);
  background: linear-gradient(180deg, var(--oz-primary-soft) 0%, var(--oz-surface) 42%); }
.oz-price-card.is-current { border-color: var(--oz-success); }
.oz-price-badge { position: absolute; inset-inline-end: 18px; top: -12px; background: var(--oz-primary); color:#fff;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 5px 12px; border-radius: 20px; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.oz-price-name { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.oz-price-tag { color: var(--oz-text-muted); font-size: 13px; margin-top: 2px; }
.oz-price-amount { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 16px 0 4px; }
.oz-price-period { font-size: 14px; font-weight: 600; color: var(--oz-text-muted); }
.oz-price-feats { list-style: none; padding: 0; margin: 14px 0 20px; display: flex; flex-direction: column; gap: 10px; }
.oz-price-feats li { font-size: 13.5px; display: flex; gap: 9px; align-items: flex-start; }
.oz-price-feats li i { margin-top: 3px; color: var(--oz-success); font-size: 12px; }
.oz-price-feats li.is-off { color: var(--oz-text-muted); }
.oz-price-feats li.is-off i { color: var(--oz-text-faint); }
.oz-price-cta { margin-top: auto; width: 100%; border-radius: 12px; font-weight: 700; padding: 11px;
  background: var(--oz-surface-2); color: var(--oz-text); border: 1px solid var(--oz-border); }
.oz-price-card.is-popular .oz-price-cta { background: var(--oz-primary); color:#fff; border-color: var(--oz-primary); }
.oz-price-cta:hover { filter: brightness(.97); }

/* ---- Invoice / receipt ---------------------------------------------------- */
.oz-invoice { background: var(--oz-surface); border: 1px solid var(--oz-border); border-radius: 16px; padding: 26px; max-width: 720px; }
.oz-inv-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--oz-border); }
.oz-inv-brand { display: flex; gap: 12px; align-items: center; }
.oz-inv-logo { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.oz-inv-bname { font-weight: 800; font-size: 17px; }
.oz-inv-bsub { color: var(--oz-text-muted); font-size: 12.5px; }
.oz-inv-title { font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--oz-primary); }
.oz-inv-num { font-weight: 700; } .oz-inv-date { color: var(--oz-text-muted); font-size: 13px; }
.oz-inv-parties { display: flex; gap: 40px; flex-wrap: wrap; padding: 16px 0; font-size: 13.5px; }
.oz-inv-plabel { color: var(--oz-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.oz-inv-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13.5px; }
.oz-inv-table th { text-align: start; color: var(--oz-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 8px; border-bottom: 1px solid var(--oz-border); }
.oz-inv-table td { padding: 11px 8px; border-bottom: 1px solid var(--oz-surface-2); }
.oz-inv-linesub { color: var(--oz-text-muted); font-size: 12px; }
.oz-inv-totals { margin: 14px 0 0; margin-inline-start: auto; max-width: 300px; }
.oz-inv-totrow { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.oz-inv-totrow.oz-inv-grand { border-top: 2px solid var(--oz-border); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 17px; }
.oz-inv-notes { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--oz-border); color: var(--oz-text-muted); font-size: 13px; }

/* ---- Product / service card ---------------------------------------------- */
.oz-product { background: var(--oz-surface); border: 1px solid var(--oz-border); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.oz-product:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(20,20,40,.10); }
.oz-product-media { position: relative; aspect-ratio: 4/3; background: var(--oz-surface-2); overflow: hidden; }
.oz-product-media img { width: 100%; height: 100%; object-fit: cover; }
.oz-product-noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--oz-text-faint); font-size: 30px; }
.oz-product-badge { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--oz-primary); color:#fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.oz-product.is-soldout .oz-product-media { filter: grayscale(.7); opacity: .7; }
.oz-product-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.oz-product-name { font-weight: 700; font-size: 14.5px; }
.oz-product-sub { color: var(--oz-text-muted); font-size: 12.5px; }
.oz-product-rating { color: #f59e0b; font-size: 12px; }
.oz-product-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.oz-product-price .oz-old { color: var(--oz-text-faint); text-decoration: line-through; font-size: 12.5px; margin-inline-end: 6px; }
.oz-product-price .oz-new { font-weight: 800; font-size: 16px; }
.oz-product-cta { border: none; background: var(--oz-primary); color:#fff; width: 36px; height: 36px; border-radius: 10px;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.oz-product-cta:hover { filter: brightness(1.05); color:#fff; }
.oz-product-out { color: var(--oz-text-muted); font-size: 12.5px; font-weight: 600; }

/* ---- Timeline ------------------------------------------------------------- */
.oz-timeline { position: relative; padding-inline-start: 8px; }
.oz-tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 20px; }
.oz-tl-item::before { content: ""; position: absolute; inset-inline-start: 15px; top: 30px; bottom: -6px; width: 2px; background: var(--oz-border); }
.oz-tl-item:last-child::before { display: none; }
.oz-tl-dot { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; font-size: 13px; z-index: 1; }
.oz-tl-body { padding-top: 4px; min-width: 0; }
.oz-tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.oz-tl-title { font-weight: 700; font-size: 14px; }
.oz-tl-time { color: var(--oz-text-muted); font-size: 12px; }
.oz-tl-text { color: var(--oz-text-muted); font-size: 13px; margin-top: 2px; }

/* ---- Chat bubbles (reusable across inbox / app previews) ------------------- */
.oz-bubble { max-width: 76%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; margin-bottom: 8px; word-wrap: break-word; }
.oz-bubble .oz-bubble-who { font-size: 11px; font-weight: 700; opacity: .7; margin-bottom: 2px; }
.oz-bubble .oz-bubble-time { font-size: 10.5px; opacity: .6; margin-top: 3px; text-align: end; }
.oz-bubble.is-them { background: var(--oz-surface); border: 1px solid var(--oz-border); border-bottom-inline-start-radius: 4px; margin-inline-end: auto; }
.oz-bubble.is-mine { background: var(--oz-primary); color:#fff; border-bottom-inline-end-radius: 4px; margin-inline-start: auto; }
.oz-bubble.is-ai { background: #0ea5a4; color:#fff; }

/* =============================================================================
   RECHARGE / WALLET — balance hero + amount-preset chips (AI credit, WhatsApp).
   Shared by the top-up screens; token-themed so dark mode + RTL come for free.
============================================================================= */
.oz-wallet-hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--oz-border); border-radius: var(--oz-radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--oz-primary-soft) 0%, transparent 55%),
    linear-gradient(180deg, var(--oz-surface) 0%, var(--oz-surface) 100%);
  padding: 22px 24px;
}
.oz-wallet-hero.is-empty {
  background:
    radial-gradient(120% 140% at 100% 0%, var(--oz-danger-soft) 0%, transparent 58%),
    var(--oz-surface);
  border-color: var(--oz-danger-line);
}
.oz-wallet-hero .oz-wallet-icon {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
}
.oz-wallet-label { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--oz-text-faint); }
.oz-wallet-value { font-size: 40px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.oz-wallet-value.is-empty { color: var(--oz-danger); }
.oz-wallet-unit { font-size: 15px; font-weight: 600; color: var(--oz-text-muted); letter-spacing: 0; }
.oz-wallet-approx { font-size: 13px; color: var(--oz-text-muted); }

/* Amount-preset chips */
.oz-amt-chips { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
@media (max-width: 420px){ .oz-amt-chips { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.oz-amt-chip {
  border: 1.5px solid var(--oz-border); background: var(--oz-surface); color: var(--oz-text);
  border-radius: 12px; padding: 12px 8px; cursor: pointer; text-align: center;
  transition: border-color .15s var(--oz-ease), background .15s var(--oz-ease), transform .12s var(--oz-ease);
  min-width: 0;
}
.oz-amt-chip:hover { border-color: var(--oz-primary-line); transform: translateY(-2px); }
.oz-amt-chip.is-active { border-color: var(--oz-primary); background: var(--oz-primary-soft); box-shadow: var(--oz-ring); }
.oz-amt-chip .oz-amt-main { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.oz-amt-chip .oz-amt-sub { font-size: 11px; color: var(--oz-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Money history list rows (top-ups + usage) */
.oz-money-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--oz-surface-2); }
.oz-money-row:last-child { border-bottom: 0; }
.oz-money-row .oz-money-main { min-width: 0; }
.oz-money-row .oz-money-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oz-money-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* WhatsApp: connection strip + business-profile editor */
.oz-conn-strip { display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--oz-success-line); background: var(--oz-success-soft); border-radius: var(--oz-radius); }
.oz-conn-icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 20px; }
.oz-conn-empty { padding: 4px 0; }
.oz-section-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--oz-text-faint); }
.oz-profile-photo { width: 100%; max-width: 168px; aspect-ratio: 1 / 1; height: auto; border-radius: 50%;
  overflow: hidden; border: 1px solid var(--oz-border); background: var(--oz-surface-2); }
.oz-profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.oz-topup-preview { border: 1px solid var(--oz-border); border-radius: var(--oz-radius); padding: 12px 14px;
  font-size: 13.5px; font-variant-numeric: tabular-nums; background: var(--oz-surface-2); }
.oz-topup-preview > div + div { margin-top: 4px; }

/* Saved payment card */
.oz-paycard {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--oz-border); border-radius: var(--oz-radius); padding: 16px;
  background: linear-gradient(120deg, var(--oz-surface-2) 0%, var(--oz-surface) 60%);
}
.oz-paycard .oz-paycard-brand { font-size: 30px; color: var(--oz-text); flex: none; }

/* =============================================================================
   AUTH — premium split-screen sign-in (admin + super). Token-themed, RTL-safe,
   atmospheric brand panel + clean form. Replaces the old .login-card look.
============================================================================= */
/* padding:0 is load-bearing — the global `body` rule pads for the fixed topbar
   + sidebar (--oz-topbar-h / --oz-sidebar-w). The login has neither, so without
   this reset the whole shell is shoved down-and-in and never fills the screen. */
.auth-page { margin: 0; padding: 0; min-height: 100vh; background: var(--oz-canvas, #f4f5f7); font-family: var(--oz-font, 'Manrope', system-ui, sans-serif); color: var(--oz-text, #1f2430); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
@media (max-width: 860px){ .auth-shell { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* Brand / atmosphere panel */
.auth-aside { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  padding: 56px; color: #fff;
  background: linear-gradient(150deg, var(--oz-primary, #4f46e5) 0%, var(--oz-primary-dark, #3730a3) 55%, #1e1b4b 100%); }
/* fine dotted texture, faded out toward the bottom, for depth */
.auth-aside::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(160deg, #000, transparent 78%); mask-image: linear-gradient(160deg, #000, transparent 78%); }
.auth-aside-glow { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% 15%, rgba(255,255,255,.18), transparent 60%),
    radial-gradient(500px 500px at 10% 90%, rgba(20,184,166,.30), transparent 60%);
  animation: authGlow 14s ease-in-out infinite alternate; }
@keyframes authGlow { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(0,-14px,0) scale(1.06); } }
.auth-brand { position: relative; z-index: 1; max-width: 420px; }
.auth-logo { width: 74px; height: 74px; border-radius: 18px; object-fit: cover; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.auth-mark { width: 74px; height: 74px; border-radius: 18px; display: grid; place-items: center; font-size: 30px;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.auth-brand-name { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 26px 0 8px; line-height: 1.1; }
.auth-brand-tag { font-size: 16px; opacity: .82; line-height: 1.6; }
.auth-aside-foot { position: relative; z-index: 1; margin-top: auto; font-size: 12.5px; opacity: .6; letter-spacing: .04em; }

/* Feature rows under the brand block */
.auth-feats { position: relative; z-index: 1; margin-top: 34px; display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.auth-feat { display: flex; align-items: center; gap: 12px; font-size: 14.5px; opacity: .92; }
.auth-feat i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 14px;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px); flex: none; }

/* Form panel */
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px;
  background: radial-gradient(760px 520px at 72% -12%, var(--oz-primary-soft, #eef2ff), transparent 62%); }
.auth-form { width: 100%; max-width: 392px; position: relative; overflow: hidden;
  background: var(--oz-surface, #fff); border: 1px solid var(--oz-border, #e4e6ea); border-radius: 20px;
  padding: 34px 32px; box-shadow: 0 26px 64px -28px rgba(20,20,60,.34);
  animation: authRise .5s cubic-bezier(.2,.7,.2,1) both; }
.auth-form::before { content: ''; position: absolute; inset-block-start: 0; inset-inline: 0; height: 4px;
  background: linear-gradient(90deg, var(--oz-primary, #4f46e5), #14b8a6); }
@keyframes authRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-form-head { margin-bottom: 26px; }
.auth-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.auth-sub { color: var(--oz-text-muted, #6b7280); margin: 6px 0 0; }
.auth-field { margin-bottom: 16px; }
.auth-field .form-label { font-size: 13px; font-weight: 600; color: var(--oz-text-muted, #6b7280); margin-bottom: 6px; }
.auth-input { position: relative; display: flex; align-items: center; }
.auth-input > i { position: absolute; inset-inline-start: 14px; color: var(--oz-text-faint, #9aa0ad); font-size: 14px; pointer-events: none; }
.auth-input .form-control { height: 48px; border-radius: 12px; padding-inline-start: 42px; padding-inline-end: 42px;
  border: 1px solid var(--oz-border, #e4e6ea); background: var(--oz-surface, #fff); font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.auth-input .form-control:focus { border-color: var(--oz-primary, #4f46e5); box-shadow: 0 0 0 4px var(--oz-primary-soft, #eef2ff); }
.auth-eye { position: absolute; inset-inline-end: 8px; background: none; border: none; color: var(--oz-text-faint, #9aa0ad); padding: 8px; cursor: pointer; }
.auth-eye.on { color: var(--oz-primary, #4f46e5); }
.auth-submit { height: 48px; border-radius: 12px; font-weight: 700; font-size: 15px; margin-top: 6px;
  box-shadow: 0 10px 24px rgba(79,70,229,.28); transition: transform .12s, box-shadow .12s; }
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(79,70,229,.34); }
.auth-foot { margin-top: 22px; text-align: center; }
.auth-foot a { color: var(--oz-text-muted, #6b7280); text-decoration: none; font-size: 13.5px; }
.auth-foot a:hover { color: var(--oz-primary, #4f46e5); }
/* Super variant: slate/indigo brand, "Ozyn" wordmark */
.auth-aside.is-super { background: linear-gradient(150deg, #1e293b 0%, #312e81 60%, #4f46e5 100%); }

/* Small screens: the brand panel is hidden, so give the card a touch more room. */
@media (max-width: 860px){ .auth-form { max-width: 420px; } }

/* Respect the quality gate — no entrance/ambient motion when asked to reduce it. */
@media (prefers-reduced-motion: reduce){
  .auth-aside-glow { animation: none; }
  .auth-form { animation: none; }
}

/* -----------------------------------------------------------------------------
   Copilot / AI markdown answers (.md-body)
   Rendered from the model's markdown by ozRenderMarkdown(). Kept compact and
   themed so headings, lists, tables and code fit the admin surface. RTL-safe.
   -------------------------------------------------------------------------- */
.md-body { font-size: 14px; line-height: 1.6; color: var(--oz-text, #1f2430); word-break: break-word; }
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  margin: 1em 0 .5em; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; color: var(--oz-text, #1f2430); }
.md-body h1 { font-size: 1.35em; }
.md-body h2 { font-size: 1.2em; }
.md-body h3 { font-size: 1.08em; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 1em; }
.md-body p { margin: 0 0 .7em; }
.md-body ul, .md-body ol { margin: 0 0 .7em; padding-inline-start: 1.4em; }
.md-body li { margin-bottom: .25em; }
.md-body li > ul, .md-body li > ol { margin-bottom: 0; }
.md-body a { color: var(--oz-primary, #4f46e5); text-decoration: underline; }
.md-body strong { font-weight: 700; }
.md-body blockquote {
  margin: 0 0 .7em; padding: .3em .9em; color: var(--oz-text-muted, #6b7280);
  border-inline-start: 3px solid var(--oz-primary-line, #c7d2fe); background: var(--oz-surface-2, #f6f7f9); border-radius: 6px; }
.md-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
  background: var(--oz-surface-2, #f6f7f9); padding: .12em .4em; border-radius: 5px; }
.md-body pre {
  margin: 0 0 .7em; padding: .7em .9em; overflow-x: auto; border-radius: 8px;
  background: var(--oz-surface-2, #f6f7f9); border: 1px solid var(--oz-border, #e5e7eb); }
.md-body pre code { background: none; padding: 0; font-size: .85em; }
.md-body hr { border: 0; border-top: 1px solid var(--oz-border, #e5e7eb); margin: 1em 0; }

/* GFM tables — the main reason the old <br> renderer was unusable. */
.md-body table {
  width: 100%; margin: 0 0 .8em; border-collapse: collapse; font-size: 13px;
  border: 1px solid var(--oz-border, #e5e7eb); border-radius: 8px; overflow: hidden; }
.md-body thead th {
  background: var(--oz-surface-2, #f6f7f9); font-weight: 700; text-align: start;
  color: var(--oz-text, #1f2430); }
.md-body th, .md-body td {
  padding: 7px 10px; border: 1px solid var(--oz-border, #e5e7eb); vertical-align: top; }
.md-body tbody tr:nth-child(even) { background: var(--oz-surface-2, #f6f7f9); }
