@font-face {
    font-family: "TajrobeUI";
    src: local("Vazirmatn"), local("IRANSans"), local("Tahoma");
    font-display: swap;
}

:root {
    color-scheme: light;
    --bg: #f6f7f4;
    --surface: #ffffff;
    --surface-soft: #f9faf6;
    --text: #17211b;
    --muted: #657166;
    --line: #dfe5dc;
    --primary: #146c5f;
    --primary-strong: #0d544a;
    --primary-soft: #e4f3ef;
    --accent: #d58b2a;
    --danger: #b42318;
    --danger-soft: #fff0ed;
    --success: #1f7a4d;
    --success-soft: #e8f7ee;
    --shadow: 0 16px 40px rgba(26, 38, 31, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(20, 108, 95, 0.10), transparent 32rem),
        var(--bg);
    color: var(--text);
    font-family: TajrobeUI, Tahoma, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.75;
}

a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

a:hover {
    color: var(--primary-strong);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

.app-shell,
.admin-shell {
    min-height: 100vh;
}

.main-nav,
.admin-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(223, 229, 220, 0.85);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(26, 38, 31, 0.04);
    scrollbar-width: none;
}

.nav-head {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nav-items {
    display: none;
    width: 100%;
    gap: 8px;
    align-items: center;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.main-nav.is-open,
.admin-nav.is-open {
    flex-wrap: wrap;
}

.main-nav.is-open .nav-items,
.admin-nav.is-open .nav-items {
    display: grid;
}

.main-nav::-webkit-scrollbar,
.admin-nav::-webkit-scrollbar {
    display: none;
}

.brand {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 7px;
    align-items: center;
    margin-left: 6px;
    color: var(--text);
    font-size: 15px;
    font-weight: 900;
    white-space: nowrap;
}

.brand-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 8px;
}

.ui-icon {
    display: inline-flex;
    width: 1.35em;
    height: 1.35em;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    border-radius: 999px;
    color: currentColor;
    font-size: 1em;
    font-weight: 900;
    line-height: 1;
}

.menu-toggle,
.nav-icon-link {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--primary);
    font-weight: 900;
    text-decoration: none;
}

.menu-toggle {
    order: -1;
}

.nav-link,
.nav-button {
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.main-nav .nav-link,
.main-nav .nav-button {
    background: var(--surface-soft);
}

.nav-link:hover,
.nav-button:hover,
.nav-link.is-active {
    border-color: var(--line);
    background: var(--surface-soft);
    color: var(--primary);
}

.nav-button {
    color: var(--danger);
}

.notification-count {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
}

.btn.success,
button.success {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.page {
    width: min(980px, calc(100% - 28px));
    margin: 16px auto 34px;
}

.page.narrow {
    width: min(720px, calc(100% - 28px));
}

.page.wide {
    width: min(1120px, calc(100% - 28px));
}

.page-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.page-title {
    margin: 0;
    font-size: clamp(22px, 5.6vw, 32px);
    line-height: 1.35;
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.panel,
.card,
.post,
.comment,
.notification,
.plan,
.stat,
.profile-box,
.post-item,
.notification-item,
.badge-item,
.reward-item,
.ad-card,
.link-item,
.report-box,
.empty-state {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel {
    padding: 14px;
}

.card,
.post,
.comment,
.notification,
.plan,
.stat,
.profile-box,
.post-item,
.notification-item,
.badge-item,
.reward-item,
.ad-card,
.link-item,
.report-box,
.empty-state {
    padding: 14px;
}

.section {
    margin-top: 12px;
}

.section-title {
    margin: 0 0 12px;
    font-size: 19px;
}

.grid {
    display: grid;
    gap: 12px;
}

.grid.two,
.plans,
.stats,
.links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.actions,
.top {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.top {
    justify-content: space-between;
}

.btn,
.submit,
button.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
}

.btn.secondary,
.submit.secondary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--primary);
}

.btn.danger,
button.danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 800;
}

label {
    display: block;
    margin: 12px 0 5px;
    color: var(--text);
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(20, 108, 95, 0.16);
}

.search-box {
    margin: 16px 0;
}

.meta,
.muted,
.hint,
.empty {
    color: var(--muted);
}

.meta,
.hint,
.field-error,
.error {
    font-size: 14px;
}

.body,
.text-block {
    white-space: pre-wrap;
}

.avatar {
    width: 112px;
    height: 112px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.stat strong {
    display: block;
    color: var(--primary);
    font-size: 30px;
    line-height: 1.2;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 900;
}

.notification.unread {
    border-color: rgba(20, 108, 95, 0.45);
    background: var(--primary-soft);
}

.layout-message {
    width: min(980px, calc(100% - 28px));
    margin: 10px auto 0;
    padding: 10px 12px;
    border-radius: var(--radius);
}

.layout-message.success,
.status {
    border: 1px solid rgba(31, 122, 77, 0.24);
    background: var(--success-soft);
    color: var(--success);
}

.layout-message.error,
.error-box {
    border: 1px solid rgba(180, 35, 24, 0.24);
    background: var(--danger-soft);
    color: var(--danger);
}

.field-error,
.error {
    color: var(--danger);
}

.empty-state {
    background: var(--surface-soft);
    text-align: center;
}

.empty-state h2,
.empty-state h3 {
    margin: 0 0 8px;
}

.empty-state p {
    margin: 6px 0;
    color: var(--muted);
}

.ad-card {
    border-style: dashed;
    background: #fffbf3;
}

.ad-image {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    margin-bottom: 10px;
    border-radius: var(--radius);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

@media (min-width: 720px) {
    body {
        font-size: 16px;
    }

    .main-nav,
    .admin-nav {
        padding: 12px 24px;
    }

    .main-nav {
        flex-wrap: nowrap;
    }

    .main-nav .nav-head {
        width: auto;
    }

    .main-nav .nav-items {
        display: flex;
        width: auto;
        flex: 1;
    }

    .main-nav .menu-toggle {
        display: none;
    }

    .main-nav .nav-icon-link {
        display: none;
    }

    .page {
        margin-top: 34px;
    }

    .panel {
        padding: 24px;
    }

    .card,
    .post,
    .comment,
    .notification,
    .plan,
    .stat,
    .profile-box,
    .post-item,
    .notification-item,
    .badge-item,
    .reward-item,
    .ad-card,
    .link-item,
    .report-box,
    .empty-state {
        padding: 18px;
    }

    .grid.two,
    .plans,
    .stats,
    .links {
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    }
}

.compact-page {
    width: min(760px, calc(100% - 20px));
    margin-top: 10px;
}

.module {
    margin-top: 8px;
}

.module-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 16px;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.status-chip {
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.status-chip span {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-chip strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.auth-page {
    display: grid;
    gap: 10px;
}

.auth-page .btn {
    width: 100%;
}

.homepage-slider {
    display: flex;
    width: 100%;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 0 8px;
    scroll-snap-type: x mandatory;
}

.slide-card {
    display: grid;
    flex: 0 0 100%;
    min-height: 180px;
    align-items: end;
    overflow: hidden;
    padding: 0;
    scroll-snap-align: start;
    background: var(--surface);
}

.slide-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius);
}

.slide-content {
    padding: 12px;
}

@media (min-width: 720px) {
    .slide-card {
        flex-basis: min(86%, 820px);
    }

    .slide-image {
        height: 260px;
    }
}

.profile-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.profile-head .avatar {
    flex: 0 0 auto;
    width: 82px;
    height: 82px;
}

.leaderboard-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.leaderboard-row:last-child {
    border-bottom: 0;
}

.remember {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 700;
}

.remember input {
    width: auto;
}

.quick-action {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    padding: 9px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--primary);
    font-weight: 900;
    text-align: center;
}

.quick-action .ui-icon {
    margin-left: 6px;
}

.quick-action.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.mini-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.mini-stat {
    padding: 8px 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
}

.mini-stat strong {
    display: block;
    color: var(--primary);
    font-size: 19px;
    line-height: 1.2;
}

.mini-stat span {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-list {
    display: grid;
    gap: 7px;
}

.compact-card {
    padding: 10px;
}

.compact-card h2,
.compact-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    line-height: 1.45;
}

.compact-card p {
    margin: 6px 0;
}

.post-card-header {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: space-between;
}

.post-card-title {
    min-width: 0;
}

.post-card-title a {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-card-body {
    display: -webkit-box;
    overflow: hidden;
    margin: 6px 0 0;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-meta-row {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 11px;
}

.metric {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    color: var(--muted);
    font-weight: 800;
}

.tiny-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 900;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(23, 33, 27, 0.08);
    border-radius: 999px;
    color: var(--text);
    font-size: 12px;
    font-weight: 900;
}

.post-type-label {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.post-type-experience {
    border-color: #b7dec2;
    background: #eaf7ed;
    color: #1d6b3a;
}

.post-type-problem {
    border-color: #f4c7a4;
    background: #fff1e8;
    color: #9a3f12;
}

.post-type-success {
    border-color: #a9dde0;
    background: #e8f8f8;
    color: #116a71;
}

.post-type-question {
    border-color: #d5c3f1;
    background: #f3edff;
    color: #5c3a99;
}

.type-help-list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.type-help-item {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.sticky-search {
    position: sticky;
    top: 61px;
    z-index: 10;
    margin: 8px 0;
    padding: 8px;
    background: rgba(246, 247, 244, 0.94);
    backdrop-filter: blur(12px);
}

.sticky-search label {
    margin-top: 0;
    font-size: 13px;
}

.sticky-search .hint {
    margin: 5px 0 0;
}

.post-detail {
    padding: 14px;
}

.post-detail .page-title {
    font-size: clamp(22px, 6vw, 30px);
}

.comment-tabs {
    display: grid;
    gap: 8px;
}

.comment-group {
    display: grid;
    gap: 8px;
}

.comment-group-title {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.reply-box {
    position: static;
    bottom: auto;
    z-index: 9;
    box-shadow: 0 12px 34px rgba(26, 38, 31, 0.16);
}

.reply-box textarea {
    min-height: 86px;
}

.dense-ad {
    padding: 10px;
}

details.report-box {
    box-shadow: none;
}

details.report-box summary {
    color: var(--primary);
    cursor: pointer;
    font-weight: 900;
}

.comment-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.like-count {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.like-button {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--primary);
    font-weight: 900;
}

.like-button.is-liked {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

@media (max-width: 420px) {
    .page-header {
        display: block;
    }

    .page-header .btn {
        width: 100%;
        margin-top: 10px;
    }

    .post-card-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .post-card-header .btn {
        min-height: 34px;
        padding: 6px 9px;
        font-size: 13px;
    }

    .quick-action {
        font-size: 13px;
    }
}
