@font-face {
    font-family: "Vazirmatn";
    src: url("/assets/Vazirmatn-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("/assets/Vazirmatn-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Font Awesome 6 Free Solid";
    src: url("/assets/fontawesome.otf") format("opentype");
    font-style: normal;
    font-weight: 900;
    font-display: block;
}

.fa-icon {
    font-family: "Font Awesome 6 Free Solid", sans-serif;
    font-style: normal;
    font-weight: 900;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    speak: none;
    line-height: 1;
}

:root {
    --gold: #ca9b5d;
    --gold-soft: #d4a916;
    --bg: #09111d;
    --panel: #131c2a;
    --card: #1c2432;
    --border: rgba(255, 255, 255, 0.08);
    --title: #f2f2f2;
    --muted: #9aa3b0;
    --green: #66d98c;
    --red: #f27373;
    --input: rgba(0, 0, 0, 0.28);
    --side: #0f172a;
    --accent: #0e7c74;
    --accent-2: #5ecfc4;
}

* { box-sizing: border-box; }
html, body, #root, .admin {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(202, 155, 93, 0.08), transparent 55%), var(--bg);
    color: var(--title);
    font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}
button, input, textarea, select {
    font-family: inherit;
}
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.card {
    background: linear-gradient(180deg, #2a3448, #1c2432);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
}
.login { width: min(420px, 100%); display: grid; gap: 10px; }
.brand .logo { font-size: 36px; font-weight: 700; color: var(--gold); }
.brand .logo-ex { font-size: 36px; font-weight: 500; color: #f0e6c0; }
.brand-sub { color: var(--muted); margin-top: 4px; font-size: 13px; }
.center { text-align: center; margin-bottom: 8px; }
label { font-size: 13px; color: var(--muted); }
input, textarea, select {
    background: var(--input);
    border: 1px solid var(--border);
    color: var(--title);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
}
textarea { min-height: 220px; width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
button { cursor: pointer; }
button.gold {
    background: linear-gradient(180deg, #d4a916, #c09249);
    color: #20150a;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 700;
}
button.gold:disabled { opacity: .55; cursor: default; }
button.ghost {
    background: transparent;
    color: var(--gold);
    border: 1px solid rgba(202, 155, 93, 0.35);
    border-radius: 10px;
    padding: 8px 12px;
}
.err { color: var(--red); font-size: 13px; }
.err.small { font-size: 11px; margin-top: 6px; }

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: #0f172a;
    color: #e8eef5;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
.side-brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.4rem 0.65rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 0.75rem;
}
.side-brand .brand .logo { font-size: 26px; font-weight: 700; color: var(--gold); letter-spacing: 0.04em; }
.side-brand .brand .logo-ex { font-size: 26px; font-weight: 500; color: #f0e6c0; }
.side-brand span { color: #9db0c7; font-size: 0.82rem; }
.side-nav { flex: 1; padding: 0.15rem 0; }
.nav-group {
    margin-bottom: calc(0.2rem + 10px);
}
.nav-group-btn {
    width: 100%;
    text-align: right;
    background: transparent;
    border: 0;
    color: #ffffff;
    font-weight: 400;
    font-size: 0.78rem;
    min-height: 2.15rem;
    padding: 0.4rem 0.45rem;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-fa-wrap {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(14, 124, 116, 0.14);
    border: 1px solid rgba(127, 212, 203, 0.12);
    transition: background 0.15s ease, border-color 0.15s ease;
}
.nav-fa {
    color: #7fd4cb;
    font-size: 0.72rem;
    line-height: 1;
}
.nav-group-title {
    flex: 1;
    line-height: 1.3;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: #ffffff;
}
.nav-chevron {
    flex-shrink: 0;
    width: 0.85rem;
    text-align: center;
    font-size: 0.62rem;
    color: #7a8fa8;
    transition: transform 0.18s ease, color 0.15s ease;
    transform-origin: center;
}
.nav-group-btn:hover {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}
.nav-group-btn:hover .nav-fa-wrap {
    background: rgba(14, 124, 116, 0.22);
    border-color: rgba(127, 212, 203, 0.22);
}
.nav-group-btn.open,
.nav-group.open > .nav-group-btn {
    color: #fff;
    background: rgba(255, 255, 255, .06);
}
.nav-group.open > .nav-group-btn .nav-fa { color: #dff7f3; }
.nav-group.open > .nav-group-btn .nav-fa-wrap {
    background: rgba(14, 124, 116, 0.32);
    border-color: rgba(127, 212, 203, 0.28);
}
.nav-group.open > .nav-group-btn .nav-chevron {
    color: #c5d8ea;
    transform: rotate(90deg);
}
.nav-sub {
    list-style: none;
    margin: 0;
    padding: 0.1rem 0.15rem 0.35rem 0.35rem;
    margin-right: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-2px);
    pointer-events: none;
    transition:
        max-height 0.2s ease,
        opacity 0.16s ease,
        transform 0.16s ease,
        padding 0.16s ease;
}
.nav-group.open > .nav-sub {
    max-height: 40rem;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    padding: 0.15rem 0.15rem 0.4rem 0.35rem;
}
.nav-item {
    width: 100%;
    text-align: right;
    border: 0;
    background: transparent;
    color: #f0f4f8;
    min-height: 2rem;
    padding: 0.38rem 0.7rem 0.38rem 0.55rem;
    border-radius: 7px;
    font-size: 0.75rem;
    font-weight: 400;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    transition: background 0.14s ease, color 0.14s ease;
}
.nav-item-fa {
    flex-shrink: 0;
    width: 1rem;
    text-align: center;
    font-size: 0.72rem;
    color: #7fd4cb;
}
.nav-item.down .nav-item-fa { color: #f27373; }
.nav-item:hover {
    background: rgba(14, 124, 116, 0.14);
    color: #ffffff;
}
.nav-item:hover .nav-item-fa { color: #dff7f3; }
.nav-item.active {
    background: rgba(14, 124, 116, 0.28);
    color: #ffffff;
    font-weight: 500;
    box-shadow: none;
}
.nav-item.active .nav-item-fa { color: #dff7f3; }
.nav-item.active::before {
    content: "";
    position: absolute;
    top: 20%;
    bottom: 20%;
    right: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: #5ecfc4;
}
.nav-home {
    margin-bottom: 0.65rem;
}
.btn {
    border: 0;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-weight: 700;
}
.btn.ghost {
    background: #e7eef7;
    color: #142033;
}
.logout { margin-top: 0.75rem; width: 100%; }

.main { display: flex; flex-direction: column; min-width: 0; }
.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
}
.content { padding: 22px; }
.head-row { display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2.g-title { font-size: 14px; color: var(--muted); margin: 24px 0 10px; }
h3 { margin: 0 0 10px; font-size: 14px; color: var(--gold); }
.hint { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.code, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.stats { display: flex; gap: 12px; margin: 16px 0 8px; }
.stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 100px;
}
.stat .n { font-size: 26px; font-weight: 700; }
.stat .n.ok { color: var(--green); }
.stat .n.bad { color: var(--red); }
.stat .l { color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card.svc { text-align: right; color: inherit; cursor: pointer; }
.svc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--red); display: inline-block; flex: 0 0 8px;
}
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }
.tabs { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.tab {
    background: var(--panel);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 14px;
}
.tab.on { color: #20150a; background: var(--gold); border-color: transparent; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    color: #d6d6d6;
    max-height: 480px;
    overflow: auto;
}
.row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.row.wrap { flex-wrap: wrap; }
.back { margin-bottom: 10px; }
.banner {
    margin-top: 12px;
    background: rgba(242, 115, 115, 0.12);
    color: #ffc9c9;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
}
@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        max-height: 50vh;
    }
    .split { grid-template-columns: 1fr; }
}
