/* Diamond Vault License Server — Admin UI */
:root {
    --bg-base:       #0a0b0f;
    --bg-surface:    #111318;
    --bg-elevated:   #1a1d26;
    --border:        rgba(255,255,255,0.07);
    --border-hover:  rgba(255,255,255,0.12);
    --text:          #e2e4ec;
    --text-muted:    #6b7280;
    --accent:        #6366f1;
    --accent-hover:  #818cf8;
    --success:       #22c55e;
    --danger:        #ef4444;
    --warn:          #f59e0b;
}

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

body {
    background: var(--bg-base);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.brand-icon { font-size: 28px; }
.brand-title { font-size: 13px; font-weight: 700; color: var(--text); }
.brand-sub   { font-size: 10px; color: var(--text-muted); }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }

.nav-link {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-link:hover { background: var(--bg-elevated); color: var(--text); }
.nav-link.active { background: rgba(99,102,241,0.15); color: var(--accent-hover); }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); margin-top: auto; }

.admin-badge {
    padding: 8px;
    border: 1px solid;
    border-radius: 8px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 8px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 8px;
    color: #ef4444;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
}
.btn-logout:hover { background: rgba(239,68,68,0.2); }

.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    max-width: calc(100vw - 220px);
}

/* ── Page Header ─────────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.header-meta { font-size: 12px; color: var(--text-muted); }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.3px;
}

/* ── Stats Grid ──────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}
.stat-card.stat-warn     { border-color: rgba(245,158,11,0.3); }
.stat-card.stat-critical { border-color: rgba(239,68,68,0.3); }
.stat-icon  { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Quick Actions ────────────────────────────────────────────────────────────── */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-hover); }
.btn-ghost     { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-danger    { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #ef4444; }
.btn-success   { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #22c55e; }

.btn-sm {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    transition: all 0.15s;
}
.btn-sm.btn-danger  { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #ef4444; }
.btn-sm.btn-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #22c55e; }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badge ───────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
}

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-grid { display: flex; flex-direction: column; gap: 12px; }
.form-row  { display: flex; gap: 12px; flex-wrap: wrap; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 13px;
    width: 100%;
    transition: border 0.15s;
    outline: none;
}
.form-input:focus { border-color: var(--accent); }
.form-hint   { font-size: 11px; color: var(--text-muted); }
.form-actions { display: flex; gap: 10px; }
.optional    { font-weight: 400; color: var(--text-muted); }

/* ── Filter bar ──────────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid;
    margin-bottom: 16px;
}
.alert-critical { color: #ef4444; background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.3); }

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid;
    margin-bottom: 16px;
    background: rgba(34,197,94,0.06);
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
}
.modal-box h3 { margin-bottom: 12px; }

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
}
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Key list (generate page) ────────────────────────────────────────────────── */
.key-list { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-radius: 8px;
    gap: 10px;
}
.key-item code { font-size: 14px; letter-spacing: 1px; color: #22c55e; }
.btn-copy {
    background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px;
}

/* ── Login page ──────────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 60%),
                var(--bg-base);
}
.login-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 22px; font-weight: 800; margin: 10px 0 4px; }
.login-brand p  { color: var(--text-muted); font-size: 13px; }
.login-form     { display: flex; flex-direction: column; gap: 14px; }

code {
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: monospace;
}
