:root {
    color-scheme: light;
    --ink: #14213d;
    --muted: #64748b;
    --line: #d7dee8;
    --panel: rgba(255, 255, 255, 0.88);
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #b45309;
    --error: #b91c1c;
    --success: #047857;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Noto Naskh Arabic", "Inter", system-ui, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(180, 83, 9, 0.12)),
        #edf2f7;
}

body.ltr,
[dir="ltr"] {
    font-family: "Inter", "Noto Naskh Arabic", system-ui, sans-serif;
}

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

.auth-shell,
.form-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.glass {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.76);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(18px);
}

.auth-card,
.form-panel {
    width: min(100%, 500px);
    border-radius: 18px;
    padding: 30px;
}

.form-panel {
    width: min(100%, 900px);
}

.brand-logo {
    width: 92px;
    height: 92px;
    object-fit: contain;
    display: block;
    margin: 0 auto 16px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 22px;
    font-size: 30px;
    line-height: 1.2;
}

.stack,
.grid-form {
    display: grid;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

button,
.pill {
    border: 0;
    border-radius: 12px;
    padding: 13px 18px;
    background: var(--brand);
    color: white;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
}

button:hover,
.pill:hover {
    background: var(--brand-dark);
}

.secondary-pill {
    background: #475569;
}

.secondary-pill:hover {
    background: #334155;
}

.grid-form button {
    grid-column: 1 / -1;
}

.admin-link,
.muted-link {
    display: block;
    margin-top: 18px;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.alert {
    border-radius: 12px;
    margin: 0 0 14px;
    padding: 12px 14px;
    font-weight: 700;
}

.alert.error {
    color: var(--error);
    background: #fee2e2;
}

.alert.success {
    color: var(--success);
    background: #d1fae5;
}

.otp-code {
    margin: 0 0 16px;
    padding: 18px;
    border: 1px dashed var(--brand);
    border-radius: 14px;
    background: #ecfdf5;
    color: var(--brand-dark);
    font-family: "Inter", monospace;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 8px;
    text-align: center;
}

.panel-heading,
.admin-topbar,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-shell {
    min-height: 100vh;
    padding: 28px;
}

.admin-topbar {
    margin: 0 auto 20px;
    max-width: 1280px;
}

.admin-topbar nav {
    display: flex;
    gap: 10px;
}

.stats-row {
    max-width: 1280px;
    margin: 0 auto 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.admin-tabs {
    max-width: 1280px;
    margin: 0 auto 18px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--line);
}

.admin-tabs a {
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    padding: 12px 16px;
    color: var(--muted);
    font-weight: 800;
}

.admin-tabs a.active {
    background: #fff;
    border-color: var(--line);
    color: var(--brand-dark);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.04);
}

.stat-card,
.sheet-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 14px 45px rgba(15, 23, 42, 0.08);
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
}

.sheet-card {
    max-width: 1280px;
    margin: 0 auto;
    overflow: hidden;
}

.toolbar {
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.toolbar input {
    max-width: 460px;
}

.toolbar a {
    color: var(--muted);
    font-weight: 800;
}

.toolbar-note {
    display: inline-block;
    margin-left: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 310px);
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

th,
td {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 11px 12px;
    text-align: left;
    white-space: nowrap;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
}

td {
    background: #fff;
}

tr:hover td {
    background: #f0fdfa;
}

.empty {
    color: var(--muted);
    text-align: center;
}

.duplicate-ip {
    background: #fef3c7 !important;
    color: #92400e;
    font-weight: 800;
}

.user-agent-cell {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inline-delete {
    display: inline-flex;
    margin: 0;
}

.icon-danger {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 0;
    background: #fff1f2;
    color: var(--error);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.icon-danger:hover {
    background: #fee2e2;
    color: #7f1d1d;
}

.directors-table {
    min-width: 680px;
}

.rtl-cell {
    font-family: "Noto Naskh Arabic", "Inter", system-ui, sans-serif;
    font-size: 15px;
    text-align: right;
}

@media (max-width: 720px) {
    .auth-card,
    .form-panel {
        padding: 22px;
        border-radius: 14px;
    }

    h1 {
        font-size: 24px;
    }

    .grid-form,
    .stats-row {
        grid-template-columns: 1fr;
    }

    .panel-heading,
    .admin-topbar,
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-tabs {
        flex-direction: column;
        border-bottom: 0;
    }

    .admin-tabs a {
        border: 1px solid var(--line);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.74);
    }

    .admin-shell {
        padding: 18px;
    }
}
