/* ===================================================================
   CERP · Admin — "Cabina de operaciones" postal editorial del Caribe
   Identidad heredada del sitio público: paper/ink/pine/sea/palm/mint,
   Fraunces (display) + Instrument Sans (UI).
   =================================================================== */

:root {
    /* --- Paleta de marca --- */
    --paper:      #FBF9F5;   /* fondo principal */
    --sand:       #F3EEE5;   /* alternancia / hover suave */
    --sand-deep:  #EAE3D6;   /* bordes cálidos sutiles */
    --ink:        #211916;   /* texto (negro cálido de marca) */
    --ink-70:     rgba(33, 25, 22, 0.70);
    --ink-55:     rgba(33, 25, 22, 0.55);
    --ink-40:     rgba(33, 25, 22, 0.40);

    --pine:       #486B65;   /* CTA primario */
    --pine-600:   #3d5c57;   /* hover */
    --pine-700:   #33504b;
    --pine-950:   #1C2926;   /* sidebar / bandas oscuras */
    --sea:        #59B4A3;   /* links / acentos / olas */
    --palm:       #57AA80;   /* éxito / activo */
    --mint:       #ADEDCB;   /* highlight sobre oscuro */

    --gold:       #C68A3E;   /* aviso / atención (sol, arena) */
    --gold-soft:  #F6EBD6;
    --coral:      #C0503A;   /* destructivo (terracota caribeña) */
    --coral-700:  #a23f31;
    --coral-soft: #F7E4DE;

    /* --- Superficies y líneas --- */
    --card:       #ffffff;
    --line:       rgba(33, 25, 22, 0.08);
    --line-strong:rgba(33, 25, 22, 0.14);

    --shadow-sm:  0 1px 2px rgba(33, 25, 22, 0.04);
    --shadow:     0 1px 2px rgba(33, 25, 22, 0.04), 0 10px 30px -18px rgba(33, 25, 22, 0.30);
    --shadow-lg:  0 24px 60px -24px rgba(28, 41, 38, 0.45);

    --radius:     14px;
    --radius-sm:  10px;
    --radius-lg:  20px;
    --radius-pill:999px;

    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --sans:  'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --sidebar-width: 264px;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --transition: all 0.22s var(--ease);
}

/* ==================== Reset y base ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--sans);
    font-size: 14px;
    color: var(--ink);
    background-color: var(--paper);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }

.eyebrow {
    font-family: var(--sans);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-weight: 600;
    color: var(--pine);
}

::selection { background: var(--mint); color: var(--pine-950); }

/* ==================== Login ==================== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(120% 90% at 85% -10%, rgba(89, 180, 163, 0.22), transparent 60%),
        linear-gradient(155deg, var(--pine-950) 0%, #14201d 100%);
}

.login-container {
    background: var(--paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 38px;
    width: 100%;
    max-width: 400px;
    animation: rise 0.5s var(--ease);
    border: 1px solid var(--line);
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-header .login-mark {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    display: grid; place-items: center;
}
.login-header .login-mark img { width: 100%; height: 100%; object-fit: contain; }

.login-header h1 { font-size: 25px; margin-bottom: 4px; color: var(--ink); }
.login-header h1 em { font-style: italic; color: var(--pine); }
.login-header p {
    color: var(--ink-55);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.login-form .form-group { margin-bottom: 18px; }
.login-form label {
    display: flex; align-items: center; gap: 8px;
    font-weight: 500; margin-bottom: 8px; color: var(--ink);
    font-size: 13px;
}
.login-form label i { color: var(--pine); font-size: 13px; }
.login-form input {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 14px; font-family: var(--sans);
    background: var(--card);
    transition: var(--transition);
}
.login-form input:focus {
    outline: none; border-color: var(--pine);
    box-shadow: 0 0 0 4px rgba(72, 107, 101, 0.14);
}
.login-form .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }

/* ==================== Layout ==================== */
.admin-panel { display: flex; min-height: 100vh; background-color: var(--paper); }

/* ==================== Sidebar ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--pine-950);
    color: rgba(255, 255, 255, 0.82);
    display: flex; flex-direction: column;
    position: fixed; height: 100vh; overflow-y: auto;
    z-index: 50;
}

.sidebar-header {
    padding: 24px 22px 20px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-header .brand-mark {
    width: 38px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center;
}
.sidebar-header .brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-header h2 {
    font-size: 16px; color: #fff; line-height: 1.1;
}
.sidebar-header h2 span {
    display: block; font-family: var(--sans); font-weight: 500;
    font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--sea); margin-top: 3px;
}

.user-info {
    padding: 18px 22px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.user-info .avatar {
    width: 40px; height: 40px; border-radius: var(--radius-pill);
    background: linear-gradient(140deg, var(--pine), var(--sea));
    display: grid; place-items: center;
    font-family: var(--serif); font-size: 16px; color: #fff; font-weight: 600;
    flex-shrink: 0;
}
.user-info strong { display: block; font-size: 13.5px; color: #fff; font-weight: 600; }
.user-role {
    display: inline-block; font-size: 10px; margin-top: 3px;
    background: rgba(173, 237, 203, 0.16); color: var(--mint);
    padding: 2px 9px; border-radius: var(--radius-pill);
    text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}

.sidebar-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none; cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: var(--transition);
    position: relative;
}
.nav-item i { font-size: 15px; width: 20px; text-align: center; color: rgba(255, 255, 255, 0.5); transition: var(--transition); }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item:hover i { color: var(--sea); }
.nav-item.active { background: rgba(89, 180, 163, 0.16); color: #fff; }
.nav-item.active i { color: var(--mint); }
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--mint);
}

.sidebar-footer { padding: 16px 18px 22px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-footer .btn { width: 100%; justify-content: center; }

/* ==================== Main ==================== */
.main-content { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-width: 0; }

.content-header {
    background: rgba(251, 249, 245, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 22px 34px;
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.content-header h1 { font-size: 27px; color: var(--ink); }
.content-header .header-lead { display: flex; flex-direction: column; gap: 3px; }
.content-header .header-lead .eyebrow { margin-bottom: 1px; }

.content-body { padding: 30px 34px 48px; flex: 1; transition: opacity 0.25s var(--ease); }
.content-body.is-loading { opacity: 0.45; pointer-events: none; }

/* ==================== Filtros ==================== */
.filters-section {
    background: var(--card);
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.search-box { flex: 1; min-width: 240px; position: relative; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-40); font-size: 14px; }
.search-box input {
    width: 100%; padding: 11px 15px 11px 42px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-family: var(--sans); background: var(--paper);
    transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--pine); background: var(--card); box-shadow: 0 0 0 4px rgba(72, 107, 101, 0.12); }

.filter-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-select {
    padding: 11px 34px 11px 14px; border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); font-size: 13.5px; font-family: var(--sans);
    background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23211916' stroke-opacity='0.5' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--ink); cursor: pointer; -webkit-appearance: none; appearance: none;
    transition: var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 4px rgba(72, 107, 101, 0.12); }

/* ==================== Tabla ==================== */
.data-table { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table thead { background: var(--sand); }
.table th {
    padding: 13px 16px; text-align: left;
    font-family: var(--sans); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-55);
    border-bottom: 1px solid var(--line);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13.5px; vertical-align: middle; }
.table tbody tr { transition: background 0.15s var(--ease); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--sand); }
.table-cell-id { font-family: var(--serif); color: var(--ink-40); font-size: 13px; }
.table-cell-primary { font-weight: 600; }
.cell-muted { color: var(--ink-40); font-style: italic; }

.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ==================== Badges / chips ==================== */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: var(--radius-pill);
    font-family: var(--sans); font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
}
.status-active   { background: rgba(87, 170, 128, 0.15); color: var(--pine-700); }
.status-active::before,
.status-inactive::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-active::before   { background: var(--palm); }
.status-inactive { background: var(--coral-soft); color: var(--coral-700); }
.status-inactive::before { background: var(--coral); }

.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: var(--radius-sm);
    font-family: var(--sans); font-size: 11.5px; font-weight: 500;
    background: var(--sand); color: var(--ink-70); border: 1px solid var(--line);
}
.chip-sea   { background: rgba(89, 180, 163, 0.12); color: var(--pine-700); border-color: rgba(89, 180, 163, 0.28); }
.chip-gold  { background: var(--gold-soft); color: #8a5f22; border-color: rgba(198, 138, 62, 0.3); }
.chip-empty { color: var(--ink-40); font-style: italic; background: transparent; border: none; padding-left: 0; }

/* ==================== Botones ==================== */
.btn {
    padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-family: var(--sans); font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: var(--transition); display: inline-flex; align-items: center; gap: 8px;
    text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }

.btn-primary { background: var(--pine); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--pine-600); }
.btn-success { background: var(--pine); color: #fff; }          /* "Nuevo X" usa pine, coherente */
.btn-success:hover:not(:disabled) { background: var(--pine-600); }
.btn-danger  { background: var(--coral); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--coral-700); }
.btn-secondary {
    background: transparent; color: var(--ink-70); border-color: var(--line-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--sand); color: var(--ink); border-color: var(--ink-40); }
.btn-ghost { background: transparent; color: var(--pine); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--sand); }

/* Botones de acción de fila: icono + affordance clara */
.icon-btn {
    width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-strong); background: var(--card);
    color: var(--ink-55); cursor: pointer; font-size: 13px;
    transition: var(--transition);
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.icon-btn.act-images:hover { border-color: var(--sea); color: var(--sea); background: rgba(89, 180, 163, 0.08); }
.icon-btn.act-edit:hover   { border-color: var(--pine); color: var(--pine); background: rgba(72, 107, 101, 0.08); }
.icon-btn.act-delete:hover { border-color: var(--coral); color: var(--coral); background: var(--coral-soft); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; }

/* ==================== Modales ==================== */
.modal {
    display: none; position: fixed; inset: 0;
    background: rgba(28, 41, 38, 0.42);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    z-index: 1000; overflow-y: auto; padding: 24px;
}
.modal.active { display: flex; align-items: center; justify-content: center; animation: fade 0.25s var(--ease); }

.modal-content {
    background: var(--paper); border-radius: var(--radius-lg);
    width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg); animation: rise 0.3s var(--ease);
    border: 1px solid var(--line);
}
.modal-large { max-width: 920px; }

.modal-header {
    padding: 22px 26px 18px;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: var(--paper); z-index: 2;
}
.modal-header h2 { font-size: 21px; color: var(--ink); }
.modal-header h2 em { font-style: italic; color: var(--pine); }
.modal-close {
    background: none; border: none; font-size: 26px; line-height: 1;
    color: var(--ink-40); cursor: pointer; width: 34px; height: 34px;
    display: grid; place-items: center; border-radius: var(--radius-sm);
    transition: var(--transition); flex-shrink: 0;
}
.modal-close:hover { background: var(--sand); color: var(--ink); }
.modal-body { padding: 24px 26px 26px; }

/* ==================== Formularios ==================== */
.form-group { margin-bottom: 18px; }
.form-group > label {
    display: block; margin-bottom: 7px; font-weight: 600; color: var(--ink);
    font-size: 13px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); font-size: 14px; font-family: var(--sans);
    background: var(--card); color: var(--ink); transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--pine);
    box-shadow: 0 0 0 4px rgba(72, 107, 101, 0.12);
}
.form-group textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.form-group select[multiple] { padding: 6px; }
.form-group select[multiple] option { padding: 6px 8px; border-radius: 6px; }
.field-hint { display: block; margin-top: 6px; color: var(--ink-40); font-size: 12px; }

.form-row { display: flex; gap: 14px; margin-bottom: 18px; }
.form-row .form-group { margin-bottom: 0; flex: 1; }
.flex-1 { flex: 1; } .flex-2 { flex: 2; }

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line);
    position: sticky; bottom: 0; background: var(--paper);
}

/* Toggle switch (checkbox) */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    width: 46px; height: 26px; border-radius: var(--radius-pill);
    background: var(--sand-deep); position: relative; transition: var(--transition); flex-shrink: 0;
    border: 1px solid var(--line-strong);
}
.switch-thumb {
    position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
    background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: var(--transition);
}
.switch input:checked + .switch-track { background: var(--palm); border-color: var(--palm); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px rgba(72, 107, 101, 0.18); }
.switch-text { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.switch-text small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-40); }

/* ==================== Gestor de imágenes ==================== */
.image-manager { display: flex; flex-direction: column; gap: 22px; }
.add-image-section, .images-list-section { padding: 20px; background: var(--sand); border-radius: var(--radius); border: 1px solid var(--line); }
.add-image-section h3, .images-list-section h3 {
    display: flex; align-items: center; gap: 9px; margin-bottom: 15px;
    color: var(--ink); font-size: 16px;
}
.add-image-section h3 i, .images-list-section h3 i { color: var(--pine); font-size: 15px; }

.image-preview { margin-top: 14px; padding: 15px; background: var(--card); border-radius: var(--radius-sm); border: 1px dashed var(--line-strong); }
.image-preview h4 { font-size: 13px; color: var(--ink-55); }
.image-preview img { max-width: 100%; max-height: 200px; border-radius: var(--radius-sm); margin-top: 10px; }

.images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.image-card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: var(--transition); position: relative; }
.image-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.image-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.image-card-body { padding: 11px 12px; }
.image-card-info { font-size: 12px; color: var(--ink-55); margin-bottom: 9px; line-height: 1.4; }
.image-card-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; background: var(--pine); color: #fff; border-radius: var(--radius-pill); font-size: 10px; font-weight: 600; margin-bottom: 9px; text-transform: uppercase; letter-spacing: 0.06em; }
.image-card-actions { display: flex; gap: 6px; }

/* ==================== Paginación ==================== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 22px; padding: 8px; }
#pageInfo { color: var(--ink-55); font-weight: 500; font-size: 13px; }

/* ==================== Barra de carga ==================== */
.loading-bar {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: linear-gradient(90deg, var(--pine), var(--sea), var(--mint));
    z-index: 9999; opacity: 0; transition: opacity 0.3s var(--ease);
    border-radius: 0 3px 3px 0; pointer-events: none;
}
.loading-bar.active { opacity: 1; animation: loadingIndeterminate 1.7s ease-in-out infinite; }
@keyframes loadingIndeterminate { 0% { width: 4%; } 50% { width: 72%; } 100% { width: 4%; } }

/* ==================== Estado de carga / vacío ==================== */
.loading, .empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 62px 24px; color: var(--ink-55); text-align: center;
}
.loading i { font-size: 40px; margin-bottom: 14px; color: var(--pine); }
.loading p { font-size: 14px; }

.empty-state .empty-icon {
    width: 64px; height: 64px; border-radius: 50%; background: var(--sand);
    display: grid; place-items: center; margin-bottom: 16px;
}
.empty-state .empty-icon i { font-size: 26px; color: var(--pine); }
.empty-state h3 { font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.empty-state p { max-width: 380px; margin-bottom: 18px; color: var(--ink-55); }

/* ==================== Toasts ==================== */
.toast-container { position: fixed; top: 22px; right: 22px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--card); border-radius: var(--radius); padding: 14px 18px;
    box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px;
    min-width: 300px; max-width: 380px; border: 1px solid var(--line);
    border-left: 4px solid var(--sea); animation: slideInRight 0.32s var(--ease);
}
.toast.success { border-left-color: var(--palm); }
.toast.error   { border-left-color: var(--coral); }
.toast.info    { border-left-color: var(--sea); }
.toast i { font-size: 18px; }
.toast.success i { color: var(--palm); }
.toast.error i   { color: var(--coral); }
.toast.info i    { color: var(--sea); }
.toast-message { flex: 1; color: var(--ink); font-size: 13.5px; }

/* ==================== Confirm dialog ==================== */
#confirmDialog { z-index: 2000; }
#confirmDialog .modal-content { max-width: 440px; }
#confirmDialog .modal-body { padding-top: 20px; }
.confirm-icon {
    width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
    margin-bottom: 16px; background: var(--coral-soft);
}
.confirm-icon i { font-size: 22px; color: var(--coral); }
.confirm-icon.warn { background: var(--gold-soft); }
.confirm-icon.warn i { color: var(--gold); }
.confirm-icon.info { background: rgba(89,180,163,0.14); }
.confirm-icon.info i { color: var(--pine); }
#confirmMessage { margin-bottom: 22px; color: var(--ink-70); line-height: 1.6; }
#confirmMessage strong { color: var(--ink); }

/* ==================== Mensajes de error ==================== */
.error-message {
    background: var(--coral-soft); color: var(--coral-700);
    padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 15px;
    display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.error-message::before { content: '\f06a'; font-family: 'Font Awesome 6 Free'; font-weight: 900; }

/* ==================== Upload dropzone ==================== */
.upload-dropzone {
    border: 2px dashed var(--line-strong); border-radius: var(--radius);
    padding: 28px 20px; text-align: center; cursor: pointer;
    transition: var(--transition); margin-bottom: 15px; background: var(--card);
}
.upload-dropzone:hover, .upload-dropzone:focus-visible, .upload-dropzone.dragover {
    border-color: var(--pine); background: rgba(72, 107, 101, 0.05); outline: none;
}
.upload-dropzone.uploading { opacity: 0.6; pointer-events: none; }
.upload-dropzone i { font-size: 30px; color: var(--pine); margin-bottom: 8px; display: block; }
.upload-dropzone p { margin: 0 0 4px; color: var(--ink); }
.upload-hint { font-size: 12px; color: var(--ink-40); }
.upload-status { padding: 10px 14px; border-radius: var(--radius-sm); background: rgba(72, 107, 101, 0.08); color: var(--ink); font-size: 13.5px; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }

.form-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-40); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.form-divider::before, .form-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ===================================================================
   DASHBOARD — "Postal de operaciones"
   =================================================================== */
.dash { display: flex; flex-direction: column; gap: 26px; }

/* Postal header (firma visual) */
.postal {
    position: relative; overflow: hidden;
    background:
        radial-gradient(120% 130% at 90% -30%, rgba(89, 180, 163, 0.28), transparent 55%),
        linear-gradient(135deg, var(--pine-950) 0%, #16221f 100%);
    border-radius: var(--radius-lg); padding: 30px 32px 34px; color: #fff;
    box-shadow: var(--shadow);
}
.postal-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 22px; display: block; opacity: 0.6; }
.postal .eyebrow { color: var(--mint); }
.postal h2 { font-size: 27px; color: #fff; margin: 8px 0 0; max-width: 640px; line-height: 1.18; }
.postal h2 em { font-style: italic; color: var(--mint); }
.postal-date { margin-top: 12px; font-size: 12.5px; color: rgba(255,255,255,0.6); display: inline-flex; align-items: center; gap: 7px; }
.postal-stamps { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 24px; position: relative; z-index: 1; }
.stamp { display: flex; flex-direction: column; gap: 2px; }
.stamp .stamp-num { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1; color: #fff; }
.stamp .stamp-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(255,255,255,0.62); display: flex; align-items: center; gap: 6px; }
.stamp .stamp-label i { color: var(--sea); }
.stamp-divider { width: 1px; align-self: stretch; background: rgba(255,255,255,0.14); }

/* Panel "Requiere atención" */
.dash-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.dash-section-head h2 { font-size: 19px; color: var(--ink); }
.dash-section-head .count-pill {
    background: var(--gold-soft); color: #8a5f22; border: 1px solid rgba(198,138,62,0.3);
    font-family: var(--sans); font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: var(--radius-pill);
}
.dash-section-lead { color: var(--ink-55); font-size: 13.5px; margin-bottom: 16px; }

.attention-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.attention-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; display: flex; align-items: flex-start; gap: 14px;
    box-shadow: var(--shadow-sm); transition: var(--transition);
    text-align: left; width: 100%; cursor: pointer; font-family: inherit;
}
.attention-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--sand-deep); }
.attention-card:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.attention-card .att-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; flex-shrink: 0; font-size: 16px; }
.att-icon.tone-gold  { background: var(--gold-soft); color: var(--gold); }
.att-icon.tone-coral { background: var(--coral-soft); color: var(--coral); }
.att-icon.tone-sea   { background: rgba(89,180,163,0.14); color: var(--pine); }
.attention-card .att-body { flex: 1; min-width: 0; }
.attention-card .att-count { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1; }
.attention-card .att-title { font-weight: 600; font-size: 13.5px; margin: 2px 0 2px; color: var(--ink); }
.attention-card .att-desc { font-size: 12.5px; color: var(--ink-55); line-height: 1.4; }
.attention-card .att-go { margin-left: auto; align-self: center; color: var(--ink-40); transition: var(--transition); }
.attention-card:hover .att-go { color: var(--pine); transform: translateX(2px); }

.all-clear {
    background: rgba(87,170,128,0.1); border: 1px solid rgba(87,170,128,0.25);
    border-radius: var(--radius); padding: 20px 22px; display: flex; align-items: center; gap: 14px; color: var(--pine-700);
}
.all-clear i { font-size: 22px; color: var(--palm); }
.all-clear strong { font-weight: 600; }

/* Mapa relacional */
.rel-map { display: flex; flex-direction: column; gap: 18px; }
.destino-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.destino-card-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
    padding: 20px 22px; border-bottom: 1px solid var(--line); background: var(--sand); flex-wrap: wrap;
}
.destino-card-head .dh-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.destino-card-head h3 { font-size: 20px; color: var(--ink); }
.destino-card-head .dh-desc { margin-top: 6px; color: var(--ink-55); font-size: 13px; font-style: italic; max-width: 620px; }
.destino-card-body { padding: 20px 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }

.sub-block { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.sub-block h4 { font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sub-block h4 i { color: var(--sea); font-size: 13px; }
.sub-group .sub-group-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-55); display: flex; align-items: center; gap: 5px; margin-bottom: 7px; }
.sub-group .sub-group-label i { color: var(--pine); }
.sub-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sub-coords { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-40); font-family: var(--serif); }

/* ===================================================================
   SEARCH CONSOLE
   =================================================================== */
.gsc { display: flex; flex-direction: column; gap: 24px; }
.gsc-range { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gsc-range .field-hint { margin: 0; }
.gsc-range select { padding: 8px 32px 8px 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.stat-tile .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-55); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat-tile .stat-label i { color: var(--sea); }
.stat-tile .stat-value { font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--ink); margin: 10px 0 6px; line-height: 1; }
.stat-delta { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.stat-delta.up   { color: var(--palm); }
.stat-delta.down { color: var(--coral); }
.stat-delta.flat { color: var(--ink-40); }

.gsc-chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.gsc-chart h3 { font-size: 16px; color: var(--ink); margin-bottom: 4px; }
.gsc-chart .field-hint { margin-bottom: 16px; }
.spark { width: 100%; height: 120px; display: block; }
.spark .spark-area { fill: rgba(89,180,163,0.14); }
.spark .spark-line { fill: none; stroke: var(--pine); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.gsc-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.gsc-table-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.gsc-table-card h3 { font-size: 15px; color: var(--ink); padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--sand); display: flex; align-items: center; gap: 8px; }
.gsc-table-card h3 i { color: var(--pine); font-size: 13px; }
.gsc-mini-table { width: 100%; border-collapse: collapse; }
.gsc-mini-table td { padding: 11px 20px; border-bottom: 1px solid var(--line); font-size: 13px; }
.gsc-mini-table tr:last-child td { border-bottom: none; }
.gsc-mini-table .term { color: var(--ink); font-weight: 500; word-break: break-word; }
.gsc-mini-table .metric { text-align: right; color: var(--ink-55); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gsc-mini-table .metric strong { color: var(--ink); font-weight: 600; }

/* ==================== Animaciones ==================== */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* ==================== Responsive ==================== */
@media (max-width: 900px) {
    :root { --sidebar-width: 0px; }
    .sidebar {
        transform: translateX(-100%); transition: transform 0.3s var(--ease);
        width: 264px; box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-header { padding: 18px 20px; }
    .content-body { padding: 20px 18px 40px; }
    .menu-toggle { display: inline-grid !important; }
}

@media (min-width: 901px) { .menu-toggle { display: none; } }

@media (max-width: 620px) {
    .content-header { flex-direction: column; align-items: stretch; }
    .content-header .btn-success { justify-content: center; }
    .filters-section { flex-direction: column; align-items: stretch; }
    .filter-controls { flex-direction: column; }
    .form-row { flex-direction: column; gap: 18px; }
    .postal { padding: 24px 22px 28px; }
    .postal h2 { font-size: 22px; }
    .postal-stamps { gap: 18px; }
    .stamp-divider { display: none; }
    .table-actions { flex-wrap: wrap; }
}

.menu-toggle {
    display: none; width: 40px; height: 40px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
    place-items: center; cursor: pointer; font-size: 16px; flex-shrink: 0;
}

/* ==================== Accesibilidad ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==================== Utilidades ==================== */
.text-center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
