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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --bg-dark: #1e293b;
    --bg-darker: #0f172a;
    --bg-card: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #475569;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 2rem;
    background: var(--bg-dark);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--primary);
}

.login-header p {
    color: var(--text-secondary);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.error-message {
    color: var(--danger);
    text-align: center;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: black;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: var(--bg-dark);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.sidebar-header h2 {
    color: var(--primary);
}

.sidebar-header .version {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#current-user {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

.section {
    max-width: 1400px;
}

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

.section-header h1 {
    margin: 0;
}

.actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-dark);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 700;
}

/* Cards */
.card {
    background: var(--bg-dark);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.card h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Tables */
.table-container {
    background: var(--bg-dark);
    border-radius: 12px;
    overflow: hidden;
}

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-info {
    background: rgba(6, 182, 212, 0.2);
    color: var(--info);
}

/* Inputs */
.search-input,
.select-input,
.date-input {
    padding: 0.5rem 1rem;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-input:focus,
.select-input:focus,
.date-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Plugins Grid */
.plugins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.plugin-card {
    background: var(--bg-dark);
    padding: 1.5rem;
    border-radius: 12px;
}

.plugin-card h4 {
    margin-bottom: 0.5rem;
}

.plugin-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.plugin-card .meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Activity List */
.activity-list {
    list-style: none;
}

.activity-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-list .time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

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

.modal {
    background: var(--bg-dark);
    border-radius: 12px;
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content {
    padding: 1.5rem;
}

/* Telemetry */
#telemetry-container {
    display: grid;
    gap: 1.5rem;
}

.telemetry-card {
    background: var(--bg-dark);
    border-radius: 12px;
    overflow: hidden;
}

.telemetry-card h4 {
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.telemetry-card pre {
    padding: 1rem 1.5rem;
    overflow-x: auto;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Plan Distribution */
#licenses-by-plan {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.plan-item {
    background: var(--bg-card);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    display: flex;
    gap: 1rem;
}

.plan-item .name {
    color: var(--text-secondary);
}

.plan-item .count {
    font-weight: 600;
}

/* License Key Style */
.license-key {
    font-family: monospace;
    font-size: 0.875rem;
}

.uuid {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Suspended Row */
tr.suspended {
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

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