* { box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    background: #f4f5f7;
    color: #222;
}
.navbar {
    position: relative;
    background: #1f2937;
    color: white;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.navbar .brand { font-weight: 600; }
.navbar .brand { display: inline-flex; align-items: center; gap: 8px; }
.avatar {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    vertical-align: middle;
}
.avatar-small { width: 30px; height: 30px; }
.avatar-profile { display: block; margin-bottom: 12px; width: 96px; height: 96px; }
.foto-ampliable { cursor: zoom-in; }
.editor-foto { margin-top: 12px; }
.editor-foto canvas { display: block; width: 240px; height: 240px; margin: 0 auto 10px; border-radius: 50%; background: #e5e7eb; }
.visor-foto {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.82);
}
.visor-foto[hidden] { display: none; }
.visor-foto img {
    max-width: min(92vw, 720px);
    max-height: 88vh;
    border-radius: 12px;
    object-fit: contain;
}
.visor-foto-cerrar {
    position: absolute;
    top: 16px;
    right: 18px;
    margin: 0;
    padding: 2px 10px;
    background: transparent;
    color: white;
    font-size: 32px;
}
.menu-toggle {
    margin: 0;
    padding: 2px 12px 8px;
    background: transparent;
    color: white;
    font-size: 28px;
    line-height: 1;
}
.menu-toggle:hover { background: #374151; }
.nav-links {
    position: absolute;
    top: 58px;
    right: 16px;
    z-index: 10;
    min-width: 180px;
    padding: 8px 0;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.nav-links a {
    display: block;
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 16px;
    font-size: 15px;
}
.nav-links a:hover { color: white; background: #374151; }

.container {
    max-width: 960px;
    margin: 24px auto;
    padding: 0 16px;
}

.login-box {
    max-width: 360px;
    margin: 80px auto;
    background: white;
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    text-align: center;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
label { font-size: 13px; color: #555; }
input, select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
}
textarea { width: 100%; resize: vertical; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font: inherit; }
.avatar-placeholder { display: flex; align-items: center; justify-content: center; background: #2563eb; color: white; font-size: 34px; }
.descripcion-publica { color: #64748b; white-space: pre-wrap; }
.perfil-publico { text-align: center; }
button {
    margin-top: 10px;
    padding: 10px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}
button:hover { background: #1d4ed8; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid #eee; font-size: 14px; }

.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.pending { background: #fee2e2; color: #b91c1c; }

.flash {
    background: #fef9c3;
    border: 1px solid #fde047;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.solicitud { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 0; border-top:1px solid #eee; }
.inline-form { display:inline-flex; margin:0 0 0 6px; }
.inline-form button { margin-top:0; padding:8px 10px; }
.bloqueo-menu { position: relative; display: inline-block; }
.boton-sutil {
    margin: 0;
    padding: 5px 8px;
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
    font-size: 12px;
}
.boton-sutil:hover { background: #f1f5f9; color: #334155; }
.bloqueo-opciones {
    position: absolute;
    right: 0;
    top: 32px;
    z-index: 5;
    min-width: 120px;
    padding: 5px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.bloqueo-opciones form { margin: 0; }
.bloqueo-opciones button {
    width: 100%;
    margin: 0;
    padding: 7px 8px;
    background: transparent;
    color: #334155;
    text-align: left;
    font-size: 12px;
}
.bloqueo-opciones button:hover { background: #f1f5f9; }

.monthly-notice {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
    padding: 14px 42px 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.notice-close {
    position: absolute;
    top: 8px;
    right: 10px;
    margin: 0;
    padding: 0 6px;
    background: transparent;
    color: #1e3a8a;
    font-size: 22px;
}
.payment-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0;
}
.payment-summary div {
    background: #f1f5f9;
    padding: 12px 8px;
    border-radius: 10px;
    text-align: center;
}
.payment-summary strong, .payment-summary small { display: block; }
.payment-summary small { color: #64748b; margin-top: 4px; }
.payment-summary .remaining-amount {
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #93c5fd;
}
.payment-summary .remaining-amount strong { font-size: 1.5rem; }
.pending-link {
    display: block;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
    text-decoration: none;
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.pending-link strong, .pending-link span { display: block; }
.pending-link span { margin-top: 6px; font-size: 14px; }
.admin-quota-control {
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
    padding-top: 16px;
}
.admin-quota-control form { margin-top: 10px; }
.perfil-submenu-toggle {
    margin-top: 0;
    width: 100%;
    text-align: left;
}
.perfil-submenu {
    border-top: 1px solid #e5e7eb;
    margin-top: 14px;
    padding-top: 14px;
}
.paid-list { list-style: none; padding: 0; margin: 0; }
.payment-history {
    border-top: 1px solid #e5e7eb;
    margin-top: 20px;
    padding-top: 16px;
}
.payment-history h3 { margin: 0 0 8px; }
.paid-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

@media (max-width: 600px) {
    .payment-summary { grid-template-columns: 1fr; }
}

.dashboard-table th { background: #f1f5f9; }

.camaras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.camara-box {
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.video-wrapper {
    position: relative;
}
.camara-box video {
    width: 100%;
    border-radius: 8px;
    background: #000;
    display: block;
}
.video-controles {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
}
.video-controles button {
    margin: 0;
    padding: 6px 10px;
    background: rgba(0,0,0,0.55);
    border-radius: 6px;
    font-size: 14px;
}
.video-controles button:hover { background: rgba(0,0,0,0.75); }

.camara-estado {
    font-size: 13px;
    color: #666;
    margin: 6px 0 0;
}

.ptz-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
}
.ptz-fila-media {
    display: flex;
    gap: 40px;
}
.ptz-btn {
    margin: 0;
    width: 44px;
    height: 40px;
    padding: 0;
    font-size: 16px;
    background: #374151;
}
.ptz-btn:hover { background: #1f2937; }
.ptz-mensaje {
    text-align: center;
    font-size: 12px;
    color: #b91c1c;
    min-height: 16px;
    margin: 4px 0 0;
}

.aviso-retraso {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    font-weight: 600;
}

.year-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}
.year-nav a { color: #2563eb; text-decoration: none; }
