/* ================================================
   ToMires Design System — common.css
   ================================================ */

/* ===== CSS Variables ===== */

:root {

    /* Colors */
    --primary-dark:    #1e3a5f;
    --primary:         #2563eb;
    --primary-hover:   #1d4ed8;
    --primary-light:   #eff6ff;
    --primary-mid:     #dbeafe;

    --accent:          #f59e0b;
    --accent-light:    #fef3c7;

    --success:         #10b981;
    --success-light:   #ecfdf5;
    --success-dark:    #059669;

    --danger:          #ef4444;
    --danger-light:    #fef2f2;
    --danger-dark:     #dc2626;

    --warning:         #f59e0b;
    --warning-light:   #fffbeb;

    /* Neutrals */
    --bg:              #dadada;
    --surface:         #ffffff;
    --surface-2:       #f8fafc;
    --border:          #62666b;
    --border-dark:     #62666b;

    /* Text */
    --text-primary:    #1e293b;
    --text-secondary:  #64748b;
    --text-muted:      #94a3b8;
    --text-inverse:    #ffffff;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08),
                  0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 6px rgba(0,0,0,0.07),
                  0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg:  0 10px 25px rgba(0,0,0,0.1),
                  0 4px 10px rgba(0,0,0,0.06);
    --shadow-xl:  0 20px 40px rgba(0,0,0,0.12),
                  0 8px 16px rgba(0,0,0,0.08);

    /* Border Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-xl:   20px;
    --radius-full: 999px;

    /* Spacing */
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 0.5rem;
    --space-12: 3rem;

    /* Typography */
    --font-family: Tahoma, Arial, sans-serif;
    --font-size-xs:   0.75rem;
    --font-size-sm:   0.875rem;
    --font-size-base: 1rem;
    --font-size-lg:   1.125rem;
    --font-size-xl:   1.25rem;
    --font-size-2xl:  1.5rem;
    --font-size-3xl:  1.875rem;
    --font-size-4xl:  2.25rem;

    /* Transitions */
    --transition-fast:   all 0.15s ease;
    --transition-normal: all 0.25s ease;
    --transition-slow:   all 0.4s ease;

    /* Table max height */
    --table-max-height: 420px;

    /* List max height */
    --list-max-height: 320px;
}

/* ===== Reset & Base ===== */

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

html {
    scroll-behavior: smooth;
}

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

/* ===== Typography ===== */

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-8);
    letter-spacing: -0.02em;
}

.section-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-5);
}

.text-muted {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* ===== Cards ===== */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border: 1px solid var(--border);
    transition: var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.card-flat {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border: 1px solid var(--border);
}

/* Stat Cards */

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: var(--transition-normal);
    overflow: hidden;
    position: relative;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: var(--radius-full) 0 0 var(--radius-full);
}

.stat-card-blue::before   { background: var(--primary); }
.stat-card-green::before  { background: var(--success); }
.stat-card-red::before    { background: var(--danger); }
.stat-card-gold::before   { background: var(--accent); }

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card-blue .stat-card-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card-green .stat-card-icon {
    background: var(--success-light);
    color: var(--success);
}

.stat-card-red .stat-card-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card-gold .stat-card-icon {
    background: var(--accent-light);
    color: var(--accent);
}

.stat-card-body {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.stat-card-value {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    word-break: break-all;
    overflow-wrap: break-word;
    min-width: 0;
}

/* ===== Forms ===== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.form-input {
    width: 100%;
    padding: 0.625rem var(--space-4);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-error {
    font-size: var(--font-size-sm);
    color: var(--danger);
    min-height: 1.25em;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.form-success {
    font-size: var(--font-size-sm);
    color: var(--success);
    min-height: 1.25em;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.625rem var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: var(--transition-fast);
}

.btn:hover::after {
    background: rgba(255,255,255,0.08);
}

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

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--border-dark);
}

.btn-success {
    background: var(--success);
    color: var(--text-inverse);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: var(--success-dark);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger-dark);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid transparent;
}

.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem var(--space-3);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 0.875rem var(--space-8);
    font-size: var(--font-size-lg);
}

.btn-block {
    width: 100%;
}

.btn-icon-edit {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon-edit:hover {
    background: var(--primary-mid);
}

.btn-icon-delete {
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-right: var(--space-1);
}

.btn-icon-delete:hover {
    background: #fee2e2;
}

/* ===== Badges ===== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.badge-blue    { background: var(--primary-light);  color: var(--primary); }
.badge-green   { background: var(--success-light);  color: var(--success-dark); }
.badge-red     { background: var(--danger-light);   color: var(--danger-dark); }
.badge-gold    { background: var(--accent-light);   color: #92400e; }
.badge-gray    { background: var(--surface-2);      color: var(--text-secondary); }

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

.table-wrapper {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-scroll {
    max-height: var(--table-max-height);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) transparent;
}

.table-scroll::-webkit-scrollbar {
    width: 6px;
}

.table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: var(--radius-full);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
}

.data-table th {
    padding: var(--space-3) var(--space-4);
    text-align: right;
    font-weight: 700;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    text-align: right;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:nth-child(even) {
    background: var(--surface-2);
}

.data-table tbody tr:nth-child(even):hover {
    background: var(--primary-light);
}

/* ===== Progress Bar ===== */

.progress-container {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-low    { background: var(--danger); }
.progress-medium { background: var(--warning); }
.progress-high   { background: var(--success); }

/* ===== Modals ===== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

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

.modal-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.25s ease;
    border: 1px solid var(--border);
}

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

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

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.modal-close-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

/* ===== Alert / Hint Box ===== */

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-right: 4px solid transparent;
    margin-bottom: var(--space-4);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary);
    border-right-color: var(--primary);
}

.alert-success {
    background: var(--success-light);
    color: var(--success-dark);
    border-right-color: var(--success);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-right-color: var(--warning);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-right-color: var(--danger);
}

/* ===== Collapsible ===== */

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: var(--space-2) 0;
}

.collapsible-header:hover .section-title {
    color: var(--primary);
}

.toggle-icon {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    transition: transform 0.3s ease;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-icon.open {
    transform: rotate(180deg);
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-mid);
}

.collapsible-content {
    display: none;
    margin-top: var(--space-5);
}

.collapsible-content.open {
    display: block;
}

/* ===== List with scroll ===== */

.scrollable-list {
    max-height: var(--list-max-height);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) transparent;
}

.scrollable-list::-webkit-scrollbar {
    width: 5px;
}

.scrollable-list::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: var(--radius-full);
}

/* ===== Empty State ===== */

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-text {
    font-size: var(--font-size-base);
    font-weight: 500;
}

/* ===== Divider ===== */

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-6) 0;
}

/* ===== Quick Filters ===== */

.quick-filters {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.quick-filter-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.quick-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.quick-filter-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.quick-filter-active:hover {
    background: var(--primary-hover);
    color: white;
}

/* ===== Month Navigator ===== */

.month-navigator {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: var(--primary);
    border-radius: var(--radius-full);
    padding: var(--space-1);
}

.month-navigator-label {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: white;
    padding: 0 var(--space-2);
    min-width: 110px;
    text-align: center;
    white-space: nowrap;
}

.month-nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.month-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Utility Classes ===== */

.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }

.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.w-full { width: 100%; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: var(--radius-full);
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    user-select: none;
    transition: var(--transition-fast);
    flex-shrink: 0;
    margin-right: var(--space-2);
    vertical-align: middle;
}

.help-icon:hover,
.help-icon.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-mid);
}

.help-popover {
    position: absolute;
    z-index: 500;
    width: 280px;
    max-width: calc(100vw - var(--space-6));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4);
    animation: helpPopoverFadeIn 0.15s ease;
}

@keyframes helpPopoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.help-popover-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.help-popover-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.help-popover-close {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: var(--transition-fast);
    flex-shrink: 0;
    margin-right: auto;
}

.help-popover-close:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.help-popover-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ================================================
   Dark Mode — Theme Variables
   ================================================ */

   [data-theme="dark"] {

    --primary-dark:    #93c5fd;
    --primary:         #60a5fa;
    --primary-hover:   #93c5fd;
    --primary-light:   #1e3a5f;
    --primary-mid:     #1e3a5f;

    --accent:          #fbbf24;
    --accent-light:    #292524;

    --success:         #34d399;
    --success-light:   #022c22;
    --success-dark:    #6ee7b7;

    --danger:          #f87171;
    --danger-light:    #2d0f0f;
    --danger-dark:     #fca5a5;

    --warning:         #fbbf24;
    --warning-light:   #1c1710;

    --bg:              #0f172a;
    --surface:         #1e293b;
    --surface-2:       #273549;
    --border:          #334155;
    --border-dark:     #475569;

    --text-primary:    #f1f5f9;
    --text-secondary:  #94a3b8;
    --text-muted:      #64748b;
    --text-inverse:    #0f172a;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4),
                  0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 6px rgba(0,0,0,0.4),
                  0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg:  0 10px 25px rgba(0,0,0,0.5),
                  0 4px 10px rgba(0,0,0,0.3);
    --shadow-xl:  0 20px 40px rgba(0,0,0,0.6),
                  0 8px 16px rgba(0,0,0,0.4);
}

/* ================================================
   Dark Mode Toggle Button
   ================================================ */

.dark-mode-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    width: 100%;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.dark-mode-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode-btn-icon {
    font-size: 1.1rem;
    width: 24px;
    min-width: 24px;
    text-align: center;
    display: inline-block;
    flex-shrink: 0;
}

.dark-mode-btn-text {
    display: inline-block;
    flex: 1;
    white-space: nowrap;
}

.dark-mode-toggle-track {
    width: 36px;
    min-width: 36px;
    height: 20px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    position: relative;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.dark-mode-toggle-track.on {
    background: var(--primary);
}

.dark-mode-toggle-thumb {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    background: white;
    transition: var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.dark-mode-toggle-track.on .dark-mode-toggle-thumb {
    right: calc(100% - 17px);
}

/* ================================================
   Quick Add FAB Button
   ================================================ */

   .dashboard-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.quick-add-fab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        #1d4ed8 100%
    );
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--font-size-base);
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    white-space: nowrap;
}

.quick-add-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.quick-add-fab:active {
    transform: translateY(0);
}

.quick-add-fab-icon {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1;
}

.quick-add-fab-text {
    font-size: var(--font-size-sm);
}

/* ================================================
   Dashboard Header Actions + Templates Bar
   ================================================ */

   .dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.dashboard-templates-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 480px;
    padding-bottom: 2px;
    cursor: grab;
    user-select: none;
}

.dashboard-templates-bar::-webkit-scrollbar {
    display: none;
}

.dashboard-templates-bar.dragging {
    cursor: grabbing;
}

.dashboard-template-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    white-space: nowrap;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.dashboard-template-chip-income {
    background: var(--success-light);
    color: var(--success-dark);
    border-color: rgba(16, 185, 129, 0.3);
}

.dashboard-template-chip-income:hover {
    background: var(--success);
    color: white;
    border-color: var(--success);
    transform: translateY(-1px);
}

.dashboard-template-chip-expense {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-color: rgba(239, 68, 68, 0.2);
}

.dashboard-template-chip-expense:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    transform: translateY(-1px);
}

/* ================================================
   Suggestion Engine — Autocomplete Dropdown
   ================================================ */

   .suggestion-wrapper {
    position: relative;
    width: 100%;
}

.suggestion-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    animation: suggestionFadeIn 0.12s ease;
}

@keyframes suggestionFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--primary-light);
}

.suggestion-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.suggestion-item-body {
    flex: 1;
    min-width: 0;
}

.suggestion-item-description {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.suggestion-item-amount {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ================================================
   Realtime Assistant — Warning Box
   ================================================ */

   .realtime-warning-box {
    display: none;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.realtime-warning-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    animation: realtimeFadeIn 0.2s ease;
}

@keyframes realtimeFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.realtime-warning-duplicate {
    background: var(--warning-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #92400e;
}

.realtime-warning-unusual_amount {
    background: var(--primary-light);
    border: 1px solid var(--primary-mid);
    color: var(--primary);
}

.realtime-warning-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.realtime-warning-text {
    flex: 1;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-10);
}

.auth-brand-logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    width: 40px;
    border-radius: 50px;
}

.auth-brand-logo-text {
    font-size: var(--font-size-4xl);
    font-weight: 900;
    color: white;
    letter-spacing: -0.03em;
}

/* ================================================
   Smart Entry Button & Modal
   ================================================ */

.dashboard-action-btns {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.smart-entry-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.smart-entry-fab:hover {
    background: var(--primary-light);
    border-color: var(--primary-mid);
    transform: translateY(-2px);
}

.smart-entry-fab.recording {
    background: var(--danger-light);
    border-color: var(--danger);
    animation: smartEntryPulse 1s infinite;
}

@keyframes smartEntryPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Guide */
.smart-entry-guide {
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
}

.smart-entry-guide-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.smart-entry-guide-examples {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.smart-entry-example {
    font-size: var(--font-size-xs);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 2px var(--space-3);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.smart-entry-example:hover {
    background: var(--primary-light);
    border-color: var(--primary-mid);
    color: var(--primary);
}

/* Input Area */
.smart-entry-input-area {
    margin-bottom: var(--space-4);
}

.smart-entry-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    resize: none;
    line-height: 1.6;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.smart-entry-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

.smart-entry-input-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.smart-entry-mic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.smart-entry-mic-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.smart-entry-mic-btn.recording {
    background: var(--danger-light);
    border-color: var(--danger);
    animation: smartEntryPulse 1s infinite;
}

.smart-entry-mic-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--danger);
    font-weight: 600;
}

.smart-entry-mic-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: smartEntryPulse 1s infinite;
}

/* Result Cards */
.smart-entry-result-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.smart-entry-result-card {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.smart-entry-result-card.complete {
    border-color: var(--success);
    background: var(--success-light);
}

.smart-entry-result-card.incomplete {
    border-color: var(--warning);
    background: var(--warning-light);
}

.smart-entry-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.smart-entry-result-status {
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
}

.smart-entry-result-status.ok {
    background: var(--success);
    color: white;
}

.smart-entry-result-status.warn {
    background: var(--warning);
    color: white;
}

.smart-entry-result-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.smart-entry-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.smart-entry-field-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 600;
}

.smart-entry-field-value {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.smart-entry-field-value.missing {
    color: var(--danger);
}

.smart-entry-field-value select {
    width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
}

/* Error State */
.smart-entry-error {
    text-align: center;
    padding: var(--space-6);
    color: var(--text-secondary);
}

.smart-entry-error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-2);
}

/* Submit Row */
.smart-entry-submit-row {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

/* Category Picker */
.smart-entry-category-picker {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.smart-entry-category-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.smart-entry-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.smart-entry-cat-chip {
    padding: var(--space-1) var(--space-3);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-family);
    color: var(--text-primary);
}

.smart-entry-cat-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.smart-entry-field-input {
    width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
    font-weight: 600;
    transition: var(--transition-fast);
}

.smart-entry-field-input:focus {
    outline: none;
    border-color: var(--primary);
}

.smart-entry-remove-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
    line-height: 1;
}

.smart-entry-remove-btn:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.smart-entry-mic-timer {
    font-size: var(--font-size-xs);
    font-weight: 800;
    color: var(--danger);
    min-width: 20px;
    text-align: center;
}

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

@media (max-width: 768px) {

    .page-title {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--space-5);
    }

    .card,
    .card-flat {
        padding: var(--space-4);
        margin-bottom: var(--space-4);
    }

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

    .modal-box {
        padding: var(--space-5);
        border-radius: var(--radius-lg);
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn-block-mobile {
        width: 100%;
        text-align: center;
    }

    .stat-card {
        padding: var(--space-3);
        gap: var(--space-2);
    }

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

    .stat-card-value {
        font-size: var(--font-size-base);
        word-break: break-all;
    }

    .stat-card-label {
        font-size: 0.65rem;
    }

    :root {
        --table-max-height: 340px;
        --list-max-height: 260px;
    }

    .quick-filters {
        width: 100%;
        justify-content: space-between;
    }

    .month-navigator {
        flex: 1;
        justify-content: space-between;
    }

    .month-navigator-label {
        min-width: unset;
        flex: 1;
    }

    .help-popover {
        width: 240px;
    }

    .dashboard-page-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: var(--space-5);
    }

    .quick-add-fab {
        width: 100%;
        justify-content: center;
    }

    .dashboard-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-action-btns {
        width: 100%;
        flex-direction: row;
        order: 1;
    }

    .quick-add-fab {
        flex: 1;
        width: auto;
        justify-content: center;
    }

    .smart-entry-fab {
        width: 46px;
        height: 46px;
        flex-shrink: 0;
    }

    .dashboard-templates-bar {
        max-width: 100%;
        order: 2;
    }

    .auth-brand-logo {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: var(--space-2);
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .auth-brand-logo-icon {
        font-size: 1.5rem;
        width: 40px;
        border-radius: 50px;
    }

    .auth-brand-logo-text {
        font-size: var(--font-size-xl);
        font-weight: 900;
    }

    .dashboard-action-btns {
        width: 100%;
        flex-direction: row;
        align-items: center;
    }

    .quick-add-fab {
        flex: 1;
        width: auto !important;
        justify-content: center;
    }

    .smart-entry-fab {
        flex-shrink: 0;
        width: 46px;
        height: 46px;
    }

    .smart-entry-result-fields {
        grid-template-columns: 1fr;
    }
}