:root {
    --bg: #0a0f1d;
    --panel: rgba(148, 163, 184, 0.045);
    --panel-strong: #0e1626;
    --accent: #38bdf8;
    --text: #f8fafc;
    --muted: #94a3b8;
    --line: rgba(148, 163, 184, 0.16);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --font-fa: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-fa);
    font-weight: 400;
    line-height: 1.85;
    color: var(--text);
    background:
        radial-gradient(900px 500px at 80% -10%, rgba(56, 189, 248, 0.12), transparent 60%),
        linear-gradient(180deg, #0a0f1d, #05070f);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

.en {
    font-family: 'Inter', system-ui, sans-serif;
    direction: ltr;
    display: inline-block;
}

/* Shell */

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

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 1.4rem;
    border-inline-start: 1px solid var(--line);
    background: rgba(6, 10, 21, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 0.98rem;
}

.brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.sidebar-nav {
    display: grid;
    gap: 0.35rem;
}

.sidebar-nav a {
    padding: 0.7rem 0.95rem;
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--muted);
    transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

.sidebar-nav a:hover {
    color: var(--text);
    background: rgba(56, 189, 248, 0.08);
}

.sidebar-nav a.is-active {
    color: var(--text);
    background: rgba(56, 189, 248, 0.14);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 0.7rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--line);
    font-size: 0.8rem;
    color: var(--muted);
}

.sidebar-footer form {
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
    transition: color 0.3s var(--ease);
}

.link-button:hover {
    color: var(--accent);
}

.main {
    padding: clamp(1.6rem, 3.5vw, 3rem);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.page-head h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
}

.page-head p {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Cards & stats */

.panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    padding: clamp(1.2rem, 2.4vw, 1.8rem);
    overflow: hidden;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.1rem 1.2rem;
    background: linear-gradient(160deg, rgba(56, 189, 248, 0.07), rgba(148, 163, 184, 0.02));
}

.stat span {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
}

.stat strong {
    font-size: 1.7rem;
    font-weight: 700;
}

/* Tables */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
    text-align: right;
}

thead th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

tbody td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.09);
    vertical-align: top;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background 0.3s var(--ease);
}

tbody tr:hover {
    background: rgba(56, 189, 248, 0.04);
}

.cell-muted {
    color: var(--muted);
}

.cell-details {
    max-width: 380px;
    color: #cbd5e1;
    white-space: pre-line;
}

.empty-state {
    padding: 2.6rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Badges */

.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-pending {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.3);
}

.badge-contacted {
    color: #bae6fd;
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.32);
}

.badge-completed {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.32);
}

.badge-on {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.badge-off {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.1);
    border-color: var(--line);
}

/* Forms */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field-full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 0.8rem;
    color: var(--muted);
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(248, 250, 252, 0.025);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

.field input[dir='ltr'] {
    font-family: 'Inter', system-ui, sans-serif;
    text-align: left;
}

.field textarea {
    min-height: 130px;
    resize: vertical;
}

.field-error {
    min-height: 1rem;
    font-size: 0.75rem;
    color: #fca5a5;
}

.field-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.field-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.7rem 1.4rem;
    border-radius: 11px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
                background 0.35s var(--ease), border-color 0.35s var(--ease);
}

.btn-primary {
    color: #041322;
    background: linear-gradient(120deg, var(--accent), #7dd3fc);
}

.btn-primary:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 16px 34px -20px rgba(56, 189, 248, 0.95);
}

.btn-ghost {
    color: var(--text);
    border-color: var(--line);
    background: rgba(148, 163, 184, 0.05);
}

.btn-ghost:hover {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.14);
}

.btn-danger {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.08);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.16);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.75rem;
    border-radius: 9px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.row-actions form {
    margin: 0;
}

.status-form select {
    padding: 0.35rem 0.6rem;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--text);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.status-form select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 1.6rem;
}

/* Alerts */

.alert {
    margin-bottom: 1.4rem;
    padding: 0.8rem 1.1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.alert-success {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.32);
}

.alert-error {
    color: #fecaca;
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.32);
}

/* Login */

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.2rem;
}

.login-card {
    width: min(420px, 100%);
    padding: clamp(1.8rem, 4vw, 2.6rem);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(248, 250, 252, 0.055), rgba(148, 163, 184, 0.02));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.login-card h1 {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
}

.login-card p {
    margin: 0 0 1.8rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.login-card .field {
    margin-bottom: 1rem;
}

.login-card .btn {
    width: 100%;
    margin-top: 0.6rem;
}

.login-back {
    display: block;
    margin-top: 1.3rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--muted);
}

.login-back:hover {
    color: var(--accent);
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 1rem;
        border-inline-start: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-nav {
        grid-auto-flow: column;
        gap: 0.2rem;
    }

    .sidebar-footer {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
        grid-auto-flow: column;
        align-items: center;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
