@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-a: #d3ac66;
    --gold-b: #c09249;
    --gold-txt: #20150a;
    --side: #111111;
    --side-2: #1c1c1c;
    --accent: #d3ac66;
    --accent-2: #c09249;
    --ink: #141414;
    --muted: #6b7280;
    --bg: #f4f7f6;
    --panel: #ffffff;
    --line: #e6ece9;
    --green: #22a34a;
    --red: #d45d5d;
    --title: #141414;
}

* { box-sizing: border-box; }
html, body, #root, .admin {
    margin: 0;
    min-height: 100%;
    background: var(--side);
    color: var(--ink);
    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;
    background: #111111;
}
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 28px rgba(20, 32, 51, 0.06);
}
.razex-logo {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #d4a916;
    line-height: 1.1;
}
.razex-logo span {
    color: #f0e6c0;
    font-weight: 500;
}
.login { width: min(420px, 100%); display: grid; gap: 10px; }
.brand-sub { color: #9aa3b0; margin-top: 4px; font-size: 13px; }
.center { text-align: center; margin-bottom: 8px; }
label { font-size: 13px; color: var(--muted); }
input, textarea, select {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 12px;
    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, var(--gold-a), var(--gold-b));
    color: var(--gold-txt);
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 700;
}
button.gold:disabled { opacity: .55; cursor: default; }
button.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    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;
    background: var(--side);
}
.sidebar {
    background: var(--side);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.1rem 0.85rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
.side-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.7rem 0.55rem 1.25rem;
    margin-bottom: 0.35rem;
}
.side-brand .razex-logo {
    direction: ltr;
    unicode-bidi: isolate;
    display: block;
    width: 100%;
    text-align: center;
    font-size: 30px;
}
.side-nav { flex: 1; padding: 0.15rem 0; display: flex; flex-direction: column; gap: 0.45rem; }

.nav-group {
    margin-bottom: 0;
    border-radius: 16px;
    padding: 0.2rem;
}
.nav-group.open {
    background: var(--side-2);
}
.nav-group-btn {
    width: 100%;
    text-align: right;
    background: transparent;
    border: 0;
    color: #ffffff;
    font-weight: 500;
    font-size: 0.88rem;
    min-height: 2.45rem;
    padding: 0.5rem 0.7rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-fa-wrap {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    border: 0;
}
.nav-fa {
    color: #fff;
    font-size: 0.86rem;
    line-height: 1;
}
.nav-group-title {
    flex: 1;
    line-height: 1.3;
    font-size: 0.88rem;
    font-weight: 500;
    color: #ffffff;
}
.nav-chevron {
    flex-shrink: 0;
    width: 0.85rem;
    text-align: center;
    font-size: 0.72rem;
    color: #fff;
    transition: transform 0.18s ease, color 0.15s ease;
    transform-origin: center;
}
.nav-group-btn:hover {
    background: rgba(211, 172, 102, 0.18);
}
.nav-group.open > .nav-group-btn {
    background: transparent;
}
.nav-group.open > .nav-group-btn .nav-chevron {
    transform: rotate(-90deg);
}
.nav-sub {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.2s ease, opacity 0.16s ease, padding 0.16s ease;
}
.nav-group.open > .nav-sub {
    max-height: 40rem;
    opacity: 1;
    pointer-events: auto;
    padding: 0.1rem 0.2rem 0.35rem;
}

.nav-item {
    width: 100%;
    text-align: right;
    border: 0;
    background: transparent;
    color: #f4f4f4;
    min-height: 2.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 12px;
    font-size: 0.86rem;
    font-weight: 500;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    transition: background 0.14s ease, color 0.14s ease;
}
.nav-item-fa {
    flex-shrink: 0;
    width: 1.1rem;
    text-align: center;
    font-size: 0.86rem;
    color: #fff;
}
.nav-item.down .nav-item-fa { color: #ff8a8a; }
.nav-item:hover {
    background: rgba(211, 172, 102, 0.22);
    color: #ffffff;
}
.nav-item:hover .nav-item-fa { color: #f0e6c0; }
.nav-item.active {
    background: linear-gradient(180deg, var(--gold-a), var(--gold-b));
    color: var(--gold-txt);
    font-weight: 700;
}
.nav-item.active .nav-item-fa { color: var(--gold-txt); }
.nav-home { margin-bottom: 0.15rem; }

.btn {
    border: 0;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    font-weight: 700;
}
.sidebar .logout {
    margin-top: 0.75rem;
    width: 100%;
    background: transparent;
    color: #fff;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    padding: 1rem 0.75rem 0.4rem;
    text-align: right;
    font-weight: 500;
}
.sidebar .logout:hover { color: var(--accent); }

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
    color: var(--ink);
    margin-block: 12px;
    margin-inline-end: 12px;
    border-radius: 20px;
    min-height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    overflow: auto;
}
.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px 8px;
    background: transparent;
    border: 0;
    color: var(--ink);
}
.who { font-weight: 700; color: var(--ink); }
.content { padding: 8px 22px 28px; }
.head-row { display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 22px; margin: 0 0 8px; color: var(--ink); }
h2.g-title { font-size: 14px; color: var(--muted); margin: 24px 0 10px; }
h3 { margin: 0 0 10px; font-size: 14px; color: var(--green); }
.hint { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.code, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #3d4a45; }
.stats { display: flex; gap: 12px; margin: 16px 0 8px; }
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 18px;
    min-width: 100px;
    box-shadow: 0 8px 20px rgba(20, 32, 51, 0.04);
}
.stat .n { font-size: 26px; font-weight: 700; color: var(--ink); }
.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: var(--ink); 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: #fff;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 14px;
}
.tab.on { color: var(--gold-txt); background: linear-gradient(180deg, var(--gold-a), var(--gold-b)); border-color: transparent; font-weight: 700; }
.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: #24302c;
    background: #f7faf8;
    border-radius: 12px;
    padding: 12px;
    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(212, 93, 93, 0.1);
    color: #9b2c2c;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
}

.content .card {
    background: #fff;
    color: var(--ink);
}
.content input,
.content textarea,
.content select {
    background: #fff;
    color: var(--ink);
    border-color: var(--line);
}

@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        max-height: 50vh;
    }
    .main {
        margin-block: 12px;
        margin-inline: 12px;
        min-height: auto;
        max-height: none;
    }
    .split { grid-template-columns: 1fr; }
}
