/* ===================================================================
   TRONX LIGHT DESIGN SYSTEM
   Beautiful, modern, mobile-first design for Admin & POS interfaces
   Light mode only - RTL Arabic support
   =================================================================== */

/* Google Fonts - Tajawal for Arabic, Inter for Latin */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

/* ---- Design Tokens (Light Mode) ---- */
:root {
    /* Brand Colors - Modern Blue-Purple */
    --tx-primary: #4f46e5;
    --tx-primary-light: #6366f1;
    --tx-primary-dark: #4338ca;
    --tx-primary-50: #eef2ff;
    --tx-primary-100: #e0e7ff;
    --tx-primary-500: #6366f1;
    --tx-primary-600: #4f46e5;
    --tx-primary-700: #4338ca;

    /* Accent - Warm Amber */
    --tx-accent: #f59e0b;
    --tx-accent-light: #fbbf24;
    --tx-accent-dark: #d97706;

    /* Semantic Colors */
    --tx-success: #10b981;
    --tx-success-light: #d1fae5;
    --tx-success-dark: #059669;
    --tx-danger: #ef4444;
    --tx-danger-light: #fee2e2;
    --tx-danger-dark: #dc2626;
    --tx-warning: #f59e0b;
    --tx-warning-light: #fef3c7;
    --tx-info: #0ea5e9;
    --tx-info-light: #e0f2fe;
    --tx-info-dark: #0284c7;

    /* Neutral / Surface */
    --tx-bg: #f8fafc;
    --tx-bg-soft: #f1f5f9;
    --tx-surface: #ffffff;
    --tx-surface-2: #fafbfc;
    --tx-border: #e2e8f0;
    --tx-border-light: #f1f5f9;
    --tx-border-strong: #cbd5e1;

    /* Text */
    --tx-text: #1e293b;
    --tx-text-soft: #475569;
    --tx-text-muted: #64748b;
    --tx-text-light: #94a3b8;
    --tx-text-inverse: #ffffff;

    /* Shadows - Soft, modern */
    --tx-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --tx-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --tx-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --tx-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
    --tx-shadow-xl: 0 20px 48px rgba(15, 23, 42, 0.14);
    --tx-shadow-primary: 0 8px 24px rgba(79, 70, 229, 0.25);
    --tx-shadow-success: 0 8px 24px rgba(16, 185, 129, 0.25);

    /* Radii */
    --tx-radius-xs: 6px;
    --tx-radius-sm: 8px;
    --tx-radius: 12px;
    --tx-radius-lg: 16px;
    --tx-radius-xl: 20px;
    --tx-radius-2xl: 24px;
    --tx-radius-full: 999px;

    /* Spacing */
    --tx-space-1: 4px;
    --tx-space-2: 8px;
    --tx-space-3: 12px;
    --tx-space-4: 16px;
    --tx-space-5: 20px;
    --tx-space-6: 24px;
    --tx-space-8: 32px;
    --tx-space-10: 40px;

    /* Layout */
    --tx-header-h: 64px;
    --tx-subnav-h: 56px;
    --tx-bottom-nav-h: 72px;
    --tx-sidebar-w: 260px;
    --tx-content-max: 1480px;

    /* Motion */
    --tx-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --tx-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --tx-dur-fast: 150ms;
    --tx-dur: 220ms;
    --tx-dur-slow: 360ms;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Tajawal', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--tx-bg);
    color: var(--tx-text);
    direction: rtl;
    font-size: 14.5px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body[dir="ltr"] { direction: ltr; }

a { text-decoration: none; color: inherit; transition: color var(--tx-dur) var(--tx-ease); }
a:hover { color: var(--tx-primary); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font-family: inherit; }

/* ---- Scrollbar (light) ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx-primary); }

/* ===================================================================
   APP SHELL
   =================================================================== */

.tx-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--tx-bg);
}

/* ---- Top Header / Navbar ---- */
.tx-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--tx-header-h);
    background: var(--tx-surface);
    border-bottom: 1px solid var(--tx-border);
    box-shadow: var(--tx-shadow-xs);
    display: flex;
    align-items: center;
    padding: 0 var(--tx-space-5);
    gap: var(--tx-space-3);
}

.tx-header__brand {
    display: flex;
    align-items: center;
    gap: var(--tx-space-3);
    text-decoration: none;
    color: var(--tx-text);
    flex-shrink: 0;
    min-width: 0;
}

.tx-header__logo {
    width: 40px;
    height: 40px;
    border-radius: var(--tx-radius-sm);
    background: linear-gradient(135deg, var(--tx-primary) 0%, var(--tx-primary-light) 100%);
    display: grid;
    place-items: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: var(--tx-shadow-primary);
    flex-shrink: 0;
}

.tx-header__title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--tx-text);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-header__title small {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--tx-text-muted);
    margin-top: 2px;
}

.tx-header__spacer { flex: 1; }

.tx-header__actions {
    display: flex;
    align-items: center;
    gap: var(--tx-space-2);
    flex-shrink: 0;
}

.tx-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--tx-radius-sm);
    background: transparent;
    color: var(--tx-text-soft);
    display: grid;
    place-items: center;
    transition: all var(--tx-dur) var(--tx-ease);
    position: relative;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.tx-icon-btn:hover {
    background: var(--tx-primary-50);
    color: var(--tx-primary);
    border-color: var(--tx-primary-100);
}

.tx-icon-btn:active { transform: scale(0.95); }

.tx-icon-btn .badge {
    position: absolute;
    top: 6px;
    inset-inline-end: 6px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--tx-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    padding: 0 5px;
    border: 2px solid var(--tx-surface);
}

.tx-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--tx-space-2);
    padding: 4px 12px 4px 4px;
    border-radius: var(--tx-radius-full);
    background: var(--tx-bg-soft);
    cursor: pointer;
    transition: background var(--tx-dur) var(--tx-ease);
}

.tx-user:hover { background: var(--tx-primary-50); }

.tx-user__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tx-primary) 0%, var(--tx-accent) 100%);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.tx-user__name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--tx-text);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tx-user__menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 220px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius);
    box-shadow: var(--tx-shadow-lg);
    padding: var(--tx-space-2);
    z-index: 200;
    display: none;
    overflow: hidden;
}

.tx-user__menu.is-open { display: block; animation: tx-fade-in var(--tx-dur) var(--tx-ease); }

.tx-user__menu a {
    display: flex;
    align-items: center;
    gap: var(--tx-space-3);
    padding: 10px 12px;
    border-radius: var(--tx-radius-sm);
    color: var(--tx-text-soft);
    font-size: 0.875rem;
    transition: all var(--tx-dur-fast) var(--tx-ease);
}

.tx-user__menu a:hover { background: var(--tx-primary-50); color: var(--tx-primary); }
.tx-user__menu a.is-danger { color: var(--tx-danger); }
.tx-user__menu a.is-danger:hover { background: var(--tx-danger-light); color: var(--tx-danger-dark); }

.tx-user__menu hr {
    border: 0;
    border-top: 1px solid var(--tx-border);
    margin: var(--tx-space-2) 0;
}

/* ===================================================================
   SUB NAVIGATION (Menu bar below header)
   =================================================================== */

.tx-subnav {
    position: sticky;
    top: var(--tx-header-h);
    z-index: 90;
    background: var(--tx-surface);
    border-bottom: 1px solid var(--tx-border);
    min-height: var(--tx-subnav-h);
    display: flex;
    align-items: center;
    padding: 0 var(--tx-space-5);
    gap: var(--tx-space-1);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.tx-subnav::-webkit-scrollbar { display: none; }

.tx-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: var(--tx-text-soft);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--tx-radius-sm);
    transition: all var(--tx-dur) var(--tx-ease);
    white-space: nowrap;
    border: 1px solid transparent;
    position: relative;
}

.tx-nav-link i { font-size: 0.95rem; opacity: 0.85; }

.tx-nav-link:hover {
    background: var(--tx-primary-50);
    color: var(--tx-primary);
}

.tx-nav-link.is-active {
    background: var(--tx-primary-50);
    color: var(--tx-primary);
    border-color: var(--tx-primary-100);
}

.tx-nav-link.is-active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    inset-inline-start: 12px;
    inset-inline-end: 12px;
    height: 3px;
    background: var(--tx-primary);
    border-radius: 3px 3px 0 0;
}

/* ===================================================================
   CONTENT AREA
   =================================================================== */

.tx-content {
    flex: 1;
    padding: var(--tx-space-6) var(--tx-space-5);
    max-width: var(--tx-content-max);
    width: 100%;
    margin: 0 auto;
}

.tx-content--flush { padding: 0; max-width: 100%; }

.tx-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tx-space-4);
    margin-bottom: var(--tx-space-6);
    flex-wrap: wrap;
}

.tx-page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--tx-text);
    line-height: 1.2;
    margin: 0;
}

.tx-page-subtitle {
    font-size: 0.9rem;
    color: var(--tx-text-muted);
    margin-top: 4px;
}

/* ===================================================================
   STATS / KPI CARDS
   =================================================================== */

.tx-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--tx-space-4);
    margin-bottom: var(--tx-space-6);
}

.tx-stat {
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius-lg);
    padding: var(--tx-space-5);
    box-shadow: var(--tx-shadow-xs);
    transition: all var(--tx-dur) var(--tx-ease);
    position: relative;
    overflow: hidden;
}

.tx-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--tx-shadow-md);
    border-color: var(--tx-primary-100);
}

.tx-stat__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--tx-radius);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    margin-bottom: var(--tx-space-3);
}

.tx-stat__icon--primary { background: var(--tx-primary-50); color: var(--tx-primary); }
.tx-stat__icon--success { background: var(--tx-success-light); color: var(--tx-success-dark); }
.tx-stat__icon--danger { background: var(--tx-danger-light); color: var(--tx-danger-dark); }
.tx-stat__icon--info { background: var(--tx-info-light); color: var(--tx-info-dark); }
.tx-stat__icon--warning { background: var(--tx-warning-light); color: var(--tx-warning); }
.tx-stat__icon--accent { background: #fef3c7; color: var(--tx-accent-dark); }

.tx-stat__value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--tx-text);
    line-height: 1.1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

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

.tx-stat__trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--tx-radius-full);
}

.tx-stat__trend--up { background: var(--tx-success-light); color: var(--tx-success-dark); }
.tx-stat__trend--down { background: var(--tx-danger-light); color: var(--tx-danger-dark); }

/* ===================================================================
   CARDS
   =================================================================== */

.tx-card {
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius-lg);
    box-shadow: var(--tx-shadow-xs);
    overflow: hidden;
    transition: box-shadow var(--tx-dur) var(--tx-ease);
}

.tx-card:hover { box-shadow: var(--tx-shadow-sm); }

.tx-card__header {
    padding: var(--tx-space-5);
    border-bottom: 1px solid var(--tx-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tx-space-3);
    flex-wrap: wrap;
}

.tx-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--tx-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--tx-space-2);
}

.tx-card__title i { color: var(--tx-primary); font-size: 0.95rem; }

.tx-card__body { padding: var(--tx-space-5); }

.tx-card__footer {
    padding: var(--tx-space-4) var(--tx-space-5);
    border-top: 1px solid var(--tx-border-light);
    background: var(--tx-surface-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--tx-space-3);
    flex-wrap: wrap;
}

/* ===================================================================
   BUTTONS
   =================================================================== */

.tx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--tx-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--tx-dur) var(--tx-ease);
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.2;
    text-decoration: none;
}

.tx-btn:active { transform: scale(0.97); }
.tx-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tx-btn i { font-size: 0.875rem; }

.tx-btn--primary {
    background: var(--tx-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}
.tx-btn--primary:hover { background: var(--tx-primary-dark); color: white; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); }

.tx-btn--success {
    background: var(--tx-success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.tx-btn--success:hover { background: var(--tx-success-dark); color: white; }

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

.tx-btn--secondary {
    background: var(--tx-surface);
    color: var(--tx-text);
    border-color: var(--tx-border);
}
.tx-btn--secondary:hover { background: var(--tx-bg-soft); border-color: var(--tx-border-strong); color: var(--tx-text); }

.tx-btn--ghost {
    background: transparent;
    color: var(--tx-text-soft);
}
.tx-btn--ghost:hover { background: var(--tx-bg-soft); color: var(--tx-text); }

.tx-btn--soft-primary {
    background: var(--tx-primary-50);
    color: var(--tx-primary);
}
.tx-btn--soft-primary:hover { background: var(--tx-primary-100); color: var(--tx-primary-dark); }

.tx-btn--sm { padding: 6px 12px; font-size: 0.8rem; }
.tx-btn--lg { padding: 14px 24px; font-size: 1rem; }
.tx-btn--block { width: 100%; }
.tx-btn--icon { padding: 10px; }

/* ===================================================================
   FORMS
   =================================================================== */

.tx-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: var(--tx-space-4);
}

.tx-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tx-text-soft);
}

.tx-input,
.tx-select,
.tx-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius-sm);
    background: var(--tx-surface);
    color: var(--tx-text);
    font-size: 0.9rem;
    transition: all var(--tx-dur) var(--tx-ease);
    -webkit-appearance: none;
    appearance: none;
}

.tx-input:focus,
.tx-select:focus,
.tx-textarea:focus {
    outline: none;
    border-color: var(--tx-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.tx-input::placeholder { color: var(--tx-text-light); }

.tx-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
    padding-inline-end: 36px;
}

.tx-textarea { resize: vertical; min-height: 80px; }

.tx-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.tx-input-group i {
    position: absolute;
    inset-inline-start: 14px;
    color: var(--tx-text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.tx-input-group .tx-input { padding-inline-start: 40px; }

/* ===================================================================
   TABLES
   =================================================================== */

.tx-table-wrap {
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius-lg);
    overflow: hidden;
    box-shadow: var(--tx-shadow-xs);
}

.tx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tx-table th {
    background: var(--tx-surface-2);
    color: var(--tx-text-soft);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 16px;
    text-align: start;
    border-bottom: 1px solid var(--tx-border);
    white-space: nowrap;
}

.tx-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--tx-border-light);
    color: var(--tx-text);
    vertical-align: middle;
}

.tx-table tbody tr {
    transition: background var(--tx-dur-fast) var(--tx-ease);
}

.tx-table tbody tr:hover { background: var(--tx-bg-soft); }
.tx-table tbody tr:last-child td { border-bottom: 0; }

/* Badges */
.tx-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--tx-radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.tx-badge--primary { background: var(--tx-primary-50); color: var(--tx-primary-dark); }
.tx-badge--success { background: var(--tx-success-light); color: var(--tx-success-dark); }
.tx-badge--danger { background: var(--tx-danger-light); color: var(--tx-danger-dark); }
.tx-badge--warning { background: var(--tx-warning-light); color: var(--tx-accent-dark); }
.tx-badge--info { background: var(--tx-info-light); color: var(--tx-info-dark); }
.tx-badge--neutral { background: var(--tx-bg-soft); color: var(--tx-text-muted); }

/* ===================================================================
   POS INTERFACE - SPECIFIC
   =================================================================== */

.tx-pos {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--tx-bg);
    overflow: hidden;
}

.tx-pos__topbar {
    height: var(--tx-header-h);
    background: var(--tx-surface);
    border-bottom: 1px solid var(--tx-border);
    display: flex;
    align-items: center;
    padding: 0 var(--tx-space-5);
    gap: var(--tx-space-3);
    flex-shrink: 0;
    box-shadow: var(--tx-shadow-xs);
}

.tx-pos__title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--tx-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tx-pos__title i { color: var(--tx-primary); }

.tx-pos__spacer { flex: 1; }

.tx-pos__body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

.tx-pos__left {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--tx-space-4);
    overflow: hidden;
    min-width: 0;
}

.tx-pos__right {
    width: 380px;
    background: var(--tx-surface);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-inline-start: 1px solid var(--tx-border);
}

/* Search bar */
.tx-search {
    position: relative;
    margin-bottom: var(--tx-space-3);
    display: flex;
    gap: var(--tx-space-2);
}

.tx-search__input {
    flex: 1;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius);
    background: var(--tx-surface);
    color: var(--tx-text);
    font-size: 0.95rem;
    transition: all var(--tx-dur) var(--tx-ease);
}

.tx-search__input:focus {
    outline: none;
    border-color: var(--tx-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.tx-search i {
    position: absolute;
    inset-inline-start: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tx-text-muted);
    pointer-events: none;
}

/* Category Tabs */
.tx-cats {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: var(--tx-space-2);
    margin-bottom: var(--tx-space-3);
    scrollbar-width: none;
    flex-shrink: 0;
}

.tx-cats::-webkit-scrollbar { display: none; }

.tx-cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius-full);
    color: var(--tx-text-soft);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--tx-dur) var(--tx-ease);
    white-space: nowrap;
    flex-shrink: 0;
}

.tx-cat:hover { border-color: var(--tx-primary-100); color: var(--tx-primary); }
.tx-cat.is-active {
    background: var(--tx-primary);
    color: white;
    border-color: var(--tx-primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Items grid */
.tx-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--tx-space-3);
    overflow-y: auto;
    padding: 4px;
    flex: 1;
}

.tx-item {
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius);
    padding: var(--tx-space-3);
    cursor: pointer;
    transition: all var(--tx-dur) var(--tx-ease);
    display: flex;
    flex-direction: column;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tx-item:hover {
    transform: translateY(-3px);
    border-color: var(--tx-primary);
    box-shadow: var(--tx-shadow-md);
}

.tx-item:active { transform: scale(0.97); }

.tx-item.is-out {
    opacity: 0.55;
    cursor: not-allowed;
}
.tx-item.is-out:hover { transform: none; box-shadow: none; border-color: var(--tx-border); }

.tx-item__img {
    height: 80px;
    margin: -12px -12px 8px;
    background: linear-gradient(135deg, var(--tx-bg-soft) 0%, var(--tx-primary-50) 100%);
    border-radius: var(--tx-radius) var(--tx-radius) 0 0;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    color: var(--tx-primary);
    overflow: hidden;
}

.tx-item__img img { width: 100%; height: 100%; object-fit: cover; }

.tx-item__name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tx-text);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.1em;
}

.tx-item__price {
    color: var(--tx-primary);
    font-weight: 800;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.tx-item__stock {
    font-size: 0.7rem;
    color: var(--tx-text-muted);
    margin-top: 2px;
}

/* Cart */
.tx-cart {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.tx-cart__header {
    padding: var(--tx-space-4);
    border-bottom: 1px solid var(--tx-border);
    background: var(--tx-surface-2);
}

.tx-cart__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--tx-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--tx-space-2);
}

.tx-cart__count {
    background: var(--tx-primary);
    color: white;
    border-radius: var(--tx-radius-full);
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.tx-cart__meta {
    display: flex;
    gap: var(--tx-space-2);
    flex-wrap: wrap;
}

.tx-cart__meta select,
.tx-cart__meta input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius-xs);
    background: var(--tx-surface);
    font-size: 0.8rem;
    color: var(--tx-text);
}

.tx-cart__items {
    flex: 1;
    overflow-y: auto;
    padding: var(--tx-space-3);
    background: var(--tx-bg);
}

.tx-cart-item {
    display: flex;
    align-items: center;
    gap: var(--tx-space-3);
    padding: var(--tx-space-3);
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-radius);
    margin-bottom: var(--tx-space-2);
    transition: all var(--tx-dur) var(--tx-ease);
}

.tx-cart-item:hover { border-color: var(--tx-primary-100); box-shadow: var(--tx-shadow-xs); }

.tx-cart-item__info { flex: 1; min-width: 0; }

.tx-cart-item__name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tx-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.tx-cart-item__price {
    font-size: 0.75rem;
    color: var(--tx-text-muted);
    font-variant-numeric: tabular-nums;
}

.tx-cart-item__qty {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--tx-bg-soft);
    border-radius: var(--tx-radius-sm);
    padding: 2px;
}

.tx-qty-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--tx-radius-xs);
    background: var(--tx-surface);
    color: var(--tx-text);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    transition: all var(--tx-dur-fast) var(--tx-ease);
    border: 1px solid var(--tx-border);
}

.tx-qty-btn:hover { background: var(--tx-primary); color: white; border-color: var(--tx-primary); }

.tx-qty-input {
    width: 36px;
    text-align: center;
    border: 0;
    background: transparent;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--tx-text);
    -moz-appearance: textfield;
}

.tx-qty-input::-webkit-outer-spin-button,
.tx-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.tx-cart-item__total {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--tx-text);
    min-width: 70px;
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.tx-cart-item__remove {
    color: var(--tx-danger);
    width: 28px;
    height: 28px;
    border-radius: var(--tx-radius-xs);
    display: grid;
    place-items: center;
    transition: background var(--tx-dur) var(--tx-ease);
}

.tx-cart-item__remove:hover { background: var(--tx-danger-light); }

.tx-cart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--tx-text-light);
    padding: var(--tx-space-6);
    text-align: center;
}

.tx-cart__empty i { font-size: 3rem; margin-bottom: var(--tx-space-3); opacity: 0.5; }

.tx-cart__footer {
    padding: var(--tx-space-4);
    background: var(--tx-surface);
    border-top: 1px solid var(--tx-border);
    flex-shrink: 0;
}

.tx-totals { margin-bottom: var(--tx-space-3); }

.tx-totals__row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
    color: var(--tx-text-soft);
}

.tx-totals__row--grand {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--tx-text);
    border-top: 1px dashed var(--tx-border);
    margin-top: var(--tx-space-2);
    padding-top: var(--tx-space-2);
}

.tx-totals__row--grand span:last-child { color: var(--tx-primary); }

.tx-cart__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--tx-space-2);
}

.tx-cart__actions .tx-btn--pay { grid-column: span 2; }

/* ===================================================================
   MODAL
   =================================================================== */

.tx-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--tx-space-4);
    animation: tx-fade-in var(--tx-dur) var(--tx-ease);
}

.tx-modal.is-open { display: flex; }

.tx-modal__dialog {
    background: var(--tx-surface);
    border-radius: var(--tx-radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--tx-shadow-xl);
    animation: tx-scale-in var(--tx-dur) var(--tx-ease);
}

.tx-modal__header {
    padding: var(--tx-space-5);
    border-bottom: 1px solid var(--tx-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tx-space-3);
}

.tx-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tx-text);
    margin: 0;
}

.tx-modal__close {
    width: 32px;
    height: 32px;
    border-radius: var(--tx-radius-sm);
    color: var(--tx-text-muted);
    display: grid;
    place-items: center;
    transition: all var(--tx-dur) var(--tx-ease);
}

.tx-modal__close:hover { background: var(--tx-bg-soft); color: var(--tx-text); }

.tx-modal__body {
    padding: var(--tx-space-5);
    overflow-y: auto;
    flex: 1;
}

.tx-modal__footer {
    padding: var(--tx-space-4) var(--tx-space-5);
    border-top: 1px solid var(--tx-border);
    display: flex;
    gap: var(--tx-space-2);
    justify-content: flex-end;
    background: var(--tx-surface-2);
}

/* ===================================================================
   ANIMATIONS
   =================================================================== */

@keyframes tx-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tx-scale-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes tx-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tx-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.tx-anim-fade { animation: tx-fade-in var(--tx-dur) var(--tx-ease); }
.tx-anim-up { animation: tx-slide-up var(--tx-dur) var(--tx-ease); }

/* ===================================================================
   RESPONSIVE - MOBILE FIRST
   =================================================================== */

/* Tablet */
@media (max-width: 1024px) {
    .tx-pos__right { width: 340px; }
    .tx-content { padding: var(--tx-space-4); }
}

/* Mobile - The most important breakpoint */
@media (max-width: 768px) {
    :root {
        --tx-header-h: 56px;
        --tx-subnav-h: 52px;
    }

    body { font-size: 14px; }

    .tx-header {
        padding: 0 var(--tx-space-3);
        gap: var(--tx-space-2);
    }

    .tx-header__title { font-size: 0.95rem; }
    .tx-header__title small { display: none; }
    .tx-header__logo { width: 36px; height: 36px; }

    .tx-icon-btn { width: 36px; height: 36px; font-size: 0.85rem; }
    .tx-user__name { display: none; }
    .tx-user { padding: 3px; }

    .tx-subnav { padding: 0 var(--tx-space-3); }
    .tx-nav-link { padding: 10px 12px; font-size: 0.8rem; }
    .tx-nav-link span:not(.tx-nav-link__text) { display: none; }

    .tx-content { padding: var(--tx-space-3); }

    .tx-page-header { flex-direction: column; align-items: stretch; }
    .tx-page-title { font-size: 1.25rem; }
    .tx-page-subtitle { font-size: 0.85rem; }

    .tx-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--tx-space-3);
    }
    .tx-stat { padding: var(--tx-space-4); }
    .tx-stat__value { font-size: 1.4rem; }
    .tx-stat__icon { width: 40px; height: 40px; font-size: 1rem; }

    .tx-card__header { padding: var(--tx-space-3) var(--tx-space-4); }
    .tx-card__body { padding: var(--tx-space-4); }
    .tx-card__title { font-size: 0.9rem; }

    /* Tables -> Card view on mobile */
    .tx-table thead { display: none; }
    .tx-table, .tx-table tbody, .tx-table tr, .tx-table td { display: block; width: 100%; }
    .tx-table tr {
        background: var(--tx-surface);
        border: 1px solid var(--tx-border);
        border-radius: var(--tx-radius);
        margin-bottom: var(--tx-space-3);
        padding: var(--tx-space-3);
    }
    .tx-table td {
        padding: 6px 0;
        border-bottom: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--tx-space-3);
    }
    .tx-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--tx-text-muted);
        font-size: 0.78rem;
    }
    .tx-table td:last-child { padding-top: var(--tx-space-2); border-top: 1px solid var(--tx-border-light); }

    /* POS mobile layout - critical */
    .tx-pos { height: 100vh; height: 100dvh; }
    .tx-pos__topbar { padding: 0 var(--tx-space-3); }
    .tx-pos__title { font-size: 0.95rem; }

    .tx-pos__body {
        flex-direction: column;
        gap: 0;
    }

    .tx-pos__left {
        padding: var(--tx-space-3);
        flex: 1;
        min-height: 0;
    }

    .tx-pos__right {
        width: 100%;
        height: 50vh;
        border-inline-start: 0;
        border-top: 1px solid var(--tx-border);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    }

    .tx-search__input { padding: 10px 14px 10px 40px; font-size: 0.9rem; }
    .tx-cat { padding: 6px 12px; font-size: 0.8rem; }
    .tx-items { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--tx-space-2); }
    .tx-item { padding: var(--tx-space-2); }
    .tx-item__img { height: 65px; margin: -8px -8px 6px; font-size: 1.4rem; }
    .tx-item__name { font-size: 0.75rem; }
    .tx-item__price { font-size: 0.85rem; }

    .tx-cart-item { padding: var(--tx-space-2); gap: var(--tx-space-2); }
    .tx-cart-item__name { font-size: 0.8rem; }
    .tx-cart-item__total { font-size: 0.85rem; min-width: 60px; }
    .tx-cart__footer { padding: var(--tx-space-3); }
    .tx-totals__row--grand { font-size: 1.05rem; }
}

/* Extra small phones */
@media (max-width: 380px) {
    .tx-stats { grid-template-columns: 1fr; }
    .tx-items { grid-template-columns: repeat(2, 1fr); }
    .tx-pos__right { height: 55vh; }
}

/* Print */
@media print {
    .tx-header, .tx-subnav, .tx-pos__topbar, .tx-pos__left, .tx-cart__footer .tx-cart__actions { display: none !important; }
    body { background: white; }
    .tx-pos__right { width: 100%; border: 0; }
}

/* ===================================================================
   UTILITIES
   =================================================================== */

.tx-flex { display: flex; }
.tx-flex-col { display: flex; flex-direction: column; }
.tx-items-center { align-items: center; }
.tx-justify-between { justify-content: space-between; }
.tx-gap-2 { gap: var(--tx-space-2); }
.tx-gap-3 { gap: var(--tx-space-3); }
.tx-gap-4 { gap: var(--tx-space-4); }
.tx-text-center { text-align: center; }
.tx-text-start { text-align: start; }
.tx-text-end { text-align: end; }
.tx-w-full { width: 100%; }
.tx-hidden { display: none !important; }
.tx-mt-3 { margin-top: var(--tx-space-3); }
.tx-mt-4 { margin-top: var(--tx-space-4); }
.tx-mb-3 { margin-bottom: var(--tx-space-3); }
.tx-mb-4 { margin-bottom: var(--tx-space-4); }
.tx-font-bold { font-weight: 700; }
.tx-text-muted { color: var(--tx-text-muted); }
.tx-text-primary { color: var(--tx-primary); }
.tx-text-success { color: var(--tx-success); }
.tx-text-danger { color: var(--tx-danger); }
