* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fa;
    color: #1f2937;
}

/* =========================
   Layout
   ========================= */

.app {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 24px 16px;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 32px;
    padding: 0 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-nav a {
    display: block;
    padding: 11px 12px;
    border-radius: 8px;
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: #f3f4f6;
    color: #111827;
}

.sidebar-nav a.active {
    background: #eaf2ff;
    color: #2563eb;
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 32px;
    gap: 20px;
}

.topbar-user {
    font-size: 14px;
    color: #4b5563;
}

.content {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* =========================
   Typography
   ========================= */

.page-title {
    margin: 0 0 8px;
    font-size: 28px;
    color: #111827;
}

.page-description {
    margin: 0 0 28px;
    color: #6b7280;
    font-size: 14px;
}

/* =========================
   Cards
   ========================= */

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(220px, 1fr)
    );
    gap: 20px;
}

.action-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease,
                box-shadow 0.15s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.card-title {
    margin: 0 0 8px;
    font-size: 17px;
    color: #111827;
}

.card-text {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

/* =========================
   Buttons
   ========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #f9fafb;
}

.btn-danger {
    background: #ffffff;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fef2f2;
}

/* =========================
   Forms
   ========================= */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* =========================
   Tables
   ========================= */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
}

/* =========================
   Messages
   ========================= */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 800px) {
    .sidebar {
        width: 190px;
    }

    .content {
        padding: 24px 18px;
    }

    .topbar {
        padding: 0 18px;
    }
}


/* =========================
   Quote Form
   ========================= */

.form-card {
    max-width: 900px;
}

.form-section {
    margin-bottom: 28px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 16px;
    color: #111827;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-group {
    margin-bottom: 0;
}

.form-help {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
}

@media (max-width: 800px) {
    .form-grid,
    .form-grid-three {
        grid-template-columns: 1fr;
    }
}

.package-row {
    margin-bottom: 16px;
}

.package-row .form-grid {
    grid-template-columns:
        minmax(100px, 0.7fr)
        repeat(3, minmax(140px, 1fr));
}

.package-row + .package-row {
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 800px) {
    .package-row .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 550px) {
    .package-row .form-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   Loading
   ========================= */

.btn.loading {
    cursor: wait;
    opacity: 0.8;
}

.spinner {
    display: none;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn.loading .spinner {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================
   History
   ========================= */

.filter-card {
    margin-bottom: 24px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.history-card {
    padding: 0;
    overflow: hidden;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.history-title {
    margin: 0;
    font-size: 17px;
}

.history-count {
    font-size: 13px;
    color: #6b7280;
}

.table-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.table-link:hover {
    text-decoration: underline;
}

.badge-freight-charged {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-carrier {
    background: #eaf2ff;
    color: #1d4ed8;
}

.badge-unselected {
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 500;
}

.empty-state {
    padding: 40px 24px;
    text-align: center;
    color: #6b7280;
}

.nowrap {
    white-space: nowrap;
}

.badge-outside-rule {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-inside-rule {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.history-row-outside-rule td:first-child {
    box-shadow: inset 4px 0 0 #dc2626;
}

.history-primary {
    font-weight: 600;
    line-height: 1.35;
}

.history-secondary {
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
}

@media (max-width: 1000px) {
    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        justify-content: stretch;
    }

    .filter-actions .btn {
        flex: 1;
    }
}

/* ========================================
   Histórico agrupado por Pedido
======================================== */

.order-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-history-group {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

/* Cabeçalho clicável */

.order-history-header {
    width: 100%;

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 20px;

    padding: 16px 20px;

    border: 0;
    background: #f8fafc;

    text-align: left;
    font: inherit;

    cursor: pointer;

    transition: background 0.15s ease;
}

.order-history-header:hover {
    background: #f1f5f9;
}

.order-history-header-left {
    display: flex;
    align-items: center;
    gap: 12px;

    min-width: 0;
}

.order-history-toggle {
    flex-shrink: 0;

    width: 14px;

    font-size: 11px;
    color: #64748b;

    transition: transform 0.15s ease;
}

/* Pedido aberto */

.order-history-group.is-open
.order-history-toggle {
    transform: rotate(90deg);
}

.order-history-info {
    min-width: 0;
}

.order-history-number {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.order-history-customer {
    margin-top: 3px;

    font-size: 13px;
    color: #64748b;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-history-count {
    flex-shrink: 0;

    padding: 5px 10px;

    border-radius: 999px;
    background: #e2e8f0;

    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

/* Conteúdo fechado por padrão */

.order-history-content {
    display: none;

    border-top: 1px solid #e2e8f0;
}

/* Conteúdo aberto */

.order-history-group.is-open
.order-history-content {
    display: block;
}

.order-quotes-table {
    margin: 0;
}

.order-quotes-table th {
    white-space: nowrap;
}

.order-quotes-table tbody tr:last-child td {
    border-bottom: 0;
}

.order-history-customer {
    margin-top: 3px;

    display: flex;
    align-items: center;
    gap: 12px;

    font-size: 13px;
    color: #64748b;

    white-space: nowrap;
    overflow: hidden;
}

.order-history-document {
    color: #94a3b8;
    font-size: 12px;
}

.order-history-header-status {
    display: flex;
    align-items: center;
    gap: 10px;

    flex-shrink: 0;
}

.order-history-alert {
    padding: 5px 10px;

    border: 1px solid #fecaca;
    border-radius: 999px;

    background: #fee2e2;

    color: #b91c1c;

    font-size: 12px;
    font-weight: 700;
}

/* =========================
   Quote Detail
   ========================= */

.detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 24px;
}

.quote-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.freight-free {
    color: #16a34a;
}

.freight-charged {
    color: #374151;
}

.summary-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
}

.summary-label {
    display: block;
    margin-bottom: 7px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}

.summary-value {
    color: #111827;
    font-size: 16px;
    font-weight: 700;
}

.quote-results-card {
    padding: 0;
    overflow: hidden;
}

.quote-results-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.quote-results-title {
    margin: 0;
    font-size: 17px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: #f0fdf4;
    color: #166534;
}

.badge-error {
    background: #fef2f2;
    color: #991b1b;
}

.badge-best {
    background: #eaf2ff;
    color: #1d4ed8;
    margin-left: 6px;
}

.cell-cheapest {
    background: #dcfce7;
    border-left: 4px solid #16a34a;
}

.cell-fastest {
    background: #dbeafe;
    border-left: 4px solid #2563eb;
}

.result-error {
    color: #991b1b;
    font-size: 13px;
}

.selection-note {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
}

.selection-form {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(280px, 2fr) auto;
    gap: 16px;
    align-items: end;
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.selection-form .form-group {
    margin-bottom: 0;
}

.selection-actions {
    display: flex;
    align-items: flex-end;
}

.selection-actions .btn {
    white-space: nowrap;
}

.btn-copy-quote {
    margin-left: 6px;
    padding: 3px 8px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background: #ffffff;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    vertical-align: middle;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-copy-quote:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-copy-quote:active {
    transform: translateY(1px);
}

.btn-copy-quote.copied {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rule-modal.show {
    display: flex;
}

.rule-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
}

.rule-modal-content {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 28px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.18);

    text-align: center;
}

.rule-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    margin: 0 auto 16px;

    border-radius: 50%;

    background: #fef2f2;
    color: #dc2626;

    font-size: 22px;
    font-weight: 700;
}

.rule-modal-content h3 {
    margin: 0 0 12px;
    font-size: 18px;
}

.rule-modal-content p {
    margin: 8px 0;
    color: #4b5563;
    line-height: 1.5;
}

.rule-modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

@media (max-width: 900px) {
    .quote-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 550px) {
    .quote-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .selection-form {
        grid-template-columns: 1fr 1fr;
    }

    .selection-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

@media (max-width: 650px) {
    .selection-form {
        grid-template-columns: 1fr;
    }

    .selection-actions {
        grid-column: auto;
    }

    .selection-actions .btn {
        width: 100%;
    }
}

.quote-results-card input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2563eb;
}

/* =========================
   Users
   ========================= */

.page-header-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-header-actions .page-description {
    margin-bottom: 0;
}

.users-card {
    padding: 0;
    overflow: hidden;
}

.users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.users-title {
    margin: 0;
    font-size: 17px;
}

.users-count {
    color: #6b7280;
    font-size: 13px;
}

.badge-admin {
    background: #eaf2ff;
    color: #1d4ed8;
}

.badge-user {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

@media (max-width: 650px) {
    .page-header-actions {
        flex-direction: column;
    }
}


/* =========================
   Login
   ========================= */

.login-page {
    margin: 0;
    min-height: 100vh;
    background: #f4f6f9;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 32px;
}

.login-header {
    margin-bottom: 28px;
}

.login-header h1 {
    margin: 0 0 8px;
    font-size: 24px;
}

.login-header p {
    margin: 0;
    color: #5f6b7a;
    font-size: 14px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-button {
    width: 100%;
    margin-top: 4px;
}

/* =========================================================
   V2 UI REFRESH - BASE
   ========================================================= */

:root {
    --v2-bg: #f6f8fb;
    --v2-surface: #ffffff;
    --v2-border: #e2e8f0;

    --v2-text: #0f172a;
    --v2-text-secondary: #64748b;

    --v2-primary: #2563eb;
    --v2-primary-hover: #1d4ed8;
    --v2-primary-soft: #eff6ff;

    --v2-radius: 10px;
    --v2-radius-lg: 12px;

    --v2-shadow:
        0 1px 2px rgba(15, 23, 42, 0.03),
        0 1px 3px rgba(15, 23, 42, 0.04);
}


/* =========================
   Base
   ========================= */

body {
    background: var(--v2-bg);
    color: var(--v2-text);
}


/* =========================
   Sidebar
   ========================= */

.sidebar {
    width: 232px;
    padding: 24px 14px;

    background: var(--v2-surface);
    border-right: 1px solid var(--v2-border);
}

.sidebar-brand {
    margin-bottom: 30px;
    padding: 0 12px;

    font-size: 19px;
    font-weight: 700;
    color: var(--v2-text);
}

.sidebar-nav {
    gap: 4px;
}

.sidebar-nav a {
    position: relative;

    padding: 10px 12px;

    border-radius: 8px;

    color: #475569;

    font-size: 14px;
    font-weight: 500;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.sidebar-nav a:hover {
    background: #f8fafc;
    color: var(--v2-text);
}

.sidebar-nav a.active {
    background: var(--v2-primary-soft);
    color: var(--v2-primary);
    font-weight: 600;
}


/* =========================
   Topbar
   ========================= */

.topbar {
    height: 64px;

    padding: 0 28px;

    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--v2-border);

    gap: 18px;
}

.topbar-user {
    color: #475569;
    font-size: 13px;
}


/* =========================
   Main Content
   ========================= */

.content {
    width: 100%;
    max-width: 1280px;

    margin: 0 auto;
    padding: 32px 36px 48px;
}


/* =========================
   Page Header
   ========================= */

.page-title {
    margin: 0 0 6px;

    color: var(--v2-text);

    font-size: 27px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-description {
    margin: 0 0 26px;

    color: var(--v2-text-secondary);

    font-size: 14px;
    line-height: 1.5;
}


/* =========================
   Cards
   ========================= */

.card {
    background: var(--v2-surface);

    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-lg);

    box-shadow: var(--v2-shadow);
}

.action-card {
    transition:
        transform 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.action-card:hover {
    transform: translateY(-1px);

    border-color: #cbd5e1;

    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.06);
}

.card-title {
    color: var(--v2-text);
}

.card-text {
    color: var(--v2-text-secondary);
}


/* =========================
   Buttons
   ========================= */

.btn {
    min-height: 38px;

    border-radius: 8px;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.05s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--v2-primary);
    color: #ffffff;

    box-shadow:
        0 1px 2px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover {
    background: var(--v2-primary-hover);
}

.btn-secondary {
    background: #ffffff;

    border: 1px solid #cbd5e1;

    color: #334155;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}


/* =========================
   Forms
   ========================= */

.form-control {
    min-height: 38px;

    padding: 9px 12px;

    border: 1px solid #cbd5e1;
    border-radius: 8px;

    color: var(--v2-text);

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.form-control:hover {
    border-color: #94a3b8;
}

.form-control:focus {
    border-color: var(--v2-primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.10);
}

.form-group label {
    color: #334155;
}

.form-help {
    color: var(--v2-text-secondary);
}


/* =========================
   Form Sections
   ========================= */

.form-card {
    width: 100%;
    max-width: 920px;
}

.form-section-title {
    color: var(--v2-text);
    border-bottom-color: var(--v2-border);
}


/* =========================
   Tables
   ========================= */

th,
td {
    border-bottom-color: var(--v2-border);
}

th {
    background: #f8fafc;

    color: #475569;

    font-size: 13px;
    font-weight: 600;
}


/* =========================
   History / Pedido
   ========================= */

.order-history-group {
    border-color: var(--v2-border);
    border-radius: var(--v2-radius);

    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.02);
}

.order-history-header {
    background: #fbfcfe;

    transition:
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.order-history-header:hover {
    background: #f8fafc;
}

.order-history-group.is-open .order-history-header {
    background: #f8fafc;
}

.order-history-number {
    color: var(--v2-text);
}

.order-history-customer {
    color: var(--v2-text-secondary);
}


/* =========================
   Quote Detail
   ========================= */

.summary-item {
    border-color: var(--v2-border);
    border-radius: var(--v2-radius);

    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.02);
}

.summary-label {
    color: var(--v2-text-secondary);
}

.summary-value {
    color: var(--v2-text);
}


/* =========================
   Responsive
   ========================= */

@media (max-width: 1100px) {
    .content {
        padding-left: 28px;
        padding-right: 28px;
    }
}

@media (max-width: 800px) {
    .sidebar {
        width: 190px;
    }

    .content {
        padding: 24px 20px 40px;
    }

    .topbar {
        padding: 0 20px;
    }
}

/* =========================================================
   V2 DASHBOARD
   ========================================================= */

.dashboard-content {
    max-width: 1180px;
}


/* =========================
   Welcome
   ========================= */

.dashboard-welcome {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    margin-bottom: 34px;
}

/* =========================
   Sections
   ========================= */

.dashboard-section {
    margin-bottom: 34px;
}

.dashboard-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 14px;
}

.dashboard-section-header h2 {
    margin: 0 0 4px;

    color: #0f172a;

    font-size: 16px;
    font-weight: 700;
}

.dashboard-section-header p {
    margin: 0;

    color: #64748b;

    font-size: 13px;
}


/* =========================
   Quick Actions
   ========================= */

.dashboard-actions-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}

.dashboard-action-card {
    position: relative;

    display: flex;
    align-items: center;

    min-height: 116px;

    padding: 22px;

    border: 1px solid #e2e8f0;
    border-radius: 12px;

    background: #ffffff;

    color: inherit;
    text-decoration: none;

    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.03);

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.dashboard-action-card:hover {
    transform: translateY(-1px);

    border-color: #cbd5e1;

    box-shadow:
        0 6px 16px rgba(15, 23, 42, 0.06);
}

.dashboard-action-primary {
    border-color: #bfdbfe;

    background:
        linear-gradient(
            135deg,
            #ffffff 0%,
            #f8fbff 100%
        );
}

.dashboard-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 42px;
    height: 42px;

    margin-right: 16px;

    border-radius: 10px;

    background: #eff6ff;

    color: #2563eb;

    font-size: 21px;
    font-weight: 500;
}

.dashboard-action-content {
    min-width: 0;
}

.dashboard-action-content h3 {
    margin: 0 0 5px;

    color: #0f172a;

    font-size: 16px;
}

.dashboard-action-content p {
    max-width: 360px;

    margin: 0;

    color: #64748b;

    font-size: 13px;
    line-height: 1.5;
}

.dashboard-action-arrow {
    margin-left: auto;
    padding-left: 20px;

    color: #94a3b8;

    font-size: 19px;

    transition:
        color 0.15s ease,
        transform 0.15s ease;
}

.dashboard-action-card:hover
.dashboard-action-arrow {
    color: #2563eb;
    transform: translateX(2px);
}


/* =========================
   Administration
   ========================= */

.dashboard-admin-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr);

    max-width: 550px;
}

.dashboard-admin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 20px;

    border: 1px solid #e2e8f0;
    border-radius: 10px;

    background: #ffffff;

    color: inherit;
    text-decoration: none;

    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

.dashboard-admin-card:hover {
    border-color: #cbd5e1;
    background: #fbfcfe;
}

.dashboard-admin-card h3 {
    margin: 0 0 4px;

    color: #0f172a;

    font-size: 14px;
}

.dashboard-admin-card p {
    margin: 0;

    color: #64748b;

    font-size: 12px;
}

.dashboard-admin-card > span {
    margin-left: 20px;

    color: #94a3b8;

    font-size: 18px;
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 850px) {

    .dashboard-actions-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-system {
        align-items: flex-start;
        flex-direction: column;
    }

}


@media (max-width: 600px) {

    .dashboard-action-card {
        padding: 18px;
    }

    .dashboard-system-flow {
        flex-wrap: wrap;
    }

}

/* =========================================================
   V2 QUOTE DETAIL
   ========================================================= */

/* Pedido / Cotação */

.quote-context {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;

    margin-bottom: 16px;
    padding: 18px 20px;

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.quote-context-main {
    display: flex;
    align-items: flex-end;
    gap: 38px;
}

.quote-context-label {
    display: block;

    margin-bottom: 4px;

    color: #64748b;

    font-size: 11px;
    font-weight: 500;
}

.quote-context-order {
    display: block;

    color: #0f172a;

    font-size: 20px;
    line-height: 1.2;
}

.quote-context-customer {
    display: block;

    color: #334155;

    font-size: 14px;
}

.quote-context-id {
    color: #64748b;

    font-size: 11px;
    text-align: right;
}

.quote-context-id strong {
    display: block;

    margin-top: 3px;

    color: #475569;

    font-size: 12px;
}


/* Main summary */

.quote-main-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 22px;
}

.quote-main-item {
    padding: 18px 20px;

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.quote-main-value {
    display: block;

    margin-top: 5px;

    color: #0f172a;

    font-size: 17px;
    font-weight: 700;
}


/* Secondary information */

.quote-info-section {
    margin-bottom: 22px;
    padding: 0 4px;
}

.quote-info-title {
    margin: 0 0 11px;

    color: #334155;

    font-size: 13px;
    font-weight: 700;
}

.quote-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.quote-info-item {
    padding: 14px 16px;

    border-right: 1px solid #e2e8f0;
}

.quote-info-item:last-child {
    border-right: 0;
}

.quote-info-item span,
.quote-selection-info span {
    display: block;

    margin-bottom: 4px;

    color: #64748b;

    font-size: 11px;
}

.quote-info-item strong,
.quote-selection-info strong {
    color: #0f172a;

    font-size: 13px;
    font-weight: 600;
}


/* Current selection */

.quote-selection-info {
    display: grid;
    grid-template-columns:
        minmax(180px, 0.35fr)
        minmax(0, 1fr);

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.quote-selection-info > div {
    padding: 14px 16px;
}

.quote-selection-info > div + div {
    border-left: 1px solid #e2e8f0;
}


/* Responsive */

@media (max-width: 900px) {

    .quote-context {
        align-items: flex-start;
        flex-direction: column;
    }

    .quote-context-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .quote-context-id {
        text-align: left;
    }

    .quote-main-summary {
        grid-template-columns: 1fr;
    }

    .quote-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quote-info-item {
        border-bottom: 1px solid #e2e8f0;
    }

    .quote-selection-info {
        grid-template-columns: 1fr;
    }

    .quote-selection-info > div + div {
        border-left: 0;
        border-top: 1px solid #e2e8f0;
    }
}

/* =========================================================
   V2 HISTORY - PEDIDO HEADER
   ========================================================= */

.order-history-order-data {
    display: flex;
    align-items: center;

    gap: 34px;
}

.order-history-order-id,
.order-history-client-data,
.order-history-document-data {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.order-history-meta-label {
    margin-bottom: 2px;

    color: #94a3b8;

    font-size: 10px;
    font-weight: 500;
    line-height: 1.1;
}

.order-history-order-id strong {
    color: #0f172a;

    font-size: 15px;
    font-weight: 700;
}

.order-history-client-data strong {
    max-width: 330px;

    overflow: hidden;

    color: #334155;

    font-size: 13px;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-history-document-data strong {
    color: #64748b;

    font-size: 12px;
    font-weight: 500;

    white-space: nowrap;
}


/* Mantém o Pedido como informação principal */

.order-history-order-id {
    min-width: 90px;
}


/* Status do lado direito */

.order-history-header-status {
    flex-shrink: 0;

    margin-left: auto;
}


/* Responsive */

@media (max-width: 950px) {

    .order-history-order-data {
        align-items: flex-start;
        flex-direction: column;

        gap: 5px;
    }

    .order-history-client-data strong {
        max-width: 100%;
    }

}