/* =========================
   Navo Components

   Global reusable UI only:
   - Shared surfaces
   - Shared headers
   - Buttons
   - Badges and pills
   - Tables
   - Action groups
   - Filter surfaces
   - Alerts and flash messages
   - Empty states

   Feature-specific layout belongs in domain stylesheets.
========================= */


/* =========================
   Component Tokens
========================= */

:root {
    --component-surface: rgba(15, 23, 42, 0.88);
    --component-surface-soft: rgba(15, 23, 42, 0.74);
    --component-surface-muted: rgba(30, 41, 59, 0.72);

    --component-row: rgba(2, 6, 23, 0.28);
    --component-row-hover: rgba(45, 212, 191, 0.055);

    --component-border: rgba(255, 255, 255, 0.12);
    --component-border-strong: rgba(255, 255, 255, 0.22);
    --component-border-soft: rgba(255, 255, 255, 0.08);

    --component-heading: #ffffff;
    --component-text: #e5e7eb;
    --component-muted: #94a3b8;
    --component-muted-strong: #cbd5e1;

    --component-primary: #2563eb;
    --component-primary-hover: #1d4ed8;
    --component-primary-text: #ffffff;

    --component-accent: #2dd4bf;
    --component-accent-hover: #5eead4;
    --component-accent-text: #020617;

    --component-neutral: #f8fafc;
    --component-neutral-hover: #ffffff;
    --component-neutral-text: #0f172a;

    --component-danger: #ef4444;
    --component-danger-hover: #dc2626;

    --component-success: #22c55e;
    --component-success-hover: #4ade80;

    --component-warning: #f59e0b;
    --component-warning-hover: #fbbf24;

    --component-info: #3b82f6;
    --component-info-hover: #2563eb;

    --component-radius-sm: 14px;
    --component-radius: 20px;
    --component-radius-lg: 26px;

    --component-button-height: 44px;
    --component-button-min-width: 112px;

    --component-shadow:
        0 24px 72px rgba(0, 0, 0, 0.26);

    --component-shadow-hover:
        0 28px 84px rgba(0, 0, 0, 0.32);

    --component-shadow-soft:
        0 14px 36px rgba(0, 0, 0, 0.22);
}


/* =========================
   Shared Box Sizing
========================= */

.card,
.panel,
.table-card,
.metric-card,
.kpi-card,
.stat-card,
.report-card,
.financial-detail-card,
.statement-card,
.summary-card,
.list-card,
.filter-card,
.search-filter-card,
.report-filter-card,
.financial-filter-card,
.empty-state,
.empty-state-box,
.button,
.btn,
.badge,
.status-badge,
.status-pill,
.pill,
.tag,
.flash,
.alert,
.message,
.flash-message {
    box-sizing: border-box;
}


/* =========================
   Shared Surfaces
========================= */

.card,
.panel,
.table-card,
.metric-card,
.kpi-card,
.stat-card,
.report-card,
.financial-detail-card,
.statement-card,
.summary-card,
.list-card {
    background:
        radial-gradient(
            circle at 92% 8%,
            rgba(45, 212, 191, 0.07),
            transparent 28%
        ),
        radial-gradient(
            circle at 8% 92%,
            rgba(129, 140, 248, 0.06),
            transparent 30%
        ),
        var(--component-surface);
    border: 1px solid var(--component-border);
    border-radius: var(--component-radius-lg);
    box-shadow:
        var(--component-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    color: var(--component-text);
    min-width: 0;
    padding: 24px;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.card:hover,
.panel:hover,
.table-card:hover,
.metric-card:hover,
.kpi-card:hover,
.stat-card:hover,
.report-card:hover,
.financial-detail-card:hover,
.statement-card:hover,
.summary-card:hover,
.list-card:hover {
    border-color: rgba(45, 212, 191, 0.22);
    box-shadow:
        var(--component-shadow-hover),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}


/* =========================
   Shared Headers
========================= */

.section-header,
.card-header,
.panel-header,
.table-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
    min-width: 0;
}

.section-header > div,
.card-header > div,
.panel-header > div,
.table-header > div {
    min-width: 0;
}

.section-header h2,
.section-header h3,
.card-header h2,
.card-header h3,
.panel-header h2,
.panel-header h3,
.table-header h2,
.table-header h3,
.card h2,
.card h3,
.panel h2,
.panel h3,
.report-card h2,
.report-card h3,
.financial-detail-card h2,
.financial-detail-card h3,
.statement-card h2,
.statement-card h3,
.summary-card h2,
.summary-card h3,
.list-card h2,
.list-card h3 {
    color: var(--component-heading);
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(1.375rem, 2.3vw, 1.875rem);
    font-weight: 950;
    letter-spacing: -0.055em;
    line-height: 1.12;
    margin: 0;
    overflow-wrap: break-word;
}

.section-header p,
.card-header p,
.panel-header p,
.table-header p,
.card p,
.panel p,
.report-card p,
.financial-detail-card p,
.statement-card p,
.summary-card p,
.list-card p {
    color: var(--component-muted);
    font-weight: 700;
    line-height: 1.55;
    margin-bottom: 0;
    overflow-wrap: break-word;
}

.eyebrow,
.kicker,
.overline,
.card-eyebrow,
.section-eyebrow {
    color: var(--component-accent);
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 950;
    letter-spacing: 0.12em;
    line-height: 1;
    margin-bottom: 12px;
    text-transform: uppercase;
}


/* =========================
   Base Buttons
========================= */

.button,
.btn,
button[type="submit"],
input[type="submit"],
input[type="button"] {
    align-items: center;
    appearance: none;
    background: var(--component-primary);
    border: 1px solid rgba(37, 99, 235, 0.55);
    border-radius: var(--component-radius-sm);
    box-shadow:
        0 12px 28px rgba(37, 99, 235, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    color: var(--component-primary-text);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 950;
    gap: 8px;
    height: var(--component-button-height);
    justify-content: center;
    line-height: 1;
    min-height: var(--component-button-height);
    min-width: var(--component-button-min-width);
    padding: 0 18px;
    text-align: center;
    text-decoration: none;
    transition:
        background-color 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
    user-select: none;
    white-space: nowrap;
}

.button:hover,
.btn:hover,
button[type="submit"]:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background: var(--component-primary-hover);
    border-color: rgba(59, 130, 246, 0.68);
    box-shadow:
        0 16px 34px rgba(37, 99, 235, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    color: var(--component-primary-text);
    transform: translateY(-1px);
}

.button:active,
.btn:active,
button[type="submit"]:active,
input[type="submit"]:active,
input[type="button"]:active {
    transform: translateY(0);
}

.button:focus-visible,
.btn:focus-visible,
button[type="submit"]:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible {
    box-shadow:
        0 0 0 4px rgba(37, 99, 235, 0.24),
        0 16px 34px rgba(37, 99, 235, 0.24);
    outline: none;
}


/* =========================
   Button Sizes
========================= */

.button.small,
.btn.small,
.btn-sm,
.button--small {
    font-size: 0.8rem;
    height: 38px;
    min-height: 38px;
    min-width: 96px;
    padding: 0 14px;
}

.button.large,
.btn.large,
.btn-lg,
.button--large {
    font-size: 0.95rem;
    height: 50px;
    min-height: 50px;
    min-width: 132px;
    padding: 0 22px;
}


/* =========================
   Primary Buttons
========================= */

.button.primary,
.btn.primary,
.btn-primary,
.button--primary {
    background: var(--component-primary);
    border-color: rgba(37, 99, 235, 0.55);
    color: var(--component-primary-text);
}

.button.primary:hover,
.btn.primary:hover,
.btn-primary:hover,
.button--primary:hover {
    background: var(--component-primary-hover);
    border-color: rgba(59, 130, 246, 0.68);
    color: var(--component-primary-text);
}


/* =========================
   Accent Buttons
========================= */

.button.accent,
.btn.accent,
.btn-accent,
.button.cta,
.btn.cta {
    background: var(--component-accent);
    border-color: rgba(45, 212, 191, 0.5);
    box-shadow:
        0 12px 28px rgba(45, 212, 191, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    color: var(--component-accent-text);
}

.button.accent:hover,
.btn.accent:hover,
.btn-accent:hover,
.button.cta:hover,
.btn.cta:hover {
    background: var(--component-accent-hover);
    border-color: rgba(94, 234, 212, 0.58);
    color: var(--component-accent-text);
}


/* =========================
   Neutral Buttons
========================= */

.button.secondary,
.btn.secondary,
.btn-secondary,
.button--secondary,
.button.outline,
.btn.outline,
.btn-outline,
.button--outline,
.button.neutral,
.btn.neutral,
.button.reset,
.btn-reset,
.reset-button,
.clear-button,
.cancel-button,
.back-button {
    background: var(--component-neutral);
    border-color: rgba(203, 213, 225, 0.95);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    color: var(--component-neutral-text);
}

.button.secondary:hover,
.btn.secondary:hover,
.btn-secondary:hover,
.button--secondary:hover,
.button.outline:hover,
.btn.outline:hover,
.btn-outline:hover,
.button--outline:hover,
.button.neutral:hover,
.btn.neutral:hover,
.button.reset:hover,
.btn-reset:hover,
.reset-button:hover,
.clear-button:hover,
.cancel-button:hover,
.back-button:hover {
    background: var(--component-neutral-hover);
    border-color: #cbd5e1;
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
    color: var(--component-neutral-text);
}


/* =========================
   Danger Buttons
========================= */

.button.danger,
.btn.danger,
.btn-danger,
.button--danger {
    background: var(--component-danger);
    border-color: rgba(252, 165, 165, 0.42);
    box-shadow:
        0 12px 28px rgba(239, 68, 68, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.button.danger:hover,
.btn.danger:hover,
.btn-danger:hover,
.button--danger:hover {
    background: var(--component-danger-hover);
    border-color: rgba(252, 165, 165, 0.5);
    color: #ffffff;
}


/* =========================
   Success Buttons
========================= */

.button.success,
.btn.success,
.btn-success,
.button--success {
    background: var(--component-success);
    border-color: rgba(187, 247, 208, 0.34);
    box-shadow:
        0 12px 28px rgba(34, 197, 94, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    color: #052e16;
}

.button.success:hover,
.btn.success:hover,
.btn-success:hover,
.button--success:hover {
    background: var(--component-success-hover);
    color: #052e16;
}


/* =========================
   Warning Buttons
========================= */

.button.warning,
.btn.warning,
.btn-warning,
.button--warning {
    background: var(--component-warning);
    border-color: rgba(253, 230, 138, 0.36);
    box-shadow:
        0 12px 28px rgba(245, 158, 11, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    color: #111827;
}

.button.warning:hover,
.btn.warning:hover,
.btn-warning:hover,
.button--warning:hover {
    background: var(--component-warning-hover);
    color: #111827;
}


/* =========================
   Info Buttons
========================= */

.button.info,
.btn.info,
.btn-info,
.button--info {
    background: var(--component-info);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow:
        0 12px 28px rgba(59, 130, 246, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.button.info:hover,
.btn.info:hover,
.btn-info:hover,
.button--info:hover {
    background: var(--component-info-hover);
    color: #ffffff;
}


/* =========================
   Link Buttons
========================= */

.button.link,
.btn.link,
.btn-link,
.button--link {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--component-accent);
    height: auto;
    min-height: 0;
    min-width: 0;
    padding: 0;
}

.button.link:hover,
.btn.link:hover,
.btn-link:hover,
.button--link:hover {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--component-accent-hover);
    transform: none;
}


/* =========================
   Disabled Controls
========================= */

.button:disabled,
.btn:disabled,
button:disabled,
input:disabled,
.button[aria-disabled="true"],
.btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
    transform: none;
}


/* =========================
   Badges and Status Pills
========================= */

.badge,
.status-badge,
.status-pill,
.pill,
.tag {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 950;
    justify-content: center;
    line-height: 1;
    min-height: 28px;
    min-width: 78px;
    padding: 7px 12px;
    text-align: center;
    white-space: nowrap;
}

.badge.success,
.badge--green,
.status-badge.success,
.status-badge.paid,
.status-badge.active,
.status-pill.success,
.status-pill.paid,
.status-pill.active,
.pill.success,
.tag.success {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.22);
    color: #86efac;
}

.badge.warning,
.badge--amber,
.status-badge.warning,
.status-badge.pending,
.status-badge.unpaid,
.status-pill.warning,
.status-pill.pending,
.status-pill.unpaid,
.pill.warning,
.tag.warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.24);
    color: #fcd34d;
}

.badge.danger,
.badge--red,
.danger-badge,
.status-badge.danger,
.status-badge.overdue,
.status-badge.inactive,
.status-badge.failed,
.status-pill.danger,
.status-pill.overdue,
.status-pill.inactive,
.status-pill.failed,
.pill.danger,
.tag.danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.26);
    color: #fca5a5;
}

.badge.info,
.badge--blue,
.status-badge.info,
.status-pill.info,
.pill.info,
.tag.info {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.24);
    color: #93c5fd;
}

.badge.neutral,
.badge--neutral,
.status-badge.neutral,
.status-pill.neutral,
.pill.neutral,
.tag.neutral {
    background: rgba(148, 163, 184, 0.13);
    border-color: rgba(148, 163, 184, 0.22);
    color: #cbd5e1;
}


/* =========================
   Shared Tables
========================= */

.table-wrapper,
.table-responsive,
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    width: 100%;
}

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

thead th,
.table thead th {
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.07),
            rgba(255, 255, 255, 0.03)
        ),
        rgba(15, 23, 42, 0.92);
    border-bottom: 1px solid var(--component-border-soft);
    color: var(--component-muted);
    font-size: 0.75rem;
    font-weight: 950;
    letter-spacing: 0.06em;
    padding: 13px 14px;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody td,
.table tbody td {
    background: var(--component-row);
    border-bottom: 1px solid var(--component-border-soft);
    color: var(--component-text);
    padding: 14px;
    vertical-align: middle;
}

tbody tr:hover td,
.table tbody tr:hover td {
    background: var(--component-row-hover);
}

tbody tr:last-child td,
.table tbody tr:last-child td {
    border-bottom: 0;
}

.table-compact thead th,
.table.compact thead th {
    padding: 9px 11px;
}

.table-compact tbody td,
.table.compact tbody td {
    padding: 10px 11px;
}


/* =========================
   Shared Action Groups
========================= */

.actions-cell,
.action-cell,
.action-group,
.table-actions,
.row-actions,
.card-actions,
.quick-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions-cell form,
.action-cell form,
.action-group form,
.table-actions form,
.row-actions form,
.card-actions form,
.quick-actions form {
    display: inline-flex;
    margin: 0;
}

.action-group.vertical,
.row-actions.vertical,
.card-actions.vertical,
.quick-actions.vertical {
    align-items: stretch;
    flex-direction: column;
}

.actions-cell .button,
.actions-cell .btn,
.action-cell .button,
.action-cell .btn,
.action-group .button,
.action-group .btn,
.table-actions .button,
.table-actions .btn,
.row-actions .button,
.row-actions .btn,
.card-actions .button,
.card-actions .btn,
.quick-actions .button,
.quick-actions .btn {
    margin: 0;
}


/* =========================
   Filter and Search Surfaces
========================= */

.filter-card,
.search-filter-card,
.report-filter-card,
.financial-filter-card {
    background:
        radial-gradient(
            circle at 8% 10%,
            rgba(45, 212, 191, 0.07),
            transparent 28%
        ),
        var(--component-surface-soft);
    border: 1px solid var(--component-border);
    border-radius: var(--component-radius);
    box-shadow:
        var(--component-shadow-soft),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    color: var(--component-text);
    min-width: 0;
    padding: 18px;
}

.filter-actions,
.search-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-actions form,
.search-actions form {
    margin: 0;
}

.filter-summary {
    color: var(--component-muted);
    font-size: 0.8rem;
    font-weight: 850;
    line-height: 1.5;
    margin: 10px 0 0;
}


/* =========================
   Alerts and Flash Messages
========================= */

.flash-messages,
.alert-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash,
.alert,
.message,
.flash-message {
    align-items: flex-start;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--component-border);
    border-radius: 16px;
    color: var(--component-text);
    display: flex;
    gap: 10px;
    font-weight: 800;
    line-height: 1.45;
    padding: 14px 16px;
}

.flash.success,
.alert.success,
.message.success,
.flash-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.26);
    color: #bbf7d0;
}

.flash.warning,
.alert.warning,
.message.warning,
.flash-warning {
    background: rgba(245, 158, 11, 0.13);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fde68a;
}

.flash.danger,
.flash.error,
.alert.danger,
.alert.error,
.message.danger,
.message.error,
.flash-error,
.flash-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.26);
    color: #fecaca;
}

.flash.info,
.alert.info,
.message.info,
.flash-info {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.26);
    color: #bae6fd;
}


/* =========================
   Flash Overlay
========================= */

.messages-stack {
    box-sizing: border-box;
    display: grid;
    gap: 10px;
    left: 50%;
    margin: 0;
    max-width: min(720px, calc(100vw - 48px));
    pointer-events: none;
    position: fixed;
    top: 22px;
    transform: translateX(-50%);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
    width: max-content;
    z-index: 9999;
}

.messages-stack.is-dismissing {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
}

.messages-stack .flash,
.messages-stack .alert,
.messages-stack .message,
.messages-stack .flash-message {
    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.24);
    margin: 0;
    max-width: 720px;
    pointer-events: auto;
}


/* =========================
   Empty States
========================= */

.empty-state,
.empty-state-box {
    align-items: center;
    background:
        radial-gradient(
            circle at 92% 8%,
            rgba(45, 212, 191, 0.05),
            transparent 28%
        ),
        var(--component-surface);
    border: 1px dashed var(--component-border);
    border-radius: var(--component-radius-lg);
    box-shadow: var(--component-shadow-soft);
    color: var(--component-muted);
    display: flex;
    flex-direction: column;
    font-size: 0.94rem;
    font-weight: 800;
    justify-content: center;
    min-height: 120px;
    padding: 32px;
    text-align: center;
}

.empty-state h2,
.empty-state h3,
.empty-state-box h2,
.empty-state-box h3 {
    color: var(--component-heading);
    font-family: Outfit, Inter, sans-serif;
    font-size: 1.375rem;
    font-weight: 950;
    letter-spacing: -0.04em;
    margin: 0 0 8px;
}

.empty-state p,
.empty-state-box p {
    color: var(--component-muted);
    margin: 0;
    max-width: 620px;
}

td.empty-state,
td.empty-state-box,
.table td.empty-state,
.table td.empty-state-box {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--component-border-soft);
    border-radius: 0;
    box-shadow: none;
    color: var(--component-muted);
    display: table-cell;
    font-size: 0.94rem;
    font-weight: 800;
    min-height: 0;
    padding: 24px 14px;
    text-align: left;
}


/* =========================
   Responsive Components
========================= */

@media (max-width: 900px) {
    .quick-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .quick-actions .button,
    .quick-actions .btn {
        width: 100%;
    }
}

@media (max-width: 820px) {
    .section-header,
    .card-header,
    .panel-header,
    .table-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .actions-cell,
    .action-cell,
    .action-group,
    .table-actions,
    .row-actions,
    .card-actions {
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .button,
    .btn,
    button[type="submit"],
    input[type="submit"],
    input[type="button"] {
        width: 100%;
    }

    .card,
    .panel,
    .table-card,
    .metric-card,
    .kpi-card,
    .stat-card,
    .report-card,
    .financial-detail-card,
    .statement-card,
    .summary-card,
    .list-card {
        border-radius: 20px;
        padding: 20px;
    }

    .filter-card,
    .search-filter-card,
    .report-filter-card,
    .financial-filter-card {
        padding: 16px;
    }

    .messages-stack {
        max-width: calc(100vw - 24px);
        top: 12px;
        width: calc(100vw - 24px);
    }

    .messages-stack .flash,
    .messages-stack .alert,
    .messages-stack .message,
    .messages-stack .flash-message {
        max-width: none;
        width: 100%;
    }
}


/* =========================
   Reduced Motion
========================= */

@media (prefers-reduced-motion: reduce) {
    .card,
    .panel,
    .table-card,
    .metric-card,
    .kpi-card,
    .stat-card,
    .report-card,
    .financial-detail-card,
    .statement-card,
    .summary-card,
    .list-card,
    .button,
    .btn,
    button,
    input,
    .messages-stack {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}