/* =================================
   DESIGN SYSTEM: Luxury Professional
   ================================= */

:root {
    --primary: #1a2147;
    --primary-light: #2d5f5f;
    --primary-lighter: #684a8c;
    --accent: #d4af37;
    --accent-light: #e8c547;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --neutral-dark: #0f172a;
    --neutral-light: #f8fafc;
    --border: #e2e8f0;
    --bottom-nav-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--neutral-light);
    color: var(--neutral-dark);
    line-height: 1.6;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--neutral-dark);
}

h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--neutral-dark);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--neutral-dark);
}

/* Obrigatório */
.required::after {
  content: " *";
  color: rgb(150, 0, 0) !important;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(26, 71, 42, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 71, 42, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-accent {
    background: var(--accent);
    color: var(--neutral-dark);
}

.btn-accent:hover {
    background: var(--accent-light);
}

.tooltip {
    position: absolute;
    z-index: 50;
    top: 100%;
    right: 0;
    min-width: 220px;
    max-width: 220px;
    padding: 0.65rem 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-radius: 0.75rem;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

.tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 1rem;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent var(--primary) transparent;
}

.help-button {
    border: 1px solid var(--border);
    background: white;
    color: var(--primary);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    padding: 0;
}

.help-button:hover {
    background: var(--primary-light);
    color: white;
    transform: translateY(-1px);
}

.help-button {
    border: 1px solid var(--border);
    background: white;
    color: var(--primary);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.help-button:hover {
    background: var(--primary-light);
    color: white;
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

#floating-add-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
    cursor: pointer;
    z-index: 880;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#floating-add-btn:hover {
    transform: translateY(-2px);
}

#floating-add-btn i {
    font-size: 1.2rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 32px 24px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    transition: width 0.25s ease, padding 0.25s ease;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.sidebar-logo > i {
    color: var(--accent);
    font-size: 1.875rem;
    flex-shrink: 0;
}

.sidebar-logo-text {
    flex: 1;
    overflow: hidden;
    transition: opacity 0.15s ease, max-width 0.25s ease;
}

.sidebar-collapse-btn {
    margin-left: auto;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: white;
}

.sidebar-collapse-btn i {
    transition: transform 0.25s ease;
    font-size: 0.75rem;
}

/* Collapsed state */
.sidebar.collapsed {
    width: 68px;
    padding: 32px 0;
}

.sidebar.collapsed .sidebar-logo {
    flex-direction: column;
    gap: 8px;
    padding: 0 12px;
    margin-bottom: 28px;
}

.sidebar.collapsed .sidebar-logo-text {
    display: none;
}

.sidebar.collapsed .sidebar-collapse-btn {
    margin-left: 0;
}

.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-menu {
    padding: 0 8px;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px;
    gap: 0;
    position: relative;
}

.sidebar.collapsed .sidebar-menu a:hover,
.sidebar.collapsed .sidebar-menu a.active {
    transform: none;
}

.sidebar.collapsed .sidebar-menu a.active {
    border-left: 3px solid var(--accent);
    padding-left: 9px;
}

.sidebar.collapsed .sidebar-menu a span {
    display: none;
}

/* Tooltip on hover in collapsed mode */
.sidebar.collapsed .sidebar-menu a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--neutral-dark);
    color: white;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 200;
}

.sidebar.collapsed .sidebar-menu a:hover::after {
    opacity: 1;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.sidebar-menu a.active {
    border-left: 3px solid var(--accent);
    padding-left: 13px;
    background: rgba(212, 175, 55, 0.1);
}

.sidebar-menu i {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Main Layout */
.main-layout {
    margin-left: 280px;
    transition: margin-left 0.25s ease;
}

.main-layout.sidebar-collapsed {
    margin-left: 68px;
}

.topbar {
    background: white;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.topbar-search {
    flex: 1;
    max-width: 400px;
    margin: 0 32px;
}

.topbar-search input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-page-title {
    display: none;
    font-size: 1rem;
    font-weight: 700;
    color: var(--neutral-dark);
    flex: 1;
    margin-left: 4px;
}

@media (max-width: 768px) {
    .topbar-page-title {
        display: block;
    }
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.content {
    padding: 32px;
    max-width: 1400px;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.page-title i {
    color: var(--primary);
    font-size: 2rem;
}

.page-subtitle {
    color: #64748b;
    font-size: 0.95rem;
}

/* Stats */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card-info h4 {
    color: #64748b;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.stat-card-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.875rem;
}

.stat-card-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-card-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-card-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-card-icon.primary {
    background: rgba(26, 71, 42, 0.1);
    color: var(--primary);
}

/* Dashboard credit cards mini panel */
.dashboard-creditcards-card {
    margin-top: -8px;
}

.dashboard-creditcards-overview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-cc-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.dashboard-cc-summary-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.dashboard-cc-summary-item small {
    display: block;
    color: #64748b;
    font-size: 0.72rem;
    margin-bottom: 3px;
}

.dashboard-cc-summary-item strong {
    font-size: 0.95rem;
}

.dashboard-cc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-cc-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) repeat(2, minmax(0, 0.8fr)) minmax(120px, 1fr);
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #f8fafc;
}

.dashboard-cc-main {
    min-width: 0;
}

.dashboard-cc-name {
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-cc-meta {
    color: #64748b;
    font-size: 0.75rem;
}

.dashboard-cc-values small {
    display: block;
    color: #64748b;
    font-size: 0.7rem;
    margin-bottom: 3px;
}

.dashboard-cc-values strong {
    font-size: 0.85rem;
}

.dashboard-cc-progress {
    min-width: 0;
}

.dashboard-cc-progress small {
    display: block;
    color: #64748b;
    font-size: 0.72rem;
    margin-top: 4px;
    text-align: right;
}

.dashboard-cc-progress-track {
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.dashboard-cc-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--success);
}

.dashboard-cc-progress-fill.danger {
    background: var(--danger);
}

@media (max-width: 1024px) {
    .dashboard-cc-summary {
        grid-template-columns: 1fr;
    }

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

    .dashboard-cc-progress {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .dashboard-creditcards-card .btn {
        width: 100%;
        justify-content: center;
    }

    .dashboard-cc-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .dashboard-cc-values strong,
    .dashboard-cc-summary-item strong {
        font-size: 0.9rem;
    }

    .dashboard-cc-progress small {
        text-align: left;
    }
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--neutral-dark);
    font-size: 0.875rem;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-primary {
    background: rgba(26, 71, 42, 0.1);
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--neutral-dark);
    font-size: 0.95rem;
}

.form-group label.inline-flex {
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.form-group .flex-nowrap {
    flex-wrap: nowrap !important;
}

.form-group label.inline-flex input[type="checkbox"] {
    accent-color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

/* Toggle switch */
.toggle-track {
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input[data-switch]:checked + .toggle-track { background: var(--success); }
input[data-switch]:checked + .toggle-track::after { transform: translateX(20px); }

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    overflow-x: hidden;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

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

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

.modal-close:hover {
    color: var(--danger);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInLeft 0.3s ease;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert i {
    font-size: 1.25rem;
}

/* ================================= */
/*         BOTTOM NAVIGATION         */
/* ================================= */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: white;
    border-top: 1px solid var(--border);
    z-index: 900;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.07);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 8px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
    flex: 1;
    min-height: 44px;
}

.bottom-nav-item i {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active i {
    transform: translateY(-1px);
}

.bottom-nav-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    box-shadow: 0 4px 14px rgba(26, 33, 71, 0.35);
    flex-shrink: 0;
    margin-bottom: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bottom-nav-add:active {
    transform: scale(0.94);
    box-shadow: 0 2px 8px rgba(26, 33, 71, 0.3);
}

/* Sidebar overlay backdrop on mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 998;
    animation: fadeIn 0.2s ease;
}

.sidebar-backdrop.show {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 280px !important;
        padding: 32px 24px !important;
        transition: left 0.3s ease;
        z-index: 999;
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    .sidebar.collapsed .sidebar-logo {
        flex-direction: row;
        padding: 0;
    }

    .sidebar.collapsed .sidebar-logo-text {
        display: block;
    }

    .sidebar.collapsed .sidebar-menu {
        padding: 0;
    }

    .sidebar.collapsed .sidebar-menu a {
        justify-content: flex-start;
        padding: 12px 16px;
        gap: 12px;
    }

    .sidebar.collapsed .sidebar-menu a span {
        display: inline;
    }

    .main-layout,
    .main-layout.sidebar-collapsed {
        margin-left: 0;
    }

    .content {
        padding: 16px 16px calc(16px + var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.05rem;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-search {
        display: none;
    }

    .page-header {
        margin-bottom: 16px;
    }

    .page-title i {
        font-size: 1.4rem;
    }

    .stat-card {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .stat-card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

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

    /* Floating add button hidden — bottom nav has + */
    #floating-add-btn {
        bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom, 0px));
    }

    /* Tabelas viram cards no mobile */
    .table-container {
        overflow-x: unset;
        border: none;
        background: transparent;
    }

    table, thead, tbody, tr, td, th {
        display: block;
        width: 100%;
    }

    thead tr {
        display: none;
    }

    tbody tr {
        background: white;
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 4px 16px;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
    }

    tbody tr:hover {
        background: white;
    }

    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 9px 0;
        border-bottom: 1px solid var(--border);
        font-size: 0.9rem;
        gap: 8px;
    }

    td:last-child {
        border-bottom: none;
    }

    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        flex-shrink: 0;
        min-width: 80px;
    }

    td[data-label=""] {
        justify-content: flex-end;
    }

    td[data-label=""]::before {
        display: none;
    }

    /* Linha de colspan (loading/empty) vira bloco simples */
    td[colspan] {
        justify-content: center;
        border-bottom: none;
    }

    td[colspan]::before {
        display: none;
    }

    /* Cards get less padding on mobile */
    .card {
        padding: 16px;
    }

    /* Page grid tighter on mobile */
    .grid {
        gap: 12px;
        margin-bottom: 20px;
    }

    /* Form inputs larger touch target */
    input, select, textarea {
        min-height: 44px;
    }

    /* Topbar user info compact */
    .topbar-user .user-name-text {
        display: none;
    }

    /* Modals slide up from bottom on mobile */
    .modal {
        align-items: flex-end;
    }

    .modal-body-panel {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        width: 100%;
        animation: slideUpModal 0.3s ease;
    }

    .modal-content {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        margin: 0;
    }

    /* Auth layout full width on small screens */
    .auth-layout {
        align-items: stretch;
    }

    .auth-card {
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: none;
        padding: 2rem 1.5rem;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 10px 12px;
    }

    .content {
        padding: 12px 12px calc(12px + var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    }

    .auth-card {
        padding: 2rem 1.25rem;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

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

@keyframes slideUpModal {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ================================= */
/*        MOBILE STRUCTURAL FIXES    */
/* ================================= */

.txn-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.txn-toggles-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
}

.profile-header-flex {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.page-subtitle {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .txn-fields-grid {
        grid-template-columns: 1fr;
    }

    .txn-toggles-row {
        gap: 16px;
    }

    .filter-bar {
        gap: 10px;
    }

    .filter-bar select,
    .filter-bar .btn {
        flex: 1 1 auto;
        min-width: 0;
    }

    .profile-header-flex {
        gap: 16px;
    }

    .profile-header-flex > .btn {
        width: 100%;
        justify-content: center;
        margin-left: 0 !important;
    }

    .page-subtitle {
        display: none;
    }
}

/* Grid responsivo */
.grid {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}

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

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-button {
    padding: 16px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    white-space: nowrap;
    min-height: 44px;
}

.tab-button:hover {
    color: var(--primary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: slideUp 0.3s ease;
}

/* Currency format */
.currency {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.currency-positive {
    color: var(--success);
}

.currency-negative {
    color: var(--danger);
}

/* Auth Page */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neutral-light);
}

.auth-component-root {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 32px rgba(26, 33, 71, 0.12);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    position: relative;
}

.auth-modal-close {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.auth-modal-close:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
}

.auth-name-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo .brand {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-logo .brand i {
    color: var(--accent);
}

.auth-logo p {
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 4px;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.75rem;
}

.auth-tab-btn {
    flex: 1;
    padding: 0.65rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.auth-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
}

.auth-panel { display: none; }
.auth-panel.active { display: block; }

.auth-panel small {
    color: #94a3b8;
    font-weight: 400;
}

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

.password-field-group {
    position: relative;
}

.password-field-group .input-with-icon {
    position: relative;
    display: block;
    width: 100%;
}

.password-field-group .input-with-icon input {
    width: 100%;
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 999px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.password-toggle:hover {
    color: var(--primary);
    transform: translateY(-50%) scale(1.05);
}

.password-rules {
    position: fixed;
    width: 300px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    z-index: 100;
}

.password-rules.hidden {
    display: none !important;
}

@media (max-width: 1024px) {
    .password-rules {
        position: absolute !important;
        top: calc(100% + 8px) !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 520px) {
    .auth-name-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.modal-overlay.hidden {
    display: none !important;
}

.rules-title {
    margin-bottom: 12px;
    font-weight: 600;
    color: #334155;
}

.rules-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.rules-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.4;
}

.rules-list li.valid {
    color: var(--success);
}

.rules-list li.invalid {
    color: #64748b;
}

.rules-list li i {
    width: 20px;
    text-align: center;
}

.feedback {
    margin-top: 8px;
    font-size: 0.85rem;
    min-height: 1.2rem;
    color: transparent;
    transition: color 0.2s ease;
}

.feedback.invalid {
    color: var(--danger);
}

.form-group input.invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.feedback.valid {
    color: var(--success);
}

.auth-load-error {
    width: min(100%, 420px);
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.06);
    color: #991b1b;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1100;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-close {
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 1.1rem;
}

.modal-body {
    color: #334155;
    line-height: 1.7;
    margin-bottom: 22px;
}

.modal-footer {
    text-align: right;
}

/* ================================= */
/*           TIMELINE REPORT         */
/* ================================= */

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.timeline-view-toggle {
    display: flex;
    gap: 4px;
}

.timeline-period-label {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--neutral-dark);
    white-space: nowrap;
}

.timeline-summary-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    margin-bottom: 24px;
    align-items: stretch;
}

.timeline-summary-stat {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 20px;
    text-align: center;
}

.timeline-summary-stat small {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 6px;
}

.timeline-summary-center {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: 10px;
    padding: 14px 28px;
    text-align: center;
    min-width: 160px;
}

.timeline-summary-center small {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.75;
    margin-bottom: 6px;
}

.timeline-stat-val {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
}

/* ── Week view: vertical timeline ── */
.tl-week {
    display: flex;
    flex-direction: column;
}

.tl-day {
    display: flex;
    gap: 0;
    cursor: pointer;
}

.tl-day:hover .tl-content {
    background: rgba(26, 33, 71, 0.025);
    border-radius: 10px;
}

.tl-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    flex-shrink: 0;
}

.tl-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--border);
    flex-shrink: 0;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}

.tl-day.is-today .tl-dot {
    background: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

.tl-day.is-future .tl-dot {
    background: #e2e8f0;
    box-shadow: 0 0 0 2px #e2e8f0;
}

.tl-line {
    width: 2px;
    flex: 1;
    background: var(--border);
    min-height: 20px;
}

.tl-day:last-child .tl-line {
    display: none;
}

.tl-content {
    flex: 1;
    min-width: 0;
    padding: 12px 10px 16px 10px;
    transition: background 0.15s;
}

.tl-day.is-future .tl-content {
    opacity: 0.6;
}

.tl-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tl-date-info {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.tl-day-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.tl-day.is-today .tl-day-name { color: var(--primary); }

.tl-day-num {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--neutral-dark);
    line-height: 1;
}

.tl-day.is-today .tl-day-num { color: var(--primary); }

.tl-month-abbr {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #94a3b8;
}

.tl-balance-area { text-align: right; }

.tl-balance-label {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    display: block;
}

.tl-balance-val {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.tl-delta {
    font-size: 0.7rem;
    font-weight: 600;
    display: block;
}

.tl-txns {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tl-txn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.tl-txn.expense { background: rgba(239, 68, 68, 0.07); }
.tl-txn.income  { background: rgba(16, 185, 129, 0.07); }
.tl-txn.pending { opacity: 0.5; border: 1px dashed var(--border); background: transparent !important; }

.tl-txn i { font-size: 0.65rem; flex-shrink: 0; }
.tl-txn.expense i { color: var(--danger); }
.tl-txn.income  i { color: var(--success); }

.tl-txn-desc {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tl-txn-cat {
    font-size: 0.68rem;
    color: #94a3b8;
    flex-shrink: 0;
    white-space: nowrap;
}

.tl-txn-amount {
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.tl-no-txns {
    color: #cbd5e1;
    font-size: 0.78rem;
    font-style: italic;
    padding: 2px 8px;
}

/* ── Month view: calendar grid ── */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-header-cell {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 6px 2px;
}

.cal-day-empty { min-height: 72px; }

.cal-day {
    position: relative;
    min-height: 72px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: white;
    overflow: visible;
}

.cal-day:hover {
    border-color: var(--primary);
    background: rgba(26, 33, 71, 0.02);
    z-index: 10;
}

.cal-day.is-today {
    border-color: var(--primary);
    background: rgba(26, 33, 71, 0.04);
}

.cal-day.is-future { opacity: 0.55; }

.cal-day-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--neutral-dark);
    margin-bottom: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-day.is-today .cal-day-num {
    color: white;
    background: var(--primary);
    font-size: 0.72rem;
}

.cal-amounts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-income-amt {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--success);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-expense-amt {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--danger);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--neutral-dark);
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    line-height: 1.6;
    text-align: left;
}

.cal-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--neutral-dark);
}

.cal-day:hover .cal-tooltip { display: block; }

/* ── Transactions date badge ── */
.txn-date-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(26, 33, 71, 0.06);
    border: 1px solid var(--primary);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
}

.txn-date-badge-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    color: var(--primary);
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    line-height: 1;
}

.txn-date-badge-clear:hover { color: var(--danger); }

@media (max-width: 768px) {
    .timeline-summary-bar {
        grid-template-columns: 1fr 1fr;
    }

    .timeline-summary-center {
        grid-column: 1 / 3;
        order: -1;
        min-width: 0;
    }

    .cal-day {
        min-height: 52px;
        padding: 4px;
    }

    .cal-day-num { font-size: 0.7rem; }

    .cal-income-amt,
    .cal-expense-amt { font-size: 0.55rem; }
}

@media (max-width: 480px) {
    .cal-grid { gap: 2px; }

    .cal-day {
        min-height: 40px;
        padding: 3px;
    }

    .cal-amounts { display: none; }
}

/* ================================= */
/*         CATEGORIES PAGE           */
/* ================================= */

.cat-summary-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.cat-stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cat-stat-card.warning { border-color: var(--warning); background: rgba(245,158,11,0.04); }
.cat-stat-card.danger  { border-color: var(--danger);  background: rgba(239,68,68,0.04); }

.cat-stat-num {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--neutral-dark);
    line-height: 1;
}

.cat-stat-card.warning .cat-stat-num { color: var(--warning); }
.cat-stat-card.danger  .cat-stat-num { color: var(--danger); }

.cat-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

/* Category rows */
.cat-row {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.cat-row:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }

.cat-sub-row {
    background: #fafafa;
    border: 1px solid #e9edf2;
    border-radius: 8px;
    margin-bottom: 6px;
}

.cat-row-main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.cat-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.cat-sub-row .cat-icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.cat-row-body { flex: 1; min-width: 0; }

.cat-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.cat-row-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--neutral-dark);
}

.cat-sub-row .cat-row-name { font-size: 0.88rem; }

.cat-usage-pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(16,185,129,0.1);
    color: var(--success);
    white-space: nowrap;
}

.cat-usage-pill.warning { background: rgba(245,158,11,0.12); color: #b45309; }
.cat-usage-pill.danger  { background: rgba(239,68,68,0.12);  color: var(--danger); }

.cat-no-limit { font-size: 0.72rem; color: #94a3b8; }

.cat-progress-track {
    height: 5px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 4px;
}

.cat-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.5s ease;
}

.cat-sub-count {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}

.cat-row-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.cat-row:hover .cat-row-actions { opacity: 1; }

.btn-icon-sm {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.75rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-icon-sm:hover { background: #f1f5f9; color: var(--primary); border-color: var(--primary); }
.btn-icon-sm.danger:hover { background: rgba(239,68,68,0.08); color: var(--danger); border-color: var(--danger); }

.cat-subcategories {
    padding: 0 14px 12px 60px;
}

/* Category form modal */
.cat-preview-circle {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--primary);
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cat-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.cat-color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.cat-color-swatch:hover { transform: scale(1.15); }
.cat-color-swatch.active { border-color: white; box-shadow: 0 0 0 2px var(--primary); }

.cat-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
    padding: 4px 2px;
}

.cat-icon-option {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.88rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.cat-icon-option:hover { background: #f1f5f9; color: var(--primary); border-color: var(--primary); }
.cat-icon-option.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Category limit alert (transaction modal) */
.cat-limit-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.83rem;
    margin-top: -4px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.cat-limit-alert.warning {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.3);
    color: #92400e;
}

.cat-limit-alert.danger {
    background: rgba(239,68,68,0.07);
    border-color: rgba(239,68,68,0.25);
    color: #991b1b;
}

.cat-limit-alert i { margin-top: 1px; flex-shrink: 0; }

@media (max-width: 768px) {
    .cat-summary-bar { grid-template-columns: 1fr 1fr; }
    .cat-row-actions { opacity: 1; }
    .cat-subcategories { padding-left: 42px; }
}

/* ================================= */
/*         CREDIT CARDS PAGE         */
/* ================================= */

.cc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.cc-card {
    border-radius: 16px;
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    cursor: default;
}

.cc-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.cc-card::after {
    content: '';
    position: absolute;
    bottom: -40px;
    right: 40px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.cc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.cc-card-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.cc-card-brand {
    font-size: 1.2rem;
    opacity: 0.85;
}

.cc-card-number {
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    font-weight: 600;
    margin-bottom: 20px;
    opacity: 0.9;
}

.cc-limit-section { margin-bottom: 16px; }

.cc-limit-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 6px;
}

.cc-limit-track {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 99px;
    overflow: hidden;
}

.cc-limit-fill {
    height: 100%;
    background: white;
    border-radius: 99px;
    transition: width 0.5s ease;
}

.cc-limit-fill.danger { background: #fca5a5; }

.cc-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    opacity: 0.8;
}

.cc-card-actions {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.cc-card:hover .cc-card-actions { opacity: 1; }

.cc-btn-icon {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.15s;
}

.cc-btn-icon:hover { background: rgba(255,255,255,0.28); }

.cc-invoice-row {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow 0.15s;
    margin-top: 12px;
}

.cc-invoice-row:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }

.cc-invoice-status {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.cc-invoice-status.open   { background: rgba(59,130,246,0.1); color: #1d4ed8; }
.cc-invoice-status.closed { background: rgba(245,158,11,0.1); color: #92400e; }
.cc-invoice-status.paid   { background: rgba(16,185,129,0.1); color: #065f46; }

@media (max-width: 768px) {
    .cc-grid { grid-template-columns: 1fr; }
}

/* ================================= */
/* Timeline visualization */
.table-container tbody tr[style*="background:#f8fafc"] {
    box-shadow: inset 0 -2px 0 0 #e2e8f0;
}

.timeline-day-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 16px !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.timeline-day-header strong {
    font-size: 1.1rem;
    color: var(--neutral-dark);
}

.timeline-day-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.timeline-day-result {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.timeline-balance-display {
    text-align: right;
}

.timeline-balance-label {
    font-size: 0.8rem;
    color: #64748b;
    display: block;
    margin-bottom: 4px;
}

.timeline-balance-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.timeline-txn-row {
    border-left: 3px solid #e2e8f0 !important;
    padding-left: 28px !important;
    transition: background-color 0.15s;
}

.timeline-txn-row:hover {
    background-color: #fafbfc !important;
}

.timeline-txn-row td:first-child {
    padding-left: 32px !important;
}

.timeline-txn-time {
    font-size: 0.85rem;
    color: #64748b;
}

/* ================================= */
/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
