/* ============================================
   Credit Analysis Dashboard Styles
   Version: 2.0.0
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary: #2348b8;
    --primary-dark: #1a348a;
    --primary-light: #3f66d2;
    --accent: #13a89e;

    --success: #14996b;
    --success-light: #dcf5eb;
    --success-dark: #0f6f4e;

    --warning: #d98b2c;
    --warning-light: #fdf1dd;
    --warning-dark: #8d5718;

    --danger: #d84f54;
    --danger-light: #fde6e7;
    --danger-dark: #8e2b30;

    --info: #2f75d8;
    --info-light: #e0ecff;
    --info-dark: #184d98;

    --vip: #7656ce;
    --vip-light: #ece5ff;
    --vip-dark: #4a3294;

    --risk-a: #14996b;
    --risk-a-bg: #dcf5eb;
    --risk-b: #2f75d8;
    --risk-b-bg: #e0ecff;
    --risk-c: #d98b2c;
    --risk-c-bg: #fdf1dd;
    --risk-d: #ef7f3a;
    --risk-d-bg: #ffeddf;
    --risk-e: #d84f54;
    --risk-e-bg: #fde6e7;

    --bg-primary: #f5f7fc;
    --bg-secondary: #ecf1fa;
    --bg-card: #ffffff;
    --bg-hover: #f8faff;
    --bg-elevated: #f9fbff;

    --text-primary: #1a2740;
    --text-secondary: #4c5f80;
    --text-muted: #7e8ea8;

    --border: #dbe3f1;
    --border-dark: #c8d4e8;

    --shadow-sm: 0 2px 4px rgba(34, 49, 92, 0.06);
    --shadow: 0 8px 24px rgba(34, 49, 92, 0.08);
    --shadow-md: 0 12px 28px rgba(34, 49, 92, 0.12);
    --shadow-lg: 0 18px 40px rgba(23, 38, 76, 0.16);

    --radius-sm: 0.35rem;
    --radius: 0.65rem;
    --radius-md: 1rem;
    --radius-lg: 1.25rem;
    --radius-full: 9999px;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 1.75rem;
    --space-8: 2rem;
    --space-10: 2.5rem;

    --transition-fast: 150ms ease;
    --transition: 220ms ease;
    --transition-slow: 320ms ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    background:
        radial-gradient(circle at 90% 10%, rgba(35, 72, 184, 0.09), transparent 30%),
        radial-gradient(circle at 10% 25%, rgba(19, 168, 158, 0.08), transparent 35%),
        var(--bg-primary);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.dashboard-container,
.detail-container {
    max-width: 1420px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

/* Header / Hero */
.dashboard-header,
.detail-header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-7);
}

.dashboard-header {
    align-items: flex-start;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, #fff, #f6f9ff);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--space-6) var(--space-7);
}

.header-content h1,
.order-title h1 {
    font-family: 'Fraunces', serif;
    letter-spacing: -0.02em;
}

.header-content h1 {
    font-size: clamp(1.55rem, 2.2vw, 2.25rem);
    line-height: 1.15;
}

.header-kicker {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.header-subtitle {
    margin-top: var(--space-2);
    color: var(--text-secondary);
    max-width: 64ch;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.logged-user {
    display: inline-flex;
    align-items: center;
    padding-right: var(--space-3);
    margin-right: var(--space-1);
    border-right: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.8rem;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: var(--danger);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

/* Dashboard Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-7);
    align-items: stretch;
}

.stat-card {
    background: linear-gradient(155deg, #ffffff, #f8fbff);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4);
    min-width: 0;
    transition: transform var(--transition-fast), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.3;
}

.stat-value {
    margin-top: var(--space-1);
    font-size: clamp(1.3rem, 1.3vw, 2rem);
    line-height: 1.15;
    font-weight: 800;
    color: var(--primary);
}

/* Filters */
.filters-section,
.orders-table-container,
.detail-section,
.action-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.filters-section {
    margin-bottom: var(--space-7);
    overflow: visible;
}

.filters-header,
.table-header,
.section-header,
.action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.filters-header h2,
.table-header h2,
.section-header h2,
.action-header h2 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 700;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--space-4);
    align-items: end;
}

.filters-form-body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.filters-row-secondary {
    padding-top: var(--space-2);
    border-top: 1px dashed var(--border);
}

.form-group-submit {
    align-self: end;
}

.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.modal-content textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    padding: 0.66rem 0.8rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(47, 117, 216, 0.12);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.multi-select {
    position: relative;
}

.multi-select-trigger {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    padding: 0.66rem 0.8rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.multi-select-trigger:focus,
.multi-select.open .multi-select-trigger {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(47, 117, 216, 0.12);
}

.multi-select-caret {
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1;
    transition: transform var(--transition-fast);
}

.multi-select.open .multi-select-caret {
    transform: rotate(180deg);
}

.multi-select-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 25;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.multi-select-clear {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: #fff;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    padding: 0.48rem 0.65rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.multi-select-clear:hover {
    background: var(--bg-hover);
}

.multi-select-options {
    max-height: 210px;
    overflow-y: auto;
    padding: 0.4rem;
}

.multi-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border-radius: var(--radius-sm);
    padding: 0.36rem 0.38rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.multi-option:hover {
    background: var(--bg-hover);
}

.multi-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
    cursor: pointer;
}

.multi-select-chips {
    display: none;
}

.multi-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.13rem 0.42rem;
}

.multi-chip-remove {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.multi-chip-remove:hover {
    color: var(--danger);
}

.multi-select-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* Tables */
.orders-table-container {
    overflow: hidden;
}

.table-header h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.06rem;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-primary);
}

.table-wrapper {
    overflow-x: auto;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.orders-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    white-space: nowrap;
    text-align: left;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: #f5f8ff;
    padding: 0.74rem 0.78rem;
    border-bottom: 1px solid var(--border);
}

.orders-table td {
    padding: 0.72rem 0.78rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.orders-table tbody tr:hover {
    background: var(--bg-hover);
}

.orders-table tbody tr:last-child td {
    border-bottom: 0;
}

.orders-table tbody tr.row-liberar { border-left: 4px solid var(--success); }
.orders-table tbody tr.row-cancelar { border-left: 4px solid var(--danger); }
.orders-table tbody tr.row-analise_humana,
.orders-table tbody tr.row-analise_humana_sem_lim_cred { border-left: 4px solid var(--warning); }
.orders-table tbody tr.row-rede_vip { border-left: 4px solid var(--vip); }
.orders-table tbody tr.row-excesso_max_limite { border-left: 4px solid #ef7f3a; }
.orders-table tbody tr.row-aguardar_pagto_ra,
.orders-table tbody tr.row-aguardar_pagto_atraso { border-left: 4px solid var(--info); }

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-8);
}

/* Badges */
.decision-badge,
.position-badge,
.risk-badge,
.risk-badge-small,
.main-decision-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.decision-badge,
.position-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.28rem 0.62rem;
}

.main-decision-badge {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.4rem 0.9rem;
}

.risk-badge-small {
    width: 1.45rem;
    height: 1.45rem;
    font-size: 0.72rem;
}

.risk-badge {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
}

.decision-liberar,
.badge-liberar,
.badge-success,
.position-L { background: var(--success-light); color: var(--success-dark); }
.decision-cancelar,
.badge-cancelar,
.badge-danger,
.position-C { background: var(--danger-light); color: var(--danger-dark); }
.decision-analise_humana,
.decision-analise_humana_sem_lim_cred,
.badge-analise_humana,
.badge-warning,
.position-B { background: var(--warning-light); color: var(--warning-dark); }
.decision-rede_vip,
.badge-rede_vip { background: var(--vip-light); color: var(--vip-dark); }
.decision-excesso_max_limite,
.badge-excesso_max_limite { background: #ffeddf; color: #9c4d11; }
.decision-aguardar_pagto_ra,
.decision-aguardar_pagto_atraso,
.badge-aguardar_pagto_ra,
.badge-aguardar_pagto_atraso,
.badge-info,
.position-M { background: var(--info-light); color: var(--info-dark); }

.decision-L { background: var(--success-light); color: var(--success-dark); }
.decision-M { background: var(--warning-light); color: var(--warning-dark); }
.decision-C { background: var(--danger-light); color: var(--danger-dark); }

.risk-A { background: var(--risk-a-bg); color: var(--risk-a); }
.risk-B { background: var(--risk-b-bg); color: var(--risk-b); }
.risk-C { background: var(--risk-c-bg); color: var(--risk-c); }
.risk-D { background: var(--risk-d-bg); color: var(--risk-d); }
.risk-E { background: var(--risk-e-bg); color: var(--risk-e); }

/* Buttons */
.btn,
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0.52rem 0.88rem;
}

.btn:disabled,
.btn-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #107a57; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #bb373d; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #b67222; }

.btn-outline {
    background: #fff;
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--border-dark);
}

.btn-lg {
    font-size: 0.92rem;
    padding: 0.66rem 1.05rem;
}

.action-buttons {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

.pagination button {
    padding: 0.44rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-light);
    color: var(--primary-dark);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

/* Detail page */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-5);
}

.order-title {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

.order-title h1 {
    font-size: clamp(1.4rem, 2vw, 2rem);
}

#position-info .position-badge {
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: var(--space-5);
}

.detail-section {
    overflow: hidden;
}

.section-body {
    padding: var(--space-5);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0.56rem 0;
    border-bottom: 1px dashed var(--border);
}

.detail-row:last-child {
    border-bottom: 0;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.detail-value {
    font-weight: 600;
    text-align: right;
    max-width: 58%;
}

.ai-summary-section {
    margin-bottom: var(--space-7);
}

.ai-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}

.ai-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    background: linear-gradient(150deg, #ffffff, #f5f9ff);
}

.ai-card h3 {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-bar {
    height: 0.54rem;
    width: 100%;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: #e5ebf8;
    margin-top: var(--space-2);
}

.score-fill {
    height: 100%;
    width: 0;
    transition: width var(--transition-slow);
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
}

.action-panel {
    margin-top: var(--space-7);
}

.action-panel .section-body {
    padding-top: var(--space-4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(22, 35, 64, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
}

.modal-content {
    width: min(540px, 92vw);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background: #fff;
    padding: var(--space-6);
}

.modal-content h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.2rem;
    margin-bottom: var(--space-2);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.modal-content textarea {
    min-height: 120px;
    resize: vertical;
    margin-bottom: var(--space-4);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

.items-modal-content {
    width: min(98vw, 1680px);
    height: min(90vh, 980px);
    max-height: 90vh;
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.items-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-1);
}

.items-modal-header h3 {
    margin: 0;
}

.items-modal-status {
    margin: 0;
}

.items-modal-body {
    flex: 1;
    min-height: 0;
}

.items-modal-table-wrapper {
    height: 100%;
    max-height: none;
    overflow: auto;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.d-block { display: block; }
.hidden { display: none !important; }

.value-positive { color: var(--success); }
.value-negative { color: var(--danger); }

.spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    animation: spin 0.9s linear infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245, 247, 252, 0.78);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1200;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    color: #fff;
    border-radius: var(--radius);
    padding: 0.65rem 0.86rem;
    box-shadow: var(--shadow-md);
    font-size: 0.82rem;
    animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

@keyframes slideIn {
    from {
        transform: translateX(26px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}

.login-card {
    width: min(480px, 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, #ffffff, #f6f9ff);
    box-shadow: var(--shadow-md);
    padding: var(--space-7);
}

.login-header h1 {
    font-family: 'Fraunces', serif;
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-size: clamp(1.35rem, 2.1vw, 1.95rem);
    margin-bottom: var(--space-2);
}

.login-header .header-subtitle {
    margin-top: 0;
}

.login-form {
    margin-top: var(--space-5);
}

.login-submit {
    width: 100%;
    margin-top: var(--space-2);
}

.login-alert {
    margin-top: var(--space-4);
    border: 1px solid #f2c2c4;
    border-radius: var(--radius);
    background: var(--danger-light);
    color: var(--danger-dark);
    padding: 0.68rem 0.8rem;
    font-size: 0.86rem;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1199px) {
    .stats-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .dashboard-container,
    .detail-container {
        padding: var(--space-6) var(--space-4);
    }

    .dashboard-header {
        padding: var(--space-5);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .dashboard-header,
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters-row {
        grid-template-columns: 1fr;
    }

    .orders-table {
        font-size: 0.78rem;
    }

    .orders-table th,
    .orders-table td {
        padding: 0.6rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn,
    .btn-action {
        width: 100%;
    }

    .items-modal-content {
        width: 98vw;
        height: 94vh;
        max-height: 94vh;
        padding: var(--space-3);
    }

    .items-modal-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 520px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}
