/* ============================================================
   QFM — حساب موتر — تم روشن نارنجی/سفید
   ============================================================ */

:root {
    --orange: #FF6B18;
    --orange-dark: #E85A0C;
    --orange-soft: #FFF1E9;
    --orange-tint: #FFE4D2;
    --ink: #1a1a1a;
    --ink-soft: #555;
    --ink-faint: #999;
    --line: #ececec;
    --line-soft: #f4f4f4;
    --white: #ffffff;
    --bg: #fafafa;
    --green: #17a558;
    --green-soft: #e8f7ee;
    --red: #e23b3b;
    --red-soft: #fdeaea;
    --amber: #d99400;
    --radius: 16px;
    --font: system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    font-size: 16px;
    padding-bottom: 40px;
}

/* ---------- ورود ---------- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    padding: 24px; min-height: 100vh;
    background: linear-gradient(160deg, var(--orange-soft), var(--white) 60%);
}
.login-card {
    width: 100%; max-width: 360px;
    background: var(--white); border: 1px solid var(--line);
    border-radius: 22px; padding: 40px 28px; margin-top: 10vh;
    box-shadow: 0 12px 40px rgba(255,107,24,.10);
}
.brand { text-align: center; margin-bottom: 28px; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 68px; height: 68px; border-radius: 20px;
    background: var(--orange); color: #fff; font-size: 26px; font-weight: 800;
    letter-spacing: .5px; box-shadow: 0 8px 20px rgba(255,107,24,.35);
}
.brand h1 { font-size: 24px; margin: 14px 0 4px; }
.brand p { color: var(--ink-faint); font-size: 14px; }

/* ---------- هدر ---------- */
.app-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 18px; background: var(--white);
    border-bottom: 1px solid var(--line);
}
.header-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.logo-badge {
    background: var(--orange); color: #fff; font-size: 13px; font-weight: 800;
    padding: 4px 8px; border-radius: 8px; letter-spacing: .5px;
}
.logout-btn {
    color: var(--ink-soft); text-decoration: none; font-size: 13px;
    border: 1px solid var(--line); padding: 7px 13px; border-radius: 9px;
}

/* ---------- تب‌ها ---------- */
.tabs {
    display: flex; gap: 6px; padding: 12px 18px;
    position: sticky; top: 58px; z-index: 15; background: var(--bg);
}
.tab {
    flex: 1; padding: 10px 0; font-size: 13.5px; font-family: var(--font);
    background: var(--white); color: var(--ink-soft);
    border: 1px solid var(--line); border-radius: 11px; cursor: pointer;
    transition: all .15s;
}
.tab.active { background: var(--orange); color: #fff; border-color: var(--orange); font-weight: 700; }

.tab-panel { display: none; padding: 6px 18px 0; }
.tab-panel.active { display: block; animation: fade .22s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- داشبورد ---------- */
.dash-greeting { margin: 14px 2px 20px; }
.dash-hello { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.dash-date { font-size: 13px; color: var(--ink-faint); margin-top: 4px; }

.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.balance-grid .full { grid-column: 1 / -1; }
.balance-card {
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    color: #fff; border-radius: var(--radius); padding: 18px;
    box-shadow: 0 6px 20px rgba(255,107,24,.25);
    position: relative; overflow: hidden;
}
.balance-card::after {
    content: ''; position: absolute; top: -30px; left: -30px;
    width: 90px; height: 90px; border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.balance-card.alt { background: linear-gradient(135deg, #2b2b2b, #111); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.balance-card .cur { font-size: 11px; opacity: .9; font-weight: 700; letter-spacing: .5px; }
.balance-card .val { font-size: 25px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; }

/* کارت‌های داشبورد */
.dash-card {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.dash-card-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; font-size: 14px; font-weight: 700; color: var(--ink);
}
.dash-card-tag { font-size: 12px; font-weight: 600; color: var(--ink-faint); }
.dash-link {
    background: none; border: none; color: var(--orange);
    font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font);
}

.dash-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat-card {
    background: var(--bg); border-radius: 12px; padding: 14px 8px; text-align: center;
}
.stat-card .s-icon { font-size: 18px; }
.stat-card .s-label { font-size: 11px; color: var(--ink-faint); margin: 5px 0 3px; }
.stat-card .s-val { font-size: 14px; font-weight: 800; }
.stat-card.income .s-val { color: var(--green); }
.stat-card.expense .s-val, .stat-card.payment .s-val { color: var(--red); }

.dash-recent { display: flex; flex-direction: column; gap: 0; }
.dash-recent .tx-item { border: none; border-bottom: 1px solid var(--line-soft); border-radius: 0; padding: 12px 0; }
.dash-recent .tx-item:last-child { border-bottom: none; padding-bottom: 0; }
.dash-recent .tx-item:first-child { padding-top: 0; }
.dash-cta { margin-top: 8px; }

/* ---------- انتخاب نوع ---------- */
.kind-picker { display: flex; gap: 8px; margin: 12px 0 20px; }
.kind-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 18px 0; font-size: 24px; font-family: var(--font);
    background: var(--white); border: 2px solid var(--line);
    border-radius: var(--radius); color: var(--ink); cursor: pointer;
    transition: all .15s;
}
.kind-btn span { font-size: 13px; color: var(--ink-soft); }
.kind-btn.selected { border-color: var(--orange); background: var(--orange-soft); }
.kind-btn.selected span { color: var(--orange-dark); font-weight: 700; }

/* ---------- فرم ---------- */
.tx-form label {
    display: block; font-size: 13px; color: var(--ink-soft);
    margin: 16px 0 7px; font-weight: 600;
}
.tx-form input[type=number],
.tx-form input[type=text],
.tx-form input[type=date],
.login-card input {
    width: 100%; padding: 14px; font-size: 16px; font-family: var(--font);
    background: var(--white); border: 1.5px solid var(--line);
    border-radius: 12px; color: var(--ink); outline: none;
}
.tx-form input:focus, .login-card input:focus { border-color: var(--orange); }

.seg { display: flex; gap: 8px; }
.seg-btn {
    flex: 1; padding: 12px 0; font-size: 15px; font-family: var(--font);
    background: var(--white); border: 1.5px solid var(--line);
    border-radius: 12px; color: var(--ink-soft); cursor: pointer;
}
.seg-btn.active { background: var(--orange); color: #fff; border-color: var(--orange); font-weight: 700; }

/* ---------- دکمه‌ها ---------- */
.btn-primary {
    width: 100%; margin-top: 24px; padding: 16px;
    font-size: 17px; font-weight: 700; font-family: var(--font);
    background: var(--orange); color: #fff; border: none;
    border-radius: 13px; cursor: pointer; transition: background .15s;
    box-shadow: 0 6px 18px rgba(255,107,24,.3);
}
.btn-primary:active { background: var(--orange-dark); }
.btn-outline {
    flex: 1; text-align: center; display: inline-block; padding: 13px 16px; font-size: 14px;
    font-weight: 600; background: var(--white); color: var(--ink); text-decoration: none;
    border: 1.5px solid var(--line); border-radius: 12px;
}
.btn-outline:active { background: var(--orange-soft); border-color: var(--orange); }

/* ---------- پیام ---------- */
.msg { margin-top: 16px; font-size: 14px; text-align: center; }
.msg.ok { color: var(--green); }
.msg.err { color: var(--red); }
.alert-error {
    background: var(--red-soft); color: var(--red);
    padding: 12px; border-radius: 10px; font-size: 14px;
    text-align: center; margin-bottom: 16px;
}

/* ---------- لیست تراکنش‌ها ---------- */
.tx-list { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.tx-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px;
}
.tx-icon {
    font-size: 20px; width: 42px; height: 42px; flex: 0 0 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px; background: var(--orange-soft);
}
.tx-body { flex: 1; min-width: 0; }
.tx-desc { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.tx-amount { font-size: 15px; font-weight: 800; white-space: nowrap; }
.tx-amount.income { color: var(--green); }
.tx-amount.expense, .tx-amount.payment { color: var(--red); }
.tx-del {
    background: none; border: none; color: var(--ink-faint);
    font-size: 18px; cursor: pointer; padding: 4px 6px;
}
.tx-del:active { color: var(--red); }

/* ---------- گزارش ---------- */
.report-actions { display: flex; gap: 10px; margin: 12px 0 18px; }
.report { padding-top: 4px; }
.report-month { font-size: 15px; color: var(--orange-dark); font-weight: 700; margin-bottom: 14px; }
.report-group {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.report-group h3 { font-size: 14px; color: var(--ink-soft); margin-bottom: 12px; }
.report-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.report-row:last-child { border-bottom: none; }
.report-row .r-label { color: var(--ink-soft); }
.report-row .r-val { font-weight: 700; }

.empty, .dash-loading { text-align: center; color: var(--ink-faint); padding: 30px 0; font-size: 14px; }
