/* ─── سیستم امتیازدهی پشتیبان‌ها ─── */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --ink: #1c2430;
    --ink-soft: #6b7686;
    --line: #e4e8ee;
    --primary: #24303e;
    --primary-hover: #37475b;
    --star: #d99000;
    --pos: #1a7f4b;
    --neg: #c53a3a;
    --neg-soft: #fdf0f0;
    --pos-soft: #eef8f2;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20, 28, 40, .05), 0 4px 16px rgba(20, 28, 40, .05);
}

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

html { font-size: 16px; }

body {
    font-family: "Vazirmatn", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.9;
    min-height: 100vh;
}

h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .75rem; }
.muted { color: var(--ink-soft); font-size: .9rem; }
b { font-weight: 700; }
a { color: var(--primary); }

/* ─── نوار بالا ─── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
    max-width: 1180px; margin: 0 auto; padding: .65rem 1.25rem;
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.brand-star { color: var(--star); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a {
    text-decoration: none; color: var(--ink-soft);
    padding: .4rem .85rem; border-radius: 8px; font-size: .92rem; font-weight: 600;
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--primary); color: #fff; }

/* ─── چیدمان ─── */
.container { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.footer {
    text-align: center; color: var(--ink-soft);
    font-size: .8rem; padding: 1.5rem 0 2rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.25rem;
}
.cards { display: grid; gap: 1.25rem; }

/* ─── فرم‌ها ─── */
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .3rem; color: var(--ink-soft); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
    width: 100%;
    font: inherit;
    padding: .55rem .8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}
.inline-form { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.inline-form input { width: auto; }

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .9rem;
    align-items: end;
}
.grid-form-btn { display: flex; }

/* ─── دکمه‌ها ─── */
.btn {
    font: inherit; font-weight: 700; cursor: pointer;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    padding: .55rem 1.1rem; border-radius: 8px;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--neg-soft); border-color: #f0c9c9; color: var(--neg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; margin-top: 1rem; }

/* ─── پیام‌ها ─── */
.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; }
.alert-ok { background: var(--pos-soft); color: var(--pos); border: 1px solid #cfe9db; }
.alert-error { background: var(--neg-soft); color: var(--neg); border: 1px solid #f0c9c9; }
.empty { color: var(--ink-soft); padding: 1.25rem 0; text-align: center; }

.badge {
    display: inline-block; padding: .1rem .6rem; border-radius: 99px;
    font-size: .82rem; font-weight: 700;
}
.badge-pos { background: var(--pos-soft); color: var(--pos); }
.badge-neg { background: var(--neg-soft); color: var(--neg); }
.badge-muted { background: var(--bg); color: var(--ink-soft); }

/* ─── کارت امتیازدهی ─── */
.rate-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: .9rem;
}
.rate-card-head h2 { margin: 0; font-size: 1.1rem; }

.star-scale { display: grid; gap: .4rem; margin-bottom: .9rem; }
.scale-row { display: flex; gap: .3rem; flex-wrap: wrap; }
.scale-neg { direction: ltr; justify-content: flex-end; }

.chip {
    font: inherit; font-weight: 700; font-size: .85rem;
    min-width: 2.6rem; padding: .3rem .4rem;
    border-radius: 8px; cursor: pointer;
    border: 1px solid var(--line); background: #fff;
    transition: transform .08s, background .12s;
}
.chip:hover { transform: translateY(-1px); }
.chip-pos:hover { background: #fdf6e6; border-color: #ecd9a8; }
.chip-neg:hover { background: var(--neg-soft); border-color: #f0c9c9; }
.chip-pos.sel { background: var(--star); border-color: var(--star); color: #fff; }
.chip-neg.sel { background: var(--neg); border-color: var(--neg); color: #fff; }

.rate-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.rate-actions input { flex: 1; min-width: 200px; }
.rate-delete { margin-top: .5rem; }

/* ─── جدول‌ها ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
thead th {
    font-size: .82rem; color: var(--ink-soft); font-weight: 700;
    background: #fafbfc; white-space: nowrap;
}
tbody tr:hover { background: #fafbfd; }
.row-off { opacity: .55; }
.cell-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.cell-money input { max-width: 140px; }
td input[type="text"] { min-width: 160px; }

.num-pos { color: var(--pos); font-weight: 700; }
.num-neg { color: var(--neg); font-weight: 700; }

.report-table th, .report-table td { white-space: nowrap; }
.sticky-col {
    position: sticky; right: 0; background: var(--surface); z-index: 2;
    box-shadow: -6px 0 8px -8px rgba(0,0,0,.15);
}
thead .sticky-col { background: #fafbfc; }
.col-total { background: #fbf9f4; }
.cell-period small { display: inline-block; margin-right: .2rem; }

/* ─── تب‌ها ─── */
.tabs { display: flex; gap: .35rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.tab {
    text-decoration: none; font-weight: 700; font-size: .92rem;
    padding: .45rem 1.1rem; border-radius: 99px;
    color: var(--ink-soft); border: 1px solid var(--line); background: var(--surface);
}
.tab:hover { color: var(--ink); }
.tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── صفحه ورود ─── */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 1.5rem;
}
.login-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; box-shadow: var(--shadow);
    padding: 2.25rem 2rem; width: 100%; max-width: 400px; text-align: center;
}
.login-mark {
    width: 3.2rem; height: 3.2rem; margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    background: #fdf6e6; color: var(--star);
    border-radius: 50%; font-size: 1.5rem;
}
.login-card h1 { font-size: 1.25rem; margin-bottom: .4rem; }
.login-card .muted { margin-bottom: 1.25rem; }
.login-card form { text-align: right; }

@media (max-width: 640px) {
    html { font-size: 15px; }
    .topbar-inner { gap: .75rem; }
    .chip { min-width: 2.3rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
