/* =====================================================================
   Hosting Panel — estilo alineado a AMX Antispam / MX backup panel
   IBM Plex Sans + IBM Plex Mono · fondo gris frío · acento ladrillo
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* Acento ladrillo (en vez del verde bosque del antispam) */
    --brick: #B5472F;
    --brick-dark: #93361F;
    --brick-darker: #6E2818;
    --clay: #D98B5F;
    --clay-soft: #E8B492;

    /* Grises fríos neutros — base del look AMX */
    --bg: #EEF1F4;
    --surface: #FFFFFF;
    --surface-2: #F6F8FA;
    --topbar: #1C2530;
    --topbar-line: #2C3846;

    --ink: #1B2430;
    --ink-soft: #5B6673;
    --ink-faint: #8A94A0;
    --line: #DDE3E9;
    --line-soft: #E9EDF1;

    /* Estados */
    --green: #2E7D5B;
    --green-bg: #E2F0EA;
    --amber: #B6791F;
    --amber-bg: #F7ECD5;
    --red: #B23B32;
    --red-bg: #F6DDD9;
    --gray: #6B7683;
    --gray-bg: #E7EBEF;

    --radius: 7px;
    --radius-lg: 11px;
    --shadow-sm: 0 1px 2px rgba(27, 36, 48, 0.05);
    --shadow: 0 1px 3px rgba(27,36,48,0.06), 0 6px 20px rgba(27,36,48,0.05);

    --font: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0 0 0.4em 0;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}
h1 { font-size: 1.55rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 0.98rem; }

a { color: var(--brick); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: 0.9em; }

/* --- Shell: sidebar + área principal --- */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    background: var(--topbar);
    color: #C6CFDA;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 20px 22px 16px 22px;
    border-bottom: 1px solid var(--topbar-line);
}
.sidebar-brand .brand-name {
    font-weight: 700;
    font-size: 1.08rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 9px;
}
.sidebar-brand .brand-mark {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--brick);
    display: inline-flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 -6px 0 rgba(0,0,0,0.18);
}
.sidebar-brand .brand-mark span {
    display: block; width: 11px; height: 3px;
    background: var(--clay-soft);
    box-shadow: 0 4px 0 #fff, 0 -4px 0 #fff;
    border-radius: 1px;
}
.sidebar-brand small {
    display: block;
    font-size: 0.72rem;
    color: var(--ink-faint);
    margin-top: 5px;
    letter-spacing: 0.02em;
}

.nav {
    display: flex;
    flex-direction: column;
    padding: 12px 12px;
    gap: 1px;
    flex: 1;
}
.nav .nav-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    padding: 12px 12px 5px 12px;
}
.nav a {
    color: #C6CFDA;
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav a:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.nav a.active { background: var(--brick); color: #fff; }
.nav a .ic { width: 16px; height: 16px; opacity: 0.85; flex-shrink: 0; }

/* Submenú del dominio actual */
.nav-sub {
    margin: 2px 0 6px 12px;
    padding-left: 12px;
    border-left: 2px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.nav-sub-title {
    font-size: 0.72rem;
    color: #8A94A3;
    padding: 4px 10px 6px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.nav-sub a {
    color: #AEB8C4;
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 0.84rem;
    font-weight: 500;
    display: block;
}
.nav-sub a:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.nav-sub a.active { background: rgba(181,71,47,0.25); color: #fff; }


.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--topbar-line);
    font-size: 0.8rem;
    color: var(--ink-faint);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-footer a { color: var(--clay-soft); }

/* --- Main --- */
.main {
    padding: 26px 34px 60px 34px;
    max-width: 1200px;
}
@media (min-width: 1400px) { .main { padding-left: 48px; } }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header p { color: var(--ink-soft); margin: 5px 0 0 0; font-size: 0.9rem; }

/* --- Botones --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.86rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}
.btn-primary { background: var(--brick); color: #fff; }
.btn-primary:hover { background: var(--brick-dark); text-decoration: none; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--ink-faint); text-decoration: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #97302a; text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: 0.78rem; }

/* --- Stat cards --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 26px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 17px 19px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--line);
}
.stat-card.accent-brick::before { background: var(--brick); }
.stat-card.accent-green::before { background: var(--green); }
.stat-card.accent-amber::before { background: var(--amber); }
.stat-card.accent-red::before { background: var(--red); }
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.stat-card .stat-label {
    font-size: 0.76rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 3px;
}

/* --- Cards --- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

/* --- Tabla --- */
.table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    font-weight: 600;
    padding: 11px 15px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
table.data td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.88rem;
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-2); }

/* Tabla embebida en card (sin borde/sombra propia) */
.card table.data { box-shadow: none; }
.card table.data th { background: transparent; }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 8px;
    border-radius: 100px;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--green-bg); color: var(--green); }
.badge-pending_dns { background: var(--amber-bg); color: var(--amber); }
.badge-ssl_failed, .badge-ssl_stuck { background: var(--red-bg); color: var(--red); }
.badge-suspended { background: var(--gray-bg); color: var(--gray); }

/* --- Quota bar --- */
.quota-bar {
    width: 110px; height: 6px;
    background: var(--line);
    border-radius: 100px;
    overflow: hidden;
}
.quota-bar-fill { height: 100%; background: var(--brick); border-radius: 100px; }
.quota-bar-fill.high { background: var(--red); }
.quota-label { font-size: 0.72rem; color: var(--ink-soft); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* --- Formularios --- */
.field { margin-bottom: 17px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .hint { font-size: 0.76rem; color: var(--ink-soft); margin-top: 5px; }
.field input[type=text], .field input[type=number], .field input[type=url],
.field input[type=password], .field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--ink);
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--brick);
    box-shadow: 0 0 0 3px rgba(181,71,47,0.12);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 18px;
    border: 1px solid transparent;
    border-left-width: 3px;
}
.alert-error { background: var(--red-bg); color: #8f2e27; border-left-color: var(--red); }
.alert-success { background: var(--green-bg); color: #1f5c41; border-left-color: var(--green); }
.alert-info { background: var(--amber-bg); color: #855812; border-left-color: var(--amber); }

/* --- Pasos DNS --- */
.dns-steps { counter-reset: step; list-style: none; padding: 0; margin: 14px 0 0 0; }
.dns-steps li {
    counter-increment: step;
    position: relative;
    padding: 11px 0 11px 36px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.88rem;
}
.dns-steps li:last-child { border-bottom: none; }
.dns-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0; top: 9px;
    width: 23px; height: 23px;
    border-radius: 50%;
    background: var(--brick);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    display: flex; align-items: center; justify-content: center;
}

/* --- Utilidades --- */
.text-muted { color: var(--ink-soft); }
.text-sm { font-size: 0.85rem; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

/* --- Login --- */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--topbar);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 34px;
    width: 100%; max-width: 380px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.4);
}
.login-card .brand-name { font-size: 1.2rem; font-weight: 700; display:flex; align-items:center; gap:10px; }
.login-card .brand-mark {
    width: 30px; height: 30px; border-radius: 7px; background: var(--brick);
    display:inline-flex; align-items:center; justify-content:center;
    box-shadow: inset 0 -7px 0 rgba(0,0,0,0.18);
}
.login-card .brand-mark span {
    display:block; width:13px; height:3px; background: var(--clay-soft);
    box-shadow: 0 5px 0 #fff, 0 -5px 0 #fff; border-radius:1px;
}
.login-sep { height:1px; background: var(--line); margin: 20px 0 22px 0; }

/* --- Responsive --- */
@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: column; }
    .nav { flex-direction: column; }
    .main { padding: 20px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .field-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
