/* DomainGuard - estilo SaaS moderno */
:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-2: #fafbfd;
    --border: #e6e9ef;
    --text: #1a2236;
    --muted: #6b7280;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-soft: #eef2ff;
    --success: #10b981;
    --success-soft: #d1fae5;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --danger: #ef4444;
    --danger-soft: #fee2e2;
    --info: #0ea5e9;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
    --shadow: 0 4px 14px rgba(15,23,42,.06);
    --radius: 12px;
    --sidebar-w: 250px;
    --topbar-h: 64px;
}
[data-theme="dark"] {
    --bg: #0f1322;
    --panel: #181d2f;
    --panel-2: #1f2540;
    --border: #2a3050;
    --text: #e6e9f3;
    --muted: #94a3b8;
    --primary: #7c83ff;
    --primary-hover: #6366f1;
    --primary-soft: #1f2540;
    --success-soft: #06301f;
    --warning-soft: #3a2a0a;
    --danger-soft: #3a1212;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 4px 14px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    transition: transform .25s;
    z-index: 50;
}
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
}
.content { padding: 24px 28px 60px; max-width: 1400px; }

/* --- Brand --- */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding: 0 4px;
}
.brand-logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), #8b8eff);
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: white;
    box-shadow: 0 4px 12px rgba(99,102,241,.35);
}
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11px; color: var(--muted); }

/* --- Menu --- */
.menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: background .15s;
    position: relative;
}
.menu a:hover { background: var(--panel-2); text-decoration: none; }
.menu a.active {
    background: var(--primary-soft);
    color: var(--primary);
}
.menu a.active svg { stroke: var(--primary); }
.badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.user-card {
    margin-top: 12px;
    padding: 12px;
    background: var(--panel-2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b8eff);
    color: white;
    font-weight: 700;
    display: grid;
    place-items: center;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; }
.user-email { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-logout { color: var(--muted); padding: 4px; }
.user-logout:hover { color: var(--danger); }

/* --- Topbar --- */
.topbar {
    height: var(--topbar-h);
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.menu-toggle {
    display: none;
    background: none;
    border: 0;
    color: var(--text);
    cursor: pointer;
}
.topbar-title { font-size: 17px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.notify-btn {
    position: relative;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 8px;
    color: var(--text);
    background: var(--panel-2);
}
.notify-btn:hover { background: var(--primary-soft); color: var(--primary); }
.notify-dot {
    position: absolute;
    top: -2px; right: -2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.theme-toggle {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 0;
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    display: grid;
    place-items: center;
}
.theme-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all .15s;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: white; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-ghost { background: transparent; }
.btn-success { background: var(--success); border-color: var(--success); color: white; }

/* --- Flash --- */
.flash {
    margin: 16px 28px 0;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 500;
    border: 1px solid;
}
.flash-ok { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.flash-err { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* --- Cards / Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 11px;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.stat-icon.s-blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.s-green { background: var(--success-soft); color: var(--success); }
.stat-icon.s-yellow { background: var(--warning-soft); color: var(--warning); }
.stat-icon.s-red { background: var(--danger-soft); color: var(--danger); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.stat-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* --- Panels --- */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.panel-title { font-size: 15px; font-weight: 700; margin: 0; }
.panel-body { padding: 20px; }
.panel-body.p-0 { padding: 0; }

.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
.grid-2 > * { min-width: 0; }

/* --- Table --- */
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.table th {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: .5px;
    background: var(--panel-2);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--panel-2); }
.table .domain-cell { font-weight: 600; }
.table .domain-cell small { color: var(--muted); font-weight: 400; display: block; }

/* --- Status pills --- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.safe { background: var(--success-soft); color: var(--success); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.urgent { background: var(--danger-soft); color: #fff; }
.pill.urgent::before { background: var(--danger); }
.pill.urgent, .pill.urgent * { -webkit-text-fill-color: #fff; }
.pill.expired { background: var(--danger-soft); color: var(--danger); }
.pill.unknown { background: var(--panel-2); color: var(--muted); }

/* --- Forms --- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text); }
.form-input, .form-select, .form-textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-textarea { min-height: 90px; resize: vertical; }
.form-hint { font-size: 11px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-row-input { display: flex; gap: 8px; }
.form-row-input .form-input { flex: 1; }

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

/* --- Filters bar --- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.filters .form-input, .filters .form-select { padding: 8px 12px; font-size: 13px; }
.search-input { flex: 1; min-width: 240px; }

/* --- Charts --- */
.chart-wrap { padding: 8px 0; }
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 180px;
    padding: 0 12px;
}
.bar {
    flex: 1;
    background: linear-gradient(180deg, var(--primary), #8b8eff);
    border-radius: 6px 6px 0 0;
    position: relative;
    min-height: 4px;
    transition: opacity .15s;
}
.bar:hover { opacity: .8; }
.bar-label { font-size: 10px; color: var(--muted); text-align: center; margin-top: 6px; }
.bar-value { font-size: 11px; font-weight: 600; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); color: var(--text); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: stretch; }

/* --- Login --- */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}
.login-card {
    background: var(--panel);
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo svg { width: 56px; height: 56px; color: var(--primary); }
.login-title { text-align: center; font-size: 22px; font-weight: 700; margin: 8px 0 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 28px; }

/* --- Domain detail --- */
.detail-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}
.detail-domain {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}
.detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.countdown-card {
    background: linear-gradient(135deg, var(--primary), #8b8eff);
    color: white;
    padding: 22px;
    border-radius: var(--radius);
    text-align: center;
}
.countdown-card.warning { background: linear-gradient(135deg, #f59e0b, #f97316); }
.countdown-card.urgent { background: linear-gradient(135deg, #ef4444, #dc2626); }
.countdown-num { font-size: 48px; font-weight: 800; line-height: 1; }
.countdown-label { font-size: 13px; opacity: .9; margin-top: 4px; }

.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-list .info { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.info-value { font-weight: 600; word-break: break-all; }

.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.tab {
    padding: 12px 16px;
    border: 0;
    background: none;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 2px solid transparent;
    font-family: inherit;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }

.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding: 0 0 18px; }
.timeline-item::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline-time { font-size: 11px; color: var(--muted); }
.timeline-text { font-weight: 500; margin-top: 2px; }
.timeline-text small { color: var(--muted); font-weight: 400; display: block; margin-top: 2px; }

.fav-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; }
.fav-btn.active { color: #fbbf24; }

/* --- Alerts list --- */
.alert-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
}
.alert-item:last-child { border-bottom: 0; }
.alert-item.unread { background: var(--primary-soft); }
.alert-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.alert-icon.info { background: var(--primary-soft); color: var(--primary); }
.alert-icon.warning { background: var(--warning-soft); color: var(--warning); }
.alert-icon.danger { background: var(--danger-soft); color: var(--danger); }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; }
.alert-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* --- Misc --- */
.empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}
.empty svg { width: 60px; height: 60px; opacity: .35; margin-bottom: 12px; }
.muted { color: var(--muted); }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--panel-2);
    border-radius: 4px;
    font-size: 11px;
    margin: 2px 2px 2px 0;
    color: var(--muted);
}
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: var(--panel);
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.2);
    z-index: 100;
    transform: translateY(100px);
    opacity: 0;
    transition: all .25s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok { background: var(--success); color: white; }
.toast.err { background: var(--danger); color: white; }

/* --- Responsive --- */
@media (max-width: 900px) {
    :root { --sidebar-w: 240px; }
    .grid-2 { grid-template-columns: 1fr; }
    .info-list { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 22px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .table th:nth-child(3), .table td:nth-child(3),
    .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
