:root {
    --bg:      #f1f5f9;
    --surface: #ffffff;
    --border:  #e2e8f0;
    --text:    #0f172a;
    --muted:   #64748b;
    --primary: #2563eb;
    --r:       6px;
}

*, *::before, *::after { box-sizing: border-box; }

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

/* === Navigation === */
.app-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.brand i { color: var(--primary); }
.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.back-link:hover { color: var(--text); }
.nav-domain { font-size: 15px; font-weight: 700; }
.nav-separator { color: var(--border); }
.nav-logout {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.nav-active { border-color: var(--primary) !important; color: var(--primary) !important; }

/* Settings dropdown */
.nav-settings-wrap { position: relative; }
.nav-settings-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 6px 10px;
    border-radius: var(--r);
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: border-color .15s, color .15s;
}
.nav-settings-btn:hover,
.nav-settings-btn.open { border-color: #94a3b8; color: var(--text); }
.nav-settings-btn.nav-active { border-color: var(--primary) !important; color: var(--primary) !important; }
.nav-settings-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    z-index: 1500;
    padding: 4px 0;
}
.nav-settings-dropdown.open { display: block; }
.nav-settings-dropdown a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    transition: background .1s, color .1s;
}
.nav-settings-dropdown a:hover { background: var(--bg); color: var(--text); }
.nav-settings-dropdown a.nav-active { color: var(--primary); font-weight: 500; }

/* === Buttons === */
.btn-primary {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #fff;
    padding: 7px 14px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s;
}
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 6px 12px;
    border-radius: var(--r);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}
.btn-ghost:hover { border-color: #94a3b8; color: var(--text); }
.btn-danger {
    background: none;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 5px 10px;
    border-radius: var(--r);
    font-size: 12px;
    cursor: pointer;
}
.btn-danger:hover { background: #fef2f2; }

/* === Cards === */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}
.card-hdr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-bdy { padding: 16px; }
.main-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}
.card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

/* === Forms === */
.form-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
    color: var(--muted);
}
.form-control {
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
    width: 100%;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-text { font-size: 11px; color: var(--muted); margin-top: 3px; }
input[type="color"] {
    padding: 2px 4px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    cursor: pointer;
    background: var(--surface);
    width: 100%;
}
input[type="color"]:focus { border-color: var(--primary); outline: none; }

/* === Stats === */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 18px; }
.stat-val { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-lbl { font-size: 11px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; }

/* === Filters & Search === */
.filter-tabs { display: flex; gap: 2px; }
.ftab { padding: 5px 12px; font-size: 12px; color: var(--muted); text-decoration: none; border-radius: 20px; transition: background .15s, color .15s; white-space: nowrap; }
.ftab:hover { background: var(--bg); color: var(--text); }
.ftab.active { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.search-wrap { display: flex; gap: 6px; }
.search-input { border: 1px solid var(--border); border-radius: var(--r); padding: 5px 10px; font-size: 13px; outline: none; background: var(--bg); }
.search-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* === Table === */
.dtable { width: 100%; border-collapse: collapse; }
.dtable th { padding: 9px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.dtable td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable tbody tr:hover td { background: #f8fafc; }
.domain-link { font-weight: 500; color: var(--text); text-decoration: none; font-size: 13px; }
.domain-link:hover { color: var(--primary); }

/* === Status badges === */
.sbadge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }

/* === DNS dot === */
.dns-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dns-dot.pointed     { background: #16a34a; }
.dns-dot.not-pointed { background: #dc2626; }
.dns-dot.unknown     { background: #cbd5e1; }

/* === Action buttons === */
.act-btn { background: none; border: none; padding: 4px 7px; color: var(--muted); cursor: pointer; border-radius: 4px; font-size: 14px; line-height: 1; transition: background .1s, color .1s; }
.act-btn:hover { background: var(--bg); color: var(--text); }
.act-btn.del:hover { color: #dc2626; }
.act-btn:disabled { opacity: .4; cursor: default; }

/* === SSL === */
.ssl-action { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; border-radius: 4px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; font-size: inherit; }
.ssl-action:hover { background: var(--bg); color: var(--primary); }
.ssl-action.failed { color: #dc2626; }
.ssl-action:disabled { opacity: .55; cursor: default; }
.ssl-cell { display: inline-flex; align-items: center; justify-content: center; width: 14px; }
#ssl-output-box { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 11px; background: #1e293b; color: #94a3b8; padding: 12px; border-radius: var(--r); max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }
.ssl-log { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 11px; background: #1e293b; color: #94a3b8; padding: 12px; border-radius: var(--r); max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }

/* === Inline selects === */
.status-sel { border: none; background: transparent; cursor: pointer; font-size: 11px; font-weight: 600; padding: 2px 4px; border-radius: 4px; outline: none; }
.status-sel:hover { background: var(--bg); }
.registrar-sel { border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; max-width: 150px; padding: 3px 4px; border-radius: 4px; outline: none; }
.registrar-sel:hover, .registrar-sel:focus { background: var(--bg); border-color: var(--border); color: var(--text); }

/* === Pagination === */
.pg-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: var(--r); font-size: 12px; color: var(--muted); text-decoration: none; }
.pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* === Modal === */
.modal-content { border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.12); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header .modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); }

/* === Empty state === */
.empty-state { padding: 60px 24px; text-align: center; color: var(--muted); }
.empty-state i { font-size: 36px; display: block; margin-bottom: 10px; opacity: .4; }

/* === Tags === */
.logo-icon { color: #a3b8cc; font-size: 14px; }
.tag-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tag-cell { cursor: pointer; }
.tag-popover { position: fixed; z-index: 2000; display: none; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r); background: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.14); pointer-events: none; line-height: 1; }
.tag-picker { position: fixed; z-index: 2100; display: none; background: #fff; border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 8px 24px rgba(15,23,42,.14); padding: 8px; min-width: 160px; }
.tag-picker-chip { display: block; width: 100%; text-align: left; padding: 5px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1.5px solid var(--tc, #6b7280); background: transparent; color: var(--tc, #6b7280); margin-bottom: 3px; transition: background .1s, color .1s; }
.tag-picker-chip:last-of-type { margin-bottom: 0; }
.tag-picker-chip.active { background: var(--tc, #6b7280); color: #fff; }
.tag-picker-chip:hover { opacity: .8; }
.tag-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; color: #fff; white-space: nowrap; }
.tag-chip { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1.5px solid var(--tag-color, #6b7280); background: transparent; color: var(--tag-color, #6b7280); transition: background .12s, color .12s; user-select: none; }
.tag-chip:hover { opacity: .8; }
.tag-chip.active { background: var(--tag-color, #6b7280); color: #fff; }

/* === Notes === */
.note-hover { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; border-radius: 4px; padding: 2px 4px; }
.note-hover:hover { background: var(--bg); color: var(--text); }
.note-popover { position: fixed; z-index: 2000; display: none; max-width: 320px; min-width: 220px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: #fff; box-shadow: 0 12px 34px rgba(15,23,42,.16); color: var(--text); font-size: 12px; line-height: 1.5; pointer-events: none; }
.note-popover .note-popover-meta { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.note-popover .note-popover-text { white-space: pre-wrap; word-break: break-word; }
.note-item { padding: 12px; border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 8px; }
.note-item:last-child { margin-bottom: 0; }
.note-text { font-size: 13px; line-height: 1.6; margin: 0 0 6px 0; }
.note-meta { font-size: 11px; color: var(--muted); }

/* === Bulk selection === */
.row-cb { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; display: block; }
.dtable tbody tr.row-selected > td { background: #eff6ff; }
.dtable tbody tr.row-selected:hover > td { background: #dbeafe; }
.bulk-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #1e293b; border-top: 2px solid #3b82f6; padding: 12px 24px; display: flex; align-items: center; gap: 10px; z-index: 1050; transform: translateY(100%); transition: transform .2s ease; flex-wrap: wrap; }
.bulk-bar.visible { transform: translateY(0); }
.bulk-sel { border: 1px solid #475569; background: #0f172a; color: #e2e8f0; border-radius: var(--r); padding: 6px 10px; font-size: 13px; cursor: pointer; min-width: 200px; max-width: 340px; flex: 1; }
.bulk-deselect { background: none; border: 1px solid #475569; color: #94a3b8; padding: 5px 12px; border-radius: var(--r); font-size: 12px; cursor: pointer; white-space: nowrap; }
.bulk-deselect:hover { border-color: #64748b; color: #cbd5e1; }

/* === Registrar / Tag management rows === */
.registrar-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 2fr) auto auto; gap: 8px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.registrar-row:last-child { border-bottom: none; }
.tag-row { display: grid; grid-template-columns: 40px minmax(160px, 1fr) 90px auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tag-row:last-child { border-bottom: none; }
.meta { font-size: 11px; color: var(--muted); white-space: nowrap; padding-top: 8px; }
@media (max-width: 760px) {
    .registrar-row { grid-template-columns: 1fr; }
    .meta { padding-top: 0; }
    .tag-row { grid-template-columns: 40px 1fr; }
}

/* === Domain detail === */
.field-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.field-val { font-size: 13px; }
.logo-preview { max-width: 100%; max-height: 180px; object-fit: contain; border-radius: 4px; display: block; margin: 0 auto; }
.logo-placeholder { min-height: 120px; border: 1px dashed var(--border); border-radius: var(--r); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; flex-direction: column; gap: 6px; }
.input-row { display: flex; gap: 6px; }
.input-row .form-control { flex: 1; }
.blur-note { border: 1px solid var(--border); border-radius: var(--r); padding: 9px 10px; font-size: 12px; line-height: 1.5; color: var(--text); background: #f8fafc; word-break: break-word; cursor: pointer; user-select: none; }
.blur-note span { display: block; filter: blur(5px); transition: filter .15s ease; user-select: text; }
.blur-note.revealed span { filter: blur(0); }
input.epp-blur { color: transparent !important; text-shadow: 0 0 7px rgba(15,23,42,.5); }
.save-indicator { font-size: 11px; color: #16a34a; display: none; }

/* === Backups === */
.badge-new { background: #dcfce7; color: #166534; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 20px; }

/* === Login === */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 36px 32px;
    width: 100%;
    max-width: 360px;
}
.login-brand {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-brand svg { color: var(--primary); }
.login-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 28px;
}
.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}
.login-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #374151;
}
.login-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 11px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.login-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.login-btn {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 16px;
    transition: background .15s;
}
.login-btn:hover { background: #1d4ed8; }
