/**
 * Main Application Stylesheet
 * سیستم طراحی مدرن، واکنش‌گرا و بهینه‌سازی‌شده برای زبان فارسی و راست‌چین (RTL)
 */

/* Vazirmatn Local Font Face Declarations */
@font-face {
    font-family: 'Vazirmatn';
    src: local('Vazirmatn'),
         url('../fonts/Vazirmatn-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: local('Vazirmatn Medium'),
         url('../fonts/Vazirmatn-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: local('Vazirmatn SemiBold'),
         url('../fonts/Vazirmatn-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: local('Vazirmatn Bold'),
         url('../fonts/Vazirmatn-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: local('Vazirmatn ExtraBold'),
         url('../fonts/Vazirmatn-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: local('Vazirmatn Light'),
         url('../fonts/Vazirmatn-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}



:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    
    --slate-950: #020617;
    --slate-900: #0f172a;
    --slate-850: #172033;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50:  #f8fafc;
    
    --emerald-600: #059669;
    --emerald-500: #10b981;
    --emerald-100: #d1fae5;
    --emerald-50:  #ecfdf5;
    
    --amber-600: #d97706;
    --amber-500: #f59e0b;
    --amber-100: #fef3c7;
    --amber-50:  #fffbeb;

    --rose-600: #e11d48;
    --rose-500: #f43f5e;
    --rose-100: #ffe4e6;
    --rose-50:  #fff1f2;
    
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Enforce Vazirmatn on all interactive form elements and dropdowns */
button,
input,
optgroup,
select,
textarea {
    font-family: var(--font-family);
}

select,
option,
optgroup {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif !important;
    direction: rtl;
    text-align: right;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Typography & Links */
h1, h2, h3, h4, h5, h6 {
    color: var(--slate-900);
    font-weight: 700;
    line-height: 1.3;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: var(--primary-hover);
}

/* Header & Navigation Bar */
.navbar {
    background-color: var(--slate-900);
    color: #ffffff;
    border-bottom: 1px solid var(--slate-800);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.navbar-container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 1.25rem;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.brand-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: normal;
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 0.5rem;
}

.nav-link {
    color: var(--slate-300);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: #ffffff;
    background-color: var(--slate-800);
}

.nav-link.active {
    color: #ffffff;
    background-color: var(--primary);
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--slate-200);
    font-size: 0.85rem;
    background-color: var(--slate-800);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--slate-700);
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-form {
    display: inline-flex;
    margin: 0;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: rgba(244, 63, 94, 0.1);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.85rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-logout:hover {
    background-color: var(--rose-600);
    border-color: var(--rose-600);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.35);
}

.btn-logout:focus-visible {
    outline: 2px solid var(--rose-500);
    outline-offset: 2px;
}

.btn-logout:active {
    transform: scale(0.98);
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--slate-700);
    color: #ffffff;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* Main Container */
.main-wrapper {
    flex: 1;
    max-width: 1360px;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
}

/* Page Header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title-group h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--slate-900);
}

.page-title-group p {
    font-size: 0.9rem;
    color: var(--slate-500);
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    min-height: 42px;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--slate-700);
    border-color: var(--slate-300);
}
.btn-secondary:hover {
    background-color: var(--slate-100);
    border-color: var(--slate-400);
    color: var(--slate-900);
}

.btn-success {
    background-color: var(--emerald-600);
    color: #ffffff;
}
.btn-success:hover {
    background-color: #047857;
    color: #ffffff;
}

.btn-danger {
    background-color: var(--rose-600);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #be123c;
    color: #ffffff;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    min-height: 32px;
}

/* Metric Cards Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-title {
    font-size: 0.85rem;
    color: var(--slate-500);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: normal;
}

.metric-sub {
    font-size: 0.8rem;
    color: var(--slate-400);
    margin-top: 0.4rem;
}

/* Card Surface */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fafbfc;
}

.card-header h2, .card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--slate-800);
}

.card-body {
    padding: 1.25rem;
}

/* Tables & Interactive Scroll Controls */
.table-scroll-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    min-width: 0;
}

/* Directional Arrow Controls for Mobile Table Navigation */
.table-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15), 0 1px 3px rgba(15, 23, 42, 0.08);
    color: var(--slate-800);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.15s ease,
                background-color 0.15s ease,
                box-shadow 0.15s ease,
                color 0.15s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.table-scroll-btn svg {
    pointer-events: none;
    stroke-width: 2.5;
}

.table-scroll-btn-left {
    left: 8px;
}

.table-scroll-btn-right {
    right: 8px;
}

/* Active and Inactivity Visibility States */
.table-scroll-wrapper.has-scroll-overflow .table-scroll-btn {
    display: flex;
}

.table-scroll-wrapper.has-scroll-overflow.is-controls-active .table-scroll-btn:not(.is-disabled):not(.is-hidden) {
    opacity: 0.96;
    visibility: visible;
    pointer-events: auto;
}

.table-scroll-wrapper.has-scroll-overflow.is-controls-faded .table-scroll-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Accessible Keyboard Focus State */
.table-scroll-btn:focus-visible,
.table-scroll-btn:focus {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Hover & Active States */
.table-scroll-btn:hover:not(:disabled):not(.is-disabled) {
    background-color: #ffffff;
    color: var(--primary);
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}

.table-scroll-btn:active:not(:disabled):not(.is-disabled) {
    transform: translateY(-50%) scale(0.95);
    background-color: var(--slate-100);
}

/* Disabled Boundary State */
.table-scroll-btn:disabled,
.table-scroll-btn.is-disabled {
    opacity: 0.25 !important;
    cursor: not-allowed;
    pointer-events: none !important;
    transform: translateY(-50%) scale(0.92);
    box-shadow: none;
}

.table-scroll-btn.is-hidden {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .table-scroll-btn {
        transition: none !important;
    }
    .table-responsive {
        scroll-behavior: auto !important;
    }
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: right;
    font-size: 0.925rem;
}

.data-table th {
    background-color: #f8fafc;
    color: var(--slate-600);
    font-weight: 600;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--slate-700);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.775rem;
    font-weight: 700;
}

.status-badge.in_stock {
    background-color: var(--emerald-50);
    color: var(--emerald-600);
    border: 1px solid var(--emerald-100);
}

.status-badge.out_of_stock {
    background-color: var(--rose-50);
    color: var(--rose-600);
    border: 1px solid var(--rose-100);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-badge.in_stock .status-dot { background-color: var(--emerald-500); }
.status-badge.out_of_stock .status-dot { background-color: var(--rose-500); }

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.4rem;
}

.form-label .required {
    color: var(--rose-500);
    margin-right: 0.2rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-family: var(--font-family);
    font-size: 0.925rem;
    color: var(--slate-900);
    background-color: #ffffff;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: 42px;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' 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/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.65rem center;
    background-size: 14px 14px;
    padding-left: 2rem;
    padding-right: 0.85rem;
    cursor: pointer;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif !important;
}

select.form-control option,
select.form-control optgroup {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif !important;
    font-size: 0.875rem;
    direction: rtl;
    text-align: right;
    background-color: #ffffff;
    color: var(--slate-900);
    padding: 0.4rem 0.6rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-text {
    font-size: 0.8rem;
    color: var(--slate-500);
    margin-top: 0.35rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--rose-600);
    margin-top: 0.35rem;
    font-weight: 500;
}

/* Filter Controls Toolbar */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    background-color: var(--bg-surface);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 420px;
}

.filter-pills {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-pill {
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--slate-600);
    background-color: var(--slate-100);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.filter-pill:hover {
    background-color: var(--slate-200);
    color: var(--slate-900);
}

.filter-pill.active {
    background-color: var(--primary);
    color: #ffffff;
}

/* Sort Toolbar Responsive Components */
.sort-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
}

.sort-fields-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 auto;
    min-width: 0;
    height: auto;
}

.sort-label {
    font-size: 0.85rem;
    color: var(--slate-600);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0;
}

.sort-select-wrapper {
    min-width: 0;
    flex: 1 1 auto;
}

.sort-select {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    height: 38px;
    padding: 0.35rem 1.85rem 0.35rem 0.65rem;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif !important;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.sort-order-wrapper {
    min-width: 0;
    flex: 0 0 auto;
}

.sort-select-order {
    width: auto;
    min-width: 80px;
    min-height: 38px;
    height: 38px;
    padding: 0.35rem 1.85rem 0.35rem 0.65rem;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif !important;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.sort-select option,
.sort-select-order option {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif !important;
    font-size: 0.875rem;
    direction: rtl;
    text-align: right;
    background-color: #ffffff;
    color: var(--slate-900);
    padding: 0.4rem 0.6rem;
}

.sort-actions-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    height: auto;
}

.btn-sort-apply,
.btn-sort-clear {
    min-height: 38px;
    height: 38px;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-sort-clear {
    color: var(--rose-600);
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--slate-500);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-300);
    background-color: #ffffff;
    color: var(--slate-700);
    text-decoration: none;
    transition: all 0.15s ease;
}

.page-btn:hover {
    background-color: var(--slate-100);
    border-color: var(--slate-400);
}

.page-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.page-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Alert Banners */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid transparent;
}

.alert-success {
    background-color: var(--emerald-50);
    border-color: var(--emerald-100);
    color: var(--emerald-600);
}

.alert-error, .alert-danger {
    background-color: var(--rose-50);
    border-color: var(--rose-100);
    color: var(--rose-600);
}

.alert-warning {
    background-color: var(--amber-50);
    border-color: var(--amber-100);
    color: var(--amber-600);
}

.alert-info {
    background-color: var(--primary-light);
    border-color: var(--primary-border);
    color: var(--primary);
}

/* Interactive Price Breakdown Preview Card */
.price-breakdown-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
}

.calc-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px dashed var(--slate-300);
    font-size: 0.875rem;
}

.calc-step:last-child {
    border-bottom: none;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--slate-800);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--slate-900);
}

.calc-label {
    color: var(--slate-600);
}

.calc-value {
    font-weight: 700;
    color: var(--slate-900);
    direction: ltr;
}

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-md);
    max-width: 500px;
    width: 100%;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 0.5rem;
}

.modal-body {
    color: var(--slate-600);
    font-size: 0.925rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Component: Product Table vs Mobile Cards */
.product-table-view {
    display: block;
}

.product-cards-view {
    display: none;
}

.mobile-cards-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.85rem;
}

.mobile-product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mobile-product-card:hover {
    box-shadow: var(--shadow-md);
}

.mpc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.mpc-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.mpc-badge-id {
    background: var(--slate-100);
    color: var(--slate-700);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}

.mpc-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.mpc-title a {
    color: var(--slate-900);
}

.mpc-title a:hover {
    color: var(--primary);
}

.mpc-description {
    font-size: 0.825rem;
    color: var(--slate-600);
    line-height: 1.45;
    background: var(--slate-50);
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-200);
}

.mpc-prices-grid {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mpc-price-row.final-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--slate-300);
    padding-bottom: 0.5rem;
}

.mpc-price-label {
    font-size: 0.85rem;
    color: var(--slate-600);
    font-weight: 500;
}

.mpc-price-val.mpc-highlight {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--slate-950);
}

.mpc-sub-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--slate-600);
    flex-wrap: wrap;
    gap: 0.25rem;
}

.mpc-sub-label {
    color: var(--slate-500);
}

.mpc-sub-val {
    font-weight: 700;
    color: var(--slate-800);
    margin-inline-start: 4px;
}

.mpc-actions-row {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

.mpc-actions-row .btn {
    min-height: 38px;
    padding: 0.35rem 0.5rem;
    font-size: 0.825rem;
}

/* Component: Redesigned Currency Settings */
.currency-settings-layout {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1.5rem;
    align-items: start;
    width: 100%;
}

.currency-form-card,
.currency-simulator-card {
    min-width: 0;
    width: 100%;
}

.source-badge {
    font-size: 0.8rem;
    background: #e0f2fe;
    color: #0369a1;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

/* Flexible, non-overlapping input groups with attached affixes */
.input-with-affix {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-with-affix:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-with-affix .form-control {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0.65rem 0.85rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--slate-900);
    background: transparent;
    outline: none;
    direction: rtl;
    text-align: right;
    unicode-bidi: isolate;
}

.input-with-affix .input-affix-label {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.85rem;
    background-color: var(--slate-100);
    color: var(--slate-600);
    font-weight: 700;
    font-size: 0.85rem;
    border-inline-start: 1px solid var(--border-color);
    white-space: nowrap;
    user-select: none;
    direction: rtl;
    unicode-bidi: isolate;
}

.input-affix-label .affix-text {
    direction: ltr;
    unicode-bidi: isolate;
}

/* Rate Summary Card & Items */
.effective-rate-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    width: 100%;
}

.rate-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0.95rem;
    background: var(--slate-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-200);
    min-width: 0;
    width: 100%;
}

.rate-summary-item.highlight-effective {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    padding: 0.85rem 1rem;
}

.rsi-label {
    font-size: 0.875rem;
    color: var(--slate-600);
    font-weight: 600;
    flex-shrink: 0;
}

.rsi-value-group {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    direction: rtl;
    unicode-bidi: isolate;
}

.rsi-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--slate-900);
    unicode-bidi: isolate;
}

.rate-summary-item.highlight-effective .rsi-value {
    font-size: 1.35rem;
    color: #1e3a8a;
}

.rsi-unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-500);
    unicode-bidi: isolate;
}

.text-amber {
    color: var(--amber-600);
}

.text-primary {
    color: var(--primary);
}

.text-blue {
    color: #0369a1;
}

.rate-meta-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
    font-size: 0.825rem;
    border-top: 1px solid var(--slate-200);
    padding-top: 0.75rem;
    width: 100%;
}

.rml-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--slate-600);
    flex-wrap: wrap;
}

.formula-explanation-box {
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    margin-top: 0.75rem;
    width: 100%;
    min-width: 0;
}

.feb-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 0.45rem;
}

.feb-formula {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-800);
    line-height: 1.6;
    margin-bottom: 0.5rem;
    background: #ffffff;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid #dbeafe;
    direction: rtl;
    unicode-bidi: isolate;
}

.feb-calc-group {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    direction: ltr;
    unicode-bidi: isolate;
}

.feb-final {
    color: #1e3a8a;
    font-weight: 800;
}

.feb-unit {
    font-size: 0.8rem;
    color: var(--slate-600);
    font-weight: 500;
}

.feb-note {
    font-size: 0.775rem;
    color: var(--slate-500);
    line-height: 1.45;
    margin: 0;
}

/* -------------------------------------------------------------------------
 * Automatic AED Exchange Rate Mode & Live Source Styling
 * ------------------------------------------------------------------------- */
.mode-selection-container {
    margin-bottom: 1.25rem;
}

.mode-switch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-top: 0.4rem;
}

.mode-card {
    position: relative;
    display: block;
    background: #ffffff;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 10px);
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.mode-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-card:hover {
    border-color: #93c5fd;
    background-color: #f8fafc;
    transform: translateY(-1px);
}

.mode-card.is-selected {
    border-color: var(--primary, #2563eb);
    background: linear-gradient(145deg, #f0f7ff 0%, #e0effe 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.mode-card-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mode-card-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.mode-card.is-selected .mode-card-icon {
    background: var(--primary, #2563eb);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.mode-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mode-card-title {
    font-size: 0.925rem;
    font-weight: 700;
    color: var(--slate-900, #0f172a);
    line-height: 1.35;
}

.mode-card.is-selected .mode-card-title {
    color: #1e40af;
}

.mode-card-desc {
    font-size: 0.75rem;
    color: var(--slate-500, #64748b);
    line-height: 1.35;
    margin-top: 0.15rem;
}

/* Automatic Mode Live Panel */
.auto-status-panel {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md, 10px);
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.25rem;
    transition: all 0.25s ease;
}

.auto-status-panel.panel-syncing {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #bfdbfe;
}

.asp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
    padding-bottom: 0.65rem;
}

.asp-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #065f46;
}

.auto-status-panel.panel-syncing .asp-title-wrap {
    color: #1e40af;
}

/* Pulsing dot for real-time status */
.live-dot-pulse {
    position: relative;
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border-radius: 50%;
}

.live-dot-pulse::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: live-pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes live-pulse {
    0% { transform: scale(0.9); opacity: 0.9; }
    50% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(0.9); opacity: 0; }
}

.btn-refresh-rate {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.775rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-refresh-rate:hover {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
}

.btn-refresh-rate:disabled {
    opacity: 0.65;
    cursor: wait;
}

.btn-refresh-rate.is-loading .spin-icon {
    animation: spin-clockwise 0.85s linear infinite;
}

@keyframes spin-clockwise {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.asp-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.65rem 1rem;
    font-size: 0.8rem;
}

.asp-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
}

.asp-label {
    color: var(--slate-600, #475569);
    font-weight: 500;
}

.asp-value {
    font-weight: 700;
    color: var(--slate-900, #0f172a);
}

/* Alert banner for auto errors */
.auto-error-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm, 6px);
    padding: 0.75rem 0.85rem;
    margin-top: 0.75rem;
}

.ae-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
}

.ae-body {
    flex: 1;
}

.ae-title {
    display: block;
    font-size: 0.825rem;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 0.2rem;
}

.ae-msg {
    font-size: 0.775rem;
    color: #b45309;
    line-height: 1.4;
    margin-bottom: 0.35rem;
}

.ae-fallback-note {
    font-size: 0.725rem;
    color: #78350f;
    line-height: 1.35;
}

/* Managed input visual treatment */
.input-readonly-managed {
    background-color: #f8fafc !important;
    color: #334155 !important;
    cursor: default !important;
    user-select: all;
    font-weight: 700;
}

.badge-system {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-size: 0.725rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
}

.badge-editable {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 0.725rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
}

.source-badge.badge-auto {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.source-badge.badge-manual {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Live source info card */
.live-source-card {
    border-color: #e2e8f0;
}

.source-link-box {
    margin: 0.65rem 0;
}

.arzdigital-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-family: monospace;
    direction: ltr;
    color: var(--primary, #2563eb);
    background: #f0f7ff;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid #bfdbfe;
    text-decoration: none;
    word-break: break-all;
    transition: all 0.15s ease;
}

.arzdigital-link:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    text-decoration: underline;
}

.fac-footer-note {
    font-size: 0.75rem;
    color: var(--slate-500, #64748b);
    line-height: 1.45;
    margin-top: 0.5rem;
}

.is-hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .mode-switch-grid {
        grid-template-columns: 1fr;
    }

    .asp-details {
        grid-template-columns: 1fr;
    }
}

/* Table Scroll Wrapper & Affordance */
.table-scroll-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
}

.table-scroll-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    user-select: none;
    text-align: center;
    transition: opacity 0.2s ease;
}

.table-scroll-hint.is-visible {
    display: flex;
}

.table-scroll-hint .tsh-icon {
    font-size: 1.1rem;
    color: var(--primary);
    line-height: 1;
}

.table-responsive .data-table {
    min-width: 720px;
}

.future-api-card {
    border-style: dashed;
    background: #fafbfc;
    margin-top: 1.25rem;
}

.fac-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    color: var(--slate-700);
    font-size: 0.9rem;
}

.fac-desc {
    font-size: 0.8rem;
    color: var(--slate-600);
    line-height: 1.5;
    margin: 0;
}

.inline-code {
    background: #e2e8f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.85em;
}

.btn-save-currency {
    width: 100%;
    min-height: 46px;
    font-size: 0.95rem;
}

/* Component: Product Form & Show Grids */
.product-form-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.product-show-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Product Details Showcase & Information Hierarchy */
.product-show-header {
    margin-bottom: 1.5rem;
}

.product-header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--slate-500);
    margin-bottom: 0.35rem;
}

.product-header-breadcrumb a {
    color: var(--primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--slate-400);
}

.product-show-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--slate-900);
    line-height: 1.35;
    word-break: break-word;
}

.product-show-subtitle {
    color: var(--slate-600);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.product-show-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

/* Product Identity Card */
.product-identity-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-identity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.product-id-badge-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-id-tag {
    background: var(--slate-100);
    color: var(--slate-700);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--slate-200);
}

.product-price-hero {
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 1.15rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.price-hero-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px dashed #bfdbfe;
    padding-bottom: 0.75rem;
}

.price-hero-label {
    font-size: 0.95rem;
    color: #1e40af;
    font-weight: 600;
}

.price-hero-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.price-hero-sub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.price-hero-chip {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chip-label {
    font-size: 0.75rem;
    color: var(--slate-500);
}

.chip-val {
    font-size: 0.95rem;
    color: var(--slate-900);
}

/* Structured Specs List */
.product-specs-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    gap: 0.75rem;
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-label {
    color: var(--slate-500);
    flex-shrink: 0;
    min-width: 110px;
}

.spec-val {
    color: var(--slate-800);
    text-align: left;
    word-break: break-word;
}

.spec-val-name {
    color: var(--slate-950);
    font-size: 0.95rem;
}

.product-desc-section {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 0.5rem;
}

.desc-heading {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--slate-700);
    margin-bottom: 0.4rem;
}

.desc-content {
    font-size: 0.9rem;
    color: var(--slate-700);
    line-height: 1.7;
    white-space: pre-line;
    word-break: break-word;
}

/* Formula Breakdown Cards */
.product-formula-card {
    height: 100%;
}

.formula-badge {
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #bfdbfe;
}

.formula-banner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.formula-banner-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--slate-600);
    display: block;
    margin-bottom: 0.25rem;
}

.formula-equation {
    font-size: 0.875rem;
    color: var(--slate-900);
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
}

.calc-steps-stack {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.calc-step-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: background-color 0.15s ease;
}

.calc-step-card:hover {
    background-color: #f8fafc;
}

.csc-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.csc-badge {
    background: var(--slate-100);
    color: var(--slate-700);
    font-size: 0.725rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.csc-label {
    font-size: 0.85rem;
    color: var(--slate-600);
    word-break: break-word;
}

.csc-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--slate-900);
    text-align: left;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.csc-unit {
    font-size: 0.775rem;
    color: var(--slate-500);
    font-weight: 500;
}

.csc-highlight-blue {
    color: #1d4ed8;
}

.csc-highlight-amber {
    color: #d97706;
}

.csc-highlight-emerald {
    color: #059669;
}

.csc-final-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: #0f172a;
    color: #ffffff;
    padding: 0.9rem 1rem;
    margin-top: 0.35rem;
}

.csc-final-card:hover {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.csc-final-card .csc-label {
    color: #cbd5e1;
    font-weight: 600;
}

.csc-badge-final {
    background: #2563eb;
    color: #ffffff;
}

.csc-final-value {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 800;
}

.formula-footer-meta {
    margin-top: 1rem;
    font-size: 0.775rem;
    color: var(--slate-500);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.meta-sep {
    color: var(--slate-300);
}

.live-preview-sticky {
    position: sticky;
    top: 88px;
}

/* Navigation Drawer Mobile Additions */
.nav-mobile-user-item {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--slate-800);
}

.mobile-drawer-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--slate-200);
    font-size: 0.9rem;
    margin-bottom: 0.65rem;
    padding: 0 0.5rem;
}

.mobile-drawer-avatar {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.btn-logout-drawer {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
}

.btn-logout-drawer:hover {
    background-color: var(--rose-600);
    color: #ffffff;
}

/* Responsive Media Queries */
@media (max-width: 991px) {
    .nav-links {
        display: none;
    }

    .mobile-toggle {
        display: block;
    }

    .nav-links.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 68px;
        right: 0;
        left: 0;
        background-color: var(--slate-900);
        padding: 1rem 1.25rem;
        border-bottom: 1px solid var(--slate-800);
        box-shadow: var(--shadow-lg);
        z-index: 60;
    }

    .nav-mobile-user-item {
        display: block;
    }

    .currency-settings-layout {
        grid-template-columns: 1fr;
    }

    .product-form-grid, .product-show-grid {
        grid-template-columns: 1fr;
    }

    .live-preview-sticky {
        position: static;
    }
}

@media (max-width: 768px) {
    .product-table-view {
        display: none;
    }

    .product-cards-view {
        display: block;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 1rem;
        gap: 0.75rem;
    }

    .header-actions {
        width: 100%;
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }

    .header-actions .btn {
        flex: 1 1 auto;
        min-height: 42px;
    }

    .filter-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 0.85rem;
        margin-bottom: 1rem;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
    }

    .filter-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .pagination-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .modal-dialog {
        max-width: min(500px, calc(100vw - 2rem));
        width: 100%;
        margin: 1rem;
        padding: 1.25rem;
    }

    .modal-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1 1 120px;
    }

    .sort-toolbar-group {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
        justify-content: flex-start;
        padding-top: 0.5rem;
        margin-top: 0.15rem;
        border-top: 1px solid var(--slate-200);
    }

    .sort-fields-row {
        flex: 1 1 auto;
        min-width: 0;
        height: auto;
    }

    .sort-actions-row {
        flex: 0 0 auto;
        height: auto;
    }
}

@media (max-width: 640px) {
    .product-show-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .product-show-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .btn-edit-product,
    .btn-back-product {
        width: 100%;
        justify-content: center;
        min-height: 42px;
    }

    .price-hero-sub {
        grid-template-columns: 1fr;
    }

    .spec-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .spec-val {
        text-align: right;
    }

    .calc-step-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
    }

    .csc-value {
        text-align: right;
        justify-content: flex-start;
        white-space: normal;
        word-break: break-word;
    }

    .csc-final-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
    }

    .csc-final-value {
        text-align: right;
    }

    .filter-toolbar {
        padding: 0.75rem;
        gap: 0.5rem;
        margin-bottom: 0.85rem;
    }

    .sort-toolbar-group {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.45rem;
        align-items: stretch;
        padding-top: 0.5rem;
        margin-top: 0.15rem;
        border-top: 1px solid var(--slate-200);
    }

    .sort-fields-row {
        display: grid;
        grid-template-columns: auto 1fr 90px;
        gap: 0.4rem;
        width: 100%;
        align-items: center;
        min-width: 0;
        flex: 0 0 auto;
        height: auto;
    }

    .sort-label {
        font-size: 0.825rem;
        white-space: nowrap;
        margin: 0;
    }

    .sort-select-wrapper {
        width: 100%;
        min-width: 0;
    }

    .sort-order-wrapper {
        width: 90px;
        min-width: 0;
    }

    .sort-select,
    .sort-select-order {
        min-height: 38px;
        height: 38px;
        font-size: 0.85rem;
        padding: 0.35rem 1.85rem 0.35rem 0.55rem;
    }

    .sort-actions-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        gap: 0.45rem;
        flex: 0 0 auto;
        height: auto;
    }

    .sort-actions-row:not(:has(.btn-sort-clear)) {
        grid-template-columns: 1fr;
    }

    .btn-sort-apply,
    .btn-sort-clear {
        width: 100%;
        justify-content: center;
        min-height: 38px;
        height: 38px;
        font-size: 0.85rem;
        padding: 0.35rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .navbar-container {
        padding: 0 0.85rem;
        height: 62px;
    }

    .brand-title {
        font-size: 0.95rem;
    }

    .brand-logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .user-badge {
        display: none;
    }

    .main-wrapper {
        padding: 0 0.75rem;
        margin: 0.85rem auto;
    }

    .page-header {
        margin-bottom: 0.75rem;
        gap: 0.5rem;
    }

    .page-title-group h1 {
        font-size: 1.25rem;
    }

    .page-title-group p {
        font-size: 0.825rem;
        margin-top: 0.15rem;
    }

    .filter-toolbar {
        padding: 0.65rem 0.75rem;
        gap: 0.45rem;
        margin-bottom: 0.75rem;
    }

    .filter-pill {
        padding: 0.3rem 0.65rem;
        font-size: 0.775rem;
    }

    .mpc-actions-row {
        flex-direction: column;
    }

    .mpc-actions-row .btn {
        width: 100%;
        min-height: 42px;
    }
}

@media (max-width: 360px) {
    .brand-title {
        font-size: 0.85rem;
    }

    .btn-logout {
        padding: 0.35rem 0.55rem;
        font-size: 0.8rem;
    }
    
    .btn-logout .logout-text {
        font-size: 0.8rem;
    }

    .sort-fields-row {
        display: grid;
        grid-template-columns: 1fr 85px;
        gap: 0.35rem;
        width: 100%;
        align-items: center;
        flex: 0 0 auto;
        height: auto;
    }

    .sort-label {
        grid-column: 1 / -1;
        font-size: 0.8rem;
        margin-bottom: -0.1rem;
    }

    .sort-order-wrapper {
        width: 85px;
    }

    .product-show-actions {
        grid-template-columns: 1fr;
    }
}

