:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --secondary: #718096;
    --success: #276749;
    --success-bg: #c6f6d5;
    --danger: #c53030;
    --danger-bg: #fed7d7;
    --warning: #c05621;
    --warning-bg: #feebc8;
    --info-bg: #bee3f8;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #2d3748;
    --text-muted: #718096;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; flex: 1; width: 100%; }

/* Navbar */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    min-height: 56px;
    position: relative;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .65rem;
    flex: 1;
}

.nav-logo {
    height: 40px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    background: #fff;
    padding: 4px 8px;
    border-radius: 6px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: .5rem;
    border-radius: var(--radius);
}

.nav-toggle:hover { background: rgba(255,255,255,.1); }

.system-logo-wrap {
    text-align: center;
    margin-bottom: 1rem;
}

.system-logo {
    max-height: 80px;
    max-width: 280px;
    width: auto;
    object-fit: contain;
}

.public-logo {
    display: block;
    margin: 0 auto 1rem;
    max-width: 300px;
    max-height: 90px;
    background: rgba(255,255,255,.95);
    padding: 10px 16px;
    border-radius: 10px;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
    flex: 1;
}

.nav-menu a {
    color: rgba(255,255,255,.85);
    padding: .5rem .75rem;
    border-radius: var(--radius);
    font-size: .9rem;
}

.nav-menu a:hover { background: rgba(255,255,255,.1); color: white; text-decoration: none; }

.nav-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .85rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: background .15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; text-decoration: none; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #4a5568; color: white; text-decoration: none; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #22543d; color: white; text-decoration: none; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #9b2c2c; color: white; text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); text-decoration: none; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { color: #9b2c2c; }
.btn-sm { padding: .25rem .5rem; font-size: .8rem; }
.btn-block { display: block; width: 100%; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h3, .card h4 { margin-bottom: 1rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.card-link {
    display: block;
    color: inherit;
    transition: transform .15s, box-shadow .15s;
}

.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    text-decoration: none;
}

.card-link h3 { color: var(--primary); margin-bottom: .5rem; }

.card-icon {
    color: var(--primary);
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.danger-card { border-color: var(--danger); }
.info-card { background: #ebf8ff; border-color: #90cdf4; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-weight: 500; font-size: .9rem; }

.form-group input,
.form-group select,
.form-group textarea {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44,82,130,.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.readonly-field { background: #edf2f7; cursor: not-allowed; }

.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }

.filter-card { margin-bottom: 1.5rem; }
.filter-form { gap: .75rem; }

/* Tables */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th, .table td {
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.table tr:hover { background: #f7fafc; }

.actions { white-space: nowrap; display: flex; gap: .35rem; flex-wrap: wrap; }

.thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--border);
}

/* Alerts */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #9ae6b4; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #feb2b2; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fbd38d; }

.alert ul { margin-left: 1.25rem; }

/* Badges */
.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-administrador { background: #fed7d7; color: #c53030; }
.badge-registrador { background: #c6f6d5; color: #276749; }
.badge-coordinador { background: #bee3f8; color: #2b6cb0; }

.status-active { color: var(--success); font-weight: 600; }
.status-inactive { color: var(--danger); font-weight: 600; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-icon {
    color: var(--primary);
    margin-bottom: .5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }

/* Page */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.75rem; color: var(--primary); }
.flex-between { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; }

.text-muted { color: var(--text-muted); font-size: .9rem; }
.results-count { margin-bottom: 1rem; font-size: .9rem; color: var(--text-muted); }

.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* Detail */
.detail-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    align-items: start;
}

.detail-photo img {
    width: 100%;
    border-radius: var(--radius);
    border: 3px solid var(--border);
}

.no-photo-large {
    width: 100%;
    aspect-ratio: 1;
    background: #edf2f7;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: .5rem 1rem;
    margin-top: 1rem;
}

.detail-list dt { font-weight: 600; color: var(--text-muted); font-size: .85rem; }
.detail-list dd { font-size: .95rem; }

.preview-photo { max-width: 120px; border-radius: var(--radius); margin-bottom: .5rem; }
.current-photo { margin-bottom: .5rem; }

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #2c5282 100%);
}

.login-container { width: 100%; max-width: 420px; padding: 1rem; }

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

.login-card h1 { text-align: center; color: var(--primary); font-size: 1.5rem; }
.subtitle { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; font-size: .9rem; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: .9rem; }

/* Public page */
.public-page {
    background: linear-gradient(135deg, var(--primary) 0%, #2c5282 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.public-container { width: 100%; max-width: 520px; padding: 1.5rem; }

.public-header { text-align: center; color: white; margin-bottom: 1.5rem; }
.public-header h1 { font-size: 1.75rem; }
.public-header p { opacity: .85; font-size: .95rem; }

.public-card { border-radius: 12px; }
.public-card h2 { color: var(--primary); margin-bottom: .5rem; }

.public-footer { text-align: center; margin-top: 1.5rem; }
.public-footer a { color: rgba(255,255,255,.9); }

.result-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
}

.result-success { background: var(--success-bg); border: 1px solid #9ae6b4; }
.result-not-found { background: var(--danger-bg); border: 1px solid #feb2b2; }

.result-icon {
    font-size: 2.5rem;
    margin-bottom: .5rem;
}

.result-success .result-icon { color: var(--success); }
.result-not-found .result-icon { color: var(--danger); }

.result-details {
    text-align: left;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: .35rem .75rem;
    margin-top: 1rem;
    font-size: .9rem;
}

.result-details dt { font-weight: 600; color: var(--text-muted); }

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    font-size: .85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: white;
}

.footer p { margin: .25rem 0; }

/* Responsive */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .navbar { flex-direction: column; align-items: flex-start; padding: .75rem 1rem; }
    .nav-menu { width: 100%; display: none; flex-direction: column; gap: 0; }
    .nav-menu-open { display: flex; }
    .nav-menu li { width: 100%; }
    .nav-menu a { display: block; padding: .75rem 1rem; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,.1); }
    .nav-menu a:hover { background: rgba(255,255,255,.1); }
    .nav-toggle { display: block; position: absolute; right: 1rem; top: .75rem; }
    .nav-brand { flex: 1; }
    .nav-user { width: 100%; flex-direction: column; align-items: flex-start; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
    .flex-between { flex-direction: column; }
}
