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

:root {
    --bg: #f8fafc;
    --bg-subtle: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --sidebar-bg: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #0f172a;
    --text-secondary: #334155;
    --muted: #64748b;
    --muted-light: #94a3b8;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --primary-border: #c7d2fe;

    --accent: #0ea5e9;
    --accent-soft: #e0f2fe;

    --success: #10b981;
    --success-soft: #ecfdf5;
    --success-text: #047857;
    --success-border: #a7f3d0;

    --warning: #f59e0b;
    --warning-soft: #fffbeb;
    --warning-text: #b45309;
    --warning-border: #fde68a;

    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --danger-text: #b91c1c;
    --danger-border: #fecaca;

    --info: #3b82f6;
    --info-soft: #eff6ff;
    --info-text: #1d4ed8;
    --info-border: #bfdbfe;

    --purple: #8b5cf6;
    --purple-soft: #f5f3ff;
    --purple-text: #6d28d9;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.1), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 40px -10px rgba(15, 23, 42, 0.16);

    --sidebar-width: 264px;
    --topbar-height: 68px;
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   APP SHELL (SIDEBAR + MAIN WRAPPER)
   ========================================================================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform var(--transition);
}

.sidebar-brand {
    height: var(--topbar-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    flex-shrink: 0;
}

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

.brand-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
}

.sidebar-cta {
    padding: 16px 16px 8px;
}

.btn-new-order-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: #ffffff;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.22);
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.btn-new-order-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.32);
    filter: brightness(1.03);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted-light);
    padding: 10px 12px 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    transition: background var(--transition), color var(--transition);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    color: var(--muted);
    transition: color var(--transition);
}

.sidebar-nav a:hover {
    background: var(--bg-subtle);
    color: var(--text);
}

.sidebar-nav a:hover i {
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav a.active i {
    color: var(--primary);
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-hover);
}

.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--primary-border);
}

.user-details {
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11.5px;
    color: var(--muted);
}

.btn-logout {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger-border);
}

/* ==========================================================================
   MAIN CONTENT & TOPBAR
   ========================================================================== */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.topbar-header {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-menu-btn {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

.page-heading {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.date-chip i {
    color: var(--primary);
}

.container {
    padding: 24px 28px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    flex: 1 0 auto;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 35;
}

/* ==========================================================================
   PAGE HEADER & TOOLBARS
   ========================================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-info h2 {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text);
}

.page-header-info p {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   CARDS & STAT BOXES
   ========================================================================== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.card h3 {
    margin: 0 0 14px 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

/* KPI Stat Card */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

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

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-soft); color: var(--primary); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-icon.purple { background: var(--purple-soft); color: var(--purple); }

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background: var(--bg-subtle);
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

thead th:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    border-left: 1px solid var(--border);
}

thead th:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    border-right: 1px solid var(--border);
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
    font-size: 13.5px;
}

tbody tr {
    transition: background-color 120ms ease;
}

tbody tr:hover {
    background-color: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

.cell-id {
    font-weight: 700;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.cell-strong {
    font-weight: 600;
    color: var(--text);
}

.cell-price {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 36px;
    color: var(--muted-light);
    margin-bottom: 12px;
    display: block;
}

.empty-state h4 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--text);
}

.empty-state p {
    margin: 0 0 16px;
    font-size: 13.5px;
}

/* ==========================================================================
   BADGES & TAGS
   ========================================================================== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid transparent;
}

.tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.tag.pending {
    background: var(--warning-soft);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.tag.preparing {
    background: var(--info-soft);
    color: var(--info-text);
    border-color: var(--info-border);
}

.tag.shipped {
    background: var(--purple-soft);
    color: var(--purple-text);
    border-color: #ddd6fe;
}

.tag.to_be_invoiced {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.tag.invoiced {
    background: #ecfeff;
    color: #0e7490;
    border-color: #a5f3fc;
}

.tag.completed,
.tag.paid,
.tag.active {
    background: var(--success-soft);
    color: var(--success-text);
    border-color: var(--success-border);
}

.tag.cancelled,
.tag.passive {
    background: var(--danger-soft);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

.payment-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.payment-badge.payment-card { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.payment-badge.payment-cash { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.payment-badge.payment-transfer { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.payment-badge.payment-open { background: #fffbeb; color: #b45309; border-color: #fde68a; }

.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}
.stock-badge.in-stock { background: var(--success-soft); color: var(--success-text); }
.stock-badge.low-stock { background: var(--warning-soft); color: var(--warning-text); }
.stock-badge.out-stock { background: var(--danger-soft); color: var(--danger-text); }

/* ==========================================================================
   FORMS, INPUTS & FILTERS
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.filter-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--bg-subtle);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 18px;
}

.filter-group {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-item {
    min-width: 180px;
    flex: 1;
    max-width: 280px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12.5px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap > i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-light);
    font-size: 14px;
    pointer-events: none;
    z-index: 2;
}

.input-icon-wrap > input[type="text"],
.input-icon-wrap > input[type="number"],
.input-icon-wrap > input[type="email"],
.input-icon-wrap > input[type="password"],
.input-icon-wrap > input {
    padding-left: 38px !important;
}

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

textarea {
    min-height: 84px;
    resize: vertical;
}

/* Status quick-select in table */
.status-select {
    padding: 5px 26px 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-strong);
    background-color: var(--surface);
    cursor: pointer;
    width: auto;
    min-width: 142px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.3;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
}

.btn:active,
button:active {
    transform: translateY(0);
}

.btn-primary,
button[type="submit"]:not(.btn) {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover,
button[type="submit"]:not(.btn):hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.32);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-subtle);
    color: var(--text);
    border-color: #94a3b8;
}

.btn-success {
    background: var(--success);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger-border);
}

.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

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

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 7px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
}

.btn-inline {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.stack {
    display: grid;
    gap: 16px;
}

.muted {
    color: var(--muted);
    font-size: 12.5px;
}

.c-name {
    font-weight: 600;
    color: var(--text);
}

/* ==========================================================================
   ALERTS & NOTICES
   ========================================================================== */
.notice {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    background: var(--success-soft);
    color: var(--success-text);
    border: 1px solid var(--success-border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.error {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    background: var(--danger-soft);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

/* ==========================================================================
   ORDER BUILDER (NEW / EDIT ORDER)
   ========================================================================== */
.order-builder-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    align-items: start;
}

.order-summary-sticky {
    position: sticky;
    top: calc(var(--topbar-height) + 20px);
}

.item-header {
    display: grid;
    grid-template-columns: 1fr 130px 140px 130px 44px;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr 130px 140px 130px 44px;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.item-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-sm);
}

.item-product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.item-thumb {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    flex-shrink: 0;
}

.item-card .item-meta {
    color: var(--muted);
    font-size: 12.5px;
}

.item-card .item-price {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.qty-stepper button {
    width: 30px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 700;
    border-radius: 0;
    cursor: pointer;
}

.qty-stepper button:hover {
    background: var(--border);
    transform: none;
}

.qty-stepper input {
    width: 52px;
    height: 32px;
    border: none;
    text-align: center;
    font-weight: 600;
    padding: 0 4px;
    border-radius: 0;
}

.qty-stepper input:focus {
    box-shadow: none;
}

.summary-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 14px;
}

.badge {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
}

.badge.muted {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-color: var(--border);
}

/* Autocomplete Suggest Box */
.suggest-box {
    position: relative;
}

.suggest-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 45;
    padding: 4px;
}

.suggest-list button {
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 500;
}

.suggest-list button:hover,
.suggest-list button.selected {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
    transform: none;
}

.suggest-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.suggest-item-thumb {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.suggest-item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 12.5px;
    white-space: nowrap;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 60;
    padding: 16px;
}

.modal-backdrop.show {
    display: flex;
    animation: fadeIn 150ms ease-out;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: min(640px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
.login-body {
    background: radial-gradient(circle at 15% 15%, #eef2ff 0%, #f8fafc 45%, #e0f2fe 100%);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    width: 100%;
    max-width: 420px;
    padding: 38px 34px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
}

.login-brand {
    display: flex;
     flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 28px;
}

.login-brand .brand-logo {
    width: 52px;
    height: 52px;
    font-size: 22px;
    border-radius: 14px;
    margin-bottom: 14px;
}

.login-card h1 {
    margin: 0 0 6px 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.4px;
}

.login-card .login-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
}

/* ==========================================================================
   IMAGE POPUP & HOVER PREVIEW
   ========================================================================== */
#imagePopupModal {
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.modal-content-image {
    max-width: 90vw;
    max-height: 88vh;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    cursor: default;
    animation: modalSlideUp 0.25s ease-out;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close-btn:hover {
    color: #cbd5e1;
}

.product-title-wrapper {
    position: relative;
    cursor: pointer;
}

.product-image-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 20px;
    z-index: 100;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.product-title-wrapper:hover .product-image-popup {
    display: block;
}

.product-image-popup img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 8px;
    display: block;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.toast {
    padding: 13px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: #ffffff;
    font-weight: 600;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 1;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: translateX(0);
    animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.toast.error {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================================================
   FOOTER & PAGINATION
   ========================================================================== */
.footer {
    margin-top: auto;
    padding: 18px 28px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
}

.footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.pagination {
    margin-top: 18px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
    .order-builder-grid {
        grid-template-columns: 1fr;
    }
    .order-summary-sticky {
        position: static;
    }
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-wrapper {
        margin-left: 0;
    }
    .mobile-menu-btn {
        display: inline-flex;
    }
    .topbar-header {
        padding: 0 16px;
    }
    .container {
        padding: 18px 16px;
    }
    .item-header {
        display: none;
    }
    .item-card {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .item-card > div:first-child {
        grid-column: 1 / -1;
    }
}
