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

:root {
    /* Backgrounds — layered dark tones, not pure black */
    --bg-deep: #08080c;
    --bg-base: #0c0c12;
    --bg-elevated: #131318;
    --bg-surface: #1a1a22;
    --bg-hover: #22222c;

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(200, 56, 68, 0.4);

    /* Text */
    --text: #e8e8f0;
    --text-dim: #888898;
    --text-muted: #555564;

    /* Accent — refined red */
    --accent: #c84050;
    --accent-hover: #b03545;
    --accent-soft: rgba(200, 64, 80, 0.1);
    --accent-glow: 0 0 20px rgba(200, 64, 80, 0.15);

    /* Semantic */
    --danger: #c84050;
    --danger-hover: #a82838;
    --success: #2ecc71;
    --success-soft: rgba(46, 204, 113, 0.1);
    --warning: #e8a030;
    --warning-soft: rgba(232, 160, 48, 0.1);

    /* Radius */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45);

    /* Transitions */
    --transition: 0.2s ease;
    --transition-fast: 0.15s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* ─── Navigation ────────────────────────────────────────── */

nav {
    background: rgba(12, 12, 18, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .brand {
    font-family: 'Racing Sans One', cursive;
    font-weight: 400;
    font-size: 1.3rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: opacity var(--transition);
}

nav .brand:hover { opacity: 0.85; }

nav .nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

nav a:hover {
    color: var(--text);
    background: var(--bg-hover);
}

/* ─── Cards ─────────────────────────────────────────────── */

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition);
}

.card h2, .card h3 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 1rem;
    color: var(--text);
}

/* ─── Forms ─────────────────────────────────────────────── */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

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

/* ─── Buttons ───────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.125rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    background: var(--accent);
    transition: background var(--transition), transform var(--transition-fast), box-shadow var(--transition);
    gap: 0.375rem;
}

.btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--accent-glow);
}

.btn:active {
    transform: scale(0.97);
}

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); box-shadow: 0 0 20px rgba(200, 64, 80, 0.15); }

.btn-success { background: #28a745; }
.btn-success:hover { background: #218838; box-shadow: 0 0 20px rgba(46, 204, 113, 0.15); }

.btn-sm {
    padding: 0.325rem 0.65rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-active {
    background: var(--accent-hover);
    box-shadow: 0 0 0 2px var(--accent);
}

.btn-block {
    display: flex;
    width: 100%;
    text-align: center;
    justify-content: center;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-dim);
    box-shadow: none;
}

/* ─── Tables ────────────────────────────────────────────── */

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-strong);
    background: var(--bg-surface);
}

th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child { border-radius: 0 var(--radius) 0 0; }

td {
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-hover);
}

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

/* ─── Badges ────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.175rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-active {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.badge-inactive {
    background: rgba(200, 64, 80, 0.1);
    color: var(--danger);
    border: 1px solid rgba(200, 64, 80, 0.2);
}

.badge-expired {
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid rgba(232, 160, 48, 0.2);
}

/* ─── Alerts ────────────────────────────────────────────── */

.alert {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(200, 64, 80, 0.08);
    color: var(--danger);
    border: 1px solid rgba(200, 64, 80, 0.2);
}

.alert-success {
    background: rgba(46, 204, 113, 0.08);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

/* ─── Page Header ───────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ─── Info Grid ─────────────────────────────────────────── */

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

.info-item {
    padding: 0.875rem;
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.info-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.info-item .value {
    font-size: 0.95rem;
    font-weight: 500;
}

/* ─── Login & Landing ───────────────────────────────────── */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-deep);
}

.login-box {
    width: 100%;
    max-width: 420px;
}

.login-box .card {
    padding: 2.5rem;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 1.75rem;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-dim);
}

.login-box .brand-title {
    font-family: 'Racing Sans One', cursive;
    text-align: center;
    color: var(--text);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.login-box .login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.75rem;
}

/* ─── Landing Hero ──────────────────────────────────────── */

.landing-hero {
    text-align: center;
    padding: 1rem 0 1.5rem;
}

.landing-hero .brand-title {
    font-family: 'Racing Sans One', cursive;
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.landing-hero .tagline {
    font-size: 0.95rem;
    color: var(--text-dim);
    font-weight: 400;
}

/* ─── Social Links ──────────────────────────────────────── */

.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social-links a {
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.4rem 0.875rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.social-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* ─── Inline Form ───────────────────────────────────────── */

.inline-form { display: inline; }

/* ─── Actions ───────────────────────────────────────────── */

.actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ─── Tabs ──────────────────────────────────────────────── */

.tab-nav {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 1.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
}

.tab-nav a,
.tab-nav button {
    padding: 0.5rem 1.25rem;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    letter-spacing: 0.01em;
}

.tab-nav a:hover,
.tab-nav button:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.tab-nav a.active,
.tab-nav button.active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 1px 4px rgba(200, 64, 80, 0.3);
}

/* ─── Pagination ────────────────────────────────────────── */

.pagination {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

.pagination .page-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ─── Quick Actions (expiry presets) ────────────────────── */

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

/* ─── Expiry Inputs ─────────────────────────────────────── */

.expiry-inputs {
    display: flex;
    gap: 0.75rem;
    align-items: end;
}

.expiry-inputs > div {
    flex: 1;
}

.expiry-inputs label {
    font-size: 0.72rem !important;
    color: var(--text-muted) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* ─── Upload Card ───────────────────────────────────────── */

.upload-card {
    margin-bottom: 1.25rem;
}

.upload-card h3 {
    margin-top: 0;
}

.upload-card input[type="file"] {
    padding: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    width: 100%;
}

/* ─── Mono text ─────────────────────────────────────────── */

.mono {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

/* ─── Scrollbar ─────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Selection ─────────────────────────────────────────── */

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

/* ─── Input Compatibility ──────────────────────────────── */

.compat-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.compat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.compat-item .badge {
    min-width: 5.5rem;
    justify-content: center;
}

.compat-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* ─── Tier Cards ───────────────────────────────────────── */

.tier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.tier-card {
    cursor: pointer;
    display: block;
}

.tier-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tier-card-inner {
    background: var(--bg-surface);
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.tier-card-inner:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.tier-card input[type="radio"]:checked + .tier-card-inner {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--accent-glow);
    background: var(--accent-soft);
}

.tier-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.tier-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.tier-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Analytics ─────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
}

.bar-track {
    background: var(--bg-surface);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.3s ease;
    min-width: 0;
}

.bar-fill-success {
    background: var(--success);
}


/* ─── Responsive ────────────────────────────────────────── */

@media (max-width: 640px) {
    .container { padding: 1.5rem 1rem; }
    .page-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    table { font-size: 0.82rem; }
    th, td { padding: 0.6rem 0.75rem; }
    .info-grid { grid-template-columns: 1fr; }
    nav { padding: 0 1rem; }
    .login-box .card { padding: 2rem 1.5rem; }
    .expiry-inputs { flex-direction: column; }
    .landing-hero .brand-title { font-size: 2.25rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
