:root {
    --primary: #0078d4;
    --primary-dark: #005a9e;
    --success: #107c10;
    --warning: #ff8c00;
    --danger: #d13438;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #323130;
    --text-muted: #605e5c;
    --border: #e1dfdd;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-info {
    font-size: 14px;
    color: var(--text-muted);
}

nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    background: var(--card-bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--primary);
    color: white;
}

.nav-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.time-filter {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.time-filter select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}

.keys-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.key-card {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.key-info {
    flex: 1;
    min-width: 200px;
}

.key-id {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    color: var(--text-muted);
}

.key-email {
    font-weight: 500;
}

.key-reason {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.key-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.key-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.key-status.active {
    background: #dff6dd;
    color: var(--success);
}

.key-status.pending {
    background: #fff4ce;
    color: var(--warning);
}

.key-status.revoked,
.key-status.rejected {
    background: #fde7e9;
    color: var(--danger);
}

.key-actions {
    display: flex;
    gap: 8px;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    padding: 8px 16px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #a80000;
}

.btn-success {
    padding: 8px 16px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.form {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    max-width: 500px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.result-box {
    margin-top: 20px;
    padding: 16px;
    border-radius: 8px;
    background: #dff6dd;
}

.result-box.error {
    background: #fde7e9;
}

.result-box .api-key {
    font-family: 'Consolas', monospace;
    background: rgba(0,0,0,0.05);
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 8px;
    word-break: break-all;
}

.admin-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.admin-section:last-child {
    border-bottom: none;
}

.filter-row {
    margin-bottom: 16px;
}

.quota-status {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 8px;
}

.quota-bar {
    margin-top: 12px;
}

.quota-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
}

.quota-bar-track {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.quota-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.quota-bar-fill.warning {
    background: var(--warning);
}

.quota-bar-fill.danger {
    background: var(--danger);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--text);
    color: white;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .key-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .key-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
