/* MCI - Modulo Contable Inteligente
   Tema: Central de Precios */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@400;500;600;700&display=swap');

/* --- Variables --- */
:root {
    --color-primary: #024B93;
    --color-primary-hover: #03397a;
    --color-accent: #E58D22;
    --color-accent-hover: #cf7d1b;
    --color-secondary: #9D1A23;

    --color-bg: #FFFFFF;
    --color-bg-alt: #F2F2F2;
    --color-card: #FFFFFF;
    --color-border: #E0E0E0;

    --color-text: #333333;
    --color-text-secondary: #253D4E;
    --color-text-heading: #253D4E;

    --color-success: #4CAF50;
    --color-warning: #FF9800;
    --color-error: #BA2530;
    --color-info: #024B93;

    --font-body: 'Montserrat', sans-serif;
    --font-heading: 'Lato', sans-serif;

    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);

    --sidebar-width: 240px;
}

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

/* --- Base --- */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg-alt);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-text-heading);
    line-height: 1.3;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-accent);
}

/* --- Navbar --- */
.navbar {
    background: var(--color-primary);
    color: #fff;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
}

.navbar-brand img {
    height: 36px;
    width: auto;
}

.navbar-brand:hover {
    color: #fff;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    list-style: none;
}

.navbar-nav a {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    transition: background 0.2s, color 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.navbar-user {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
}

.navbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-right: 0.5rem;
}

/* --- App Layout (sidebar + content) --- */
.app-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    padding: 1rem 0;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar-toggle {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-link {
    display: block;
    padding: 0.65rem 1.25rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--color-bg-alt);
    color: var(--color-primary);
}

.sidebar-active {
    background: rgba(2,75,147,0.08);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background: var(--color-border);
    margin: 0.5rem 1.25rem;
}

/* --- Main content --- */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    width: 100%;
}

body:not(.has-sidebar) .main-content {
    margin: 0 auto;
}

.main-content--wide {
    max-width: none;
}

/* --- Cards --- */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

/* --- Stats cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-primary);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--color-text-heading);
}

.stat-card .stat-detail {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.stat-card--accent { border-left-color: var(--color-accent); }
.stat-card--secondary { border-left-color: var(--color-secondary); }
.stat-card--success { border-left-color: var(--color-success); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-accent {
    background: var(--color-accent);
    color: #fff;
}
.btn-accent:hover { background: var(--color-accent-hover); }

.btn-danger {
    background: var(--color-error);
    color: #fff;
}
.btn-danger:hover { background: #a01f28; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}
.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

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

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: var(--color-bg-alt);
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr.row-new {
    background: #e8f0fe;
}

tbody tr.row-new:hover {
    background: #d4e4fc;
}

tbody tr.row-overdue {
    background: #ffebee;
}

tbody tr.row-overdue:hover {
    background: #ffcdd2;
}

tbody tr.row-due-soon {
    background: #fff8e1;
}

tbody tr.row-due-soon:hover {
    background: #ffecb3;
}

tbody tr.row-cancelled {
    background: #f5f5f5;
}

tbody tr.row-cancelled:hover {
    background: #eeeeee;
}

tbody tr.row-paid {
    background: #e8f5e9;
}

tbody tr.row-paid:hover {
    background: #c8e6c9;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-secondary);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: var(--color-text-heading);
}

.form-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(2,75,147,0.15);
}

.form-control.is-invalid {
    border-color: var(--color-error);
}

.field-error {
    color: var(--color-error);
    font-size: 0.8rem;
    display: block;
    margin-top: 0.2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-error {
    color: var(--color-error);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* --- Filters bar --- */
.filters-bar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 0.25rem;
}

.filter-group .form-control {
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
}

/* --- Alerts --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* --- Badge --- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-error { background: #ffebee; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-neutral { background: var(--color-bg-alt); color: var(--color-text-secondary); }

/* --- Status badges --- */
.badge-pagado { background: #e8f5e9; color: #2e7d32; }
.badge-cancelado { background: #ffebee; color: #c62828; }
.badge-vencido { background: var(--color-bg-alt); color: #666; }
.badge-porpagar { background: #fff8e1; color: #f57f17; }

/* --- Utility --- */
.text-right { text-align: right; }

/* --- Section header --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h1 {
    font-size: 1.5rem;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

/* --- Dashboard grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* --- SAT status component --- */
.sat-status-title {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.sat-status-detail {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

/* --- Chart container --- */
.chart-container {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-height: 300px;
}

.chart-container h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* --- Order items --- */
.order-items-list {
    margin-bottom: 1rem;
}

.order-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius);
}

.order-item-row .form-group {
    margin-bottom: 0;
}

.order-item-row label {
    font-size: 0.75rem;
}

.order-total {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: right;
    padding: 0.75rem 0;
    border-top: 2px solid var(--color-border);
    margin-top: 0.5rem;
}

/* --- Alerts list (dashboard) --- */
.alerts-list {
    list-style: none;
}

.alerts-list li {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}

.alerts-list li:last-child {
    border-bottom: none;
}

.alert-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.alert-dot--warning { background: var(--color-warning); }
.alert-dot--info { background: var(--color-info); }
.alert-dot--error { background: var(--color-error); }

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

/* --- HTMX loading indicator --- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* --- Landing page --- */
.landing-hero {
    text-align: center;
    padding: 4rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.landing-hero h1 {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
}

.landing-hero p {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    max-width: 550px;
    margin: 0 auto 2rem;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.landing-feature {
    text-align: center;
    padding: 1.5rem;
}

.landing-feature h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.landing-feature p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* --- Auth pages --- */
.auth-container {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.auth-link {
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
    color: var(--color-text-secondary);
}

.btn-nav-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-nav-logout:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* --- Status select dropdown --- */
.status-select {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
}

/* --- Invoice table column constraints --- */
.td-uuid {
    max-width: 180px;
    overflow-x: auto;
    white-space: nowrap;
}

.td-uuid code {
    font-size: 0.78rem;
    background: none;
    padding: 0;
}

.td-issuer {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-description {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Action links in tables --- */
.table-actions {
    display: flex;
    gap: 0.5rem;
}

.table-actions a,
.table-actions button {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
}

/* --- Chat Sidebar --- */
.chat-sidebar {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    width: 0;
    background: var(--color-bg-alt);
    border-left: 1px solid var(--color-border);
    box-shadow: -2px 0 12px rgba(0,0,0,0.08);
    z-index: 95;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease;
}

.chat-sidebar--open {
    width: 380px;
}

.chat-sidebar-header {
    background: var(--color-bg);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--color-border);
}

.chat-sidebar-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-heading);
    margin: 0;
}

.chat-sidebar-header-actions {
    display: flex;
    gap: 0.25rem;
}

.chat-header-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-body);
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chat-header-btn:hover {
    background: var(--color-bg-alt);
    border-color: var(--color-border);
    color: var(--color-text);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--color-text-secondary);
}

.chat-empty-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-heading);
    margin-bottom: 0.5rem;
}

.chat-empty-text {
    font-size: 0.8rem;
    line-height: 1.5;
    max-width: 260px;
}

.chat-bubble {
    max-width: 88%;
    padding: 0.65rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1.55;
    word-wrap: break-word;
}

.chat-bubble--user {
    background: var(--color-primary);
    color: #fff;
    align-self: flex-end;
    border-radius: var(--radius) var(--radius) 2px var(--radius);
    box-shadow: var(--shadow);
}

.chat-bubble--ai {
    background: var(--color-card);
    color: var(--color-text);
    align-self: flex-start;
    border: 1px solid var(--color-border);
    border-radius: var(--radius) var(--radius) var(--radius) 2px;
    box-shadow: var(--shadow);
}

.chat-bubble--error {
    background: #ffebee;
    color: #c62828;
    align-self: flex-start;
    border: 1px solid #ffcdd2;
    border-radius: var(--radius) var(--radius) var(--radius) 2px;
}

.chat-actions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.chat-action-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 10px;
    text-transform: capitalize;
}

.chat-input-area {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    flex-shrink: 0;
}

.chat-input-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(2,75,147,0.15);
}

.chat-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}

.chat-send-btn:hover {
    background: var(--color-primary-hover);
}

.chat-send-btn:active {
    transform: scale(0.98);
}

.chat-typing {
    padding: 0.6rem 1.25rem;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-style: italic;
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.chat-typing-dots::after {
    content: '';
    animation: chat-dots 1.4s steps(4, end) infinite;
}

@keyframes chat-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

.chat-toggle-btn {
    display: block;
    width: 100%;
    padding: 0.65rem 1.25rem;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: var(--color-text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.chat-toggle-btn:hover {
    background: var(--color-bg-alt);
    color: var(--color-primary);
}

/* --- Reports --- */
.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.report-header h1 {
    font-size: 1.5rem;
}

.report-header-actions {
    display: flex;
    gap: 0.5rem;
}

.report-table th,
.report-table td {
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

.report-table th {
    background: var(--color-primary);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
}

.report-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.report-totals {
    background: var(--color-bg-alt);
}

.report-totals td {
    border-top: 2px solid var(--color-border);
}

.report-grand-total {
    background: var(--color-primary);
    color: #fff;
}

.report-grand-total td {
    border-top: 2px solid var(--color-primary-hover);
    color: #fff;
}

.report-grand-total strong {
    color: #fff;
}

/* --- Print --- */
@media print {
    .navbar, .sidebar, .footer, .chat-sidebar, .chat-toggle-btn,
    .report-header-actions, .navbar-hamburger {
        display: none !important;
    }

    .app-layout {
        display: block;
    }

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

    body {
        background: #fff;
        font-size: 10pt;
    }

    .card {
        box-shadow: none;
        border: none;
        padding: 0;
        margin-bottom: 1rem;
    }

    .report-table th, .report-table td {
        padding: 0.25rem 0.4rem;
        font-size: 8pt;
    }

    .report-header {
        margin-bottom: 0.5rem;
    }
}

/* --- Responsive --- */

/* Tablet landscape */
@media (max-width: 1024px) {
    .main-content {
        padding: 1.25rem 1.5rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chat-sidebar--open {
        width: 320px;
    }

    th, td {
        padding: 0.6rem 0.65rem;
        font-size: 0.85rem;
    }

    th {
        font-size: 0.75rem;
    }
}

/* Tablet portrait / large phones */
@media (max-width: 768px) {
    .navbar-hamburger {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        z-index: 90;
        transform: translateX(-100%);
        transition: transform 0.2s;
        box-shadow: var(--shadow-md);
    }

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

    .app-layout {
        flex-direction: column;
    }

    .main-content {
        padding: 1rem;
        max-width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .order-item-row {
        grid-template-columns: 1fr 1fr;
    }

    .landing-hero {
        padding: 2rem 1rem;
    }

    .landing-hero h1 {
        font-size: 1.75rem;
    }

    .chat-sidebar--open {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .section-header h1 {
        font-size: 1.25rem;
    }

    .navbar-nav {
        gap: 0.5rem;
    }

    .navbar-nav a,
    .btn-nav-logout {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    .card {
        padding: 1rem;
    }

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

    th, td {
        padding: 0.5rem 0.5rem;
        font-size: 0.8rem;
    }

    .report-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .provider-info {
        flex-direction: column;
        gap: 0.25rem;
    }

    .provider-info span {
        margin-left: 0 !important;
    }
}

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

    .landing-features {
        grid-template-columns: 1fr;
    }

    .navbar {
        padding: 0 0.75rem;
    }

    .navbar-brand span {
        font-size: 1rem;
    }

    .navbar-user {
        display: none;
    }

    .order-item-row {
        grid-template-columns: 1fr;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.85rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}
