* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #ff6b35;
    --primary-dark: #dc5224;
    --ink: #202427;
    --muted: #71808a;
    --line: #dde4e7;
    --page: #f6f8f6;
    --surface: #ffffff;
    --teal: #128c7e;
    --green: #2f9e61;
    --warning: #f2b441;
    --danger: #cf3f35;
    --radius: 8px;
    --shadow: 0 10px 28px rgba(32, 36, 39, 0.1);
}

body {
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(246, 248, 246, 0.96), rgba(255, 255, 255, 0.86)),
        url('https://images.unsplash.com/photo-1543352634-a1c51d9f1fa7?auto=format&fit=crop&w=1800&q=80') center / cover fixed;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

button,
input,
textarea {
    font: inherit;
}

.admin-page {
    width: min(1180px, calc(100vw - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 62px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(32, 36, 39, 0.05);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 850;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: #fff;
    background: var(--ink);
    border-radius: var(--radius);
    font-size: 0.78rem;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 11px;
    color: var(--muted);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 800;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: var(--teal);
}

.nav-link.logout:hover {
    background: var(--danger);
}

.admin-main {
    display: grid;
    gap: 14px;
    padding: 16px 0 0;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.eyebrow {
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

h1 {
    margin-top: 3px;
    font-size: 1.75rem;
    line-height: 1.15;
}

.subtle {
    color: var(--muted);
    font-size: 0.92rem;
}

.card,
.stat-card,
.login-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(32, 36, 39, 0.05);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
}

.stat-card {
    padding: 14px;
}

.stat-value {
    color: var(--primary-dark);
    font-size: 1.75rem;
    line-height: 1;
    font-weight: 850;
}

.stat-label {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.card {
    padding: 16px;
}

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

.card h2,
.card h3 {
    font-size: 1rem;
}

.table-wrap {
    max-height: 58vh;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--muted);
    background: #fbfcfb;
    font-size: 0.74rem;
    font-weight: 850;
    text-transform: uppercase;
}

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

.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 850;
}

.badge-free {
    color: var(--muted);
    background: #eef2f3;
}

.badge-premium {
    color: #885900;
    background: #fff1c7;
}

.badge-active {
    color: #12673f;
    background: #d9f0e2;
}

.badge-disabled {
    color: #a02b24;
    background: #fce8e6;
}

/* Action buttons for user management */
.action-cell {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.btn-action {
    min-height: 30px;
    padding: 5px 10px;
    border: 0;
    border-radius: var(--radius);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.btn-enable {
    color: #fff;
    background: var(--teal);
}
.btn-enable:hover {
    opacity: 0.85;
}

.btn-disable {
    color: #fff;
    background: var(--warning);
}
.btn-disable:hover {
    opacity: 0.85;
}

.btn-delete {
    color: #fff;
    background: var(--danger);
}
.btn-delete:hover {
    opacity: 0.85;
}

/* Disabled row styling */
.row-disabled {
    opacity: 0.6;
}
.row-disabled td {
    text-decoration: line-through;
}

.form-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 14px;
}

.form-group {
    display: grid;
    gap: 7px;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 850;
}

input,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    outline: none;
}

textarea {
    min-height: 74px;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: rgba(18, 140, 126, 0.55);
    box-shadow: 0 0 0 4px rgba(18, 140, 126, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    color: #fff;
    background: var(--primary);
    border: 0;
    border-radius: var(--radius);
    font-weight: 850;
    cursor: pointer;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.alert {
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 750;
    display: none;
}

.alert.show {
    display: block;
}

.alert-error {
    color: var(--danger);
    background: rgba(207, 63, 53, 0.08);
    border: 1px solid rgba(207, 63, 53, 0.18);
}

.alert-success {
    color: #12673f;
    background: rgba(47, 158, 97, 0.1);
    border: 1px solid rgba(47, 158, 97, 0.18);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.login-card {
    width: min(100%, 390px);
    padding: 22px;
    box-shadow: var(--shadow);
}

.login-card .brand {
    justify-content: center;
    margin-bottom: 16px;
}

.login-card h1 {
    text-align: center;
}

.login-card .subtle {
    margin: 5px 0 18px;
    text-align: center;
}

.login-card form {
    display: grid;
    gap: 13px;
}

@media (max-width: 860px) {
    .admin-topbar,
    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

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

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    place-items: center;
    padding: 18px;
    background: rgba(32, 36, 39, 0.45);
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: grid;
}

.modal {
    width: min(100%, 460px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.modal-head h3 {
    font-size: 1rem;
    font-weight: 800;
}

.modal-close {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: var(--radius);
    font-size: 1.3rem;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--page);
}

.modal-body {
    padding: 16px;
}

.modal-body .form-grid {
    grid-template-columns: 1fr 1fr;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

.form-hint {
    color: var(--muted);
    font-size: 0.76rem;
    margin-top: -2px;
}

/* Small button */
.btn-sm {
    min-height: 34px;
    padding: 7px 14px;
    font-size: 0.85rem;
}

/* Outline button */
.btn-outline {
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--line);
}

.btn-outline:hover {
    background: var(--page);
}

/* Icon buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.btn-icon:hover {
    background: var(--page);
}

.btn-icon-danger:hover {
    background: rgba(207, 63, 53, 0.08);
    border-color: var(--danger);
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.badge-you {
    color: var(--teal);
    background: rgba(18, 140, 126, 0.1);
}

.badge-sole {
    color: var(--muted);
    background: #eef2f3;
}

.settings-note {
    margin-top: -4px;
}

.settings-note p {
    color: var(--teal);
    font-size: 0.82rem;
    font-weight: 750;
}
