:root {
    --font-display: 'Outfit', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* ---- Per-portal accent theme, set via [data-theme] on <html> ---- */
[data-theme="customer"] {
    --accent-50:#fff7ed; --accent-100:#ffedd5; --accent-400:#fb923c;
    --accent:#ea580c; --accent-600:#ea580c; --accent-700:#c2410c; --accent-dark:#9a3412;
    --accent-grad-a:#fb923c; --accent-grad-b:#ea580c;
}
[data-theme="merchant"] {
    --accent-50:#eff6ff; --accent-100:#dbeafe; --accent-400:#60a5fa;
    --accent:#2563eb; --accent-600:#2563eb; --accent-700:#1d4ed8; --accent-dark:#1e3a8a;
    --accent-grad-a:#3b82f6; --accent-grad-b:#2563eb;
}
[data-theme="courier"] {
    --accent-50:#f0fdf4; --accent-100:#dcfce7; --accent-400:#4ade80;
    --accent:#16a34a; --accent-600:#16a34a; --accent-700:#15803d; --accent-dark:#14532d;
    --accent-grad-a:#22c55e; --accent-grad-b:#15803d;
}
[data-theme="admin"] {
    --accent-50:#eef2ff; --accent-100:#e0e7ff; --accent-400:#818cf8;
    --accent:#4f46e5; --accent-600:#4f46e5; --accent-700:#4338ca; --accent-dark:#3730a3;
    --accent-grad-a:#6366f1; --accent-grad-b:#4338ca;
}

body {
    font-family: var(--font-body);
    background:
        radial-gradient(1200px 500px at 10% -10%, var(--accent-50), transparent),
        radial-gradient(900px 400px at 110% 10%, var(--accent-100), transparent) fixed,
        #f8fafc;
    min-height: 100vh;
}
h1, h2, h3, .font-display { font-family: var(--font-display); }

/* Custom scrollbar -- purely cosmetic, safe everywhere */
::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: var(--accent-100); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-400); }

/* Gentle entrance animation for the content column */
/* IMPORTANT: this animation must never use `transform` (or `filter`,
   `perspective`, `will-change: transform`). `<main>` in
   layouts/portal.blade.php carries this class on every page, and every
   fixed-position element in the app -- the bottom tab bars, their
   "More" sheets, the admin nav drawer, and every other `fixed inset-0`
   modal -- renders as a DESCENDANT of that `<main>` (they're all inside
   @yield('content')). Per the CSS spec, an element with a `transform`
   value (including one set by a running -- or completed, with `both`
   fill-mode -- animation) becomes the containing block for any
   `position: fixed` descendant, instead of the viewport. That silently
   confined every fixed element in the app to `<main>`'s own box --
   `max-w-6xl mx-auto`, whatever height the current page's content
   happened to be -- rather than the actual screen, which is exactly why
   the bottom tab bar could fail to span or sit at the real bottom of
   the screen ("doesn't auto fit") depending on the page. Opacity-only
   keeps the same fade-in polish with none of that risk. */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.page-fade { animation: fadeIn .35s ease both; }

/* ---------------------------------------------------------------
   GLOBAL, PURELY-ADDITIVE POLISH for the ~60 content pages built
   before this stylesheet existed. None of these rules override a
   Tailwind utility's own declared value (background-color,
   border-radius, box-shadow base state) -- they only ADD properties
   Tailwind's static utilities never set (hover states, transitions,
   focus rings, gradient overlays), so nothing already built breaks.
   ----------------------------------------------------------------- */

/* Smooth, elegant hover-lift for every card (anything already
   carrying "shadow" -- every page's cards use this pattern) */
main [class*="shadow"] { transition: box-shadow .25s ease, transform .25s ease; }
main [class*="shadow"]:hover { box-shadow: 0 20px 35px -12px rgba(15,23,42,.12); transform: translateY(-2px); }

/* Buttons: layer a subtle gradient + lift on top of the existing
   flat Tailwind colour, keyed to whichever accent colour each
   portal already uses consistently throughout its pages */
main button, main a.button-like { transition: transform .15s ease, filter .15s ease, box-shadow .15s ease; }
main [class*="bg-orange-600"], main [class*="bg-blue-600"], main [class*="bg-green-600"],
main [class*="bg-indigo-600"], main [class*="bg-red-600"], main [class*="bg-gray-800"] {
    background-image: linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,0) 60%);
    box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
main [class*="bg-orange-600"]:hover, main [class*="bg-blue-600"]:hover, main [class*="bg-green-600"]:hover,
main [class*="bg-indigo-600"]:hover, main [class*="bg-red-600"]:hover, main [class*="bg-gray-800"]:hover {
    filter: brightness(1.08); transform: translateY(-1px);
    box-shadow: 0 8px 16px -4px rgba(15,23,42,.18);
}
main button:active { transform: translateY(0); }

/* Inputs/selects/textareas: replace the bare browser focus outline
   with an elegant themed ring (existing markup never sets its own
   focus style, so this is pure addition) */
main input, main select, main textarea {
    transition: border-color .15s ease, box-shadow .15s ease;
}
main input:focus, main select:focus, main textarea:focus {
    outline: none;
    border-color: var(--accent-400) !important;
    box-shadow: 0 0 0 3px var(--accent-100);
}

/* Small polish: rounded badges/pills get a touch more life */
main [class*="rounded-full"] { transition: transform .15s ease; }

/* ---- Sub-nav pill bar (used by the 4 portal nav partials) ---- */
.pill-bar {
    display: flex; gap: .25rem; overflow-x: auto; padding: .35rem;
    background: rgba(255,255,255,.7); backdrop-filter: blur(6px);
    border: 1px solid rgba(226,232,240,.8); border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    scrollbar-width: thin;
}
.nav-pill {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    padding: .55rem .9rem; border-radius: .7rem; font-size: .84rem; font-weight: 500;
    color: #475569; transition: all .15s ease; flex-shrink: 0;
}
.nav-pill:hover { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.nav-pill.active {
    color: #fff; background-image: linear-gradient(135deg, var(--accent-grad-a), var(--accent-grad-b));
    box-shadow: 0 4px 10px -2px var(--accent-100);
}
.nav-pill i { width: 15px; text-align: center; flex-shrink: 0; }

/* ---- Mobile app-style bottom tab bar (customer/merchant/courier portals) ---- */
.tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(226,232,240,.8);
    box-shadow: 0 -6px 20px rgba(15,23,42,.06);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .2rem; padding: .55rem 0 .45rem; font-size: .64rem; font-weight: 600;
    color: #94a3b8; transition: color .15s ease, transform .15s ease;
    position: relative;
}
.tab-item i { font-size: 1.08rem; transition: transform .15s ease; }
.tab-item:active i { transform: scale(.88); }
.tab-item.active { color: var(--accent); }
.tab-item.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 22px; height: 3px; border-radius: 0 0 3px 3px;
    background-image: linear-gradient(135deg, var(--accent-grad-a), var(--accent-grad-b));
}
.tab-item .tab-badge {
    position: absolute; top: 2px; right: calc(50% - 16px);
    min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: .55rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* "More" sheet grid items */
.more-grid-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .5rem; padding: 1rem .5rem; border-radius: 1rem; background: #f8fafc;
    color: #334155; font-size: .74rem; font-weight: 600; text-align: center;
    transition: background .15s ease;
}
.more-grid-item:active { background: #f1f5f9; }
.more-grid-item i { font-size: 1.15rem; color: #64748b; }
.more-grid-item.active { background: var(--accent-100, #ffedd5); color: var(--accent-dark); }
.more-grid-item.active i { color: var(--accent); }

/* ---- Toast notifications (replaces alert()) ---- */
.toast-container {
    position: fixed; z-index: 60; display: flex; flex-direction: column; gap: .5rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    left: 1rem; right: 1rem;
    align-items: center;
}
@media (min-width: 640px) {
    .toast-container { left: auto; right: 1.5rem; align-items: flex-end; }
}
.toast {
    display: flex; align-items: center; gap: .6rem;
    background: #1e293b; color: #fff; font-size: .84rem; font-weight: 500;
    padding: .75rem 1rem; border-radius: .75rem; box-shadow: 0 10px 30px rgba(15,23,42,.25);
    max-width: 420px; width: 100%;
    opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease;
}
.toast.toast-in { opacity: 1; transform: translateY(0); }
.toast i { font-size: 1rem; flex-shrink: 0; }
.toast-success i { color: #4ade80; }
.toast-error i { color: #f87171; }
.toast-info i { color: #60a5fa; }
.toast span { flex: 1; line-height: 1.35; }
.toast button {
    background: none; border: none; color: rgba(255,255,255,.5); font-size: 1.1rem;
    line-height: 1; cursor: pointer; padding: 0 .1rem;
}
.toast button:hover { color: #fff; }

/* ---- Signed-in account header (#accountHeader in layouts/portal.blade.php) ----
   renderAccountHeader() in app.js reveals this once a profile loads. It
   must NEVER become visible below the md breakpoint: the header only has
   room for the logo + hamburger on mobile (the account info lives in the
   mobile drawer instead, via #mobileAccountHeader). Toggling Tailwind's
   plain `hidden` utility from JS doesn't guarantee that -- removing
   `hidden` from an element that also carries `md:flex` leaves it with NO
   display rule at all below md (browsers default to `display:block`), so
   the full desktop avatar/name/bell/logout row was rendering on top of
   the mobile header instead of staying hidden until md. This rule makes
   "below md" non-negotiable regardless of which Tailwind classes JS
   happens to add or remove. */
#accountHeader { display: none !important; }
@media (min-width: 768px) {
    #accountHeader.account-ready { display: flex !important; }
}


/* =====================================================================================================
   Panel shell: sidebar grid, active menu entry, hide/show toggle
   ===================================================================================================== */
.panel-grid { display: block; }
@media (min-width: 1024px) {
    .panel-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; }
    html.side-collapsed .panel-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
    html.side-collapsed .panel-grid > aside { display: none; }
}
.side-toggle {
    display: none; align-items: center; gap: .5rem; font-size: .78rem; font-weight: 600; color: #475569;
    background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; padding: .45rem .8rem; margin-bottom: .9rem;
    transition: background .15s, color .15s, border-color .15s;
}
.side-toggle:hover { background: var(--accent-50); color: var(--accent-700); border-color: var(--accent-100); }
@media (min-width: 1024px) { .side-toggle { display: inline-flex; } }

.side-link {
    display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; border-radius: .75rem;
    font-size: .875rem; font-weight: 500; color: #475569; position: relative; transition: background .15s, color .15s;
}
.side-link i { width: 1rem; text-align: center; color: #94a3b8; transition: color .15s; }
.side-link:hover { background: #f1f5f9; color: #0f172a; }
.side-link.active { background: var(--accent-50); color: var(--accent-700); font-weight: 600; }
.side-link.active i { color: var(--accent); }
.side-link.active::before {
    content: ''; position: absolute; left: -.35rem; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: var(--accent);
}
.side-group { padding: 0 .9rem; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #94a3b8; margin-bottom: .25rem; }

/* =====================================================================================================
   Professional, responsive forms and data (opt-in helpers used by the admin catalogue, merchant products, ...)
   ===================================================================================================== */
.ui-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.ui-stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; padding: .85rem 1rem; }
.ui-stat p:first-child { font-size: .72rem; color: #94a3b8; font-weight: 500; }
.ui-stat p:last-child { font-size: 1.35rem; font-weight: 700; color: #0f172a; line-height: 1.25; }
.ui-label { display: block; font-size: .75rem; font-weight: 600; color: #475569; margin-bottom: .3rem; }
.ui-input, .ui-select, .ui-textarea {
    width: 100%; background: #fff; border: 1px solid #cbd5e1; border-radius: .7rem; padding: .55rem .8rem;
    font-size: .875rem; color: #0f172a; min-height: 2.5rem; transition: border-color .15s, box-shadow .15s;
}
.ui-textarea { min-height: 5rem; }
.ui-input:focus, .ui-select:focus, .ui-textarea:focus { outline: none; border-color: var(--accent-400); box-shadow: 0 0 0 3px var(--accent-100); }
.ui-input::placeholder { color: #94a3b8; }
.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: .7rem; padding: .5rem .95rem; font-size: .85rem; font-weight: 600; min-height: 2.5rem; border: 1px solid #cbd5e1; background: #fff; color: #334155; transition: all .15s; }
.ui-btn:hover { background: #f8fafc; }
.ui-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ui-btn-primary:hover { background: var(--accent-700); border-color: var(--accent-700); }
.ui-btn-danger { color: #dc2626; border-color: #fecaca; }
.ui-btn-danger:hover { background: #fef2f2; }
.ui-btn-sm { min-height: 2rem; padding: .3rem .65rem; font-size: .78rem; border-radius: .55rem; }
.ui-btn:disabled { opacity: .45; cursor: not-allowed; }
.ui-badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.ui-badge.ok { background: #dcfce7; color: #166534; } .ui-badge.warn { background: #fef3c7; color: #92400e; }
.ui-badge.bad { background: #fee2e2; color: #991b1b; } .ui-badge.info { background: #dbeafe; color: #1e40af; } .ui-badge.mute { background: #f1f5f9; color: #475569; }
.ui-thumb { width: 2.75rem; height: 2.75rem; border-radius: .6rem; object-fit: cover; border: 1px solid #e2e8f0; background: #f8fafc; flex-shrink: 0; }
.ui-thumb-empty { width: 2.75rem; height: 2.75rem; border-radius: .6rem; background: #f1f5f9; color: #cbd5e1; display: grid; place-items: center; flex-shrink: 0; }
.ui-form-grid { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .ui-form-grid { grid-template-columns: 1fr 1fr; } .ui-form-grid .span-2 { grid-column: span 2; } }
.ui-toolbar { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 768px) { .ui-toolbar { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .ui-toolbar { grid-template-columns: repeat(8, 1fr); } }
.ui-toolbar .span-2 { grid-column: span 2; }
.ui-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem 0; font-size: .82rem; color: #64748b; }
.ui-modal { position: fixed; inset: 0; z-index: 60; }
.ui-modal .scrim { position: absolute; inset: 0; background: rgba(15,23,42,.5); }
.ui-modal .sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 1.25rem 1.25rem 0 0; max-height: 92vh; overflow-y: auto; box-shadow: 0 -10px 40px rgba(15,23,42,.2); }
.ui-modal .sheet-head { position: sticky; top: 0; background: #fff; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
@media (min-width: 640px) {
    .ui-modal .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 40rem); border-radius: 1.25rem; }
    .ui-modal .sheet.narrow { width: min(92vw, 28rem); }
}

/* Responsive table: a normal table from tablet up, a stack of labelled cards on phones. */
.rtable { width: 100%; font-size: .875rem; border-collapse: collapse; }
.rtable thead th { background: #f8fafc; color: #64748b; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: .65rem .9rem; white-space: nowrap; }
.rtable tbody td { padding: .7rem .9rem; border-top: 1px solid #f1f5f9; vertical-align: middle; }
.rtable tbody tr:hover { background: #fafbff; }
@media (min-width: 768px) { .rtable { background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; overflow: hidden; border-collapse: separate; border-spacing: 0; } }
@media (max-width: 767px) {
    .rtable { background: transparent; border: 0; }
    .rtable thead { display: none; }
    .rtable input.ui-input, .rtable select.ui-select { width: 100% !important; max-width: 12rem; text-align: right; }
    .rtable tbody td.cell-main .truncate { white-space: normal; max-width: none !important; }
    .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
    .rtable tbody tr { border: 1px solid #e2e8f0; border-radius: 1rem; margin: 0 0 .75rem; padding: .35rem .25rem; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
    .rtable tbody td { border: 0; padding: .4rem .8rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: right; }
    .rtable tbody td::before { content: attr(data-label); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: #94a3b8; text-align: left; flex-shrink: 0; }
    .rtable tbody td[data-label=""]::before, .rtable tbody td:not([data-label])::before { content: none; }
    .rtable tbody td.cell-main { display: block; text-align: left; }
    .rtable tbody td.cell-actions { justify-content: flex-end; flex-wrap: wrap; }
}

/* photo picker (merchant products) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: .5rem; }
.photo-tile { position: relative; aspect-ratio: 1; border-radius: .75rem; overflow: hidden; border: 1px solid #e2e8f0; background: #f8fafc; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile button { position: absolute; top: .2rem; right: .2rem; width: 1.5rem; height: 1.5rem; border-radius: 999px; background: rgba(15,23,42,.7); color: #fff; line-height: 1; }
.ui-stats { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) { .ui-stats { grid-template-columns: repeat(5, 1fr); } }
.btn-label { display: none; } @media (min-width: 640px) { .btn-label { display: inline; } }
.only-mobile { display: inline; } @media (min-width: 768px) { .only-mobile { display: none; } }
.ui-switch { position: relative; display: inline-block; width: 2.5rem; height: 1.5rem; cursor: pointer; }
.ui-switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ui-switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; transition: background .15s; pointer-events: none; }
.ui-switch span::after { content: ""; position: absolute; top: .125rem; left: .125rem; width: 1.25rem; height: 1.25rem; border-radius: 999px; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.ui-switch input:checked + span { background: #22c55e; } .ui-switch input:checked + span::after { transform: translateX(1rem); }

/* ---- v26.14 layout safety nets ---- */
/* Inputs inside a flex row may shrink instead of pushing the page wider than the phone. */
@media (max-width: 640px) {
  .flex > input, .flex > select, .flex > textarea { min-width: 0; }
  .flex > button { flex-shrink: 1; }
  input[type="time"] { min-width: 0; max-width: 100%; width: 6.4rem !important; }
}
/* Wide tables scroll inside their own box on desktop rather than widening the whole page. */
@media (min-width: 769px) {
  div:has(> table.rtable) { overflow-x: auto; max-width: 100%; }
}
