/* ===== Reset & Variables ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #f8f9fc;
    --surface: #ffffff;
    --surface2: #f1f3f9;
    --surface3: #e6e9f0;
    --border: #e2e5ed;
    --border-light: #eef0f5;

    --text: #0f172a;
    --text-dim: #475569;
    --text-muted: #94a3b8;

    --accent: #4f46e5;
    --accent-light: #eef2ff;
    --accent-hover: #4338ca;

    --green: #059669;
    --green-light: #d1fae5;
    --red: #dc2626;
    --red-light: #fee2e2;
    --blue: #2563eb;
    --blue-light: #dbeafe;
    --yellow: #d97706;
    --yellow-light: #fef3c7;
    --purple: #7c3aed;
    --purple-light: #ede9fe;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
    --shadow-md: 0 4px 12px rgba(15,23,42,0.06);
    --shadow-lg: 0 12px 40px rgba(15,23,42,0.1);
    --shadow-card: 0 1px 3px rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.02);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base ===== */
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app { max-width: 960px; margin: 0 auto; padding: 0 24px 80px; }

/* ===== Header ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(248, 249, 252, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.logo { flex-shrink: 0; }
header h1 { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; color: var(--text); }
.subtitle { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-actions { display: flex; align-items: center; gap: 6px; }

/* View tabs */
.view-tabs {
    display: flex; background: var(--surface2); border-radius: var(--radius-md); padding: 3px; gap: 2px;
    border: 1px solid var(--border-light);
}
.view-tab {
    background: none; border: none; padding: 6px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 600; color: var(--text-dim); cursor: pointer;
    font-family: var(--font-sans); transition: all var(--transition);
    display: flex; align-items: center; gap: 6px;
}
.view-tab:hover { color: var(--text); background: rgba(255,255,255,0.5); }
.view-tab.active {
    background: var(--surface); color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.view-tab svg { opacity: 0.7; }
.view-tab.active svg { opacity: 1; }

/* ===== Buttons ===== */
.btn-accent {
    background: var(--accent); color: white; border: none;
    padding: 7px 16px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: var(--font-sans); transition: all var(--transition);
    display: inline-flex; align-items: center; gap: 5px;
    box-shadow: 0 1px 2px rgba(79,70,229,0.3);
}
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(79,70,229,0.3); }
.btn-accent:active { transform: translateY(0); }

.btn-secondary {
    background: var(--surface); color: var(--text-dim); border: 1px solid var(--border);
    padding: 7px 16px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 500; cursor: pointer;
    font-family: var(--font-sans); transition: all var(--transition);
}
.btn-secondary:hover { background: var(--surface2); color: var(--text); border-color: var(--text-muted); }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: 1px solid transparent; color: var(--text-dim);
    padding: 6px 10px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: var(--font-sans); transition: all var(--transition);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-ghost:disabled { opacity: 0.35; cursor: default; }
.btn-sm { padding: 5px 12px; font-size: 11px; }

.undo-count {
    background: var(--accent-light); color: var(--accent); padding: 0 5px;
    border-radius: 4px; font-size: 10px; font-weight: 700; min-width: 16px; text-align: center;
}

/* ===== Sheet ===== */
.view-content { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.sheet-header {
    display: flex; position: sticky; top: 57px;
    background: var(--surface); border-bottom: 2px solid var(--border);
    z-index: 90; box-shadow: var(--shadow-sm);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    margin-top: 12px;
}
.sh-cell {
    padding: 10px 10px; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--text-muted); text-align: center; flex-shrink: 0;
    border-right: 1px solid var(--border-light); user-select: none;
}
.sh-label { width: 340px; text-align: left; padding-left: 36px; }
.sh-col { width: 120px; }
.sh-running { width: 120px; color: var(--accent); }
.sh-note { width: 40px; flex-grow: 1; border-right: none; }

.sheet-body { padding-bottom: 40px; }

/* Section */
.section { border-bottom: 1px solid var(--border-light); }
.section-header {
    display: flex; align-items: center; background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
    cursor: pointer; user-select: none; border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}
.section-header:hover { background: var(--surface3); }
.section-toggle {
    width: 28px; text-align: center; color: var(--text-muted); font-size: 10px; flex-shrink: 0;
    transition: transform var(--transition);
}
.section.collapsed .section-toggle { transform: rotate(-90deg); }
.section.collapsed .section-rows { display: none; }
.section-date {
    font-weight: 700; font-size: 13px; color: var(--accent); padding: 10px 8px;
    width: calc(340px - 28px); letter-spacing: -0.2px;
}

.section-totals { display: flex; }
.section-total-cell {
    width: 120px; padding: 10px 10px; text-align: right; font-size: 13px; font-weight: 700;
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    border-right: 1px solid var(--border-light); flex-shrink: 0;
}
.st-positive { color: var(--green); }
.st-negative { color: var(--red); }
.st-zero { color: var(--text-muted); }
.section-running {
    width: 120px; padding: 10px 10px; text-align: right; font-size: 13px; font-weight: 700;
    font-family: var(--font-mono); color: var(--accent);
    border-right: 1px solid var(--border-light); flex-shrink: 0;
}
.section-note-spacer { width: 40px; flex-grow: 1; }

/* Status badge */
.section-status {
    font-size: 9px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-left: 8px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.status-ok { background: var(--green-light); color: var(--green); }
.status-tight { background: var(--yellow-light); color: var(--yellow); }
.status-danger { background: var(--red-light); color: var(--red); }

/* Category divider */
.cat-divider {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px 4px 36px;
    background: var(--surface);
}
.cat-divider-label {
    font-size: 9px; padding: 2px 7px; border-radius: 4px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px; flex-shrink: 0;
}
.cat-divider-line {
    flex: 1; height: 1px; background: var(--border-light);
}

/* Rows */
.row {
    display: flex; border-bottom: 1px solid var(--border-light);
    transition: background var(--transition); position: relative;
}
.row.row-income { background: rgba(5, 150, 105, 0.04); }
.row.row-expense { background: rgba(220, 38, 38, 0.04); }
.row.row-income:hover { background: rgba(5, 150, 105, 0.08); }
.row.row-expense:hover { background: rgba(220, 38, 38, 0.08); }
.row:hover { background: rgba(79, 70, 229, 0.02); }

.row-label {
    width: 340px; padding: 7px 10px 7px 36px; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex-shrink: 0; border-right: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 6px;
}

.row-cat {
    font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: 700;
    text-transform: uppercase; flex-shrink: 0; letter-spacing: 0.3px;
}
.cat-salary { background: var(--blue-light); color: var(--blue); }
.cat-parental { background: var(--purple-light); color: var(--purple); }
.cat-gov { background: var(--green-light); color: var(--green); }
.cat-rent { background: var(--yellow-light); color: var(--yellow); }
.cat-business { background: #ccfbf1; color: #0d9488; }
.cat-mortgage { background: var(--red-light); color: var(--red); }
.cat-loan { background: #ffedd5; color: #c2410c; }
.cat-living { background: #fce7f3; color: #be185d; }
.cat-education { background: var(--purple-light); color: #6d28d9; }
.cat-transfer { background: var(--yellow-light); color: var(--yellow); }
.cat-investment { background: #e0e7ff; color: #4338ca; }
.cat-other { background: var(--surface3); color: var(--text-dim); }

.row-name { overflow: hidden; text-overflow: ellipsis; font-weight: 450; }
.row-label-edit { cursor: text; }
.row-label-edit.cell-edit { background: var(--accent-light) !important; outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 2px; }

.has-memo { cursor: help; position: relative; }
.has-memo::after {
    content: attr(data-memo); position: absolute; bottom: calc(100% + 4px); left: 36px;
    background: var(--text); color: white; padding: 6px 12px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 500; pointer-events: none; opacity: 0;
    transition: opacity 0.15s; z-index: 50; max-width: 300px; white-space: normal;
    box-shadow: var(--shadow-lg);
}
.has-memo:hover::after { opacity: 1; }

.recurring-badge {
    font-size: 8px; background: var(--accent-light); color: var(--accent);
    padding: 1px 5px; border-radius: 3px; font-weight: 700; flex-shrink: 0;
}

.cell {
    width: 120px; padding: 7px 10px; text-align: right;
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 13px; border-right: 1px solid var(--border-light); flex-shrink: 0;
}
.cell.editable { cursor: text; }
.cell.editable:hover { background: var(--accent-light); }
.cell.positive { color: var(--green); font-weight: 600; }
.cell.negative { color: var(--red); font-weight: 600; }
.cell.zero { color: var(--text-muted); }

.cell-running {
    width: 120px; padding: 7px 10px; text-align: right;
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 13px; font-weight: 700; border-right: 1px solid var(--border-light); flex-shrink: 0;
}
.cell-running.negative { color: var(--red); }

.cell-memo { width: 40px; padding: 6px; flex-grow: 1; display: flex; align-items: center; justify-content: center; }
.memo-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; opacity: 0.4; }

.cell-edit { background: var(--accent-light) !important; outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 2px; }
.cell-edit input {
    width: 100%; background: none; border: none; color: var(--text); text-align: right;
    font-size: 13px; font-family: var(--font-mono); outline: none;
}

/* Row actions */
.row-actions {
    position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
    display: none; gap: 2px; z-index: 10;
}
.row:hover .row-actions { display: flex; }
.row-action {
    width: 20px; height: 20px; background: var(--surface); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 11px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; padding: 0; line-height: 1;
    transition: all var(--transition);
}
.row-action:hover { background: var(--surface3); color: var(--text); }
.row-action.action-del:hover { background: var(--red-light); color: var(--red); }
.row-action.action-copy:hover { background: var(--accent-light); color: var(--accent); }

.drag-handle {
    width: 20px; height: 20px; cursor: grab; display: flex; align-items: center;
    justify-content: center; color: var(--text-muted); font-size: 10px;
    border-radius: 4px; background: var(--surface); border: 1px solid var(--border);
    transition: all var(--transition);
}
.drag-handle:hover { background: var(--surface3); color: var(--text); }
.drag-handle:active { cursor: grabbing; }
.row.dragging { opacity: 0.4; background: var(--accent-light); }
.row.drag-over { border-top: 2px solid var(--accent); }
.row.drag-over-below { border-bottom: 2px solid var(--accent); }

/* Monthly summary */
.row-summary {
    display: flex; border-bottom: 1px solid var(--border-light);
    background: var(--surface2); font-weight: 700; font-size: 12px;
}
.sum-label {
    width: 340px; padding: 8px 10px 8px 36px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.5px; font-size: 10px;
    flex-shrink: 0; border-right: 1px solid var(--border-light);
    display: flex; align-items: center;
}
.sum-cell {
    width: 120px; padding: 8px 10px; text-align: right;
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    border-right: 1px solid var(--border-light); flex-shrink: 0;
}
.sum-cell.positive { color: var(--green); }
.sum-cell.negative { color: var(--red); }
.sum-spacer { width: 40px; flex-grow: 1; }

/* Quick add */
.quick-add { display: flex; border-bottom: 1px solid var(--border-light); }
.quick-add:hover { background: rgba(79, 70, 229, 0.015); }
.quick-add-label {
    width: 340px; padding: 5px 8px 5px 36px; border-right: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.quick-add-cat, .quick-add-col {
    background: var(--surface); border: 1px solid var(--border-light); color: var(--text-dim);
    padding: 3px 4px; border-radius: 4px; font-size: 10px; font-family: var(--font-sans); flex-shrink: 0;
    transition: border-color var(--transition);
}
.quick-add-cat { width: 70px; }
.quick-add-col { width: 58px; }
.quick-add-cat:focus, .quick-add-col:focus { border-color: var(--accent); outline: none; }
.quick-add-name {
    flex: 1; background: none; border: 1px solid transparent; color: var(--text);
    padding: 3px 6px; border-radius: 4px; font-size: 12px; font-family: var(--font-sans); min-width: 0;
}
.quick-add-name::placeholder { color: var(--text-muted); }
.quick-add-name:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.quick-add-cell {
    width: 120px; padding: 3px 4px; border-right: 1px solid var(--border-light);
    flex-shrink: 0; display: flex; align-items: center;
}
.quick-add-cell input {
    width: 100%; background: none; border: 1px solid transparent; color: var(--text);
    text-align: right; font-size: 12px; font-family: var(--font-mono);
    padding: 3px 4px; border-radius: 4px;
}
.quick-add-cell input:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.quick-add-tail { display: flex; align-items: center; padding: 0 6px; flex-grow: 1; }
.quick-add-btn {
    background: var(--accent); color: white; border: none;
    padding: 3px 12px; border-radius: 4px; font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
}
.quick-add-btn:hover { background: var(--accent-hover); }

/* ===== Toasts ===== */
.confirm-toast {
    position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: white; padding: 12px 18px;
    border-radius: var(--radius-md); display: flex; align-items: center; gap: 14px;
    font-size: 13px; font-weight: 500; z-index: 300;
    transition: bottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg);
}
.confirm-toast.visible { bottom: 28px; }
.btn-confirm-yes {
    background: var(--red); color: white; border: none;
    padding: 5px 16px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 600; cursor: pointer; transition: background var(--transition);
}
.btn-confirm-yes:hover { background: #b91c1c; }
.btn-confirm-no {
    background: rgba(255,255,255,0.12); color: white; border: none;
    padding: 5px 16px; border-radius: var(--radius-sm);
    font-size: 12px; cursor: pointer; transition: background var(--transition);
}
.btn-confirm-no:hover { background: rgba(255,255,255,0.2); }

.save-toast {
    position: fixed; bottom: -60px; right: 24px;
    background: var(--green); color: white; padding: 8px 16px;
    border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
    z-index: 250; transition: bottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(5,150,105,0.3);
}
.save-toast.visible { bottom: 28px; }

/* ===== Modal ===== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.4); backdrop-filter: blur(4px);
    z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.15s ease; }
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); width: 480px; max-height: 85vh;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px; border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.modal-close {
    background: none; border: none; color: var(--text-muted); font-size: 22px;
    cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center;
    justify-content: center; border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 18px 22px; }
.modal-footer {
    padding: 14px 22px; border-top: 1px solid var(--border-light);
    display: flex; justify-content: flex-end; gap: 8px;
}

.form-row { margin-bottom: 14px; }
.form-row label {
    display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 5px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-row input, .form-row select {
    width: 100%; background: var(--surface); border: 1px solid var(--border);
    color: var(--text); padding: 9px 12px; border-radius: var(--radius-sm);
    font-size: 13px; font-family: var(--font-sans);
    transition: all var(--transition);
}
.form-row input:focus, .form-row select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-row-inline { display: flex; gap: 12px; }

.toggle-group {
    display: flex; background: var(--surface2); border-radius: var(--radius-sm);
    padding: 3px; gap: 2px; border: 1px solid var(--border-light);
}
.toggle-btn {
    flex: 1; background: none; border: none; padding: 7px 12px; border-radius: 4px;
    font-size: 12px; font-weight: 600; color: var(--text-dim); cursor: pointer;
    font-family: var(--font-sans); transition: all var(--transition);
}
.toggle-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
/* Tag pills on rows */
.row-tags { display: inline-flex; gap: 3px; margin-left: 4px; }
.tag-pill {
    font-size: 9px; padding: 1px 6px; border-radius: 4px; font-weight: 600;
    border: 1px solid; white-space: nowrap;
}

/* Tag selector in modal */
.tag-selector {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.tag-toggle {
    font-size: 11px; padding: 4px 12px; border-radius: 20px; font-weight: 600;
    border: 1.5px solid var(--tag-color); color: var(--tag-color);
    background: transparent; cursor: pointer; font-family: var(--font-sans);
    transition: all var(--transition);
}
.tag-toggle:hover { background: color-mix(in srgb, var(--tag-color) 10%, transparent); }
.tag-toggle.active {
    background: var(--tag-color); color: white; border-color: var(--tag-color);
}
.tag-add-btn {
    width: 26px; height: 26px; border-radius: 50%; border: 1.5px dashed var(--border);
    background: none; color: var(--text-muted); font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-sans); transition: all var(--transition);
}
.tag-add-btn:hover { background: var(--surface2); border-color: var(--text-muted); color: var(--text); }

.recurring-options {
    background: var(--accent-light); border-radius: var(--radius-sm);
    padding: 14px; margin-top: 8px; border: 1px solid rgba(79,70,229,0.1);
}

/* ===== Assets Page ===== */
.assets-page { max-width: 720px; padding: 20px 0; }
.assets-section { margin-bottom: 28px; }
.assets-section h2 {
    font-size: 16px; font-weight: 700; margin-bottom: 14px;
    color: var(--text); letter-spacing: -0.2px;
}
.section-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-title-row h2 { margin-bottom: 0; }

.assets-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.asset-sum-card {
    background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); padding: 16px 18px;
    box-shadow: var(--shadow-card); transition: all var(--transition);
}
.asset-sum-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.asset-sum-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); margin-bottom: 6px; font-weight: 600;
}
.asset-sum-val { font-size: 22px; font-weight: 800; font-family: var(--font-mono); }

.account-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); margin-bottom: 6px;
    box-shadow: var(--shadow-card); transition: all var(--transition);
}
.account-row:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
.acc-info { display: flex; align-items: center; gap: 10px; }
.acc-dot { width: 8px; height: 8px; border-radius: 50%; }
.acc-name { font-size: 14px; font-weight: 500; }
.acc-type {
    font-size: 9px; padding: 2px 7px; border-radius: 4px; font-weight: 700; text-transform: uppercase;
}
.type-bank { background: var(--blue-light); color: var(--blue); }
.type-cash { background: var(--green-light); color: var(--green); }
.type-invest { background: var(--purple-light); color: var(--purple); }
.acc-right { display: flex; align-items: center; gap: 10px; }
.acc-val { font-size: 16px; font-weight: 700; font-family: var(--font-mono); }

.asset-drag-handle {
    width: 22px; height: 22px; cursor: grab; display: flex; align-items: center;
    justify-content: center; color: var(--text-muted); font-size: 11px;
    border-radius: 4px; background: var(--surface2); border: 1px solid var(--border-light);
    transition: all var(--transition); flex-shrink: 0; opacity: 0;
}
.account-row:hover .asset-drag-handle, .debt-card:hover .asset-drag-handle { opacity: 1; }
.asset-drag-handle:hover { background: var(--surface3); color: var(--text); }
.asset-drag-handle:active { cursor: grabbing; }

.account-row.dragging, .debt-card.dragging { opacity: 0.4; background: var(--accent-light); }
.account-row.drag-over, .debt-card.drag-over { border-top: 2px solid var(--accent); }
.account-row.drag-over-below, .debt-card.drag-over-below { border-bottom: 2px solid var(--accent); }

.acc-actions, .debt-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); }
.account-row:hover .acc-actions, .debt-card:hover .debt-actions { opacity: 1; }
.asset-action {
    width: 26px; height: 26px; background: var(--surface2); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); padding: 0; transition: all var(--transition);
}
.asset-action:hover { background: var(--surface3); color: var(--text); }
.asset-action.action-del:hover { background: var(--red-light); color: var(--red); }

.debt-card {
    background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); padding: 18px; margin-bottom: 10px;
    box-shadow: var(--shadow-card); transition: all var(--transition);
}
.debt-card:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
.debt-top-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.debt-header { margin-bottom: 2px; }
.debt-name { font-size: 15px; font-weight: 600; letter-spacing: -0.1px; }
.debt-remaining { font-size: 14px; color: var(--red); font-weight: 700; font-family: var(--font-mono); }
.debt-bar { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.debt-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.debt-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }

.net-worth-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
    border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    padding: 28px; text-align: center; box-shadow: var(--shadow-card);
}
.nw-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-muted); margin-bottom: 8px; font-weight: 600;
}
.nw-value { font-size: 36px; font-weight: 800; font-family: var(--font-mono); letter-spacing: -1px; }

/* Deleted items */
.deleted-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: var(--surface); border: 1px dashed var(--border);
    border-radius: var(--radius-sm); margin-bottom: 6px; opacity: 0.7;
    transition: opacity var(--transition);
}
.deleted-item:hover { opacity: 1; }
.deleted-info { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.deleted-type {
    font-size: 9px; padding: 2px 7px; border-radius: 4px; font-weight: 700;
    text-transform: uppercase; background: var(--surface3); color: var(--text-dim);
}
.btn-restore {
    background: none; border: 1px solid var(--accent); color: var(--accent);
    padding: 4px 12px; border-radius: 4px; font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
}
.btn-restore:hover { background: var(--accent-light); }

/* ===== Dashboard ===== */
.dashboard { max-width: 960px; padding: 20px 0; }
.dash-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.dash-card {
    background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); padding: 18px;
    box-shadow: var(--shadow-card); transition: all var(--transition);
}
.dash-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dc-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); margin-bottom: 8px; font-weight: 600;
}
.dc-value { font-size: 22px; font-weight: 800; font-family: var(--font-mono); letter-spacing: -0.5px; }
.dc-value.green { color: var(--green); }
.dc-value.red { color: var(--red); }
.dc-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-panel {
    background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); padding: 22px;
    box-shadow: var(--shadow-card);
}
.dash-panel h3 {
    font-size: 13px; font-weight: 600; color: var(--text-dim);
    margin-bottom: 18px; letter-spacing: -0.1px;
}

.dash-milestone {
    display: flex; gap: 14px; padding: 10px 0;
    border-bottom: 1px solid var(--border-light); font-size: 13px;
    transition: background var(--transition);
}
.dash-milestone:hover { background: var(--surface2); margin: 0 -8px; padding: 10px 8px; border-radius: 4px; }
.dash-milestone:last-child { border-bottom: none; }
.dm-date {
    color: var(--accent); font-weight: 700; min-width: 70px; font-size: 12px;
    font-family: var(--font-mono);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app { padding: 0 12px 60px; }
    header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 0; }
    .header-right { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
    .view-tab span { display: none; }
    .view-tab { padding: 6px 10px; }
    .dash-cards { grid-template-columns: repeat(2, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }
    .assets-summary { grid-template-columns: 1fr; }
    .sh-label, .row-label, .quick-add-label { width: 200px; }
    .section-date { width: calc(200px - 28px); }
}
