/* ══════════════════════════════════════════════════════════════
   Fibbl – Cash Book  |  Stylesheet
   Mobile-first, Dark mode support via [data-theme="dark"]
   ══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
    /* Brand */
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --primary-light: #BBDEFB;
    --primary-lighter: #E3F2FD;

    /* Semantic */
    --cash-in: #1B5E20;
    --cash-out: #C62828;
    --btn-cash-in: #4CAF50;
    --btn-cash-out: #F44336;
    --btn-cash-in-hover: #43A047;
    --btn-cash-out-hover: #E53935;

    /* Surface */
    --bg: #FFFFFF;
    --bg-secondary: #F5F5F5;
    --bg-card: #FFFFFF;
    --surface: #FFFFFF;

    /* Text */
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-hint: #9E9E9E;

    /* Border & Shadow */
    --border: #E0E0E0;
    --border-light: #EEEEEE;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.16);

    /* Layout */
    --header-height: 52px;
    --sidebar-width: 280px;
    --max-app-width: 480px;

    /* Transition */
    --speed: 0.2s;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] {
    --primary-light: #1565C0;
    --primary-lighter: #0D47A1;

    --cash-in: #4CAF50;
    --cash-out: #F44336;

    --bg: #121212;
    --bg-secondary: #1E1E1E;
    --bg-card: #1E1E1E;
    --surface: #252525;

    --text-primary: #E0E0E0;
    --text-secondary: #9E9E9E;
    --text-hint: #757575;

    --border: #333333;
    --border-light: #2A2A2A;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.4;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
}

ul { list-style: none; }
a { text-decoration: none; color: inherit; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.hidden { display: none !important; }

/* ── App Container ──────────────────────────────────────────── */
.app {
    max-width: var(--max-app-width);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg);
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    height: var(--header-height);
    background: var(--primary);
    color: #FFFFFF;
    padding: 0 4px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background var(--speed);
}

.header-btn:hover,
.header-btn:focus-visible {
    background: rgba(255,255,255,0.15);
}

.header-btn svg {
    display: block;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.15rem;
    font-weight: 600;
    color: #FFFFFF;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background var(--speed);
    white-space: nowrap;
}

.header-title:hover {
    background: rgba(255,255,255,0.12);
}

.dropdown-arrow {
    opacity: 0.8;
}

.header-title-text {
    font-size: 1.15rem;
    font-weight: 600;
    white-space: nowrap;
}

.header-spacer {
    flex: 1;
}

.delete-btn {
    color: #FFCDD2;
}

.delete-btn:hover {
    color: #FF8A80;
    background: rgba(255,255,255,0.15);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: 85vw;
    height: 100%;
    background: var(--bg);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    background: var(--primary);
    color: #FFFFFF;
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.sidebar-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.sidebar-app-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.sidebar-subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
}

.sidebar-menu {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--speed);
}

.sidebar-item:hover,
.sidebar-item:focus-visible {
    background: var(--bg-secondary);
}

.sidebar-item.active {
    color: var(--primary);
    background: var(--primary-lighter);
    font-weight: 600;
}

[data-theme="dark"] .sidebar-item.active {
    background: rgba(33, 150, 243, 0.15);
}

.si-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ── Filter Pills ───────────────────────────────────────────── */
.filter-pills-row {
    background: var(--primary-light);
    padding: 8px 10px;
    flex-shrink: 0;
}

[data-theme="dark"] .filter-pills-row {
    background: var(--primary-dark);
}

.filter-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar { display: none; }

.pill {
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1.5px solid rgba(255,255,255,0.6);
    color: #FFFFFF;
    background: transparent;
    transition: all var(--speed);
    flex-shrink: 0;
}

.pill:hover {
    background: rgba(255,255,255,0.15);
}

.pill.active {
    background: #FFFFFF;
    color: var(--primary);
    border-color: #FFFFFF;
    font-weight: 600;
}

[data-theme="dark"] .pill {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.85);
}

[data-theme="dark"] .pill.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

/* ── Date Navigation ────────────────────────────────────────── */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-lighter);
    padding: 6px 4px;
    flex-shrink: 0;
}

[data-theme="dark"] .date-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.date-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-primary);
    transition: background var(--speed);
}

.date-nav-btn:hover {
    background: rgba(0,0,0,0.06);
}

[data-theme="dark"] .date-nav-btn:hover {
    background: rgba(255,255,255,0.08);
}

.date-nav-btn svg {
    display: block;
}

.date-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

/* ── Table Header ───────────────────────────────────────────── */
.table-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1.5px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
    font-weight: 600;
    font-size: 0.85rem;
}

.th-date {
    flex: 1;
    color: var(--text-primary);
}

.th-cash-in {
    width: 90px;
    text-align: right;
    color: var(--cash-in);
}

.th-cash-out {
    width: 90px;
    text-align: right;
    color: var(--cash-out);
}

/* ── Transaction List ───────────────────────────────────────── */
.transaction-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
    min-height: 120px;
}

.tx-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--speed);
}

.tx-row:hover {
    background: var(--bg-secondary);
}

.tx-row:active {
    background: var(--primary-lighter);
}

[data-theme="dark"] .tx-row:active {
    background: rgba(33, 150, 243, 0.1);
}

.tx-info {
    flex: 1;
    min-width: 0;
}

.tx-description {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-datetime {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tx-amount-in,
.tx-amount-out {
    width: 90px;
    text-align: right;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.tx-amount-in {
    color: var(--cash-in);
}

.tx-amount-out {
    color: var(--cash-out);
}

.tx-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-hint);
    font-size: 0.9rem;
}

.tx-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ── Bottom Controls ────────────────────────────────────────── */
.bottom-controls {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.bottom-buttons {
    display: flex;
    padding: 8px 10px;
    gap: 10px;
}

.btn-cash-in,
.btn-cash-out {
    flex: 1;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    color: #FFFFFF;
    text-align: center;
    transition: background var(--speed), transform 0.1s;
}

.btn-cash-in {
    background: var(--btn-cash-in);
}

.btn-cash-in:hover { background: var(--btn-cash-in-hover); }

.btn-cash-out {
    background: var(--btn-cash-out);
}

.btn-cash-out:hover { background: var(--btn-cash-out-hover); }

.btn-cash-in:active,
.btn-cash-out:active {
    transform: scale(0.97);
}

/* ── Summary Table ──────────────────────────────────────────── */
.summary-table {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

[data-theme="dark"] .summary-table {
    background: var(--surface);
}

.summary-row {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.summary-cell {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    border-right: 1px solid var(--border);
}

.summary-cell:last-child {
    border-right: none;
}

.summary-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-style: italic;
}

.summary-value {
    font-size: 0.92rem;
    font-weight: 600;
    margin-top: 2px;
}

.cash-in-color { color: var(--cash-in); }
.cash-out-color { color: var(--cash-out); }

.balance-footer {
    font-size: 0.85rem;
}

.balance-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.balance-row.total {
    font-weight: 700;
    background: var(--bg-secondary);
}

[data-theme="dark"] .balance-row.total {
    background: var(--surface);
}

/* ── View ───────────────────────────────────────────────────── */
.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view.hidden { display: none !important; }

/* ── Transaction Form ───────────────────────────────────────── */
.form-container {
    padding: 12px 14px;
    overflow-y: auto;
    flex: 1;
}

.type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.type-btn {
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--speed);
}

.type-btn[data-type="cashIn"].active {
    background: var(--btn-cash-in);
    border-color: var(--btn-cash-in);
    color: #FFFFFF;
}

.type-btn[data-type="cashOut"].active {
    background: var(--btn-cash-out);
    border-color: var(--btn-cash-out);
    color: #FFFFFF;
}

.form-amount-box {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 4px 12px;
    margin-bottom: 12px;
    background: var(--bg);
    gap: 8px;
}

.amount-type-label {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}

.amount-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: right;
    padding: 8px 0;
    outline: none;
    color: var(--text-primary);
    -moz-appearance: textfield;
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-desc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.desc-input {
    flex: 1;
    border: none;
    border-bottom: 2px solid var(--border);
    padding: 10px 4px;
    font-size: 0.95rem;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    transition: border-color var(--speed);
}

.desc-input:focus {
    border-bottom-color: var(--primary);
}

.camera-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--speed);
}

.camera-btn:hover {
    background: var(--primary-dark);
}

.attachment-preview {
    position: relative;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.attachment-preview img {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
}

.remove-attachment-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #FFFFFF;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-field {
    margin-bottom: 12px;
}

.form-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--speed);
}

.form-input:focus {
    border-color: var(--primary);
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text-primary);
    outline: none;
    appearance: auto;
}

.form-datetime {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

.form-datetime .form-field {
    flex: 1;
}

.form-static-field {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.btn-save {
    width: 100%;
    padding: 14px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF;
    background: var(--primary);
    margin-top: 16px;
    transition: background var(--speed);
    letter-spacing: 0.5px;
}

.btn-save:hover {
    background: var(--primary-dark);
}

.btn-save:active {
    transform: scale(0.98);
}

/* ── Dialogs ────────────────────────────────────────────────── */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s;
}

.dialog-overlay.hidden {
    display: none !important;
}

.dialog {
    background: var(--bg);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.dialog-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 14px 16px 8px;
}

.dialog-head .dialog-title {
    padding: 0;
}

.dialog-action-btn {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.dialog-action-btn:hover {
    background: var(--primary-lighter);
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
}

.btn-primary {
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #FFFFFF;
    background: var(--primary);
    transition: background var(--speed);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-primary.full-width {
    width: 100%;
    display: block;
    margin: 12px 16px;
    width: calc(100% - 32px);
}

.btn-secondary {
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    transition: background var(--speed);
}

.btn-secondary:hover { background: var(--border); }

/* ── Account Selector ───────────────────────────────────────── */
.account-list {
    max-height: 300px;
    overflow-y: auto;
}

.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    transition: background var(--speed);
    border-bottom: 1px solid var(--border-light);
}

.account-item:hover {
    background: var(--bg-secondary);
}

.account-item.active {
    background: var(--primary-lighter);
    color: var(--primary);
    font-weight: 600;
}

[data-theme="dark"] .account-item.active {
    background: rgba(33, 150, 243, 0.15);
}

.account-item-name {
    font-size: 0.95rem;
}

.account-item-actions {
    display: flex;
    gap: 4px;
}

.account-item-actions button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: background var(--speed);
}

.account-item-actions button:hover {
    background: var(--border);
}

.btn-add-account {
    display: block;
    width: 100%;
    padding: 14px 16px;
    text-align: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    transition: background var(--speed);
}

.btn-add-account:hover {
    background: var(--primary-lighter);
}

/* ── Account Form ───────────────────────────────────────────── */
.account-form-dialog {
    padding-bottom: 4px;
}

.form-group {
    padding: 0 16px;
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

/* ── Filter Menu ────────────────────────────────────────────── */
.filter-dialog {
    position: fixed;
    top: var(--header-height);
    right: 0;
    left: auto;
    max-width: 260px;
    width: auto;
    border-radius: 0 0 0 8px;
    animation: slideDown 0.2s;
    max-height: calc(100vh - var(--header-height));
}

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.filter-menu {
    padding: 4px 0;
}

.filter-menu-item {
    padding: 13px 24px;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--speed);
}

.filter-menu-item:hover,
.filter-menu-item:focus-visible {
    background: var(--bg-secondary);
}

.filter-menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 2px 0;
}

/* ── Search Dialog ──────────────────────────────────────────── */
.search-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    width: 100%;
    border-radius: 0;
    animation: fadeIn 0.15s;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
}

.search-icon {
    color: var(--text-hint);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 8px 0;
    outline: none;
    color: var(--text-primary);
}

.search-clear-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-hint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.search-clear-btn:hover {
    background: var(--bg-secondary);
}

/* ── Report Dialog ──────────────────────────────────────────── */
.report-dialog {
    padding: 16px 0 4px;
}

.report-toggle {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    margin-bottom: 16px;
}

.report-tab {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    background: var(--bg);
    transition: all var(--speed);
}

.report-tab.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

.report-dates {
    padding: 0 16px;
    margin-bottom: 12px;
}

.report-date-field {
    margin-bottom: 12px;
}

.report-date-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.date-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-icon {
    font-size: 1.1rem;
}

.report-format {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 12px 16px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.radio-label-text {
    font-weight: 600;
    font-size: 0.95rem;
}

.pdf-color { color: var(--cash-in); }
.excel-color { color: var(--cash-in); }

/* ── Compact Dialog (Date picker, Date range) ───────────────── */
.compact-dialog {
    padding-bottom: 4px;
}

.compact-dialog .dialog-title {
    padding-bottom: 12px;
}

/* ── Confirm Dialog ─────────────────────────────────────────── */
.confirm-dialog {
    padding: 20px 16px 8px;
}

.confirm-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* ── Settings ───────────────────────────────────────────────── */
.settings-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.settings-section {
    margin-bottom: 4px;
}

.settings-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 16px 8px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    width: 100%;
    text-align: left;
    background: var(--bg);
    color: var(--text-primary);
}

.settings-item.clickable {
    cursor: pointer;
    transition: background var(--speed);
}

.settings-item.clickable:hover {
    background: var(--bg-secondary);
}

.settings-item.danger .settings-item-label {
    color: var(--cash-out);
}

.settings-item-label {
    font-size: 0.9rem;
}

.settings-item-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-arrow {
    font-size: 1.2rem;
    color: var(--text-hint);
    font-weight: 300;
}

.settings-inline-input {
    width: 48px;
    text-align: center;
    padding: 6px 8px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text-primary);
    outline: none;
}

.settings-inline-input:focus {
    border-color: var(--primary);
}

.gdrive-not-configured {
    color: var(--text-hint);
    font-style: italic;
    font-size: 0.82rem;
}

/* ── Toggle Switch ──────────────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.85rem;
    z-index: 9999;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s;
    max-width: 90vw;
    text-align: center;
}

.toast.hidden {
    display: none !important;
}

@keyframes toastIn {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ── Responsive ─────────────────────────────────────────────── */

/* Mobile — default (360px+) */
@media (max-width: 374px) {
    html { font-size: 13px; }
    .th-cash-in, .th-cash-out,
    .tx-amount-in, .tx-amount-out { width: 75px; }
    .pill { padding: 4px 10px; font-size: 0.78rem; }
}

/* Desktop */
@media (min-width: 600px) {
    .app {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        box-shadow: var(--shadow-sm);
    }

    .filter-dialog {
        right: calc((100% - var(--max-app-width)) / 2);
    }

    .search-dialog {
        max-width: var(--max-app-width);
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (min-width: 1024px) {
    body {
        background: var(--bg-secondary);
    }

    [data-theme="dark"] body {
        background: #0a0a0a;
    }
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
    .header, .sidebar, .sidebar-overlay, .bottom-buttons,
    .dialog-overlay, .toast, .filter-pills-row, .date-nav { display: none !important; }
    .app { max-width: 100%; border: none; box-shadow: none; }
    .transaction-list { overflow: visible; }
}
