/* === Reset & Variables (Gransy-style Light Theme) === */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface2: #f5f6f8;
    --surface3: #eef0f3;
    --border: #e0e3e8;
    --border2: #d0d3d9;
    --text: #1a1a2e;
    --text2: #555;
    --text3: #7b8794;
    --accent: #4361ee;
    --accent-hover: #3a56d4;
    --accent-subtle: rgba(67,97,238,0.08);
    --success: #2d6a4f;
    --success-subtle: rgba(45,106,79,0.08);
    --warning: #e67e22;
    --warning-subtle: rgba(230,126,34,0.08);
    --danger: #e63946;
    --danger-subtle: rgba(230,57,70,0.08);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 10px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.mono { font-family: 'Consolas', 'Courier New', monospace; font-size: 13px; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5c8ce; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a4ab; }

/* === Sidebar === */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex; flex-direction: column;
    z-index: 100;
}
.logo {
    padding: 0 20px 20px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--accent);
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    padding-bottom: 16px;
}
.logo i { color: var(--accent); font-size: 18px; }
.logo span { color: var(--text3); }
.nav { flex: 1; padding: 8px 0; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    margin-bottom: 1px;
    color: var(--text2);
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 13px;
    font-weight: 500;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }

/* === Main === */
.main { margin-left: 260px; padding: 0; }
.header {
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 24px;
    flex-shrink: 0;
}
.header h1 { font-size: 16px; font-weight: 600; }

/* === Stats === */
.stats { display: flex; gap: 12px; }
.stat {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
}
.stat-icon {
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.stat-icon.purple { background: rgba(99,102,241,0.1); color: #6366f1; }
.stat-icon.green { background: rgba(45,106,79,0.1); color: #2d6a4f; }
.stat-icon.blue { background: rgba(67,97,238,0.1); color: #4361ee; }
.stat-value { font-size: 15px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text3); }

/* === Toolbar === */
.toolbar {
    display: flex; gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap; align-items: center;
}

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.4;
    color: var(--text2);
}
.btn:hover { background: var(--surface2); color: var(--text); }
.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary {
    background: var(--surface);
    color: var(--text2);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-error {
    background: var(--danger-subtle);
    border: 1px solid rgba(230,57,70,0.3);
    color: var(--danger);
}
.btn-error:hover { background: rgba(230,57,70,0.15); }
.btn-danger { background: var(--danger); color: white; border: none; }
.btn-danger:hover { background: #c0313d; }

/* === Search === */
.search-box { flex: 1; max-width: 380px; position: relative; }
.search-box input {
    width: 100%; padding: 8px 14px 8px 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
}
.search-box input::placeholder { color: var(--text3); }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.search-box i { position: absolute; left: 12px; top: 12px; color: var(--text3); font-size: 13px; }
.search-box textarea {
    width: 100%; padding: 8px 14px 8px 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px; font-family: inherit;
    line-height: 1.4;
    min-height: 36px; max-height: 200px;
    resize: vertical;
    box-sizing: border-box;
}
.search-box textarea::placeholder { color: var(--text3); }
.search-box textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.select {
    padding: 7px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); }

/* === Card === */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: var(--shadow);
}

/* === Table === */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
    background: var(--surface2);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

/* === Badges === */
.badge {
    display: inline-flex; padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: var(--accent-subtle); color: var(--accent); }

/* === Action buttons === */
.actions { display: flex; gap: 2px; }
.action-btn {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text3);
    background: transparent;
    border: 1px solid transparent;
    font-size: 13px;
}
.action-btn:hover { background: var(--surface2); color: var(--accent); border-color: var(--border); }

/* === Proxy badge === */
.proxy-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px;
    background: var(--surface2);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text2);
    border: 1px solid var(--border);
}
.proxy-badge i { color: var(--accent); font-size: 11px; }

/* === Modal === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.3);
    display: none; align-items: flex-start; justify-content: center;
    padding-top: 60px;
    z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text3);
    background: none; border: none;
    font-size: 16px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 20px; flex: 1; overflow-y: auto; max-height: 60vh; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%; padding: 9px 12px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
}
.form-input::placeholder { color: var(--text3); }
.form-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 2px var(--accent-subtle); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 5px; }
.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 20px 0 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.section-title:first-child { margin-top: 0; padding-top: 0; border: none; }

/* === Login === */
.login-screen {
    position: fixed; inset: 0;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    width: 100%; max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    width: 48px; height: 48px;
    margin: 0 auto 16px;
    background: var(--accent);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: white;
}
.login-box h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.login-box p { color: var(--text3); margin-bottom: 24px; font-size: 13px; }
.login-box .form-input { text-align: center; font-size: 15px; }
.login-error { color: var(--danger); font-size: 12px; margin-top: 14px; }

/* === Tabs === */
.tab-content { display: none; padding: 20px 24px; }
.tab-content.active { display: block; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); font-size: 14px; }

/* === Toast === */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    padding: 12px 20px;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius);
    display: flex; align-items: center; gap: 10px;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    max-width: 400px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* === Debug === */
.debug-box {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text3);
}
.debug-box input { cursor: pointer; accent-color: var(--accent); }

/* === Pagination === */
.pagination { display: flex; gap: 3px; }
.page-btn {
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text2);
    font-size: 12px;
    font-family: inherit;
}
.page-btn:hover { background: var(--surface2); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === Expiry highlights === */
.exp-30 { background: rgba(230,57,70,0.06) !important; }
.exp-60 { background: rgba(230,126,34,0.06) !important; }
.exp-90 { background: rgba(234,179,8,0.04) !important; }

/* === Domain selection === */
.domain-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.bulk-bar {
    display: none;
    background: var(--accent-subtle);
    border: 1px solid rgba(67,97,238,0.2);
    padding: 10px 16px;
    border-radius: var(--radius);
    align-items: center; gap: 10px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
}
.bulk-bar.show { display: flex; }
.expiring-text { color: var(--danger); font-weight: 600; }

/* === Selection === */
::selection { background: rgba(67,97,238,0.2); }

/* === Checkbox accent === */
input[type="checkbox"] { accent-color: var(--accent); }
