/* ── Reset & Base ─────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000000;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
}

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
    width: 220px;
    background: #050505;
    border-right: 1px solid #141414;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #141414;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000000;
}

.logo-icon svg { width: 18px; height: 18px; stroke-width: 2.5; }

.logo-text {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #ffffff;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    color: #666666;
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item svg { width: 16px; height: 16px; }

.nav-item:hover { color: #cccccc; background: #0d0d0d; }

.nav-item.active {
    color: #ffffff;
    background: #111111;
    border-left: 2px solid #ffffff;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid #141414;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-avatar {
    width: 30px;
    height: 30px;
    background: #111111;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666666;
}

.user-avatar svg { width: 14px; height: 14px; }

.user-name { font-size: 0.75rem; font-weight: 600; color: #cccccc; }
.user-role { font-size: 0.65rem; color: #555555; }

.logout-btn {
    background: none;
    border: none;
    color: #555555;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.logout-btn:hover { color: #ff4444; background: rgba(255,68,68,0.08); }
.logout-btn svg { width: 14px; height: 14px; }

/* ── Main Content ─────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #141414;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #050505;
    position: sticky;
    top: 0;
    z-index: 5;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.plan-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    background: #111111;
    border: 1px solid #222222;
    color: #888888;
}

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

/* ── Stats Row ────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: #0a0a0a;
    border: 1px solid #141414;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg { width: 18px; height: 18px; }

.stat-icon.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.stat-icon.green { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-icon.red { background: rgba(239,68,68,0.1); color: #ef4444; }

.stat-label { font-size: 0.7rem; color: #666666; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-number { font-size: 1.25rem; font-weight: 700; color: #ffffff; margin-top: 2px; }

/* ── Panel ────────────────────────────────────── */
.panel {
    background: #0a0a0a;
    border: 1px solid #141414;
    border-radius: 8px;
    padding: 1.25rem;
}

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

.panel-header h2 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
}

/* ── Quick Steps ──────────────────────────────── */
.quick-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.step {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: #050505;
    border: 1px solid #141414;
    border-radius: 6px;
}

.step-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: #111111;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #888888;
}

.step-info h4 { font-size: 0.8rem; font-weight: 600; color: #cccccc; margin-bottom: 0.25rem; }
.step-info p { font-size: 0.7rem; color: #555555; line-height: 1.4; }

/* ── Forms ────────────────────────────────────── */
.app-form { display: flex; flex-direction: column; gap: 0.875rem; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; }

.form-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.375rem;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #050505;
    border: 1px solid #1a1a1a;
    border-radius: 5px;
    color: #ffffff;
    font-size: 0.825rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-field input::placeholder { color: #444444; }
.form-field input:focus,
.form-field select:focus { outline: none; border-color: #333333; }

.form-field select option { background: #0a0a0a; color: #ffffff; }

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    margin-top: 0.5rem;
    background: #ffffff;
    border: none;
    border-radius: 5px;
    color: #000000;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-primary:hover { background: #e0e0e0; }
.btn-primary svg { width: 14px; height: 14px; }

/* ── App Cards ────────────────────────────────── */
.apps-list { display: flex; flex-direction: column; gap: 0.75rem; }

.app-card {
    background: #050505;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    padding: 1rem;
}

.app-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.app-card-info { display: flex; align-items: center; gap: 0.5rem; }
.app-card-info h3 { font-size: 0.9rem; font-weight: 700; color: #ffffff; }

.app-version {
    font-size: 0.65rem;
    font-weight: 600;
    color: #888888;
    background: #111111;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.app-card-actions { display: flex; gap: 0.375rem; }

.btn-sm {
    padding: 0.35rem;
    background: #111111;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    color: #888888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-sm:hover { color: #ffffff; border-color: #333333; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-sm.btn-danger:hover { color: #ff4444; border-color: #ff4444; background: rgba(255,68,68,0.08); }

.app-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label { font-size: 0.625rem; color: #555555; text-transform: uppercase; letter-spacing: 0.04em; }
.meta-item code { font-size: 0.7rem; color: #888888; font-family: 'SF Mono', Monaco, monospace; }

/* ── License Counter & Warnings ───────────────── */
.license-counter {
    font-size: 0.75rem;
    color: #666666;
}

.warning-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.2);
    color: #f59e0b;
}

.warning-bar svg { width: 16px; height: 16px; min-width: 16px; }

.warning-bar.warning-upgrade {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.2);
    color: #ef4444;
}

/* ── Generated Key Result ─────────────────────── */
.gen-key-result {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(16,185,129,0.06);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: 6px;
}

.gen-key-success {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #10b981;
    margin-bottom: 0.5rem;
}

.gen-key-success svg { width: 16px; height: 16px; }

.gen-key-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #050505;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid #1a1a1a;
}

.gen-key-box code {
    flex: 1;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85rem;
    color: #ffffff;
    letter-spacing: 0.03em;
}

.copy-btn {
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.copy-btn:hover { color: #ffffff; }
.copy-btn svg { width: 14px; height: 14px; }

/* ── Data Table ───────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.data-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #555555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #141414;
}

.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #0d0d0d;
    color: #cccccc;
}

.data-table tr:hover td { background: #050505; }

.empty-td {
    text-align: center;
    padding: 2rem 0.75rem !important;
    color: #444444 !important;
}

.td-muted { color: #555555 !important; }

.key-code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
    color: #ffffff;
    background: #111111;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.hwid-code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.65rem;
    color: #555555;
}

.status-pill {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.st-unused { background: rgba(245,158,11,0.1); color: #f59e0b; }
.st-active { background: rgba(16,185,129,0.1); color: #10b981; }
.st-expired { background: rgba(239,68,68,0.1); color: #ef4444; }

.row-actions { display: flex; gap: 0.25rem; }

.filter-select {
    padding: 0.4rem 0.625rem;
    background: #050505;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    color: #cccccc;
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
}

.filter-select:focus { outline: none; border-color: #333333; }
.filter-select option { background: #0a0a0a; }

/* ── Modal ────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2rem;
}

.modal-box {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #141414;
}

.modal-head h2 { font-size: 1rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    transition: color 0.15s;
}

.modal-close:hover { color: #ffffff; }
.modal-close svg { width: 18px; height: 18px; }

.modal-body { padding: 1.25rem; }
.modal-body h3 { font-size: 0.85rem; font-weight: 700; color: #ffffff; margin-bottom: 0.5rem; }
.modal-desc { font-size: 0.75rem; color: #666666; margin-bottom: 1rem; }

.cred-list { display: flex; flex-direction: column; gap: 0.625rem; }

.cred-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: #050505;
    border: 1px solid #141414;
    border-radius: 5px;
}

.cred-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #555555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 110px;
}

.cred-value {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex: 1;
    justify-content: flex-end;
}

.cred-value code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.7rem;
    color: #cccccc;
    word-break: break-all;
    text-align: right;
}

.copy-sm {
    background: none;
    border: none;
    color: #555555;
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    min-width: 18px;
}

.copy-sm:hover { color: #ffffff; }
.copy-sm svg { width: 12px; height: 12px; }

.code-block {
    background: #050505;
    border: 1px solid #141414;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
}

.code-block pre {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.725rem;
    color: #aaaaaa;
    line-height: 1.6;
    white-space: pre;
}

/* ── Empty State ──────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #444444;
}

.empty-state svg { width: 32px; height: 32px; margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.8rem; }

/* ── Tab Content ──────────────────────────────── */
.tab-content { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Spinning ─────────────────────────────────── */
.spinning { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 900px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .quick-steps { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .logo-text,
    .sidebar .nav-item span,
    .sidebar .user-info { display: none; }
    .main-content { margin-left: 60px; }
    .sidebar-nav .nav-item { justify-content: center; padding: 0.6rem; }
    .form-row-2 { grid-template-columns: 1fr; }
}
