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

:root {
    --bg: #f5f6fa;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --card-bg: #fff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #e0e0e0;
    --primary: #3498db;
    --primary-hover: #2980b9;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #8e9aaf;
}

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

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #34495e;
}

.login-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 8px;
    width: 360px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text);
    font-size: 22px;
}

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

.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
    flex: 1;
}

.nav-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.1);
}

.nav-menu a.active {
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-link {
    color: var(--sidebar-text);
    text-decoration: none;
    opacity: 0.7;
    font-size: 13px;
}

.logout-link:hover { opacity: 1; }

.content {
    flex: 1;
    margin-left: 220px;
    padding: 24px 30px;
    max-width: 1200px;
}

/* Typography */
h1 { font-size: 22px; margin-bottom: 20px; font-weight: 600; }
h2 { font-size: 18px; margin: 20px 0 12px; font-weight: 600; }
h3 { font-size: 15px; margin-bottom: 12px; font-weight: 600; }
h4 { font-size: 14px; margin: 10px 0 8px; font-weight: 600; }

.text-muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 6px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 13px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}

.input-sm { width: auto; min-width: 80px; }

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    font-weight: 500;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: #95a5a6; color: #fff; }
.btn-secondary:hover { background: #7f8c8d; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.table tbody tr:hover { background: #f8f9fa; }

.table-logs td { vertical-align: top; }
.table-logs code { font-size: 12px; word-break: break-all; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: #d5f5e3; color: #1e8449; }
.badge-warning { background: #fdebd0; color: #935116; }
.badge-error { background: #fadbd8; color: #922b21; }
.badge-info { background: #d6eaf8; color: #2471a3; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.alert-error { background: #fadbd8; color: #922b21; border: 1px solid #f5b7b1; }
.alert-info { background: #d6eaf8; color: #2471a3; border: 1px solid #aed6f1; }
.alert-warning { background: #fdebd0; color: #935116; border: 1px solid #f9e79f; }

/* Domain list */
.domain-list { margin-top: 14px; }

.domain-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.domain-item:last-child { border-bottom: none; }

.domain-item input[type="checkbox"] { width: auto; }

.domain-item .status {
    margin-left: auto;
    font-size: 12px;
}

/* Checkbox grid */
.domain-checkboxes {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px;
}

.checkbox-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.checkbox-label {
    display: block;
    padding: 4px 0;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-label input { width: auto; margin-right: 6px; }

/* Logs */
.logs-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.log-output {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 14px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-detail {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: 4px;
}

.log-success td:first-child { border-left: 3px solid var(--success); }
.log-error td:first-child { border-left: 3px solid var(--danger); }
.log-info td:first-child { border-left: 3px solid var(--info); }

/* Compact list */
.compact-list { margin: 6px 0 0 20px; font-size: 12px; }

details summary { cursor: pointer; color: var(--primary); }
details summary:hover { text-decoration: underline; }

hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
