/* The panel borrows the Mini App's palette so the two read as one product,
   but it is a desk tool rather than a phone screen: wider, denser, and built
   around a list you scan rather than a form you fill. */

:root {
    --bg: #141b23;
    --surface: #1c252f;
    --surface-2: #232e3a;
    --line: #2b3743;
    --text: #eaf0f6;
    --muted: #8296a8;
    --accent: #4ea1f0;
    --accent-soft: rgba(78, 161, 240, 0.14);
    --ok: #6bbf83;
    --warn: #d9a441;
    --danger: #e56a6a;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans Arabic", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

/* ---------- the gate ---------- */

.gate {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.gate-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 26px 26px;
    text-align: center;
}

.gate-mark {
    font-size: 34px;
    line-height: 1;
    margin-bottom: 14px;
}

.gate-card h1 {
    margin: 0 0 8px;
    font-size: 21px;
}

.gate-lead {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 13.5px;
}

.verify {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Six digits, spaced so they can be read back off a phone at a glance. */
.code-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 12px;
    text-indent: 12px;
    outline: none;
}

.code-input:focus {
    border-color: var(--accent);
}

/* ---------- shell ---------- */

.app {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 18px 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.brand-mark {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.brand strong {
    display: block;
    font-size: 15px;
}

.brand-sub {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ---------- stats ---------- */

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

.stat {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 15px 12px;
}

.stat-value {
    display: block;
    font-size: 25px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.stat-label {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--muted);
}

.stat.is-pending .stat-value {
    color: var(--warn);
}

.stat.is-blocked .stat-value {
    color: var(--danger);
}

.stat.is-active .stat-value {
    color: var(--ok);
}

/* ---------- toolbar ---------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.chip {
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 7px 15px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.chip:hover {
    color: var(--text);
}

.chip.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.chip-count {
    margin-inline-start: 6px;
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
}

.search {
    flex: 1;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px 14px;
    outline: none;
}

.search:focus {
    border-color: var(--accent);
}

.search::placeholder {
    color: var(--muted);
}

/* ---------- users ---------- */

.users {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user {
    background: var(--surface);
    border-radius: var(--radius);
    border-inline-start: 3px solid transparent;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* The status is the first thing worth knowing, so it is the edge of the card
   as well as a badge -- readable before any text is parsed. */
.user.is-pending {
    border-inline-start-color: var(--warn);
}

.user.is-approved {
    border-inline-start-color: var(--ok);
}

.user.is-blocked {
    border-inline-start-color: var(--danger);
    opacity: 0.72;
}

.avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--muted);
}

.user-main {
    flex: 1;
    min-width: 160px;
}

.user-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-meta {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 9px;
}

.badge.is-pending {
    background: rgba(217, 164, 65, 0.16);
    color: var(--warn);
}

.badge.is-approved {
    background: rgba(107, 191, 131, 0.16);
    color: var(--ok);
}

.badge.is-blocked {
    background: rgba(229, 106, 106, 0.16);
    color: var(--danger);
}

.user-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

/* ---------- buttons ---------- */

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
    filter: brightness(1.14);
}

.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-primary {
    background: var(--accent);
    color: #07131f;
    font-weight: 600;
}

.btn-ghost {
    background: var(--surface-2);
    color: var(--text);
}

.btn-plain {
    background: none;
    color: var(--muted);
}

.btn-plain:hover {
    color: var(--text);
}

.btn-ok {
    background: rgba(107, 191, 131, 0.16);
    color: var(--ok);
}

.btn-danger {
    background: rgba(229, 106, 106, 0.16);
    color: var(--danger);
}

.btn-wide {
    width: 100%;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}

/* ---------- messages ---------- */

.message {
    min-height: 20px;
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--danger);
    text-align: center;
}

.message.is-ok {
    color: var(--ok);
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 44px 0;
    font-size: 14px;
}

/* ---------- sheet ---------- */

.sheet {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.sheet-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 88dvh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.sheet-head h2 {
    margin: 0;
    font-size: 18px;
}

.sheet-sub {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.sheet-title {
    margin: 22px 0 10px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.danger-title {
    color: var(--danger);
}

.facts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fact {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
}

.fact-label {
    color: var(--muted);
}

.fact-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.activity {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.activity li {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.activity b {
    display: block;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.activity span {
    font-size: 11px;
    color: var(--muted);
}

/* A count of zero is not news; dimming it lets the real activity stand out. */
.activity li.is-empty {
    opacity: 0.45;
}

.sheet-text,
.sheet-card .search {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 11px 13px;
    margin-bottom: 10px;
    outline: none;
    resize: vertical;
}

.sheet-text:focus,
.sheet-card .search:focus {
    border-color: var(--accent);
}

.sheet-warn {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
}

@media (max-width: 560px) {
    .user {
        align-items: flex-start;
    }

    .user-actions {
        width: 100%;
    }

    .user-actions .btn {
        flex: 1;
    }
}
