/* ====================================
   KS Shield — Founder Panel Styles
   ==================================== */

:root {
    --bg-primary: #08080d;
    --bg-secondary: #0e0e15;
    --bg-card: #12121c;
    --bg-sidebar: #0a0a12;
    --bg-input: #181828;
    --bg-hover: #1c1c2e;
    --bg-active: rgba(245, 158, 11, 0.08);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-focus: rgba(245, 158, 11, 0.4);

    --text-primary: #eeeef2;
    --text-secondary: #8888a0;
    --text-muted: #55556a;

    --orange: #f59e0b;
    --red: #ef4444;
    --green: #10b981;
    --green-bright: #00ff88;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --yellow: #fbbf24;
    --cyan: #06b6d4;

    --gradient: linear-gradient(135deg, #f59e0b, #ef4444);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;

    --transition: 0.2s ease;
    --sidebar-width: 240px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg-primary); color: var(--text-primary); line-height: 1.5; min-height: 100vh; overflow-x: hidden; }

/* ====== Screens ====== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* ====== Login ====== */
.login-container { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100vh; position: relative; }
.login-glow { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); width: 500px; height: 500px; background: radial-gradient(circle, rgba(245, 158, 11, 0.06) 0%, transparent 70%); pointer-events: none; }
.login-card { width: 100%; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 44px 40px; position: relative; z-index: 1; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-header h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.accent { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.login-footer { text-align: center; margin-top: 20px; }
.link-btn { background: none; border: none; color: var(--orange); font-family: var(--font); font-size: 0.8125rem; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ====== Forms ====== */
.form-group { margin-bottom: 16px; position: relative; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select {
    width: 100%; padding: 11px 14px; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font); font-size: 0.9375rem;
    transition: var(--transition); outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08); }
.form-group input::placeholder { color: var(--text-muted); }
.form-group select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238888a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-group select option { background: var(--bg-card); color: var(--text-primary); }
.form-error { color: var(--red); font-size: 0.8125rem; margin-bottom: 12px; min-height: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row .form-group { margin-bottom: 10px; }
.create-form { padding: 4px 0; }

.btn-tiny { position: absolute; right: 6px; top: 32px; background: rgba(245,158,11,0.1); color: var(--orange); border: 1px solid rgba(245,158,11,0.2); border-radius: 4px; padding: 4px 8px; font-size: 0.7rem; cursor: pointer; font-family: var(--font); }
.btn-tiny:hover { background: rgba(245,158,11,0.2); }

/* ====== Buttons ====== */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; background: var(--gradient); color: white; border: none;
    border-radius: var(--radius-sm); font-family: var(--font); font-size: 0.875rem;
    font-weight: 600; cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; padding: 13px; font-size: 0.9375rem; }
.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font);
    font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: transparent;
    color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 0.75rem; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-hover); }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-loader { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Action buttons inside table */
.btn-action {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px;
    border-radius: 4px; font-family: var(--font); font-size: 0.7rem; font-weight: 500;
    cursor: pointer; transition: var(--transition); border: 1px solid; white-space: nowrap;
}
.btn-revoke { background: rgba(239,68,68,0.1); color: var(--red); border-color: rgba(239,68,68,0.2); }
.btn-revoke:hover { background: rgba(239,68,68,0.2); }
.btn-suspend { background: rgba(251,191,36,0.1); color: var(--yellow); border-color: rgba(251,191,36,0.2); }
.btn-suspend:hover { background: rgba(251,191,36,0.2); }
.btn-activate { background: rgba(16,185,129,0.1); color: var(--green); border-color: rgba(16,185,129,0.2); }
.btn-activate:hover { background: rgba(16,185,129,0.2); }
.btn-reset { background: rgba(59,130,246,0.1); color: var(--blue); border-color: rgba(59,130,246,0.2); }
.btn-reset:hover { background: rgba(59,130,246,0.2); }
.btn-extend { background: rgba(139,92,246,0.1); color: var(--purple); border-color: rgba(139,92,246,0.2); }
.btn-extend:hover { background: rgba(139,92,246,0.2); }
.btn-delete { background: rgba(239,68,68,0.05); color: #ff6b6b; border-color: rgba(239,68,68,0.15); }
.btn-delete:hover { background: rgba(239,68,68,0.15); }

.actions-cell { display: flex; flex-wrap: wrap; gap: 4px; }

/* ====== Sidebar ====== */
#dashboard-screen { display: none; }
#dashboard-screen.active { display: flex; }
.sidebar {
    width: var(--sidebar-width); background: var(--bg-sidebar); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-header { padding: 20px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 800; }
.sidebar-badge { background: var(--gradient); color: white; font-size: 0.6rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; letter-spacing: 0.05em; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: transparent;
    border: none; color: var(--text-secondary); border-radius: var(--radius-sm); font-family: var(--font);
    font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: var(--transition); text-align: left; width: 100%;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--orange); }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.admin-info { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; font-weight: 500; }
.admin-avatar { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; }
.founder-avatar { background: var(--gradient); color: white; }
.logout-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 6px; transition: var(--transition); }
.logout-btn:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ====== Main Content ====== */
.main-content { margin-left: var(--sidebar-width); padding: 28px 32px; flex: 1; min-height: 100vh; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; }
.page-desc { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* ====== Stats ====== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; align-items: center; gap: 14px; transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-icon {
    width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}
.stat-icon.orange { background: rgba(245,158,11,0.1); color: var(--orange); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--green); }
.stat-icon.yellow { background: rgba(251,191,36,0.1); color: var(--yellow); }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--red); }
.stat-icon.blue { background: rgba(59,130,246,0.1); color: var(--blue); }
.stat-icon.purple { background: rgba(139,92,246,0.1); color: var(--purple); }
.stat-info { display: flex; flex-direction: column; }
.stat-num { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-lbl { font-size: 0.75rem; color: var(--text-muted); }

/* ====== Cards ====== */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 0.9375rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

.action-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px;
    background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-primary); font-family: var(--font); font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: var(--transition); margin-bottom: 8px;
}
.action-btn:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.action-btn:last-child { margin-bottom: 0; }

/* ====== Table ====== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.data-table th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: rgba(255,255,255,0.015); }
.empty-cell { text-align: center; padding: 40px 14px !important; color: var(--text-muted); }
.mono { font-family: var(--mono); font-size: 0.75rem; }

/* Status badges */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.status-active { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.status-suspended { background: rgba(251,191,36,0.1); color: var(--yellow); border: 1px solid rgba(251,191,36,0.2); }
.status-revoked { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.status-expired { background: rgba(136,136,160,0.1); color: var(--text-muted); border: 1px solid rgba(136,136,160,0.2); }

.access-badge { font-size: 0.75rem; font-weight: 500; }
.access-lifetime { color: var(--orange); }

/* ====== Modals ====== */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-card { position: relative; z-index: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 440px; overflow: hidden; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-desc { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 20px; }

.cred-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: left; }
.cred-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cred-row:last-child { border-bottom: none; }
.cred-label { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; }
.cred-value { font-family: var(--mono); font-size: 0.8125rem; color: var(--orange); font-weight: 600; }

/* ====== Toast ====== */
.toast {
    position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 0.875rem; font-weight: 500; z-index: 10000;
    animation: slideIn 0.3s ease;
}
.toast.success { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.toast.error { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ====== Responsive ====== */
@media (max-width: 768px) {
    .sidebar { width: 100%; position: relative; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; align-items: center; padding: 8px; }
    .sidebar-header { padding: 8px; border: none; }
    .sidebar-nav { flex-direction: row; padding: 0 8px; overflow-x: auto; }
    .sidebar-footer { padding: 8px; border: none; }
    .main-content { margin-left: 0; padding: 20px 16px; }
    #dashboard-screen.active { flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
