/* 
  Aether POS Design System & CSS Stylesheet
  Vanilla CSS, Dark/Glassmorphic Theme
*/

:root {
    /* Color Palette (HSL) */
    --bg-app: hsl(252, 28%, 6%);
    --bg-sidebar: hsl(252, 24%, 4%);
    --bg-card: rgba(26, 22, 42, 0.55);
    --bg-card-hover: rgba(36, 31, 57, 0.75);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-focus: rgba(121, 80, 242, 0.4);
    
    /* Brand Accents */
    --color-primary: hsl(256, 90%, 65%);
    --color-primary-hover: hsl(256, 90%, 58%);
    --color-primary-glow: rgba(121, 80, 242, 0.25);
    
    --color-secondary: hsl(161, 100%, 40%);
    --color-secondary-hover: hsl(161, 100%, 35%);
    
    --color-warning: hsl(28, 100%, 53%);
    --color-danger: hsl(343, 90%, 55%);
    --color-danger-hover: hsl(343, 90%, 48%);
    
    /* Typography Colors */
    --text-main: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 25%, 68%);
    --text-muted-dark: hsl(215, 16%, 47%);
    
    /* Elevations and Transitions */
    --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.8);
    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    
    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Navigation Styling */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-left: 8px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px var(--color-primary-glow);
}

.logo-icon {
    width: 22px;
    height: 22px;
    color: white;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(to right, #ffffff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    min-height: 0;            /* allow the nav to shrink inside the flex column */
    overflow-y: auto;          /* …and scroll when items exceed the viewport */
    overflow-x: hidden;
    margin: 0 -8px;            /* let the scrollbar sit at the sidebar edge */
    padding: 0 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 99px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.nav-item i {
    width: 20px;
    height: 20px;
    transition: var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-main);
    background-color: var(--bg-card);
}

.nav-item.active {
    color: white;
    background-color: var(--color-primary);
    box-shadow: 0 4px 16px var(--color-primary-glow);
}

.nav-item.active i {
    color: white;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--color-primary-glow);
    border: 1px solid var(--border-color-focus);
    color: var(--text-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info .user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-info .user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area Styling */
.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-header {
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background-color: var(--bg-header, rgba(10, 8, 16, 0.4));
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.time-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.time-widget i {
    width: 16px;
    height: 16px;
}

.content-body {
    flex-grow: 1;
    padding: 24px;
    overflow-y: auto;
    min-height: 0;
    background: radial-gradient(circle at 50% 0%, rgba(121, 80, 242, 0.05), transparent 60%);
}

.content-body:has(.cashier-layout) {
    overflow: hidden;
}

/* --- CASHIER VIEW LAYOUT --- */
.cashier-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    height: 100%;
}

.catalog-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    overflow: hidden;
}

.catalog-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px 12px 48px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 12px var(--color-primary-glow);
    background-color: var(--bg-card-hover);
}

/* Inventory / generic search input (icon sits in the padded-left area) */
.search-input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px 12px 48px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

.search-input::placeholder { color: var(--text-muted-dark); }

.search-input:focus {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 12px var(--color-primary-glow);
    background-color: var(--bg-card-hover);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.btn-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-icon:hover {
    color: white;
}

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    padding: 8px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-card-hover);
}

.tab-btn.active {
    color: white;
    background-color: var(--color-primary-glow);
    border-color: var(--color-primary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: max-content;
    align-content: start;
    gap: 16px;
    overflow-y: auto;
    padding-bottom: 24px;
    flex-grow: 1;
}

.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 150px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.product-card:hover {
    transform: translateY(-4px);
    background-color: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
}

.product-category-tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-secondary);
    margin-bottom: 6px;
    display: inline-block;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.product-sku {
    font-size: 0.75rem;
    color: var(--text-muted-dark);
    font-family: monospace;
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.product-price {
    font-size: 1.15rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.stock-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
}

.stock-badge.in-stock {
    background-color: rgba(0, 204, 136, 0.1);
    color: var(--color-secondary);
}

.stock-badge.low-stock {
    background-color: rgba(255, 107, 0, 0.1);
    color: var(--color-warning);
}

.stock-badge.out-of-stock {
    background-color: rgba(255, 26, 92, 0.1);
    color: var(--color-danger);
}

.out-of-stock-card {
    opacity: 0.55;
}

/* Hover overlay action */
.add-to-cart-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(12, 10, 20, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: var(--transition-fast);
    border: none;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

.product-card:hover .add-to-cart-overlay {
    opacity: 1;
}

.add-to-cart-overlay i {
    width: 28px;
    height: 28px;
    color: var(--color-secondary);
}

.add-to-cart-overlay.disabled {
    cursor: not-allowed;
    background-color: rgba(12, 10, 20, 0.85);
}
.add-to-cart-overlay.disabled i {
    color: var(--color-danger);
}

/* Cart Sidebar Section */
.cart-section {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-lg);
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.01);
}

.cart-title {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-title i {
    color: var(--color-primary);
}

.cart-count-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-card);
    padding: 4px 10px;
    border-radius: 12px;
}

.cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 250px;
    flex-shrink: 0;
}

.empty-cart-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    padding: 0 20px;
}

.empty-cart-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted-dark);
    margin-bottom: 16px;
}

.empty-cart-state p {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-main);
}

.empty-cart-state span {
    font-size: 0.8rem;
}

/* Cart Item Card */
.cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.cart-item-price-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cart-item-price-total {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.95rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-controller {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.quantity-btn {
    border: none;
    background: none;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.quantity-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
}

.quantity-val {
    width: 28px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-remove-item {
    border: none;
    background: none;
    color: var(--text-muted-dark);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-item:hover {
    color: var(--color-danger);
    background-color: rgba(255, 26, 92, 0.1);
}

/* Cart Summary Layout */
.cart-summary {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.summary-row .val {
    font-weight: 600;
    color: var(--text-main);
    font-family: monospace;
}

.summary-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

.total-row {
    font-size: 1.15rem;
    color: var(--text-main);
    font-weight: 700;
}

.total-row .val {
    color: var(--color-secondary);
    font-size: 1.3rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
}

.discount-input-group {
    align-items: center;
}

.discount-input-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.discount-control {
    display: flex;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 6px;
    width: 90px;
}

.discount-control input {
    background: none;
    border: none;
    color: white;
    width: 100%;
    text-align: right;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
}

.discount-control .unit {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 2px;
}

.btn-checkout {
    margin-top: 8px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
}

/* Core Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    box-shadow: 0 0 16px var(--color-primary-glow);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: rgba(255,255,255,0.12);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}
.btn-danger:hover {
    background-color: var(--color-danger-hover);
}

/* Form inputs styling */
.form-control {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: var(--transition-fast);
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(121, 80, 242, 0.25);
}

.text-large {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    font-family: monospace;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.col-span-2 {
    grid-column: span 2;
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted-dark);
    margin-top: 4px;
    display: block;
}

/* Table styling for Inventory & History */
.table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.pos-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.pos-table th {
    background-color: rgba(0, 0, 0, 0.25);
    padding: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.pos-table td {
    padding: 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.inventory-row {
    transition: var(--transition-fast);
}

.inventory-row:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.category-pill {
    font-size: 0.75rem;
    font-weight: 600;
    background-color: rgba(121, 80, 242, 0.1);
    color: var(--text-main);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(121, 80, 242, 0.15);
}

.text-mono {
    font-family: monospace;
}

.font-semibold {
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted);
}

.badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.badge-success {
    background-color: rgba(0, 204, 136, 0.1);
    color: var(--color-secondary);
}

.badge-warning {
    background-color: rgba(255, 107, 0, 0.1);
    color: var(--color-warning);
}

.badge-danger {
    background-color: rgba(255, 26, 92, 0.1);
    color: var(--color-danger);
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-action {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-action:hover {
    background-color: var(--bg-card);
    color: white;
}

.edit-btn:hover {
    border-color: var(--border-color-focus);
    color: var(--color-primary);
}

.delete-btn:hover {
    border-color: rgba(255, 26, 92, 0.3);
    color: var(--color-danger);
}

/* Modals & Dialog overlays styling */
.pos-modal {
    border: 1px solid var(--border-color);
    background-color: var(--bg-app);
    color: var(--text-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    outline: none;
}

.confirm-modal {
    max-width: 400px;
}

.receipt-modal {
    max-width: 380px;
    background-color: #f8fafc;
    color: #0f172a;
    border: none;
}

.pos-modal::backdrop {
    background: rgba(10, 8, 16, 0.75);
    backdrop-filter: blur(8px);
}

.modal-content {
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
}

.btn-close {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.btn-close:hover {
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-alert {
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 16px;
}

.modal-alert.danger {
    background-color: rgba(255, 26, 92, 0.1);
    border: 1px solid rgba(255, 26, 92, 0.2);
    color: var(--color-danger);
}

/* Pay Modal Details styling */
.pay-summary-card {
    background: linear-gradient(135deg, rgba(121, 80, 242, 0.15), rgba(0, 204, 136, 0.05));
    border: 1px solid var(--border-color-focus);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    margin-bottom: 24px;
}

.summary-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.summary-val {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--color-secondary);
}

.payment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.payment-method-option {
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition-fast);
    position: relative;
}

.payment-method-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.payment-method-option i {
    width: 24px;
    height: 24px;
}

.payment-method-option:hover {
    background-color: var(--bg-card-hover);
    color: white;
}

.payment-method-option.active {
    border-color: var(--color-primary);
    background-color: var(--color-primary-glow);
    color: white;
}

.change-due-box {
    margin-top: 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.change-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.change-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-secondary);
    font-family: monospace;
}

/* Warnings and deletes modal details */
.warning-icon-container {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 26, 92, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.warning-icon {
    width: 32px;
    height: 32px;
    color: var(--color-danger);
}

.confirm-message {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.confirm-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- OWNER DASHBOARD VIEW --- */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cashier-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.metric-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon i {
    width: 22px;
    height: 22px;
}

.revenue-icon {
    background-color: rgba(0, 204, 136, 0.1);
    color: var(--color-secondary);
}

.profit-icon {
    background-color: rgba(121, 80, 242, 0.1);
    color: var(--color-primary);
}

.orders-icon {
    background-color: rgba(0, 180, 255, 0.1);
    color: #00b4ff;
}

.stock-alert-icon {
    background-color: rgba(255, 107, 0, 0.1);
    color: var(--color-warning);
}

.metric-trend {
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 20px;
}

.metric-trend.positive {
    background-color: rgba(0, 204, 136, 0.1);
    color: var(--color-secondary);
}

.metric-trend.neutral {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.metric-trend.negative {
    background-color: rgba(255, 26, 92, 0.1);
    color: var(--color-danger);
}

.metric-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value {
    font-size: 2rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
}

.metric-card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted-dark);
}

.alert-warning-card {
    border-color: rgba(255, 107, 0, 0.3);
    background: radial-gradient(circle at 100% 0%, rgba(255, 107, 0, 0.05), transparent 70%), var(--bg-card);
}

/* Charts card styling */
.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.chart-header-title h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.chart-header-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chart-legend-pill {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend-pill::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.revenue-legend {
    background-color: rgba(0, 204, 136, 0.1);
    color: var(--color-secondary);
}
.revenue-legend::before {
    background-color: var(--color-secondary);
}

.profit-legend {
    background-color: rgba(121, 80, 242, 0.1);
    color: var(--color-primary);
}
.profit-legend::before {
    background-color: var(--color-primary);
}

.chart-canvas-wrapper {
    position: relative;
    height: 320px;
    width: 100%;
}

/* Pulsing alert animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- RECEIPT STYLING --- */
.receipt-paper {
    padding: 24px 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.4;
}

.receipt-header {
    text-align: center;
}

.receipt-logo {
    width: 32px;
    height: 32px;
    color: #7950f2;
    margin-bottom: 8px;
}

.receipt-header h3 {
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.receipt-header p {
    font-size: 0.75rem;
    color: #475569;
}

.receipt-title {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 8px 0;
}

.receipt-divider {
    border-bottom: 2px dashed #94a3b8;
    margin: 12px 0;
}

.receipt-divider-sub {
    border-bottom: 1px dashed #cbd5e1;
    margin: 8px 0;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
}

.receipt-table th {
    font-family: inherit;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #475569;
    padding-bottom: 6px;
    text-align: left;
}

.receipt-table td {
    padding: 4px 0;
}

.receipt-totals {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.receipt-total-row {
    display: flex;
    justify-content: space-between;
}

.receipt-total-row.final-total {
    font-weight: 800;
    font-size: 1.15rem;
}

.receipt-total-row.payment-details {
    font-size: 0.75rem;
    color: #475569;
    margin-top: 6px;
}

.receipt-total-row.change-details {
    font-size: 0.75rem;
    color: #475569;
}

.receipt-footer {
    text-align: center;
    font-size: 0.75rem;
    color: #475569;
    margin-top: 12px;
}

.barcode {
    font-size: 1.25rem;
    letter-spacing: 2px;
    margin-top: 8px;
    color: #0f172a;
}

.receipt-modal-actions {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    background-color: var(--bg-app);
    border-top: 1px solid var(--border-color);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.receipt-modal-actions button {
    flex: 1;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.mt-2 { margin-top: 8px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.text-mono { font-family: monospace; }
.text-danger { color: var(--color-danger); }
.empty-table-icon, .empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted-dark);
}

/* Printing styles overrides */
@media print {
    body * {
        visibility: hidden;
    }
    .receipt-modal, .receipt-modal * {
        visibility: visible;
    }
    .receipt-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        box-shadow: none;
        transform: none;
    }
    .receipt-modal-actions {
        display: none;
    }
}

/* Custom styles for auth/logs/staff */
.badge-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.logout-btn:hover {
    background-color: rgba(255, 26, 92, 0.1) !important;
    color: white !important;
}

/* ===========================================================================
   PLATFORM ADMIN (Control Center) — self-contained component styles
   =========================================================================== */
.nav-section-label {
    display: block;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-muted-dark, var(--text-muted));
    padding: 16px 14px 6px;
    opacity: 0.75;
}
.nav-section-label:first-child { padding-top: 4px; }

.pa-wrap { max-width: 1280px; margin: 0 auto; }
.pa-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.pa-head h1 { font-family: 'Outfit', sans-serif; font-size: 1.9rem; font-weight: 800; margin: 0; }
.pa-head p { color: var(--text-muted); margin: 6px 0 0; }

/* Stat cards */
.pa-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 26px; }
.pa-stat {
    position: relative; overflow: hidden;
    padding: 22px; border-radius: var(--radius-lg);
    background: var(--bg-card); border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.pa-stat .pa-stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pa-stat .pa-stat-label { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; }
.pa-stat .pa-stat-value { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; line-height: 1; }
.pa-stat .pa-stat-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 8px; }
.pa-ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.pa-ic i { width: 20px; height: 20px; }
.pa-ic.violet { background: rgba(121,80,242,0.14); color: #a78bfa; }
.pa-ic.green  { background: rgba(0,204,136,0.14);  color: #34d399; }
.pa-ic.amber  { background: rgba(245,158,11,0.14); color: #fbbf24; }
.pa-ic.red    { background: rgba(239,68,68,0.14);  color: #f87171; }
.pa-ic.blue   { background: rgba(59,130,246,0.14); color: #60a5fa; }

/* Cards / panels */
.pa-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    padding: 24px; margin-bottom: 22px;
}
.pa-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pa-card-head h2 { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; margin: 0; }
.pa-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .pa-grid-2 { grid-template-columns: 1fr; } }

/* Table */
.pa-table { width: 100%; border-collapse: collapse; }
.pa-table th {
    text-align: left; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.6px;
    text-transform: uppercase; color: var(--text-muted); padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}
.pa-table td { padding: 14px; border-bottom: 1px solid var(--border-color); font-size: 0.92rem; vertical-align: middle; }
.pa-table tbody tr:last-child td { border-bottom: none; }
.pa-table tbody tr { transition: background 0.15s; }
.pa-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.pa-table a.pa-link { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.pa-table a.pa-link:hover { text-decoration: underline; }
.pa-empty { text-align: center; color: var(--text-muted); padding: 40px 16px; }

/* Avatar */
.pa-avatar {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: #fff;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
}
.pa-cell-id { display: flex; align-items: center; gap: 12px; }
.pa-cell-id .sub { color: var(--text-muted); font-size: 0.8rem; }

/* Status pills */
.pa-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; }
.pa-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pa-pill.active      { color: #34d399; background: rgba(0,204,136,0.12); }
.pa-pill.trial       { color: #60a5fa; background: rgba(59,130,246,0.12); }
.pa-pill.suspended   { color: #f87171; background: rgba(239,68,68,0.12); }
.pa-pill.deactivated { color: #fbbf24; background: rgba(245,158,11,0.12); }
.pa-pill.cancelled   { color: var(--text-muted); background: rgba(148,163,184,0.12); }
.pa-pill.past_due    { color: #fbbf24; background: rgba(245,158,11,0.12); }
.pa-pill.pending     { color: #fbbf24; background: rgba(245,158,11,0.12); }
.pa-pill.approved    { color: #34d399; background: rgba(0,204,136,0.12); }
.pa-pill.rejected    { color: #f87171; background: rgba(239,68,68,0.12); }

/* Buttons */
.pa-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: var(--radius-md); border: 1px solid transparent;
    font-weight: 600; font-size: 0.88rem; cursor: pointer; text-decoration: none;
    transition: all 0.15s; line-height: 1; white-space: nowrap;
}
.pa-btn i { width: 16px; height: 16px; }
.pa-btn-sm { padding: 6px 11px; font-size: 0.8rem; }
.pa-btn-primary { background: var(--color-primary); color: #fff; }
.pa-btn-primary:hover { background: var(--color-primary-hover); }
.pa-btn-ghost { background: transparent; border-color: var(--border-color); color: var(--text-main); }
.pa-btn-ghost:hover { background: rgba(255,255,255,0.05); }
.pa-btn-success { background: rgba(0,204,136,0.14); color: #34d399; border-color: rgba(0,204,136,0.25); }
.pa-btn-success:hover { background: rgba(0,204,136,0.22); }
.pa-btn-warn { background: rgba(245,158,11,0.14); color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.pa-btn-warn:hover { background: rgba(245,158,11,0.22); }
.pa-btn-danger { background: rgba(239,68,68,0.14); color: #f87171; border-color: rgba(239,68,68,0.25); }
.pa-btn-danger:hover { background: rgba(239,68,68,0.22); }

/* Forms */
.pa-field { margin-bottom: 18px; }
.pa-field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 7px; color: var(--text-main); }
.pa-input, .pa-select, .pa-textarea {
    width: 100%; padding: 11px 13px; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); background: var(--bg-app, var(--bg-body));
    color: var(--text-main); font-size: 0.92rem; font-family: inherit;
}
.pa-input:focus, .pa-select:focus, .pa-textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-glow); }
.pa-textarea { resize: vertical; min-height: 80px; }
.pa-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .pa-form-grid { grid-template-columns: 1fr; } }
.pa-color-row { display: flex; align-items: center; gap: 10px; }
.pa-color-row input[type=color] { width: 46px; height: 40px; padding: 2px; border-radius: 8px; border: 1px solid var(--border-color); background: transparent; cursor: pointer; }

/* Toolbar / filters */
.pa-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.pa-search { position: relative; flex: 1; min-width: 220px; }
.pa-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-muted); }
.pa-search input { padding-left: 40px; }
.pa-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pa-chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-color); color: var(--text-muted); font-size: 0.82rem; font-weight: 600; text-decoration: none; transition: all 0.15s; }
.pa-chip:hover { color: var(--text-main); border-color: var(--color-primary); }
.pa-chip.on { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Modal */
.pa-modal-overlay { position: fixed; inset: 0; background: rgba(5,4,12,0.7); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.pa-modal-overlay.show { display: flex; }
.pa-modal { width: 100%; max-width: 440px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg, 0 24px 60px rgba(0,0,0,0.5)); overflow: hidden; }
.pa-modal-head { padding: 20px 22px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.pa-modal-head h3 { margin: 0; font-family: 'Outfit', sans-serif; font-size: 1.15rem; }
.pa-modal-body { padding: 22px; }
.pa-modal-foot { padding: 16px 22px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; justify-content: flex-end; }
.pa-x { background: none; border: none; color: var(--text-muted); cursor: pointer; }

/* Messages / toast inline */
.pa-msg { padding: 13px 16px; border-radius: var(--radius-md); margin-bottom: 18px; font-weight: 500; display: flex; align-items: center; gap: 9px; }
.pa-msg.success { background: rgba(0,204,136,0.1); color: #34d399; border: 1px solid rgba(0,204,136,0.22); }
.pa-msg.error { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.22); }

/* Misc */
.pa-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pa-meta-list { display: flex; flex-direction: column; gap: 14px; }
.pa-meta-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pa-meta-item .k { color: var(--text-muted); font-size: 0.86rem; }
.pa-meta-item .v { font-weight: 600; font-size: 0.9rem; text-align: right; }
.pa-danger-zone { border: 1px solid rgba(239,68,68,0.25); border-radius: var(--radius-lg); padding: 22px; background: rgba(239,68,68,0.04); }
.spin { animation: pa-spin 0.9s linear infinite; }
@keyframes pa-spin { to { transform: rotate(360deg); } }
.pa-feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.pa-feed-item:last-child { border-bottom: none; }
.pa-feed-item .pa-feed-dot { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(121,80,242,0.12); color: #a78bfa; }
.pa-feed-item .pa-feed-dot i { width: 15px; height: 15px; }
.pa-feed-item .t { font-size: 0.7rem; color: var(--text-muted); }

/* ===== Platform admin: toasts, global search, extras ===== */
.pa-toast-wrap { position: fixed; top: 18px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.pa-toast { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--radius-md);
    font-weight: 500; font-size: 0.9rem; box-shadow: 0 14px 40px rgba(0,0,0,0.4); backdrop-filter: blur(8px);
    transition: opacity 0.4s, transform 0.4s; }
.pa-toast i { width: 18px; height: 18px; flex-shrink: 0; }
.pa-toast.success { background: rgba(0,204,136,0.15); color: #34d399; border: 1px solid rgba(0,204,136,0.3); }
.pa-toast.error { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.pa-toast.warn { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }

.pa-globalsearch { position: relative; }
.pa-globalsearch > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.pa-globalsearch input { width: 280px; max-width: 40vw; padding: 9px 12px 9px 36px; border-radius: 999px;
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); font-size: 0.88rem; }
.pa-globalsearch input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-glow); }
.pa-globalsearch-results { position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-height: 380px; overflow-y: auto;
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0,0,0,0.45); display: none; z-index: 100; }
.pa-globalsearch-results.show { display: block; }
.pa-gs-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-decoration: none; color: var(--text-main); border-bottom: 1px solid var(--border-color); }
.pa-gs-row:last-child { border-bottom: none; }
.pa-gs-row:hover { background: rgba(255,255,255,0.04); }
.pa-gs-type { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-primary);
    background: var(--color-primary-glow); padding: 3px 7px; border-radius: 6px; }
.pa-gs-label { font-weight: 600; font-size: 0.88rem; }
.pa-gs-sub { font-size: 0.78rem; color: var(--text-muted); }
.pa-gs-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.88rem; }

/* Tabs */
.pa-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); margin-bottom: 22px; flex-wrap: wrap; }
.pa-tab { padding: 11px 18px; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); text-decoration: none;
    border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.pa-tab:hover { color: var(--text-main); }
.pa-tab.on { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* Health bar */
.pa-health { display: flex; align-items: center; gap: 8px; }
.pa-health-bar { width: 60px; height: 6px; border-radius: 99px; background: rgba(255,255,255,0.1); overflow: hidden; }
.pa-health-bar span { display: block; height: 100%; border-radius: 99px; }
.pa-health.healthy .pa-health-bar span { background: #34d399; }
.pa-health.at_risk .pa-health-bar span { background: #fbbf24; }
.pa-health.dormant .pa-health-bar span { background: #f87171; }

/* Banner (announcement) */
.pa-banner { display: flex; align-items: center; gap: 10px; padding: 12px 18px; font-weight: 500; font-size: 0.9rem; }
.pa-banner.info { background: rgba(59,130,246,0.14); color: #93c5fd; }
.pa-banner.success { background: rgba(0,204,136,0.14); color: #6ee7b7; }
.pa-banner.warning { background: rgba(245,158,11,0.14); color: #fcd34d; }
.pa-banner.danger { background: rgba(239,68,68,0.14); color: #fca5a5; }

/* Plan / coupon cards grid */
.pa-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.pa-plan-price { font-family: 'Outfit', sans-serif; font-size: 2.1rem; font-weight: 800; }
.pa-plan-price small { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.pa-feat { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-muted); padding: 5px 0; }
.pa-feat i { width: 15px; height: 15px; color: #34d399; }

/* Checkbox list */
.pa-check { display: flex; align-items: center; gap: 9px; padding: 8px 0; font-weight: 500; }
.pa-mono { font-family: ui-monospace, monospace; font-size: 0.82rem; }

/* Cashier product card image */
.product-card-image {
    width: 100%; height: 120px; border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 12px;
    background: var(--bg-body, rgba(255,255,255,0.03));
    border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
}
.product-card-image img { width: 100%; height: 100%; object-fit: cover; }
.product-card-image-placeholder { width: 30px; height: 30px; color: var(--text-muted); opacity: 0.5; }

/* ==========================================================================
   MOBILE RESPONSIVE OVERHAUL
   Comprehensive mobile-first fixes for phones & tablets
   ========================================================================== */

/* --- Hamburger Button (hidden on desktop) --- */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition-fast);
}
.hamburger-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-focus);
}
.hamburger-btn i {
    width: 20px;
    height: 20px;
}

/* --- Sidebar Overlay Backdrop (mobile) --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   TABLET BREAKPOINT  (≤1024px)
   ========================================================================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }

    /* Cashier: catalog + cart stacked vertically */
    .cashier-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    /* Cart sits below catalog on tablet, capped height */
    .cart-section {
        max-height: 420px;
    }

    /* Tighten header padding */
    .main-header {
        padding: 0 20px;
        height: 68px;
    }

    /* Product grid: 3 columns */
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    /* Metrics: 2 columns */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Table: allow horizontal scroll */
    .table-container {
        overflow-x: auto;
    }
}

/* ==========================================================================
   MOBILE BREAKPOINT  (≤768px)
   ========================================================================== */
@media (max-width: 768px) {

    /* Allow body to scroll on mobile */
    body {
        overflow: auto;
        height: auto;
    }

    /* App container becomes vertical, full height auto */
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    /* --- Sidebar: off-canvas drawer --- */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        max-width: 85vw;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        box-shadow: var(--shadow-lg);
    }

    .app-sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Show hamburger on mobile */
    .hamburger-btn {
        display: flex;
        margin-right: 12px;
    }

    /* Main area takes full width */
    .app-main {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    /* Header: compact and touch-friendly */
    .main-header {
        height: auto;
        min-height: 64px;
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .header-title-area {
        flex: 1;
        min-width: 0;
    }

    .header-title {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-subtitle {
        display: none; /* hide tagline on small screens */
    }

    .header-actions {
        gap: 8px !important;
    }

    /* Hide clock on smallest screens */
    .time-widget {
        display: none;
    }

    /* Content area: normal scroll */
    .content-body {
        padding: 16px;
        overflow: visible;
        min-height: 0;
    }

    .content-body:has(.cashier-layout) {
        overflow: visible;
        padding: 12px;
    }

    /* --- Cashier layout: single-column stacked --- */
    .cashier-layout {
        grid-template-columns: 1fr;
        gap: 16px;
        height: auto;
    }

    .catalog-section {
        height: auto;
        overflow: visible;
        min-height: 400px;
    }

    /* Product grid: 2 columns on mobile */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        overflow: visible;
        padding-bottom: 16px;
    }

    .product-card {
        padding: 12px;
        min-height: 120px;
    }

    .product-name {
        font-size: 0.88rem;
    }

    .product-price {
        font-size: 1rem;
    }

    /* Cart: full width, collapsible feel */
    .cart-section {
        height: auto;
        max-height: none;
        border-radius: var(--radius-md);
        overflow: visible;
    }

    .cart-items-container {
        min-height: 120px;
        max-height: 320px;
        overflow-y: auto;
    }

    /* --- Category tabs: scrollable strip --- */
    .category-tabs {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .category-tabs::-webkit-scrollbar { display: none; }

    /* --- Metrics grid: 1 column --- */
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* --- Tables: horizontal scroll --- */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pos-table th,
    .pos-table td {
        padding: 12px 10px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    /* --- Form grids collapse to 1 col --- */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .col-span-2 {
        grid-column: span 1;
    }

    /* --- Modals: full-screen on mobile --- */
    .pos-modal {
        width: calc(100vw - 24px);
        max-width: none;
        top: auto;
        bottom: 12px;
        left: 12px;
        right: 12px;
        transform: none;
        border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm);
        max-height: 90vh;
        overflow-y: auto;
    }

    .confirm-modal,
    .receipt-modal {
        max-width: none;
    }

    /* --- Payment grid: 2 cols on mobile --- */
    .payment-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Dashboard page container --- */
    .dashboard-container {
        padding: 0 !important;
    }

    /* --- System admin global search: compact --- */
    .pa-globalsearch input {
        width: 160px;
        max-width: none;
    }

    /* --- PA card grids: 1 column --- */
    .pa-card-grid {
        grid-template-columns: 1fr;
    }

    /* --- Sidebar footer user info: compact --- */
    .user-info .user-name {
        font-size: 0.8rem;
    }

    /* Role badge */
    .role-badge {
        font-size: 0.68rem;
        padding: 2px 6px;
    }

    /* Action buttons: larger tap targets */
    .btn-action {
        width: 38px;
        height: 38px;
    }

    .quantity-btn {
        width: 32px;
        height: 32px;
    }

    /* Nav items: bigger tap targets in drawer */
    .nav-item {
        padding: 14px 16px;
        font-size: 1rem;
    }

    /* Announcements banner: wrap text */
    .pa-banner {
        flex-wrap: wrap;
        font-size: 0.82rem;
    }
}

/* ==========================================================================
   SMALL PHONE  (≤480px)
   ========================================================================== */
@media (max-width: 480px) {
    /* Product grid: single column */
    .product-grid {
        grid-template-columns: 1fr;
    }

    /* Cart item: compact */
    .cart-item {
        gap: 8px;
        padding: 10px;
    }

    .cart-item-name {
        max-width: 160px;
        font-size: 0.85rem;
    }

    /* Header title smaller */
    .header-title {
        font-size: 1rem;
    }

    /* Modal full width */
    .pos-modal {
        left: 4px;
        right: 4px;
        width: calc(100vw - 8px);
    }

    /* Summary value larger font compress */
    .summary-val {
        font-size: 1.75rem;
    }

    /* Checkout button bigger */
    .btn-checkout {
        padding: 16px;
        font-size: 1rem;
    }

    /* Tables: extra compact */
    .pos-table th,
    .pos-table td {
        padding: 10px 8px;
        font-size: 0.78rem;
    }
}

/* ==========================================================================
   PAGE-SPECIFIC BASE STYLES (all screen sizes)
   Defines classes that individual pages rely on but had no CSS definition
   ========================================================================== */

/* --- Shared action bar used on Inventory, Staff, Orders, Logs --- */
.inventory-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* --- Search bar wrapper inside action bars --- */
.inventory-action-bar .search-box {
    flex: 1;
    min-width: 200px;
    max-width: 440px;
}

.inventory-action-bar .search-box input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 11px 16px 11px 46px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.93rem;
    outline: none;
    transition: var(--transition-fast);
}

.inventory-action-bar .search-box input:focus {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 12px var(--color-primary-glow);
}

/* --- Inventory filter row (search + 2 selects) --- */
.search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.search-bar > div { flex: 1; min-width: 160px; }
.search-bar select { min-width: 140px; }

/* --- Inventory container --- */
.inventory-container { width: 100%; }

/* --- Dashboard layout --- */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Dashboard/system_admin charts section --- */
.dashboard-charts-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Chart canvas wrapper --- */
.chart-canvas-wrapper {
    height: 260px;
}

/* --- Reports page --- */
.reports-page { display: flex; flex-direction: column; gap: 0; }

/* --- Staff / Logs containers --- */
.staff-container,
.orders-container { width: 100%; }

/* --- CashUp page --- */
.cashup-container { max-width: 720px; margin: 0 auto; }

/* --- Expenses page --- */
.expenses-container { width: 100%; }

/* --- Sales history page --- */
.sales-history-container { width: 100%; }

/* --- Store settings page --- */
.store-settings-container { max-width: 720px; }

/* --- Login page full-center --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

/* --- System admin tenant detail split layout --- */
.pa-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ==========================================================================
   PAGE-SPECIFIC MOBILE OVERRIDES  (≤768px)
   ========================================================================== */
@media (max-width: 768px) {

    /* ---- INVENTORY ---- */
    .inventory-container { padding: 0; }

    /* Action bar stacks vertically */
    .inventory-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .inventory-action-bar .search-box {
        max-width: none;
        width: 100%;
    }

    /* Search + filter bar: stack on mobile */
    .search-bar {
        flex-direction: column;
        gap: 10px;
    }

    .search-bar > div,
    .search-bar select {
        width: 100%;
        min-width: 0;
    }

    /* Inventory action buttons: wrap and stretch */
    .inventory-action-bar > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .inventory-action-bar .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }

    /* Hide less important table columns on mobile */
    .pos-table .hide-mobile { display: none; }

    /* ---- ORDERS ---- */
    /* Order modal: single column on mobile */
    #order-modal .modal-body[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    /* Orders filter tabs: scrollable */
    .orders-container .category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 6px;
    }
    .orders-container .category-tabs::-webkit-scrollbar { display: none; }
    .orders-container .tab-btn { flex-shrink: 0; }

    /* ---- DASHBOARD ---- */
    .chart-canvas-wrapper {
        height: 200px;
    }

    .chart-card-header {
        flex-direction: column;
        gap: 10px;
    }

    /* Best seller insight: wrap */
    .dashboard-layout > div[style*="align-items:center"] {
        flex-wrap: wrap !important;
    }

    /* Dashboard: top 5 table wraps */
    .dashboard-layout .inventory-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- REPORTS ---- */
    /* Toolbar stacks vertically */
    .report-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .report-toolbar .form-group {
        width: 100% !important;
    }

    .report-toolbar input[type="date"] {
        width: 100% !important;
    }

    .report-toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    /* Report cards: full bleed padding */
    .reports-page > div[class="report-card"],
    .reports-page > div[style*="background:var(--bg-card)"] {
        padding: 16px !important;
    }

    /* ---- STAFF ---- */
    .staff-container .inventory-action-bar {
        flex-direction: row;
        justify-content: space-between;
    }

    /* ---- SETTINGS / APPEARANCE ---- */
    /* Already has media query inside <style> tag in template,
       but we ensure color-input-wrap doesn't overflow */
    .color-input-wrap .form-control {
        width: 90px !important;
    }

    /* ---- CASHUP PAGE ---- */
    .cashup-container {
        max-width: 100%;
        padding: 0;
    }

    /* ---- STORE SETTINGS ---- */
    .store-settings-container {
        max-width: 100%;
    }

    /* ---- SYSTEM ADMIN PAGES ---- */
    .pa-detail-grid {
        grid-template-columns: 1fr;
    }

    /* Admin search bar: full width */
    .pa-globalsearch input {
        width: 100% !important;
    }

    /* ---- LOGS PAGE ---- */
    /* Log entries: wrap long content */
    .pa-feed-item {
        flex-direction: column;
        gap: 6px;
    }

    /* ---- STOREFRONT PUBLIC PAGE ---- */
    .storefront-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ---- SAAS LANDING PAGE ---- */
    .saas-hero {
        padding: 60px 20px 40px;
        text-align: center;
    }

    .saas-hero h1 { font-size: 2rem; }

    .saas-features-grid {
        grid-template-columns: 1fr !important;
    }

    /* Registration form on landing: full width */
    .saas-register-form {
        padding: 24px 16px !important;
    }
}

/* ==========================================================================
   PAGE-SPECIFIC SMALL PHONE OVERRIDES  (≤480px)
   ========================================================================== */
@media (max-width: 480px) {

    /* ---- INVENTORY ---- */
    /* On very small phones hide SKU and Cost Price columns */
    .inventory-container .pos-table th:nth-child(3),
    .inventory-container .pos-table td:nth-child(3),
    .inventory-container .pos-table th:nth-child(6),
    .inventory-container .pos-table td:nth-child(6) {
        display: none;
    }

    /* ---- STAFF ---- */
    /* Hide Date Joined column */
    .staff-container .pos-table th:nth-child(4),
    .staff-container .pos-table td:nth-child(4) {
        display: none;
    }

    /* ---- ORDERS ---- */
    /* Hide Contact column on smallest screens */
    .orders-container .pos-table th:nth-child(3),
    .orders-container .pos-table td:nth-child(3) {
        display: none;
    }

    /* ---- DASHBOARD ---- */
    .chart-canvas-wrapper { height: 160px; }

    /* Metric value: smaller font */
    .metric-value { font-size: 1.6rem !important; }

    /* ---- REPORTS ---- */
    /* Report toolbar buttons: side by side */
    .report-toolbar .btn {
        width: auto;
        flex: 1;
    }

    /* ---- STOREFRONT ---- */
    .storefront-grid {
        grid-template-columns: 1fr !important;
    }

    /* ---- ACTION BAR BUTTONS ---- */
    /* Stack all action bar buttons on very small screens */
    .inventory-action-bar > div {
        flex-direction: column;
    }
    .inventory-action-bar .btn {
        width: 100%;
    }
}

/* ==========================================================================
   ALL-PAGES FINAL MOBILE PASS
   Comprehensive fixes for every remaining page + system admin components
   ========================================================================== */

/* ── SYSTEM ADMIN: pa-* COMPONENT MOBILE FIXES ──────────────────────────── */

/* pa-head: let title and buttons stack neatly */
@media (max-width: 768px) {
    .pa-wrap {
        padding: 0 4px;
    }

    .pa-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 18px;
    }

    .pa-head h1 {
        font-size: 1.45rem;
    }

    .pa-head .pa-actions,
    .pa-head > a,
    .pa-head > button {
        align-self: stretch;
    }

    /* Stat cards: 2 cols on tablet/mobile */
    .pa-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 18px;
    }

    .pa-stat {
        padding: 16px;
    }

    .pa-stat .pa-stat-value {
        font-size: 1.6rem;
    }

    /* Grid 2 col → single col (already has @900 but 768 overrides) */
    .pa-grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* pa-toolbar: stack search + chips */
    .pa-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pa-search {
        min-width: 0;
        width: 100%;
    }

    .pa-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .pa-chips::-webkit-scrollbar { display: none; }
    .pa-chip { flex-shrink: 0; }

    /* pa-table: horizontal scroll */
    .pa-card > .pa-table,
    .pa-card[style*="padding:0"] > .pa-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pa-table th,
    .pa-table td {
        padding: 10px 10px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    /* pa-actions: wrapping buttons */
    .pa-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* pa-actions inside table cells */
    td .pa-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    /* Bulk action bar */
    #bulk-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px;
    }

    #bulk-bar .pa-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    /* pa-modal: near-fullscreen bottom sheet on mobile */
    .pa-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .pa-modal {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* pa-form-grid: already collapses at 640 but make consistent */
    .pa-form-grid {
        grid-template-columns: 1fr;
    }

    /* System admin card inner padding: tighten on mobile */
    .pa-card {
        padding: 16px;
        margin-bottom: 14px;
    }

    /* Tenant detail header: wrap store name + avatar */
    .pa-head > div[style*="display:flex"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }

    /* pa-card-grid (plans, coupons) */
    .pa-card-grid {
        grid-template-columns: 1fr;
    }

    /* System admin global search: expand to fill on mobile */
    .pa-globalsearch {
        width: 100%;
    }
    .pa-globalsearch input {
        width: 100% !important;
        max-width: none !important;
        border-radius: var(--radius-md) !important;
    }

    .pa-globalsearch-results {
        width: 100%;
        right: auto;
        left: 0;
    }

    /* Toast: full width */
    .pa-toast-wrap {
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 80px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .pa-stats {
        grid-template-columns: 1fr;
    }

    .pa-stat .pa-stat-value {
        font-size: 1.4rem;
    }

    .pa-head h1 {
        font-size: 1.2rem;
    }

    /* Tenants table: hide less critical columns on very small phones */
    .pa-wrap .pa-table th:nth-child(4),
    .pa-wrap .pa-table td:nth-child(4),
    .pa-wrap .pa-table th:nth-child(5),
    .pa-wrap .pa-table td:nth-child(5),
    .pa-wrap .pa-table th:nth-child(6),
    .pa-wrap .pa-table td:nth-child(6) {
        display: none;
    }

    /* Bulk action buttons: full width */
    #bulk-bar .pa-actions {
        grid-template-columns: 1fr;
    }

    .pa-modal-body {
        padding: 16px;
    }

    .pa-modal-foot {
        padding: 12px 16px;
        flex-direction: column;
    }

    .pa-modal-foot .pa-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ── CASHUP / Z-REPORT PAGE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Date picker form: stack */
    .cashup-form,
    form[action*="cashup"],
    div[style*="max-width:900px"] > form {
        flex-direction: column !important;
        gap: 10px !important;
    }

    div[style*="max-width:900px"] > form input,
    div[style*="max-width:900px"] > form button {
        width: 100%;
        max-width: none !important;
    }

    /* Z-report stat grid: 2 cols */
    div[style*="grid-template-columns:repeat(auto-fit,minmax(160px"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Summary rows at bottom */
    div[style*="display:flex; justify-content:space-between"] {
        gap: 8px;
    }

    /* Payment method table */
    .inventory-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    /* Cashup grid: single column */
    div[style*="grid-template-columns:repeat(auto-fit,minmax(160px"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── EXPENSES PAGE ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .expenses-container .inventory-action-bar {
        flex-direction: column;
        gap: 10px;
    }

    .expenses-container form[style*="display:flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .expenses-container form input,
    .expenses-container form select,
    .expenses-container form button {
        width: 100% !important;
    }
}

/* ── SALES HISTORY PAGE ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sales-history-container .inventory-action-bar {
        flex-direction: column;
    }
}

/* ── LOGS PAGE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Log filter toolbar */
    .logs-container form,
    .logs-container .inventory-action-bar {
        flex-direction: column;
        gap: 10px;
    }

    .logs-container select,
    .logs-container input {
        width: 100%;
    }
}

/* ── STORE SETTINGS (STORE_SETTINGS.HTML) ───────────────────────────────── */
@media (max-width: 768px) {
    .store-settings-container .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ── CUSTOMER PAGES ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .customer-container {
        padding: 0;
    }

    .customer-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── SYSTEM ADMIN ANALYTICS PAGE ────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Analytics charts: reduce height */
    canvas[id*="Chart"] {
        max-height: 220px;
    }
}

/* ── SYSTEM ADMIN PLANS PAGE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .pa-card-grid {
        grid-template-columns: 1fr;
    }

    /* Plan price: compact */
    .pa-plan-price {
        font-size: 1.6rem;
    }
}

/* ── GLOBAL: fix any inline flex/grid that still breaks on mobile ─────────
   These use attribute selectors to catch common inline style patterns
   that couldn't be targeted via class names.
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    /* Any inline display:flex with gap that wraps */
    [style*="display:flex"][style*="gap"] {
        flex-wrap: wrap;
    }

    /* Any inline grid with fixed 2-column setup: make 1 col */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Common fixed widths that break layouts */
    [style*="width: 200px"],
    [style*="width:200px"],
    [style*="width: 180px"],
    [style*="width:180px"] {
        width: 100% !important;
        max-width: none !important;
    }

    /* Ensure select inputs don't overflow */
    select.form-control {
        width: 100% !important;
    }
}

/* ── PRINT STYLES (receipt / cashup) ────────────────────────────────────── */
@media print {
    .app-sidebar,
    .main-header,
    .hamburger-btn,
    .sidebar-overlay,
    .btn,
    .pa-btn,
    .nav-item {
        display: none !important;
    }

    .app-main {
        height: auto !important;
        overflow: visible !important;
    }

    .content-body {
        padding: 0 !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }
}

/* ===========================================================================
   Global: broken-image fallback, client pagination, mobile table→card
   =========================================================================== */
.img-fallback {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-body, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color); color: var(--text-muted);
    border-radius: 8px; min-width: 38px; min-height: 38px;
}
.img-fallback i { width: 40%; height: 40%; max-width: 28px; max-height: 28px; opacity: 0.5; }

.pg-hidden { display: none !important; }

.js-pager {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    margin: 18px 0 4px; flex-wrap: wrap;
}
.js-pager:empty { display: none; }
.js-pager button {
    font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
    padding: 8px 14px; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main);
    transition: var(--transition-fast);
}
.js-pager button:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.js-pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.js-pager .js-pg-info { font-size: 0.85rem; color: var(--text-muted); }

/* --- Mobile: render data tables as stacked cards --- */
@media (max-width: 768px) {
    .inventory-table thead,
    .pa-table thead,
    .pos-table thead { display: none; }

    .inventory-table, .inventory-table tbody,
    .pa-table, .pa-table tbody,
    .pos-table, .pos-table tbody { display: block; width: 100%; }

    .inventory-table tr,
    .pa-table tr,
    .pos-table tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 8px 14px;
        margin-bottom: 12px;
    }

    .inventory-table td,
    .pa-table td,
    .pos-table td {
        display: flex; align-items: center; justify-content: space-between;
        gap: 14px; text-align: right;
        padding: 8px 0 !important; border: none !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    .inventory-table tr td:last-child,
    .pa-table tr td:last-child,
    .pos-table tr td:last-child { border-bottom: none !important; }

    .inventory-table td::before,
    .pa-table td::before,
    .pos-table td::before {
        content: attr(data-label);
        font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
        letter-spacing: 0.04em; color: var(--text-muted);
        text-align: left; flex-shrink: 0;
    }
    /* Cells with no header label (e.g. action buttons / checkboxes) span full width */
    .inventory-table td:not([data-label])::before,
    .pa-table td:not([data-label])::before,
    .pos-table td:not([data-label])::before { content: ""; }

    /* Let action buttons / pills sit nicely on the right */
    .inventory-table td .pa-actions,
    .pa-table td .pa-actions { justify-content: flex-end; flex-wrap: wrap; }

    /* Stop the old horizontal-scroll behaviour now that we're card-based */
    .inventory-table, .pa-table, .pos-table { overflow: visible !important; }
}


/* Cashier product card action buttons (always visible) */
.product-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.pc-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 10px; border-radius: var(--radius-md); border: 1px solid var(--border-color);
    font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
    background: var(--bg-body, rgba(255,255,255,0.03)); color: var(--text-main);
    transition: var(--transition-fast);
}
.pc-btn i { width: 15px; height: 15px; }
.pc-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pc-btn-add { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.pc-btn-add:hover { background: var(--color-primary-hover); }
.pc-btn-remove { color: var(--color-danger); border-color: rgba(255,26,92,0.25); }
.pc-btn-remove:hover { background: rgba(255,26,92,0.12); }

/* Card itself no longer needs hover-to-reveal; keep a subtle lift only */
.product-card { cursor: default; }
.add-to-cart-overlay { display: none !important; }
