:root {
    /* Marca: negro / azul / blanco, con rojo como acento de alerta */
    --navy: #0d1420;
    --navy-light: #16233b;
    --brand: #1d5fa8;
    --brand-dark: #123f73;
    --red: #b3261e;
    --red-dark: #8f1e18;

    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #14181f;
    --muted: #6b7280;
    --border: #e3e7ee;

    --danger: #b3261e;
    --success: #1f6b45;
    --warning: #b3822f; /* solo se usa para "prioridad media", tono semáforo estándar */
}

[data-theme="dark"] {
    --bg: #0b0f16;
    --card: #151b26;
    --text: #e7ebf2;
    --muted: #9aa4b2;
    --border: #262f3f;
    --navy: #05080e;
    --navy-light: #0f1826;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    transition: background .2s ease, color .2s ease;
}

a { text-decoration: none; }

/* ---------- Logo ---------- */
.logo-img { height: 34px; width: auto; display: block; }
.logo-badge {
    background: var(--navy);
    border-radius: 14px;
    padding: .55rem .8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.logo-badge .logo-img { height: 40px; }
.brand-lockup { display: flex; align-items: center; gap: .6rem; }
.brand-lockup .brand-text { color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .3px; }
.brand-lockup .brand-text span { color: var(--brand); }

/* ---------- Navbar ---------- */
.navbar-sistema {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    flex-wrap: wrap;
    gap: .5rem;
}
.navbar-sistema .brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .3px;
}
.navbar-sistema .brand span { color: var(--brand); }
.navbar-sistema .nav-links a {
    color: rgba(255,255,255,.85);
    margin-left: 1.25rem;
    font-size: .93rem;
    font-weight: 500;
    transition: color .15s;
}
.navbar-sistema .nav-links a:hover { color: var(--brand); }
.navbar-sistema .nav-links a.active { color: #fff; border-bottom: 2px solid var(--red); padding-bottom: 3px; }
.user-pill {
    background: rgba(255,255,255,.1);
    color: #fff;
    padding: .35rem .8rem;
    border-radius: 30px;
    font-size: .85rem;
    margin-left: 1.25rem;
}

/* ---------- Selector de tema (claro/oscuro) ---------- */
.theme-toggle-btn {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    margin-left: 1rem;
    transition: background .15s;
    line-height: 1;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,.2); }

/* ---------- Hero público ---------- */
.hero-public {
    background: radial-gradient(circle at 20% 20%, #16233b 0%, #05080e 70%);
    color: #fff;
    padding: 4rem 1.5rem 3.5rem;
    text-align: center;
}
.hero-public .logo-badge { margin-bottom: 1.5rem; }
.hero-public h1 { font-weight: 800; font-size: 2.4rem; }
.hero-public h1 span { color: var(--brand); }
.hero-public p { color: rgba(255,255,255,.8); max-width: 620px; margin: 1rem auto 2rem; font-size: 1.05rem; }

.btn-brand {
    background: var(--brand);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: .65rem 1.6rem;
    border-radius: 8px;
    transition: background .15s;
}
.btn-brand:hover { background: var(--brand-dark); color: #fff; }
.btn-outline-light-custom {
    border: 1.5px solid rgba(255,255,255,.6);
    color: #fff;
    padding: .6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    background: transparent;
}
.btn-outline-light-custom:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- Tarjetas empresas ---------- */
.empresas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}
.empresa-card {
    background: var(--card);
    border-radius: 14px;
    padding: 1.6rem 1.4rem;
    border-top: 5px solid var(--brand);
    box-shadow: 0 4px 18px rgba(20,33,61,.08);
    transition: transform .15s, background .2s;
}
.empresa-card:hover { transform: translateY(-4px); }
.empresa-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; color: var(--navy); }
[data-theme="dark"] .empresa-card h3 { color: var(--text); }
.empresa-card p { font-size: .88rem; color: var(--muted); margin: 0; }

/* ---------- Contenedores generales ---------- */
.page-wrap { max-width: 1180px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.panel {
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 2px 14px rgba(20,33,61,.06);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: background .2s, border-color .2s;
}
.panel h2, .panel h4, .panel h5 { color: var(--navy); font-weight: 700; }
[data-theme="dark"] .panel h2, [data-theme="dark"] .panel h4, [data-theme="dark"] .panel h5 { color: var(--text); }

.stat-card {
    background: var(--card);
    border-radius: 14px;
    padding: 1.4rem;
    border-left: 5px solid var(--brand);
    box-shadow: 0 2px 14px rgba(20,33,61,.06);
}
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--navy); }
[data-theme="dark"] .stat-card .num { color: var(--text); }
.stat-card .label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; }

.auth-box {
    max-width: 440px;
    margin: 3rem auto;
    background: var(--card);
    border-radius: 16px;
    padding: 2.2rem 2rem;
    box-shadow: 0 8px 30px rgba(20,33,61,.12);
    text-align: center;
}
.auth-box h2 { color: var(--navy); font-weight: 800; margin-bottom: .3rem; }
[data-theme="dark"] .auth-box h2 { color: var(--text); }
.auth-box .sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.6rem; }
.auth-box form { text-align: left; }

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: .55rem .8rem;
    background: var(--card);
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .18rem rgba(29,95,168,.25);
    background: var(--card);
    color: var(--text);
}
label { font-weight: 600; font-size: .85rem; color: var(--navy); margin-bottom: .3rem; }
[data-theme="dark"] label { color: var(--text); }

.table-sistema { background: var(--card); border-radius: 12px; overflow: hidden; color: var(--text); }
.table-sistema thead { background: var(--navy); color: #fff; }
.table-sistema th { font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
[data-theme="dark"] .table-sistema, [data-theme="dark"] .table-sistema td { color: var(--text); background: var(--card); }
[data-theme="dark"] .table > :not(caption) > * > * { color: var(--text); background: var(--card); border-color: var(--border); }

.badge-estado { padding: .3rem .65rem; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-pendiente { background: #fde8d0; color: #97530b; }
.badge-en_proceso { background: #d9e8fd; color: #14497d; }
.badge-completado { background: #d7f0e0; color: var(--success); }

.badge-prioridad { padding: .25rem .55rem; border-radius: 6px; font-size: .72rem; font-weight: 700; }
.badge-baja { background: #e8ecef; color: #4b5563; }
.badge-media { background: #fdeecb; color: var(--warning); }
.badge-alta { background: #f8d7d5; color: var(--red); }

.badge-rol { padding: .25rem .6rem; border-radius: 6px; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.badge-dueno { background: var(--navy); color: #fff; }
.badge-empleado { background: #d9e8fd; color: #14497d; }
.badge-cliente { background: #fdeecb; color: var(--warning); }

footer.footer-sistema {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: .82rem;
}

/* Modales en modo oscuro */
[data-theme="dark"] .modal-content { background: var(--card); color: var(--text); }
[data-theme="dark"] .modal-header, [data-theme="dark"] .modal-footer { border-color: var(--border); }
[data-theme="dark"] .btn-close { filter: invert(1); }
