/* ── Texto tipo documento (plan de comunicación / pizarra) ── */
.doc-render{background:var(--surface);color:var(--text);border-radius:8px;padding:24px 28px;font-family:'Georgia',Georgia,serif;border:1px solid var(--border);}
.doc-render h1{font-size:22px;font-weight:800;margin:0 0 6px;letter-spacing:-.2px;line-height:1.2;color:var(--text);}
.doc-render hr{border:none;border-top:1px solid var(--border);margin:20px 0 16px;}
.doc-render h2{font-size:17px;font-weight:700;margin:0 0 10px;color:var(--text);}
.doc-render h3{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;margin:14px 0 4px;color:var(--text-muted);}
.doc-render p{font-size:13px;line-height:1.75;margin:0 0 8px;color:var(--text);}
.doc-render p strong{font-weight:600;color:var(--text);}
.doc-render ul{margin:6px 0 12px 0;padding:0;list-style:none;}
.doc-render ul li{font-size:13px;line-height:1.7;margin-bottom:3px;padding-left:18px;color:var(--text);}
.doc-render ul li::before{content:"● ";color:var(--text-muted);margin-left:-18px;}
.board-block{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:18px 22px;margin-bottom:14px;font-family:'Georgia',Georgia,serif;}
.board-block h1{font-size:18px;font-weight:800;margin:0 0 8px;color:var(--accent);}
.board-block hr{display:none;}
.board-block h2{font-size:15px;font-weight:700;margin:0 0 8px;color:var(--text);}
.board-block h3{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;margin:10px 0 4px;color:var(--text-muted);}
.board-block p{font-size:13px;line-height:1.7;margin:0 0 8px;color:var(--text);}
.board-block p strong{font-weight:600;}
.board-block ul{margin:4px 0 10px 0;padding:0;list-style:none;}
.board-block ul li{font-size:13px;line-height:1.65;margin-bottom:3px;padding-left:18px;color:var(--text);}
.board-block ul li::before{content:"● ";color:var(--accent);margin-left:-18px;}

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface2: #242424;
    --border: #2e2e2e;
    --text: #e8e8e8;
    --text-muted: #888;
    --accent: #7c6af7;
    --accent-hover: #9182f8;
    --danger: #e05252;
    --success: #52c97a;
    --warning: #e0a652;
    --radius: 10px;
    --radius-sm: 6px;
    --surface-2: #242424;
    /* Alias de compatibilidad: nombres antiguos usados en estilos inline de las vistas */
    --muted: #888;
    --panel: #1a1a1a;
    --panel2: #242424;
    --accent2: #6af7a0;
    --warn: #e0a652;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

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

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    letter-spacing: -0.3px;
}

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 13px; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.nav-links a.nav-secondary { font-size: 12px; opacity: .55; }
.nav-links a.nav-secondary:hover { opacity: .85; }

.drive-badge {
    background: var(--surface2);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 12px !important;
}
.drive-badge.connected { border-color: var(--success); color: var(--success) !important; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.page-header h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

/* Clients grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.client-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: border-color .2s, transform .15s;
    display: block;
    color: var(--text);
}
.client-card:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-2px);
}

.client-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.client-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}
.client-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.client-name { font-weight: 600; font-size: 15px; }
.client-meta { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

.color-dots { display: flex; gap: 4px; margin-top: 10px; }
.color-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,.1); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: all .15s;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #000; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="color"],
input[type="file"],
select,
textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    transition: border-color .15s;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
input[type="color"] { height: 36px; padding: 2px 4px; cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Client detail */
.client-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    min-width: 0;
}
.client-detail-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
}

.tabs { display: flex; gap: 2px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab {
    padding: 10px 18px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    border: none;
    background: transparent;
    font-family: inherit;
    transition: color .15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-day-header {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.calendar-cell {
    min-height: 90px;
    max-height: 180px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
    transition: border-color .15s;
    position: relative;
}
.calendar-cell:hover { border-color: var(--accent); }
.calendar-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.calendar-cell.today { border-color: var(--accent); }

.day-number {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}
.today .day-number { color: var(--accent); }

.post-chip {
    display: block;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.post-chip.idea { background: rgba(124,106,247,.2); color: var(--accent); }
.post-chip.draft { background: rgba(224,166,82,.2); color: var(--warning); }
.post-chip.approved { background: rgba(82,201,122,.2); color: var(--success); }
.post-chip.published { background: rgba(82,201,122,.1); color: var(--text-muted); }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; }

/* Post detail */
.post-section { margin-bottom: 24px; }
.post-section h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 10px; }

.ideas-list { display: flex; flex-direction: column; gap: 8px; }
.idea-option {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color .15s;
    font-size: 13px;
    text-align: left;
    color: var(--text);
    font-family: inherit;
}
.idea-option:hover { border-color: var(--accent); }
.idea-option.selected { border-color: var(--accent); background: rgba(124,106,247,.1); }

.copy-output {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 13px;
    white-space: pre-wrap;
    min-height: 80px;
    line-height: 1.6;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.status-badge.idea { background: rgba(124,106,247,.2); color: var(--accent); }
.status-badge.draft { background: rgba(224,166,82,.2); color: var(--warning); }
.status-badge.approved { background: rgba(82,201,122,.2); color: var(--success); }
.status-badge.published { background: rgba(82,201,122,.1); color: var(--text-muted); }

/* Script output */
.script-output {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    line-height: 1.7;
    color: #c8e6c9;
    max-height: 400px;
    overflow-y: auto;
}

/* Image preview */
.image-preview {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    max-width: 400px;
}
.image-preview img { width: 100%; display: block; }

/* Loader */
.loader { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; }

/* Breadcrumb */
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb span { margin: 0 6px; }

/* Badge genérico (compat: pill pequeña de estado suelta en textos inline) */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: var(--surface2); border: 1px solid var(--border); }
.badge-idea { color: var(--accent); }
.badge-draft { color: var(--warning); }
.badge-ready, .badge-approved { color: var(--success); }
.badge-published { color: var(--text-muted); }
.badge.error { color: var(--danger); }

/* Drive info */
.drive-info {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.drive-info.connected { border-color: rgba(82,201,122,.3); color: var(--success); }

/* Utility */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Surface variant */
.surface-2 { background: var(--surface2); }

/* Org idea rows */
.org-idea-row:hover { border-color: var(--accent); }

/* Idea chips */
.idea-chip {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 6px;
    transition: border-color .15s;
}
.idea-chip:hover { border-color: var(--accent); }
.idea-chip.selected { border-color: var(--accent); background: rgba(124,106,247,.12); }

/* Reference image cards */
.ref-image-card:hover { border-color: var(--accent); }

/* Example post cards */
.example-post-card { transition: border-color .15s; }
.example-post-card:hover { border-color: var(--border); }

/* ── Calendario general: leyenda de clientes ── */
.client-legend { display:flex; flex-wrap:wrap; gap:12px; margin-bottom:20px; }
.legend-item { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-muted); }
.legend-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }

/* Badge de cliente en el chip */
.chip-client {
    display:inline-block;
    background:rgba(255,255,255,.12);
    border-radius:2px;
    padding:0 3px;
    font-size:9px;
    font-weight:700;
    letter-spacing:.4px;
    margin-right:4px;
    vertical-align:middle;
}

/* Drag-and-drop */
.calendar-cell.drag-over { border-color:var(--accent); background:rgba(124,106,247,.1); }
.post-chip[draggable="true"] { cursor:grab; user-select:none; }
.post-chip[draggable="true"]:active { cursor:grabbing; opacity:.6; }

/* Botón edición rápida dentro del chip */
.chip-edit-btn {
    float: right;
    margin-left: 4px;
    font-size: 11px;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255,255,255,.18);
    cursor: pointer;
    line-height: 1.4;
    vertical-align: middle;
}
.chip-edit-btn:hover { background: rgba(255,255,255,.35); }

/* Drag handle dentro del chip */
.chip-drag-handle {
    display: inline-block;
    margin-right: 4px;
    opacity: 0.4;
    cursor: grab;
    font-size: 12px;
    line-height: 1;
    vertical-align: middle;
}
.post-chip:hover .chip-drag-handle { opacity: 0.8; }

/* chip-wrapper: contenedor draggable */
.chip-wrapper {
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    margin-bottom: 3px;
    cursor: grab;
    user-select: none;
}
.chip-wrapper:active { cursor: grabbing; }
.chip-wrapper .post-chip {
    flex: 1;
    min-width: 0;
    display: block;
    margin-bottom: 0;
    text-decoration: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.chip-wrapper .chip-edit-btn {
    flex-shrink: 0;
    padding: 2px 5px;
    background: rgba(255,255,255,.12);
    border: none;
    color: var(--text);
    font-size: 11px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    height: 100%;
    line-height: 1.6;
    opacity: 1;
}
.chip-wrapper .chip-edit-btn:hover { background: rgba(255,255,255,.28); }

/* Badge cliente: ancho minimo para consistencia */
.chip-client { min-width: 30px; text-align: center; letter-spacing: .3px; }

/* Lista mobile calendario: oculta por defecto */
.calendar-mobile-list { display: none; }

/* ── Portal del cliente: navegación (folded from templates/web/portal/base.html) ── */
.portal-nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.portal-brand { font-weight: 700; font-size: 15px; color: var(--text); }
.portal-brand span { color: var(--accent); }
.portal-tabs { display: flex; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.portal-tab { padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; white-space: nowrap; }
.portal-tab:hover { color: var(--text); }
.portal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.portal-tab .tab-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--danger); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 6px; }
.portal-content { max-width: 860px; margin: 0 auto; padding: 28px 24px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

/* Evitar overflow horizontal en toda la app */
html, body { overflow-x: hidden; }

/* Calendario: breakpoint 1024px para pantallas medianas */
@media (max-width: 1024px) {
    .calendar-header { flex-wrap: wrap; gap: 8px; justify-content: center; }
    .calendar-header > .flex { flex-wrap: wrap; gap: 6px; justify-content: center; }
}

@media (max-width: 768px) {

    /* Container */
    .container { padding: 20px 16px; }

    /* Navbar */
    .navbar { padding: 0 16px; }
    .nav-links { gap: 12px; }
    .nav-links a { font-size: 12px; }

    /* Page header */
    .page-header { flex-wrap: wrap; gap: 10px; }
    .page-header h1 { font-size: 18px; }

    /* Clients grid → 1 columna en mobile, 2 en tablet */
    .clients-grid { grid-template-columns: 1fr; }

    /* Client detail header → apilar */
    .client-detail-header { flex-wrap: wrap; gap: 12px; }
    .client-detail-header .flex { margin-left: 0 !important; width: 100%; }

    /* Tabs → scrollables horizontalmente */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; padding-bottom: 0; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { white-space: nowrap; flex-shrink: 0; padding: 10px 14px; font-size: 12px; }

    /* Forms */
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }

    /* Cards */
    .card { padding: 14px; }

    /* Calendar header */
    .calendar-header { flex-wrap: wrap; gap: 8px; }
    .calendar-header .flex { width: 100%; }

    /* Calendario → ocultar grilla, mostrar lista de posts */
    .calendar-grid { display: none; }
    .calendar-mobile-list { display: block; }

    /* Modal */
    .modal { padding: 16px; width: 96%; }

    /* Post detail: columnas a una sola */
    .post-detail-cols { flex-direction: column; }

    /* Botones en grupos → wrap */
    .flex.gap-8 { flex-wrap: wrap; }

    /* Imagen preview */
    .image-preview { max-width: 100%; }

    /* Gen panel rows */
    .client-gen-row { flex-wrap: wrap; gap: 8px; }
    .client-gen-row label { min-width: unset !important; }

    /* Legend */
    .client-legend { gap: 8px; }
}

@media (min-width: 480px) and (max-width: 768px) {
    .clients-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {

    /* Client detail header: apilar avatar + nombre + botones */
    .client-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .client-detail-header > div:last-child {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    /* Secciones de marca: grillas a columna */
    .form-row, .form-row-3 { grid-template-columns: 1fr !important; }

    /* Imágenes de referencia: grid más pequeño */
    [style*="grid-template-columns: repeat(auto-fill, minmax(120px"] {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
    }

    /* Panel de posts en portal agencia: formularios inline → columna */
    [style*="display:flex;gap:6px;align-items:flex-end"] {
        flex-direction: column;
        align-items: stretch !important;
    }
    [style*="display:flex;gap:6px;align-items:flex-end"] button,
    [style*="display:flex;gap:6px;align-items:center"] button[type="submit"] {
        width: 100%;
        height: auto !important;
        justify-content: center;
    }

    /* Cabecera de post en portal agencia */
    [style*="display:flex;align-items:center;gap:8px;padding:12px 16px"] {
        flex-wrap: wrap;
    }

    /* Botones de aprobar/rechazar en portal agencia */
    [style*="display:flex;gap:8px;align-items:center;flex-wrap:wrap"] {
        gap: 6px;
    }

    /* Mensajes generales: input + botón */
    .card form.flex { flex-direction: column; }
    .card form.flex button { width: 100%; height: auto !important; justify-content: center; }

    /* Post detail: ocultar sidebar en mobile si hubiera */
    .post-detail-cols { flex-direction: column !important; }

    /* Calendar header en cliente: achicar */
    .calendar-header h2 { font-size: 15px; }

    /* Tabla de tareas: wrap */
    [style*="display:flex;justify-content:space-between"] { flex-wrap: wrap; gap: 8px; }

    /* Portal: ocultar enlaces secundarios, apilar en mobile */
    .portal-content { padding: 20px 14px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   A PARTIR DE AQUÍ: reglas propias de la app PHP sin equivalente en el
   diseño original (widgets de subida de archivos, tablas, badges de la
   librería de plantillas, portal de cliente extendido con tareas/chat/
   transparencia, etc.). Se conservan tal cual estaban.
   ══════════════════════════════════════════════════════════════════════════ */

h1,h2,h3{color:var(--text);}
table{width:100%;border-collapse:collapse}
th,td{padding:8px;border-bottom:1px solid var(--border);text-align:left}
.badge{display:inline-block;padding:2px 8px;border-radius:20px;font-size:12px;background:var(--surface2);border:1px solid var(--border)}
.badge-idea{color:var(--text-muted)}
.badge-draft{color:var(--warning)}
.badge-ready{color:var(--accent)}
.badge-published{color:var(--success)}
.badge-approved{color:var(--accent)}
.grid{display:grid;gap:16px}
.grid-2{grid-template-columns:1fr 1fr}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-7{grid-template-columns:repeat(7,1fr)}
.error{color:var(--danger)}
.success{color:var(--success)}
.muted{color:var(--text-muted)}
.login-body{display:flex;align-items:center;justify-content:center;height:100vh;background:var(--bg)}
.login-box{background:var(--surface);padding:32px;border-radius:var(--radius);border:1px solid var(--border);width:320px}
.login-box h1{font-size:18px;margin-top:0}
.login-box button{width:100%;margin-top:8px}
.color-swatch{display:inline-block;width:24px;height:24px;border-radius:4px;border:1px solid var(--border);vertical-align:middle}
.thumb{width:100%;max-width:220px;border-radius:6px;border:1px solid var(--border)}
.flex-between{display:flex;justify-content:space-between;align-items:center}
.notif-dot{background:var(--danger);color:#fff;border-radius:10px;padding:0 6px;font-size:11px}
hr{border:none;border-top:1px solid var(--border);margin:16px 0}

/* ── Portal de cliente (public/portal/*.php): contenido extendido
     (tareas, chat, transparencia) sin equivalente exacto en el original ── */
.p-wrap{max-width:860px;margin:0 auto;padding:24px 16px 60px}
.p-section{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px 22px;margin-bottom:22px}
.p-section-title{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;color:var(--text);margin-bottom:4px}
.p-section-desc{font-size:12px;color:var(--text-muted);margin:0 0 16px}
.p-subsection-divider{display:flex;align-items:center;gap:10px;margin:20px 0 14px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;color:var(--text-muted);cursor:pointer}
.p-subsection-divider::after{content:'';flex:1;height:1px;background:var(--border)}
.p-empty{font-size:13px;color:var(--text-muted);text-align:center;padding:24px 0}
.brand-card{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:16px 20px}
.brand-row{display:flex;align-items:center;gap:20px;flex-wrap:wrap}
.brand-logo img{max-height:52px;max-width:120px;object-fit:contain;border-radius:6px;background:#fff;padding:4px}
.brand-colors{display:flex;gap:6px;flex-wrap:wrap}
.brand-swatch{width:28px;height:28px;border-radius:6px;border:1px solid var(--border);flex-shrink:0}
.brand-fonts,.brand-tone{font-size:12px;color:var(--text-muted)}
.brand-divider{width:1px;height:36px;background:var(--border);flex-shrink:0}
.p-cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.p-calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.p-cal-day-header{text-align:center;font-size:10px;font-weight:600;color:var(--text-muted);padding:4px 0;text-transform:uppercase}
.p-cal-cell{background:var(--surface);border:1px solid var(--border);border-radius:6px;padding:4px;min-height:64px;font-size:11px}
.p-cal-cell.empty{background:transparent;border-color:transparent}
.p-cal-cell.today{border-color:var(--accent)}
.p-day-num{font-size:10px;font-weight:600;color:var(--text-muted);margin-bottom:3px}
.p-chip{display:block;font-size:9px;padding:2px 4px;border-radius:3px;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-feed{display:flex;flex-direction:column;gap:10px;max-height:380px;overflow-y:auto;margin-bottom:14px;padding:12px;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius)}
.chat-bubble-wrap{display:flex;flex-direction:column}
.chat-bubble-wrap.client{align-items:flex-end}
.chat-bubble-wrap.agency{align-items:flex-start}
.chat-bubble{max-width:78%;padding:9px 13px;border-radius:12px;font-size:13px;line-height:1.5;white-space:pre-wrap;word-break:break-word}
.chat-bubble.client{background:rgba(124,106,247,.25);border-bottom-right-radius:4px}
.chat-bubble.agency{background:var(--surface);border-bottom-left-radius:4px}
.chat-meta{font-size:10px;color:var(--text-muted);margin-top:3px;padding:0 4px}
.chat-form{display:flex;gap:8px;align-items:flex-end}
.chat-form textarea{flex:1;resize:none;min-height:52px}
.task-item{border:1px solid var(--border);border-radius:var(--radius);margin-bottom:10px;overflow:hidden}
.task-item.done{opacity:.65}
.task-head{display:flex;align-items:flex-start;gap:10px;padding:12px 14px;background:var(--surface)}
.task-dot-btn{width:16px;height:16px;padding:0;border-radius:50%;border:2px solid var(--border);background:transparent;cursor:pointer;margin-top:2px;flex-shrink:0}
.task-dot-btn.done{border-color:var(--success);background:var(--success)}
.task-title{font-size:13px;font-weight:500;margin-bottom:4px}
.task-item.done .task-title{text-decoration:line-through}
.task-desc{font-size:12px;color:var(--text-muted);white-space:pre-wrap;line-height:1.6}
.task-due{font-size:11px;padding:2px 7px;border-radius:4px;background:var(--surface2);color:var(--text-muted);display:inline-block}
.task-due.overdue{background:rgba(224,82,82,.15);color:var(--danger)}
.task-thread{padding:10px 14px;background:var(--surface2);border-top:1px solid var(--border)}
.thread-bubble-wrap{display:flex;flex-direction:column;margin-bottom:8px}
.thread-bubble-wrap.client{align-items:flex-end}
.thread-bubble-wrap.agency{align-items:flex-start}
.thread-bubble{max-width:82%;border-radius:10px;padding:8px 12px;font-size:13px}
.thread-bubble.client{background:rgba(124,106,247,.25);border-bottom-right-radius:3px}
.thread-bubble.agency{background:var(--surface);border-bottom-left-radius:3px}
.post-block{border:1px solid var(--border);border-radius:var(--radius);margin-bottom:8px;overflow:hidden}
.post-head{display:flex;align-items:center;gap:10px;padding:12px 14px;background:var(--surface);cursor:pointer}
.post-body{padding:14px;background:var(--surface2);border-top:1px solid var(--border)}
.review-box{margin-bottom:14px;padding:12px;background:var(--surface);border-radius:var(--radius-sm);border:1px solid rgba(124,106,247,.35)}
.review-imgs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.review-imgs img{width:90px;height:90px;object-fit:cover;border-radius:6px;border:1px solid var(--border)}
.review-field{margin-bottom:12px;padding:10px;background:var(--surface2);border-radius:var(--radius-sm);border:1px solid var(--border)}
.review-field-label{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--text-muted);margin-bottom:6px}
.idea-item{display:flex;align-items:flex-start;gap:10px;padding:11px 14px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);margin-bottom:8px}
.idea-form{display:flex;gap:8px;margin-bottom:16px}
.idea-form input{flex:1}
.board-tag{font-size:10px;padding:2px 7px;border-radius:4px;background:var(--surface2);color:var(--text-muted)}
.board-tag.client{background:rgba(124,106,247,.25);color:var(--accent)}
.transp-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 20px;margin-bottom:12px}
.transp-warn{background:rgba(224,82,82,.1);border:1px solid rgba(224,82,82,.35);border-radius:var(--radius-sm);padding:10px 14px;margin-bottom:14px;font-size:13px;font-weight:600;color:var(--danger)}
.transp-months{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.transp-month{text-align:center;padding:8px 12px;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-sm);min-width:80px}

/* Campana de notificaciones dentro de .portal-nav (public/portal/*.php) */
.p-notif-bell{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text-muted);text-decoration:none;padding:6px 10px;border-radius:8px;border:1px solid var(--border);background:var(--surface2);flex-shrink:0}
.p-notif-bell:hover{color:var(--text)}
.p-notif-badge{background:var(--danger);color:#fff;border-radius:10px;font-size:10px;font-weight:700;min-width:16px;height:16px;padding:0 4px;display:inline-flex;align-items:center;justify-content:center}

@media (max-width:600px){
  .p-wrap{padding:16px 12px 60px}
  .brand-divider{display:none}
  .chat-bubble,.thread-bubble{max-width:90%}
}

/* Plan de comunicación renderizado (doc-render + doc-render.js) */
.plan-doc.doc-render{max-height:560px;overflow-y:auto;padding:28px 32px;}
