@font-face {
    font-family: "IRANYekanX";
    src: url("fonts/IRANYekanX-Regular.woff") format("woff");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f3f6fc;
    --card: #ffffff;
    --card-soft: #f8faff;
    --ink: #18213a;
    --heading: #10172a;
    --muted: #778199;
    --line: #e6eaf2;
    --line-strong: #d6dceb;
    --primary: #5368f5;
    --primary-dark: #3f51d8;
    --primary-soft: #eef0ff;
    --danger: #d44757;
    --green: #169b69;
    --sidebar: #111a35;
    --sidebar-soft: #1a2545;
    --shadow-sm: 0 4px 16px rgba(21, 31, 60, .045);
    --shadow-md: 0 15px 45px rgba(21, 31, 60, .09);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background:
        radial-gradient(circle at 8% 0%, rgba(83, 104, 245, .07), transparent 23rem),
        var(--bg);
    color: var(--ink);
    font-family: "IRANYekanX", Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
}

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

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 100vh;
    padding: 24px 18px 18px;
    display: flex;
    flex-direction: column;
    color: #fff;
    overflow-y: auto;
    background:
        radial-gradient(circle at 10% 10%, rgba(112, 130, 255, .24), transparent 15rem),
        linear-gradient(180deg, #131d3c 0%, #0c142b 100%);
    box-shadow: -10px 0 35px rgba(9, 16, 37, .08);
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 2px 7px;
    color: #fff;
    text-decoration: none;
}

.brand-mark, .login-brand > span, .login-icon {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #7586ff, #4f60eb);
    box-shadow: 0 8px 22px rgba(83, 104, 245, .32), inset 0 1px rgba(255, 255, 255, .25);
    font: 800 21px/1 Arial, sans-serif;
}

.brand b { display: block; font: 800 17px/1.3 Arial, sans-serif; letter-spacing: .2px; }
.brand small { display: block; margin-top: 4px; color: #9da9c9; font-size: 10px; white-space: nowrap; }

.sidebar-close {
    display: none;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    font-size: 26px;
    cursor: pointer;
}

.nav-label {
    margin: 32px 13px 10px;
    color: #7683a8;
    font-size: 10px;
    letter-spacing: .4px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 6px; }

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: #aeb8d3;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-nav a svg, .logout-button svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-nav a:hover { color: #fff; background: rgba(255, 255, 255, .055); transform: translateX(-2px); }
.sidebar-nav a.active { color: #fff; border-color: rgba(255, 255, 255, .055); background: linear-gradient(90deg, rgba(91, 108, 243, .25), rgba(255, 255, 255, .07)); }
.sidebar-nav a.active::before { content: ""; position: absolute; right: -18px; width: 4px; height: 25px; border-radius: 4px 0 0 4px; background: #8190ff; box-shadow: 0 0 14px #687aff; }

.sidebar-user {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 36px;
    gap: 10px;
    align-items: center;
    margin-top: auto;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 15px;
    background: rgba(255, 255, 255, .055);
}

.user-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, #38466e, #293655);
    font-size: 17px;
    font-weight: 800;
}

.user-meta { min-width: 0; }
.user-meta b, .user-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta b { color: #eef1fa; font-size: 12px; }
.user-meta small { color: #8895b6; font-size: 10px; }
.sidebar-user form { margin: 0; }

.logout-button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: #9eabc8;
    background: transparent;
    cursor: pointer;
}
.logout-button:hover { color: #ffb8c0; background: rgba(220, 73, 91, .12); }

.sidebar-backdrop { display: none; }

.main { min-width: 0; padding: 30px clamp(20px, 3vw, 44px) 45px; }

.topbar {
    min-height: 65px;
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-heading { margin-left: auto; }
.eyebrow { display: block; margin-bottom: 1px; color: var(--primary); font-size: 10px; font-weight: 700; }
.topbar h1 { margin: 0; color: var(--heading); font-size: clamp(23px, 2.4vw, 30px); line-height: 1.45; letter-spacing: -.4px; }

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #dce9e4;
    border-radius: 11px;
    color: #318064;
    background: rgba(255, 255, 255, .65);
    font-size: 11px;
}
.topbar-status span { width: 8px; height: 8px; border-radius: 50%; background: #24b27a; box-shadow: 0 0 0 4px rgba(36, 178, 122, .11); }

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}
.menu-toggle span { display: block; height: 2px; margin: 4px 0; border-radius: 3px; background: var(--ink); }

.card {
    position: relative;
    margin-bottom: 22px;
    padding: clamp(18px, 2.3vw, 25px);
    border: 1px solid rgba(220, 225, 237, .9);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 16px; color: var(--heading); font-size: 17px; letter-spacing: -.15px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(145px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat {
    position: relative;
    min-height: 125px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: linear-gradient(145deg, #fff, #fafbff);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.stat::before { content: ""; position: absolute; top: -22px; left: -18px; width: 78px; height: 78px; border-radius: 50%; background: var(--accent-soft, #eef0ff); }
.stat::after { content: ""; position: absolute; top: 19px; left: 20px; width: 11px; height: 11px; border: 4px solid var(--accent, #6578f7); border-radius: 4px; transform: rotate(12deg); }
.stat:nth-child(2) { --accent: #a15bea; --accent-soft: #f4eaff; }
.stat:nth-child(3) { --accent: #13a57a; --accent-soft: #e6f8f2; }
.stat:nth-child(4) { --accent: #ed8a39; --accent-soft: #fff1e5; }
.stat:nth-child(5) { --accent: #e05f76; --accent-soft: #ffebef; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 13px; color: var(--heading); font-size: 28px; line-height: 1.3; }

.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.narrow { max-width: 850px; }
.form-grid { display: grid; gap: 16px; }

label { display: grid; gap: 7px; color: #39435a; font-size: 12px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    min-height: 47px;
    padding: 10px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    outline: none;
    color: var(--ink);
    background: #fbfcff;
    font: inherit;
    transition: border .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { min-height: 90px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #abb3c5; }
input:focus, select:focus, textarea:focus { border-color: #8795f8; background: #fff; box-shadow: 0 0 0 4px rgba(83, 104, 245, .1); }
label.check { display: flex; align-items: center; justify-content: flex-start; gap: 9px; min-height: 35px; font-weight: 500; }
label.check input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--primary); }

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    color: var(--ink);
    background: #fff;
    text-decoration: none;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(28, 39, 72, .08); }
.button.primary { border-color: var(--primary); color: #fff; background: linear-gradient(135deg, #6578f8, #4b5ee7); box-shadow: 0 8px 18px rgba(83, 104, 245, .19); }
.button.primary:hover { background: linear-gradient(135deg, #5b6ff3, #4052d9); }
.button.danger { border-color: #f3cfd4; color: var(--danger); background: #fff5f6; }
.button.small { min-height: 34px; padding: 5px 10px; font-size: 10px; }
.button.full { width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; scrollbar-width: thin; }
table { width: 100%; min-width: 650px; border-collapse: collapse; background: #fff; }
th, td { padding: 13px 15px; border-bottom: 1px solid #edf0f5; text-align: right; white-space: nowrap; }
th { color: #80899d; background: #f9faff; font-size: 10px; font-weight: 700; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
td form { margin: 0; }
.actions { display: flex; align-items: center; gap: 7px; }
.broadcast-callout { display: flex; align-items: center; justify-content: space-between; gap: 25px; overflow: hidden; background: linear-gradient(135deg, #fff, #f4f6ff); }
.broadcast-callout h2 { margin: 2px 0 3px; }
.broadcast-callout p { margin: 0; }
.broadcast-grid { align-items: stretch; }
.recipient-count { padding: 4px 10px; border-radius: 20px; color: var(--primary); background: var(--primary-soft); font-size: 10px; }
.command-box { display: grid; gap: 8px; margin: 18px 0; padding: 18px; border: 1px dashed #bdc6f4; border-radius: 14px; background: #f4f6ff; text-align: center; }
.command-box code { font-size: 18px; }
.empty { padding: 32px; color: var(--muted); text-align: center; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 10px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.green { color: var(--green); background: #e8f8f1; }
.badge.gray { color: #727c91; background: #eef1f5; }

.alert { padding: 12px 15px; margin-bottom: 17px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.alert-success { border: 1px solid #bfe9d5; color: #13764e; background: #eaf9f2; }
.alert-error { border: 1px solid #f3c7cc; color: #aa2d3c; background: #fff1f2; }
.hint, small { color: var(--muted); font-weight: 400; }
.note { border-color: #dfe5fa; background: linear-gradient(145deg, #f8faff, #fff); }
.details { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 9px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; color: var(--heading); }
.break { white-space: normal; word-break: break-all; }
.danger-text { color: var(--danger); }
code { padding: 2px 6px; border-radius: 6px; color: #4655b7; background: #eef0fa; direction: ltr; font-family: Consolas, monospace; font-size: .9em; }

.login-page {
    min-height: 100vh;
    padding: 30px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(116, 134, 255, .25), transparent 27rem),
        radial-gradient(circle at 90% 85%, rgba(61, 216, 177, .1), transparent 25rem),
        #0e1731;
}
.login-shell { width: min(1050px, 100%); min-height: 610px; display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid rgba(255, 255, 255, .08); border-radius: 28px; background: rgba(255, 255, 255, .035); box-shadow: 0 35px 90px rgba(0, 0, 0, .3); backdrop-filter: blur(8px); }
.login-intro { padding: clamp(35px, 5vw, 65px); display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: linear-gradient(145deg, rgba(93, 111, 244, .13), rgba(255, 255, 255, .015)); }
.login-brand { display: flex; align-items: center; gap: 12px; font: 800 19px/1 Arial, sans-serif; }
.login-intro h1 { max-width: 570px; margin: 14px 0; font-size: clamp(30px, 4vw, 47px); line-height: 1.55; letter-spacing: -1px; }
.login-intro p { max-width: 520px; color: #aeb8d3; font-size: 14px; }
.login-kicker { color: #91a0ff; font-size: 11px; font-weight: 800; }
.login-features { display: flex; flex-wrap: wrap; gap: 8px; }
.login-features span { padding: 7px 11px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 10px; color: #bfc7dc; background: rgba(255, 255, 255, .045); font-size: 10px; }
.login-card { align-self: center; margin: 35px; padding: clamp(25px, 4vw, 38px); display: grid; gap: 18px; border-radius: 22px; background: #fff; box-shadow: 0 25px 60px rgba(0, 0, 0, .18); }
.login-card-head { display: flex; align-items: center; gap: 13px; margin-bottom: 3px; }
.login-card h2 { margin: 0; color: var(--heading); font-size: 22px; }
.login-card p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.login-icon { display: none; }
.login-submit { min-height: 49px; margin-top: 3px; font-size: 13px; }
.login-submit span { font-size: 18px; }
.login-security { text-align: center; font-size: 9px; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
}

@media (max-width: 960px) {
    .app-shell { grid-template-columns: 245px minmax(0, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, minmax(145px, 1fr)); }
    .two-columns { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr 1fr; }
    .login-intro { padding: 38px; }
    .login-card { margin: 24px; }
}

@media (max-width: 860px) {
    body.sidebar-open { overflow: hidden; }
    .app-shell { display: block; }
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: min(300px, 87vw);
        height: 100dvh;
        transform: translateX(105%);
        transition: transform .25s ease;
        box-shadow: -20px 0 60px rgba(0, 0, 0, .25);
    }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; display: block; visibility: hidden; opacity: 0; background: rgba(9, 15, 32, .52); backdrop-filter: blur(2px); transition: opacity .25s ease, visibility .25s ease; }
    .sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
    .sidebar-close, .menu-toggle { display: block; }
    .main { padding: 18px clamp(14px, 4vw, 25px) 35px; }
    .topbar { min-height: 58px; margin-bottom: 18px; }
    .topbar-status { display: none; }
    .page-heading { margin-left: 0; margin-right: 2px; }
    .page-heading h1 { font-size: 22px; }
}

@media (max-width: 720px) {
    .login-page { padding: 14px; align-items: start; }
    .login-shell { min-height: 0; grid-template-columns: 1fr; border-radius: 22px; }
    .login-intro { min-height: 235px; padding: 28px; }
    .login-intro h1 { margin: 12px 0 5px; font-size: 27px; }
    .login-intro p { margin: 0; font-size: 11px; }
    .login-features { display: none; }
    .login-card { margin: 0; border-radius: 22px 22px 0 0; }
    .login-icon { display: inline-grid; }
    .details { grid-template-columns: 1fr; gap: 2px; }
    .details dd { margin-bottom: 9px; }
}

@media (max-width: 540px) {
    body { font-size: 13px; }
    .main { padding-inline: 12px; }
    .topbar { align-items: center; }
    .eyebrow { display: none; }
    .topbar h1 { font-size: 19px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { min-height: 104px; padding: 15px; }
    .stat strong { margin-top: 9px; font-size: 23px; }
    .stat::before { width: 63px; height: 63px; }
    .stat::after { top: 15px; left: 16px; }
    .card { margin-bottom: 14px; padding: 16px; border-radius: 15px; }
    .card-heading { align-items: flex-start; }
    .card-heading h2 { margin-bottom: 0; }
    .table-wrap { margin-inline: 0; }
    table { min-width: 610px; }
    th, td { padding: 11px 12px; }
    .form-grid .button.primary { width: 100%; }
    .broadcast-callout { align-items: stretch; flex-direction: column; }
    .broadcast-callout .button { width: 100%; }
    .login-page { padding: 0; background: #0e1731; }
    .login-shell { width: 100%; border: 0; border-radius: 0; }
    .login-intro { min-height: 220px; border-radius: 0; }
    .login-card { padding: 25px 20px 30px; border-radius: 22px 22px 0 0; box-shadow: none; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat { min-height: 95px; }
}
