/* LumiFin — temiz arayüz (tek tema, çakışmasız) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-deep: #0b0f14;
    --bg-main: #0f1419;
    --bg-elevated: #161c26;
    --bg-card: #1a2230;
    --bg-hover: #222c3c;
    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.24);
    --text: #e8edf4;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #4f7df3;
    --accent-soft: rgba(79, 125, 243, 0.14);
    --accent-glow: rgba(79, 125, 243, 0.28);
    --pos: #34d399;
    --neg: #f87171;
    --pos-soft: rgba(52, 211, 153, 0.12);
    --neg-soft: rgba(248, 113, 113, 0.12);
    --pos-line: rgba(52, 211, 153, 0.35);
    --neg-line: rgba(248, 113, 113, 0.35);
    --info: #60a5fa;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --font: 'Outfit', system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="light"] {
    --bg-deep: #eef2f7;
    --bg-main: #f4f6fa;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #eef2f7;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.16);
    --text: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;
    --accent: #3b6de8;
    --accent-soft: rgba(59, 109, 232, 0.1);
    --pos: #059669;
    --neg: #dc2626;
    --pos-soft: rgba(5, 150, 105, 0.1);
    --neg-soft: rgba(220, 38, 38, 0.1);
    --pos-line: rgba(5, 150, 105, 0.28);
    --neg-line: rgba(220, 38, 38, 0.28);
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num.pos, .positive { color: var(--pos); }
.num.neg, .negative { color: var(--neg); }
.num.neutral, .neutral { color: var(--text-muted); }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

#loadingOverlay {
    position: fixed; inset: 0; z-index: 200;
    background: var(--bg-main);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
}
.loader-ring { width: 48px; height: 48px; position: relative; }
.loader-ring::before, .loader-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; }
.loader-ring::before { border: 3px solid var(--bg-hover); }
.loader-ring::after { border: 3px solid transparent; border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#appContainer { min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
.app-header {
    position: sticky; top: 0; z-index: 40;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 1rem;
    height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.brand {
    display: flex; align-items: center; gap: 0.6rem;
    text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.1rem;
}
.brand-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #4f7df3, #3b5bdb);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.95rem;
}
.brand span { color: var(--accent); }

.unit-picker { position: relative; }
.unit-picker-btn {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.4rem 0.7rem; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.85rem; cursor: pointer;
}
.unit-picker:hover .dropdown-panel { display: block; }
.dropdown-panel {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    min-width: 240px; background: var(--bg-card);
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; z-index: 50;
}
.dropdown-label { padding: 0.5rem 0.75rem; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.dropdown-item-wrap { display: flex; align-items: center; padding: 0.1rem 0.3rem; }
.dropdown-item-wrap:hover { background: var(--bg-hover); }
.dropdown-item {
    flex: 1; display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.65rem; border: none; background: none;
    color: var(--text-muted); font: inherit; font-size: 0.875rem;
    cursor: pointer; text-align: left; border-radius: var(--radius-sm);
}
.dropdown-item.active { color: var(--accent); background: var(--accent-soft); }
.dropdown-tools { display: flex; gap: 2px; opacity: 0; }
.dropdown-item-wrap:hover .dropdown-tools { opacity: 1; }
.dropdown-new {
    width: 100%; padding: 0.65rem 0.75rem; border: none; border-top: 1px solid var(--border);
    background: none; color: var(--text-muted); font: inherit; font-size: 0.85rem;
    cursor: pointer; text-align: left; display: flex; align-items: center; gap: 0.5rem;
}
.dropdown-new:hover { color: var(--accent); background: var(--accent-soft); }

.main-nav { display: none; align-items: center; gap: 0.2rem; }
@media (min-width: 768px) { .main-nav { display: flex; } }
.nav-item {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.75rem; border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none; font-size: 0.875rem; font-weight: 500;
}
.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }

.header-actions { display: flex; align-items: center; gap: 0.4rem; }
.auth-chip {
    display: none; align-items: center; gap: 0.5rem;
    padding: 0.35rem 0.65rem; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border);
    font-size: 0.75rem; color: var(--text-muted);
}
@media (min-width: 768px) { .auth-chip { display: flex; } }
.auth-chip button { border: none; background: none; color: var(--neg); cursor: pointer; font: inherit; font-size: 0.75rem; }

.mobile-menu {
    position: absolute; top: 60px; left: 0; right: 0;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    padding: 1rem; box-shadow: var(--shadow);
}
.mobile-menu .nav-item { display: block; margin-bottom: 0.35rem; }
.mobile-menu hr { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }
.mobile-menu select {
    width: 100%; padding: 0.5rem; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); font: inherit;
}

.app-main { flex: 1; max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 5.5rem; width: 100%; }

/* Page */
.page { }
.page.no-animate > * { opacity: 1 !important; transform: none !important; animation: none !important; }
.page-head {
    display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.25rem;
}
.page-head h1 { font-size: 1.45rem; font-weight: 700; display: flex; align-items: center; gap: 0.55rem; }
.page-head h1 i { color: var(--accent); }
.page-head p { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.2rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Cards & stats */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stat-grid { display: grid; gap: 0.75rem; margin-bottom: 1.25rem; }
.stat-grid.three { grid-template-columns: 1fr; }
@media (min-width: 640px) { .stat-grid.three { grid-template-columns: repeat(3, 1fr); } }
.stat-grid.compact { margin-bottom: 1rem; }
.stat-card {
    padding: 1rem 1.1rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.stat-card.mini { padding: 0.75rem 1rem; }
.stat-label { display: block; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.2rem; font-weight: 600; }
.stat-card.mini .stat-value { font-size: 1rem; }

/* Child grid & cards */
.child-grid {
    display: flex; flex-direction: column; gap: 0.5rem;
}

.child-card {
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border); background: var(--bg-card);
    display: flex; flex-direction: column;
}
.child-card.positive { border-color: var(--pos-line); }
.child-card.negative { border-color: var(--neg-line); }
.child-card.over-limit { box-shadow: inset 0 0 0 1px var(--neg); }

.child-summary {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.85rem 1rem;
    width: 100%; border: none; background: var(--bg-elevated);
    cursor: pointer; text-align: left; font: inherit; color: inherit;
    transition: background 0.12s;
}
.child-summary:hover { background: var(--bg-hover); }
.child-card.positive .child-summary { border-left: 3px solid var(--pos); }
.child-card.negative .child-summary { border-left: 3px solid var(--neg); }

.child-summary-main {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 0.35rem;
}
.child-summary-net {
    font-size: 1.05rem; font-weight: 700; flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.child-chevron {
    flex-shrink: 0; color: var(--text-muted); font-size: 0.75rem;
    transition: transform 0.2s ease;
}
.child-card.expanded .child-chevron { transform: rotate(180deg); }

.child-details { display: none; }
.child-card.expanded .child-details { display: block; }

.child-toolbar {
    display: flex; justify-content: flex-end; gap: 0.2rem;
    padding: 0.5rem 1rem 0; border-bottom: 1px solid var(--border);
}
.limit-dot {
    display: inline-flex; align-items: center; font-size: 0.75rem;
}
.limit-dot.warn { color: var(--neg); }

.child-header { display: flex; flex-direction: column; }

.child-name-strip {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    min-height: 3.75rem;
}
.child-card.positive .child-name-strip { border-bottom-color: var(--pos-line); }
.child-card.negative .child-name-strip { border-bottom-color: var(--neg-line); }

.child-avatar {
    width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem;
}
.child-card.positive .child-avatar { background: var(--pos-soft); color: var(--pos); }
.child-card.negative .child-avatar { background: var(--neg-soft); color: var(--neg); }

.child-name {
    flex: 1; min-width: 0; margin: 0;
    font-size: 1.15rem; font-weight: 700; line-height: 1.3;
    color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.child-actions { display: flex; gap: 0.2rem; flex-shrink: 0; }

.child-meta {
    display: flex; flex-wrap: wrap; gap: 0.35rem;
    padding: 0.4rem 1rem 0.5rem;
}
.limit-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    font-size: 0.68rem; padding: 0.15rem 0.5rem; border-radius: 999px;
}
.limit-badge.warn { background: var(--neg-soft); color: var(--neg); }
.limit-badge.ok { background: var(--bg-hover); color: var(--text-muted); }

.child-body { padding: 0.85rem 1rem; flex: 1; }

.money-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem;
}
@media (max-width: 480px) { .money-grid { grid-template-columns: 1fr; } }

.amount-row { display: flex; flex-direction: column; gap: 0.35rem; }
.stepper-quick-row { display: flex; gap: 0.35rem; justify-content: center; }
.stepper-quick {
    flex: 1; padding: 0.25rem 0.4rem; font-size: 0.72rem; font-weight: 600;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--bg-hover); color: var(--text-muted); cursor: pointer; font: inherit;
}
.stepper-quick:hover { border-color: var(--accent); color: var(--accent); }
.amount-row-head { line-height: 1; }
.amount-tag {
    font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 0.25rem;
}
.amount-tag.tag-h { color: var(--pos); }
.amount-tag.tag-b { color: var(--neg); }

.child-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    display: flex; flex-direction: column; gap: 0.4rem;
}
.child-footer.positive { background: var(--pos-soft); }
.child-footer.negative { background: var(--neg-soft); }
.child-footer-row {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.child-footer .label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.child-footer .amount { font-size: 1rem; font-weight: 600; }

.balance-bar {
    display: flex; width: 100%; height: 6px; border-radius: 999px;
    overflow: hidden; background: var(--bg-hover);
}
.balance-seg { height: 100%; min-width: 0; }
.balance-seg.harclik { background: var(--pos); }
.balance-seg.borc { background: var(--neg); }

.balance-legend {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.35rem 0.65rem; font-size: 0.72rem; color: var(--text-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.25rem; }
.legend-item strong { font-weight: 600; font-size: 0.75rem; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.legend-dot.harclik { background: var(--pos); }
.legend-dot.borc { background: var(--neg); }
.legend-kalan { margin-left: auto; font-size: 0.68rem; font-weight: 600; }

/* Stepper */
.stepper { display: flex; align-items: stretch; width: 100%; }
.stepper-btn {
    width: 2.25rem; height: 2.25rem; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--bg-elevated);
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.stepper-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stepper-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.stepper-btn.success-hover:hover { background: var(--pos-soft); color: var(--pos); border-color: var(--pos-line); }
.stepper-btn.danger-hover:hover { background: var(--neg-soft); color: var(--neg); border-color: var(--neg-line); }
.stepper input {
    flex: 1; min-width: 0; text-align: center;
    border: 1px solid var(--border); border-left: none; border-right: none;
    background: var(--bg-main); color: var(--text); font: inherit;
    padding: 0.35rem 0.25rem; outline: none; height: 2.25rem;
    font-variant-numeric: tabular-nums; font-size: 0.85rem;
}
.stepper input:focus { border-color: var(--accent); }
.stepper-sm .stepper-btn { width: 2rem; height: 2rem; font-size: 0.7rem; }
.stepper-sm input { height: 2rem; font-size: 0.8rem; padding: 0.2rem; }

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }

/* Balance / debt */
.balance-layout { display: grid; gap: 1.25rem; }
@media (min-width: 1024px) { .balance-layout { grid-template-columns: 2fr 1fr; } }
.balance-main, .balance-side { display: flex; flex-direction: column; gap: 1.25rem; }
.panel { padding: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 600; font-size: 0.9rem; margin-bottom: 0.85rem;
}
.panel-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.panel-head .dot.red { background: var(--neg); }
.panel-head .dot.green { background: var(--pos); }
.panel-head .badge { margin-left: auto; font-size: 0.78rem; padding: 0.15rem 0.55rem; border-radius: 999px; }
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }
.panel-body.stack { display: flex; flex-direction: column; gap: 1rem; }
.field-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; font-size: 0.85rem; color: var(--text-muted); }

.debt-row {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    padding: 0.75rem; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.debt-row:last-child { margin-bottom: 0; }
.debt-info { flex: 1; min-width: 0; }
.debt-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.debt-type { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.1rem; }
.debt-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.debt-balance { min-width: 4rem; text-align: center; font-weight: 600; font-size: 0.88rem; }
.debt-stepper { gap: 0.15rem; }
.empty-inline { text-align: center; color: var(--text-dim); font-size: 0.875rem; padding: 1.5rem; }

/* History */
.filters { padding: 1rem; margin-bottom: 1.25rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.filter-row .form-input { flex: 1; min-width: 140px; }
.search-wrap { position: relative; flex: 2; min-width: 200px; }
.search-wrap i { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
.search-wrap input { padding-left: 2.25rem; }
.quick-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; align-items: center; }
.tag-label { font-size: 0.7rem; color: var(--text-dim); }
.tag {
    padding: 0.25rem 0.65rem; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-elevated); color: var(--text-muted); font-size: 0.75rem; cursor: pointer;
}
.tag:hover, .tag.active { background: var(--accent-soft); color: var(--accent); }
.history-group { margin-bottom: 1.5rem; }
.history-group h3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.65rem; display: flex; align-items: center; gap: 0.4rem; }
.history-row {
    display: flex; gap: 0.75rem; padding: 0.75rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); margin-bottom: 0.5rem; background: var(--bg-elevated);
}
.history-row.success { border-color: var(--pos-line); background: var(--pos-soft); }
.history-row.danger { border-color: var(--neg-line); background: var(--neg-soft); }
.history-icon {
    width: 34px; height: 34px; border-radius: 8px; background: var(--bg-hover);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted);
}
.history-row.success .history-icon { color: var(--pos); }
.history-row.danger .history-icon { color: var(--neg); }
.history-body { flex: 1; min-width: 0; }
.history-desc { font-size: 0.875rem; }
.history-desc strong { color: var(--text); }
.history-time { font-size: 0.7rem; color: var(--text-dim); margin-top: 0.15rem; }
.history-amount { text-align: right; flex-shrink: 0; }
.history-balance { font-size: 0.7rem; color: var(--text-dim); }
.auto-tag { font-size: 0.7rem; color: var(--accent); }

/* Settings */
.settings-grid { display: grid; gap: 1rem; }
@media (min-width: 768px) { .settings-grid { grid-template-columns: repeat(2, 1fr); } }
.settings-grid h3 { font-size: 1rem; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.settings-grid h3 i { color: var(--accent); }
.settings-grid .btn { margin-top: 0.65rem; margin-right: 0.5rem; }
.hint { font-size: 0.8rem; color: var(--text-muted); }
.hint.block { margin-bottom: 1rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.55rem 1rem; border-radius: var(--radius-sm); font: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; border: 1px solid transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
    background: linear-gradient(135deg, #4f7df3, #3b5bdb);
    color: #fff; border-color: transparent;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.secondary { background: var(--bg-elevated); border-color: var(--border); color: var(--text); }
.btn.secondary:hover { background: var(--bg-hover); }
.btn.danger { background: var(--neg-soft); border-color: var(--neg-line); color: var(--neg); }
.btn.sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn.full { width: 100%; }
.link { border: none; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 0.85rem; }
.link.muted { color: var(--text-muted); }
.import-label { cursor: pointer; display: inline-flex; }

.icon-btn {
    width: 34px; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-elevated); color: var(--text-muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.danger:hover { background: var(--neg-soft); color: var(--neg); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 0.72rem; }

.fab-wrap { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 30; }
.fab {
    width: 52px; height: 52px; border-radius: 14px; border: none;
    background: linear-gradient(135deg, #4f7df3, #3b5bdb);
    color: #fff; font-size: 1.2rem; cursor: pointer;
    box-shadow: 0 6px 20px var(--accent-glow);
    display: flex; align-items: center; justify-content: center;
}

/* Forms */
.form-input {
    width: 100%; padding: 0.65rem 0.85rem; border-radius: var(--radius-sm);
    background: var(--bg-main); border: 1px solid var(--border); color: var(--text);
    font: inherit; font-size: 0.9rem; outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-input.center { text-align: center; font-size: 1.1rem; }
.form-stack { display: flex; flex-direction: column; gap: 0.85rem; }
.form-stack label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; color: var(--text-muted); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.check-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }

/* Modal */
#modalContainer {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-panel {
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh;
    display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-panel.wide { max-width: 620px; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.15rem; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 1.05rem; }
.modal-body { padding: 1.15rem; overflow-y: auto; flex: 1; }
.modal-foot {
    padding: 1rem 1.15rem; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 0.5rem;
}
.confirm-msg { text-align: center; color: var(--text-muted); padding: 0.5rem 0; }

/* Auth */
#authScreen {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: rgba(0, 0, 0, 0.6);
}
.welcome-card {
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: 2rem 1.75rem;
    max-width: 400px; width: 100%; text-align: center; box-shadow: var(--shadow);
}
.welcome-logo {
    width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 16px;
    background: linear-gradient(135deg, #4f7df3, #3b5bdb);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; color: #fff;
}
.welcome-card h1 { font-size: 1.65rem; margin-bottom: 0.35rem; }
.welcome-card h1 span { color: var(--accent); }
.welcome-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
.welcome-actions { display: flex; flex-direction: column; gap: 0.65rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.5rem; text-align: left; }
.auth-links { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.25rem; flex-wrap: wrap; }
.auth-error {
    color: var(--neg); font-size: 0.85rem; margin-bottom: 0.65rem;
    padding: 0.5rem 0.65rem; border-radius: var(--radius-sm);
    background: var(--neg-soft); text-align: left;
}
.auth-error.hidden { display: none; }
.auth-status-mobile { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.25rem; }

.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.type-btn {
    padding: 0.75rem; border-radius: var(--radius-sm); border: 2px solid var(--border);
    background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; font: inherit;
    display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
}
.type-btn.active.borc { border-color: var(--neg); background: var(--neg-soft); color: var(--neg); }
.type-btn.active.alacak { border-color: var(--pos); background: var(--pos-soft); color: var(--pos); }
.debt-preview { text-align: center; padding: 1rem; border-radius: var(--radius-sm); }
.debt-preview.borc { background: var(--neg-soft); }
.debt-preview.alacak { background: var(--pos-soft); }
.debt-preview .big { font-size: 1.75rem; font-weight: 700; }
.bulk-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.25rem; }
.bulk-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.bulk-table-head,
.bulk-row {
    display: grid;
    grid-template-columns: 2rem 1fr 5.5rem 5.5rem 5.5rem;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
}
.bulk-table-head {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}
.bulk-row {
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    transition: background 0.12s;
}
.bulk-row:last-child { border-bottom: none; }
.bulk-row:hover { background: var(--bg-elevated); }
.bulk-row.hidden { display: none; }
.bulk-row input[type="checkbox"] { width: 1rem; height: 1rem; cursor: pointer; }
.bulk-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-num { font-size: 0.8rem; text-align: right; }
.bulk-toolbar {
    display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
}
.bulk-toolbar .form-input { flex: 1; min-width: 140px; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.bulk-dist-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.bulk-dist-card {
    display: flex; align-items: flex-start; gap: 0.65rem;
    padding: 0.75rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-elevated); cursor: pointer;
}
.bulk-dist-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.bulk-dist-card input { margin-top: 0.2rem; flex-shrink: 0; }
.bulk-dist-card strong { display: block; font-size: 0.9rem; margin-bottom: 0.15rem; }
.bulk-dist-card small { display: block; font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }
.sort-control { display: flex; align-items: center; gap: 0.45rem; }
.sort-label { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.sort-select { width: auto; min-width: 9rem; padding: 0.45rem 0.65rem; font-size: 0.85rem; }
.bulk-item {
    display: flex; align-items: center; gap: 0.65rem; padding: 0.65rem;
    border-radius: var(--radius-sm); background: var(--bg-elevated); cursor: pointer;
}
.bulk-select-head { display: flex; gap: 0.75rem; }
.bulk-dist { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--text-muted); }
.bulk-dist label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }

.summary-list { display: flex; flex-direction: column; }
.summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.65rem 0; border-bottom: 1px solid var(--border);
}
.summary-row.sep { border-top: 1px solid var(--border-strong); margin-top: 0.35rem; padding-top: 0.85rem; }
.summary-row.highlight { background: var(--bg-elevated); margin: 0 -1.15rem; padding: 0.85rem 1.15rem; border-radius: var(--radius-sm); }
.summary-label { display: flex; align-items: center; gap: 0.6rem; font-size: 0.875rem; color: var(--text-muted); }
.summary-row .num.pos { color: var(--pos); }
.summary-row .num.neg { color: var(--neg); }

.law-section { margin-bottom: 1.25rem; }
.law-section h4 { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.65rem; }
.law-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; font-size: 0.8rem; color: var(--text-muted); }
.law-field-head { display: flex; align-items: center; gap: 0.5rem; }
.law-field-name { color: var(--text); font-weight: 600; font-size: 0.85rem; }
.law-key {
    color: var(--text); font-family: var(--mono); font-size: 0.72rem;
    background: var(--bg-hover); border: 1px solid var(--border);
    padding: 0.05rem 0.4rem; border-radius: 6px;
}
.law-translate { font-size: 0.75rem; color: var(--text-dim); font-style: italic; }
.legend-grid { display: grid; gap: 0.35rem; }
.legend-row {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem;
    padding: 0.45rem 0.6rem; border-radius: 8px;
    background: var(--bg-elevated); border: 1px solid var(--border);
}
.legend-name { color: var(--text); font-size: 0.82rem; }
.legend-kind { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; }

.empty-state { padding: 3rem 1.5rem; text-align: center; }
.empty-icon {
    width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 16px;
    background: var(--bg-elevated); display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--text-dim);
}
.empty-title { font-weight: 500; color: var(--text-muted); }
.empty-sub { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.25rem; }
.col-span-full { grid-column: 1 / -1; }

/* Toast */
#toastContainer {
    position: fixed; top: 1rem; right: 1rem; z-index: 150;
    display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem 1rem; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 500; pointer-events: auto;
    border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.toast.out { opacity: 0; }
.toast-success { background: #14532d; color: #bbf7d0; }
.toast-error { background: #450a0a; color: #fecaca; }
.toast-info { background: #1e3a5f; color: #bfdbfe; }
.toast-warning { background: #422006; color: #fde68a; }
[data-theme="light"] .toast-success { background: #dcfce7; color: #166534; }
[data-theme="light"] .toast-error { background: #fee2e2; color: #991b1b; }
[data-theme="light"] .toast-info { background: #dbeafe; color: #1e40af; }
[data-theme="light"] .toast-warning { background: #fef3c7; color: #92400e; }

.text-muted { color: var(--text-muted); }

/* PIN */
#pinLockScreen {
    position: fixed; inset: 0; z-index: 180;
    background: rgba(0, 0, 0, 0.85);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.pin-card {
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: 2rem; max-width: 360px; width: 100%;
    text-align: center; box-shadow: var(--shadow);
}
.pin-icon {
    width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.pin-card h2 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.pin-card p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.25rem; }
.pin-input { font-size: 1.5rem; letter-spacing: 0.3em; font-family: var(--mono); margin-bottom: 0.5rem; }
.pin-error { color: var(--neg); font-size: 0.8rem; margin-bottom: 0.75rem; }
#undoBtn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Charts */
.chart-panel { margin-bottom: 1.25rem; }
.chart-wrap { position: relative; height: 320px; padding: 0.5rem 0; }
.monthly-table { display: flex; flex-direction: column; gap: 0.35rem; }
.monthly-row {
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0.5rem;
    padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); background: var(--bg-elevated);
    font-size: 0.85rem;
}
.monthly-row span:first-child { color: var(--text-muted); font-weight: 500; }

/* Alert banner */
.alert-banner {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.85rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
    border: 1px solid var(--border);
}
.alert-banner i { font-size: 1.25rem; flex-shrink: 0; }
.alert-banner div { flex: 1; min-width: 0; }
.alert-banner strong { display: block; font-size: 0.9rem; }
.alert-banner span { font-size: 0.8rem; color: var(--text-muted); }
.alert-banner.ok { background: var(--pos-soft); border-color: var(--pos-line); }
.alert-banner.ok i { color: var(--pos); }
.alert-banner.warn { background: var(--neg-soft); border-color: var(--neg-line); }
.alert-banner.warn i { color: var(--neg); }
.alert-banner.info { background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.25); }
.alert-banner.info i { color: var(--info); }

@media (max-width: 767px) {
    .unit-picker { display: none; }
    #menuToggle { display: flex; }
}
@media (min-width: 768px) {
    #menuToggle { display: none; }
}
@media (max-width: 640px) {
    .monthly-row { grid-template-columns: 1fr 1fr; }
    .monthly-row span:first-child { grid-column: 1 / -1; }
    .debt-row { flex-direction: column; align-items: stretch; }
    .debt-actions { justify-content: space-between; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
