/* ============================================================
   Trunked — Luxe layer (2026-11-07). PRESENTATION ONLY.
   Loaded LAST (after trunked-vision.css). To revert completely, delete the
   <link ... trunked-luxe.css> line in includes/layout.php and login.php.
   ============================================================ */
html body {
  --x-r: 18px;
  --x-r-sm: 12px;
  --x-line: color-mix(in srgb, var(--tk-text-primary) 8%, transparent);
  --x-line-2: color-mix(in srgb, var(--tk-text-primary) 15%, transparent);
  --x-tint: color-mix(in srgb, var(--tk-accent) 8%, transparent);
  --x-sh1: 0 1px 2px rgba(11,21,48,.05), 0 4px 14px -6px rgba(11,21,48,.10);
  --x-sh2: 0 2px 4px rgba(11,21,48,.06), 0 18px 36px -18px rgba(11,21,48,.28);
  --x-ease: cubic-bezier(.2,.8,.2,1);
  --x-ok: #12a97f; --x-warn: #e39a1f; --x-bad: #e5484d;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
html:not(.light) body { --x-sh1: 0 1px 2px #0006, 0 6px 16px -8px #000a; --x-sh2: 0 2px 4px #0007, 0 22px 40px -20px #000d; }
html body { background-image: radial-gradient(1100px 420px at 85% -120px, color-mix(in srgb, var(--tk-accent) 9%, transparent), transparent 70%); background-attachment: fixed; }
html { scroll-behavior: smooth; }
html body :focus-visible { outline: 3px solid color-mix(in srgb, var(--tk-accent) 70%, #fff); outline-offset: 2px; border-radius: 8px; }
html body ::selection { background: color-mix(in srgb, var(--tk-accent) 30%, transparent); }
html body * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--tk-text-muted) 55%, transparent) transparent; }

/* ---------- Page header ---------- */
html body .tk-breadcrumb { font-size: .74rem; opacity: .8; margin-bottom: 6px; }
html body .tk-dash-greeting h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); letter-spacing: -.01em; line-height: 1.15; }
html body .tk-dash-greeting p { font-size: .86rem; }

/* ---------- Cards ---------- */
html body .tk-content :is(.tk-card, .tk-stat-card, .tk-kpi-hero-card, .rpt-summary-card, .tk-quick-action-card, .tk-icon-stat-card, .tk-revenue-pair-card) {
  border-radius: var(--x-r); box-shadow: var(--x-sh1); border-color: var(--x-line);
  transition: box-shadow .25s var(--x-ease), transform .25s var(--x-ease), border-color .25s ease;
}
html body .tk-content :is(.tk-stat-card, .tk-kpi-hero-card, .rpt-summary-card, .tk-quick-action-card):hover { box-shadow: var(--x-sh2); transform: translateY(-2px); border-color: var(--x-line-2); }
html body .tk-content .tk-card:hover { box-shadow: var(--x-sh1); transform: none; }
html body .tk-content .tk-card-title-text { font-size: 1rem; font-weight: 700; letter-spacing: -.005em; }
html body .tk-content .tk-card-title-link { font-size: .78rem; font-weight: 650; padding: 5px 11px; border-radius: 999px; background: var(--x-tint); color: var(--tk-accent); text-decoration: none; transition: background .2s ease; }
html body .tk-content .tk-card-title-link:hover { background: color-mix(in srgb, var(--tk-accent) 16%, transparent); }

/* ---------- KPI hero cards ---------- */
html body .tk-content .tk-kpi-hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 18px; align-items: stretch; }
html body .tk-content .tk-kpi-hero-card { display: flex; flex-direction: column; padding: 20px 22px; isolation: isolate; }
html body .tk-content .tk-kpi-hero-card::after { width: 3px; opacity: .75; }
html body .tk-content .tk-kpi-hero-card::before {
  display: block; content: ''; position: absolute; z-index: -1; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tk-kpi-mark, var(--tk-accent)) 16%, transparent), transparent 70%);
  pointer-events: none; opacity: 1; transform: none; left: auto; bottom: auto;
}
html body .tk-content .tk-kpi-hero-card:nth-child(1) { --tk-kpi-mark: #6366f1; }
html body .tk-content .tk-kpi-hero-card:nth-child(2) { --tk-kpi-mark: #3b82f6; }
html body .tk-content .tk-kpi-hero-card:nth-child(3) { --tk-kpi-mark: #12a97f; }
html body .tk-content .tk-kpi-hero-card:nth-child(4) { --tk-kpi-mark: #f59e0b; }
html body .tk-content .tk-kpi-hero-icon { width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--tk-kpi-mark, #6366f1) 80%, transparent); }
html body .tk-content .tk-kpi-hero-value { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.1rem); font-variant-numeric: tabular-nums; word-break: keep-all; }
html body .tk-content .tk-kpi-hero-spark { margin-top: auto; padding-top: 10px; min-height: 36px; }
html body .tk-content .tk-kpi-sub-row { display: flex; gap: 22px; margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--x-line-2); }
html body .tk-content .tk-kpi-sub-row > div div { font-size: .7rem; color: var(--tk-text-muted); margin-top: 2px; font-weight: 550; }
html body .tk-content .tk-goal-bar { margin-top: auto !important; padding-top: 12px; }
html body .tk-content .tk-kpi-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
html body .tk-content .tk-kpi-mini { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--tk-text-primary) 3.5%, transparent); border: 1px solid var(--x-line); }
html body .tk-content .tk-kpi-mini-val { font-size: 1.3rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
html body .tk-content .tk-kpi-mini-lbl { font-size: .7rem; color: var(--tk-text-muted); margin-top: 3px; font-weight: 600; }

/* ---------- Stat cards ---------- */
html body .tk-content .tk-stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
html body .tk-content .tk-stat-value { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); font-variant-numeric: tabular-nums; line-height: 1.1; }

/* ---------- Quick actions ---------- */
html body .tk-content .tk-quick-action-card { border-radius: 14px; }
html body .tk-content .tk-quick-action-icon { border-radius: 12px; box-shadow: 0 8px 14px -8px rgba(0,0,0,.4); }
html body .tk-content .tk-quick-action-label { font-weight: 700; }
html body .tk-content .tk-quick-action-desc { font-size: .76rem; color: var(--tk-text-muted); }

/* ---------- Empty states ---------- */
html body .tk-content .tk-empty, html body .tk-content .tk-card > p:only-child { min-height: 120px; border-radius: 14px; font-size: .88rem; }
html body .tk-content td.tk-empty { display: table-cell; min-height: 0; border: 0; background: none; }
html body .tk-content td.tk-empty::before { display: none; }

/* ---------- Tables ---------- */
html body .tk-content .tk-table-wrap { border-radius: var(--x-r); background: var(--tk-bg-card); }
html body .tk-content .tk-table thead th { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tk-text-secondary); white-space: nowrap; border-bottom: 1px solid var(--x-line-2); }
html body .tk-content .tk-table tbody tr { border-bottom: 1px solid var(--x-line); }
html body .tk-content .tk-table tbody tr:last-child { border-bottom: 0; }
html body .tk-content .tk-table tbody tr:hover { background: var(--x-tint); }
html body .tk-content .tk-table td { font-variant-numeric: tabular-nums; }

/* ---------- Forms and buttons ---------- */
html body :is(.tk-input, .tk-select, .tk-textarea):focus { border-color: var(--tk-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tk-accent) 20%, transparent); outline: none; }
html body :is(.tk-input, .tk-select, .tk-textarea)::placeholder { color: var(--tk-text-muted); opacity: .85; }
html body .tk-btn { border-radius: 12px; font-weight: 650; min-height: 42px; transition: transform .15s var(--x-ease), box-shadow .2s ease, background .2s ease, border-color .2s ease, filter .2s ease; }
html body .tk-btn:active { transform: scale(.97); }
html body .tk-btn[disabled], html body .tk-btn[aria-busy="true"] { opacity: .6; cursor: progress; pointer-events: none; }
html body .tk-btn-success { box-shadow: 0 8px 16px -10px var(--x-ok); }
html body details.tk-card > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; min-height: 28px; }
html body details.tk-card > summary::-webkit-details-marker { display: none; }
html body details.tk-card > summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--tk-accent); border-bottom: 2px solid var(--tk-accent); transform: rotate(-45deg); transition: transform .2s var(--x-ease); flex: none; margin-right: 2px; }
html body details.tk-card[open] > summary::before { transform: rotate(45deg); }
html body .tk-alert { border-radius: 14px; border-width: 1px; box-shadow: var(--x-sh1); }

/* ---------- Sidebar ---------- */
html body .tk-sidebar-logo { padding-bottom: 8px; }
html body .tk-nav { padding-bottom: 12px; }
html body .tk-nav-section-label { padding: 14px 14px 6px; }
html body .tk-nav-item { margin: 1px 8px; transition: background .18s ease, color .18s ease, transform .18s var(--x-ease); }
html body .tk-nav-item:hover:not(.tk-nav-active) { transform: translateX(2px); }
html body .tk-sidebar-bottom { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--tk-bg-sidebar) 92%, var(--tk-accent))); }
html body .tk-bigman-tag { text-align: center; opacity: .5; padding: 4px 0 2px; }
html body .tk-user-card { transition: border-color .2s ease, background .2s ease; }
html body .tk-user-card:hover { border-color: var(--x-line-2); background: var(--x-tint); }

/* ---------- Top bar ---------- */
html body .tk-topbar { background: color-mix(in srgb, var(--tk-bg-secondary) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); box-shadow: 0 1px 0 var(--x-line); }
html body .tk-topbar-search { transition: box-shadow .2s ease, border-color .2s ease, background .2s ease; }
html body .tk-live-clock { background: color-mix(in srgb, var(--tk-text-primary) 3%, transparent); line-height: 1.15; }
html body .tk-clock-time { font-weight: 700; letter-spacing: .02em; }
html body .tk-notif-badge { box-shadow: 0 0 0 2px var(--tk-bg-secondary); }
html body .tk-user-dropdown, html body .tk-notif-dropdown, html body .tk-apps-dropdown { animation: xPop .18s var(--x-ease); transform-origin: top right; }
@keyframes xPop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Modals ---------- */
html body .tk-modal-backdrop { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgba(8,12,28,.55); }
html body .tk-modal { border-radius: 20px; box-shadow: var(--x-sh2); max-height: min(88vh, 900px); overflow: auto; }

/* ---------- Login ---------- */
html body .tk-login-form-card { border-radius: 24px; box-shadow: var(--x-sh2); }
html body .tk-login-heading { letter-spacing: -.01em; }
html body .tk-pin-pad .tk-btn { box-shadow: var(--x-sh1); transition: transform .12s var(--x-ease), background .15s ease; }
html body .tk-pin-pad .tk-btn:hover { background: var(--x-tint); border-color: var(--x-line-2); }
html body .tk-login-hero-img { transform: scale(1.02); }
html body .tk-login-feature { backdrop-filter: blur(6px); }

/* ---------- POS ---------- */
html body.tk-pos-page .pos-item-card { overflow: hidden; }
html body.tk-pos-page .pos-item-card:hover { box-shadow: var(--x-sh2) !important; }
html body.tk-pos-page .pos-cart { box-shadow: var(--x-sh2) !important; }
html body.tk-pos-page .pos-workflow-bar, html body.tk-pos-page .pos-menu-toolbar { border-radius: 16px; box-shadow: var(--x-sh1); }
html body.tk-pos-page .pos-state-chip { border-radius: 999px; }
html body.tk-pos-page .tk-content > p > a, html body.tk-pos-page .pos-bills-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; font-size: .85rem; font-weight: 650;
  text-decoration: none; color: var(--tk-accent); background: var(--x-tint); border: 1px solid color-mix(in srgb, var(--tk-accent) 22%, transparent);
}
html body.tk-pos-page .tk-content > p { margin: 8px 0 12px; }

/* ---------- Toasts / banners ---------- */
html body .tk-toast { border-radius: 14px; box-shadow: var(--x-sh2); backdrop-filter: blur(8px); }
html body .tk-net-banner { border-radius: 14px; box-shadow: var(--x-sh2); }

/* ---------- Wide screens ---------- */
@media (min-width: 1500px) {
  html body .tk-content { max-width: 1760px; padding-left: 36px; padding-right: 36px; }
  html body .tk-content .tk-kpi-hero-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1100px) {
  html body .tk-content .tk-dash-row { gap: 20px; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  html body .tk-content .tk-kpi-hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  html body .tk-breadcrumb { display: none; }
  html body .tk-content { padding: 14px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }
  html body .tk-dash-greeting { margin-bottom: 14px; }
  html body .tk-dash-greeting h2 { font-size: 1.3rem; }
  html body .tk-topbar { height: 50px; padding: 0 12px; }
  html body .tk-mobile-bar { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--x-line); }
  html body .tk-content .tk-card { padding: 16px; border-radius: 16px; }
  html body .tk-content .tk-card-title { margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
  html body .tk-content .tk-kpi-hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
  html body .tk-content .tk-kpi-hero-card { padding: 14px 14px 12px; border-radius: 16px; }
  html body .tk-content .tk-kpi-hero-card:hover, html body .tk-content .tk-stat-card:hover, html body .tk-content .tk-quick-action-card:hover { transform: none; }
  html body .tk-content .tk-kpi-hero-top { margin-bottom: 10px; gap: 6px; }
  html body .tk-content .tk-kpi-hero-icon { width: 38px; height: 38px; border-radius: 11px; }
  html body .tk-content .tk-kpi-hero-icon svg { width: 20px; height: 20px; }
  html body .tk-content .tk-kpi-hero-value { font-size: 1.28rem; }
  html body .tk-content .tk-kpi-hero-label { font-size: .74rem; }
  html body .tk-content .tk-kpi-hero-badge, html body .tk-content .tk-kpi-hero-top .tk-card-title-subtitle { font-size: .66rem; padding: 3px 8px; }
  html body .tk-content .tk-kpi-hero-card:nth-child(n+3) { grid-column: 1 / -1; }
  html body .tk-content .tk-kpi-hero-card:nth-child(4) .tk-kpi-hero-top { display: none; }
  html body .tk-content .tk-kpi-hero-card:nth-child(4) .tk-kpi-mini-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  html body .tk-content .tk-kpi-hero-card:nth-child(4) .tk-kpi-hero-label { margin: 0 0 10px !important; }
  html body .tk-content .tk-kpi-mini { padding: 8px 6px; text-align: center; }
  html body .tk-content .tk-kpi-mini-val { font-size: 1.1rem; }
  html body .tk-content .tk-kpi-mini-lbl { font-size: .62rem; }
  html body .tk-content .tk-kpi-sub-row { gap: 14px; }
  html body .tk-content .tk-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  html body .tk-content .tk-stat-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  html body .tk-content .tk-stat-card { padding: 14px; }
  html body .tk-content .tk-chart-wrap { min-height: 190px; }
  html body .tk-modal { border-radius: 20px 20px 0 0; }
  html body .tk-modal-backdrop { align-items: flex-end; padding: 0; }
  html body :is(.tk-input, .tk-select, .tk-textarea) { font-size: 16px; min-height: 46px; }
  html body .tk-btn { min-height: 46px; }
  html body .tk-filter-bar { display: flex; flex-direction: row !important; flex-wrap: wrap; align-items: center !important; gap: 10px !important; padding: 12px; }
  html body .tk-filter-bar > :is(.tk-input, .tk-select, input, select) { flex: 1 1 calc(50% - 10px) !important; width: auto !important; min-width: 0; height: auto; min-height: 46px; }
  html body .tk-filter-bar > :is(input[type="search"], input[type="text"], .tk-filter-search) { flex-basis: 100% !important; }
  html body .tk-filter-bar > .tk-filter-sep { display: none; }
  html body .tk-filter-bar > :is(.tk-btn, button, a.tk-btn) { flex: 1 1 calc(50% - 10px); justify-content: center; }
  html body .tk-filter-bar > .tk-filter-right, html body .tk-filter-bar > div { flex: 1 1 100% !important; width: 100%; }
  html body .tk-toast-stack { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: none; }

  /* Wide tables become readable cards (class added by trunked-resilience.js; falls back to scroll). */
  html body .tk-content .tk-table-wrap.tk-stacked { border: 0; box-shadow: none; background: transparent; overflow: visible !important; }
  html body .tk-content table.tk-stack thead { display: none; }
  html body .tk-content table.tk-stack, html body .tk-content table.tk-stack tbody { display: block; width: 100%; }
  html body .tk-content table.tk-stack tbody tr { display: block; margin: 0 0 12px; padding: 6px 14px; background: var(--tk-bg-card); border: 1px solid var(--x-line); border-radius: 16px; box-shadow: var(--x-sh1); }
  html body .tk-content table.tk-stack tbody td {
    display: flex !important; justify-content: space-between; align-items: center; gap: 14px; max-width: none !important; width: auto !important;
    padding: 10px 0 !important; border: 0; border-bottom: 1px solid var(--x-line); text-align: right; white-space: normal !important; overflow-wrap: anywhere;
  }
  html body .tk-content table.tk-stack tbody td:last-child { border-bottom: 0; }
  html body .tk-content table.tk-stack tbody td::before { content: attr(data-label); flex: none; max-width: 46%; text-align: left; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tk-text-muted); }
  html body .tk-content table.tk-stack tbody td:not([data-label])::before { display: none; }
  html body .tk-content table.tk-stack tbody td[data-label=""]::before { display: none; }
  html body .tk-content table.tk-stack tbody td > :is(.tk-btn, form, a.tk-btn) { margin-left: auto; }
}
@media (max-width: 380px) {
  html body .tk-content .tk-kpi-hero-value { font-size: 1.15rem; }
  html body .tk-content .tk-kpi-hero-grid { gap: 10px !important; }
  html body .tk-content .tk-kpi-hero-card:nth-child(4) .tk-kpi-mini-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (hover: none) {
  html body .tk-content :is(.tk-card, .tk-stat-card, .tk-kpi-hero-card, .tk-quick-action-card):hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html body * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  html body { background: #fff !important; }
  html body .tk-sidebar, html body .tk-topbar, html body .tk-mobile-bar, html body .tk-toast-stack, html body .tk-net-banner { display: none !important; }
  html body .tk-content { max-width: none; padding: 0; }
}
