:root {
    --bg-color: #0d0f14;
    --cell-bg: rgba(255, 255, 255, 0.03);
    --cell-border: rgba(255, 255, 255, 0.1);
    --cell-hover: rgba(255, 255, 255, 0.08);
    --accent: #00ff88;
    --accent-glow: rgba(0, 255, 136, 0.4);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.5);
    --glass-bg: rgba(10, 15, 25, 0.6);

    /* Modo Dia/Noche (10/10/2026): todo color fijo pasa por estas variables.
       Valores de :root = modo noche (identicos a los anteriores). */
    --accent-text: #00ff88;            /* verde para texto/bordes (en dia se oscurece) */
    --accent-soft: rgba(0, 255, 136, 0.2);
    --accent-soft-strong: rgba(0, 255, 136, 0.4);
    --accent-border: rgba(0, 255, 136, 0.5);
    --body-grad-1: rgba(20, 40, 80, 0.5);
    --body-grad-2: rgba(0, 100, 80, 0.3);
    --bar-bg: rgba(10, 15, 25, 0.8);
    --modal-bg: rgba(20, 20, 25, 0.8);
    --modal-solid: #1a1a2e;
    --modal-border: rgba(255, 255, 255, 0.1);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-strong: rgba(0, 0, 0, 0.5);
    --surface-1: rgba(255, 255, 255, 0.03);
    --surface-1-border: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.05);
    --surface-3: rgba(255, 255, 255, 0.08);
    --surface-hover-border: rgba(255, 255, 255, 0.3);
    --btn-border: rgba(255, 255, 255, 0.2);
    --input-border: rgba(255, 255, 255, 0.1);
    --field-bg: rgba(255, 255, 255, 0.08);
    --field-border: rgba(255, 255, 255, 0.25);
    --auth-field-bg: rgba(0, 0, 0, 0.2);
    --auth-field-bg-focus: rgba(0, 0, 0, 0.4);
    --option-bg: #14141f;
    --text-strong: #eee;
    --text-soft: #ccc;
    --text-label: #ddd;
    --text-hint: #888;
    --text-desc: #9ba3af;
    --btn-acc-bg: rgba(255, 255, 255, 0.1);
    --btn-acc-border: rgba(255, 255, 255, 0.2);
    --btn-acc-hover: rgba(255, 255, 255, 0.2);
    --btn-acc-active: rgba(255, 255, 255, 0.4);
    --cell-face: rgba(255, 255, 255, 0.85);
    --cell-edge: rgba(255, 255, 255, 0.3);
    --cell-empty-border: rgba(255, 255, 255, 0.1);
    --spinner-track: rgba(255, 255, 255, 0.3);
    --spinner-head: #fff;
    --danger-text: #ff4466;
    --danger-text-hover: #ff6688;
    --danger-bg: #ff5566;
    --danger-bg-hover: #ff3344;
    --error-text: #ff8a80;
    --error-border: rgba(255, 138, 128, 0.5);
    --warn-text: #ffdd00;
    --warn-text-active: #cca400;
    --warn-border: rgba(255, 221, 0, 0.4);
    --warn-soft: rgba(255, 221, 0, 0.5);
    --editor-bar-bg: linear-gradient(rgba(255, 221, 0, 0.10), rgba(255, 221, 0, 0.06)), #191922;
    --editor-bar-border: rgba(255, 221, 0, 0.35);
    --scan-outline: #00ff88;
    --scan-ring: rgba(255, 255, 255, 0.9);
    --scan-group: #ffdd00;
    --scan-group-ring: rgba(0, 0, 0, 0.5);
    --banner-bg: #3d2a00;
    --banner-text: #ffd27a;
    --banner-border: #ffb74d;
    --logo-filter: brightness(0) invert(1);
    --logo-auth-filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
    --auth-box-bg: linear-gradient(145deg, rgba(30, 40, 60, 0.7), rgba(15, 20, 30, 0.9));
    --auth-box-border: rgba(255, 255, 255, 0.15);
    --auth-title: linear-gradient(to right, #fff, #aaa);
    --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23aaa' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
    color-scheme: dark;
}

/* Modo dia: fondo claro, contraste AA. El verde brillante queda solo como fondo (con texto negro). */
:root[data-theme="light"] {
    --bg-color: #f4f6f9;
    --cell-bg: rgba(15, 23, 42, 0.03);
    --cell-border: rgba(15, 23, 42, 0.14);
    --cell-hover: rgba(15, 23, 42, 0.07);
    --text-main: #12161f;
    --text-muted: #4b5563;
    --glass-bg: rgba(255, 255, 255, 0.9);

    --accent-text: #007a51;
    --accent-soft: rgba(0, 200, 110, 0.18);
    --accent-soft-strong: rgba(0, 200, 110, 0.35);
    --accent-border: #007a51;
    --body-grad-1: rgba(80, 140, 255, 0.10);
    --body-grad-2: rgba(0, 180, 120, 0.08);
    --bar-bg: rgba(255, 255, 255, 0.92);
    --modal-bg: rgba(255, 255, 255, 0.98);
    --modal-solid: #ffffff;
    --modal-border: rgba(15, 23, 42, 0.12);
    --overlay-bg: rgba(15, 23, 42, 0.45);
    --shadow: rgba(15, 23, 42, 0.10);
    --shadow-strong: rgba(15, 23, 42, 0.18);
    --surface-1: #ffffff;
    --surface-1-border: rgba(15, 23, 42, 0.12);
    --surface-2: rgba(15, 23, 42, 0.04);
    --surface-3: rgba(15, 23, 42, 0.07);
    --surface-hover-border: rgba(15, 23, 42, 0.3);
    --btn-border: rgba(15, 23, 42, 0.3);
    --input-border: #8a94a6;
    --field-bg: #ffffff;
    --field-border: #8a94a6;
    --auth-field-bg: #ffffff;
    --auth-field-bg-focus: #ffffff;
    --option-bg: #ffffff;
    --text-strong: #12161f;
    --text-soft: #374151;
    --text-label: #1f2937;
    --text-hint: #4b5563;
    --text-desc: #4b5563;
    --btn-acc-bg: #ffffff;
    --btn-acc-border: rgba(15, 23, 42, 0.3);
    --btn-acc-hover: rgba(15, 23, 42, 0.06);
    --btn-acc-active: rgba(15, 23, 42, 0.14);
    --cell-face: #ffffff;
    --cell-edge: rgba(15, 23, 42, 0.22);
    --cell-empty-border: rgba(15, 23, 42, 0.18);
    --spinner-track: rgba(15, 23, 42, 0.18);
    --spinner-head: #007a51;
    --danger-text: #c62828;
    --danger-text-hover: #a01818;
    --danger-bg: #c62839;
    --danger-bg-hover: #a51d2d;
    --error-text: #b3261e;
    --error-border: rgba(179, 38, 30, 0.5);
    --warn-text: #7a5c00;
    --warn-text-active: #5c4500;
    --warn-border: rgba(122, 92, 0, 0.5);
    --warn-soft: rgba(150, 115, 0, 0.6);
    --editor-bar-bg: #fff6cc;
    --editor-bar-border: rgba(160, 120, 0, 0.5);
    --scan-outline: #006b47;
    --scan-ring: rgba(255, 255, 255, 0.95);
    --scan-group: #8a6400;
    --scan-group-ring: rgba(255, 255, 255, 0.85);
    --banner-bg: #fff4d6;
    --banner-text: #5c3d00;
    --banner-border: #e0a030;
    --logo-filter: brightness(0) opacity(0.85);
    --logo-auth-filter: brightness(0) opacity(0.85);
    --auth-box-bg: linear-gradient(145deg, #ffffff, #f1f4f8);
    --auth-box-border: rgba(15, 23, 42, 0.12);
    --auth-title: linear-gradient(to right, #12161f, #374151);
    --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%234b5563' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
    color-scheme: light;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, var(--body-grad-1), transparent 25%),
        radial-gradient(circle at 85% 30%, var(--body-grad-2), transparent 25%);
    color: var(--text-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* iPad/iPhone: el alto visible real (sin quedar debajo de las barras del navegador) */
    display: flex;
    flex-direction: column;
}

/* Barra Superior Persistente */
#top-bar {
    height: 70px;
    background: var(--bar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--cell-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-area img {
    height: 40px;
    filter: var(--logo-filter);
}

.logo-area span {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
}



.user-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: black;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.btn-logout {
    padding: 6px 12px;
    font-size: 13px;
    border-color: var(--btn-border);
}

.glass-select, .glass-input {
    background: var(--glass-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    outline: none;
    border-radius: 12px;
    padding: 10px 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    height: 44px; /* Matches buttons */
}

.glass-select:focus, .glass-input:focus {
    border-color: var(--accent-text);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
/* Todos los select con la misma flecha propia (la nativa quedaba pegada al borde redondeado) */
select.glass-select {
    -webkit-appearance: none; appearance: none;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.glass-select option {
    background: var(--option-bg);
    color: var(--text-main);
}

.btn-primary {
    background: var(--accent);
    color: black;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--btn-border);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--cell-hover);
}

/* Contenedores de Vistas */
.view-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    padding: 20px;
}

.home-content {
    display: none; /* deprecated class */
}

/* Gallery Container */
.gallery-container {
    width: 90%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--cell-border);
}

.gallery-header h2 {
    font-size: 2rem;
    margin: 0;
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--cell-border);
    border-radius: 20px;
    padding: 8px 15px;
    gap: 10px;
    width: 300px;
    transition: all 0.3s ease;
}

.search-container:focus-within {
    border-color: var(--accent-text);
    background: var(--cell-hover);
    box-shadow: 0 0 10px rgba(0,255,136,0.2);
}

#board-search {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

#board-search::placeholder {
    color: var(--text-muted);
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding: 5px 10px 5px 5px;
}

.board-list {
    display: none; /* deprecated class */
}

.board-card {
    background: var(--surface-1);
    border: 1px solid var(--surface-1-border);
    padding: 24px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    min-height: 160px;
}
@media (min-width: 1400px) {
    .board-grid { grid-template-columns: repeat(4, 1fr); }
}

.board-card:hover {
    background: var(--surface-3);
    border-color: var(--surface-hover-border);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.btn-delete-card {
    background: rgba(255, 50, 80, 0.1);
    color: var(--danger-text);
    border: 1px solid rgba(255, 50, 80, 0.2);
    border-radius: 8px;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-delete-card:hover {
    background: rgba(255, 50, 80, 0.2);
    color: var(--danger-text-hover);
    border-color: rgba(255, 50, 80, 0.4);
    transform: scale(1.05);
}

.import-section {
    background: rgba(0, 0, 0, 0.2);
    padding: 30px;
    border-radius: 12px;
    border: 1px dashed var(--cell-border);
    text-align: center;
}

.file-input {
    font-size: 16px;
    padding: 10px;
    width: 100%;
    max-width: 400px;
    background: var(--surface-3);
    border-radius: 8px;
    color: var(--text-main);
}

/* === VISTA DEL TABLERO === */
#board-view {
    flex-direction: column;
    padding: 10px 20px;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overflow: hidden;
}

/* Acumulador de Frases (Sentence Bar) */
.accumulator-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 160px;
    margin-bottom: 15px;
    padding: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
}

.acc-nav-btns, .acc-action-btns {
    display: flex;
    gap: 10px;
    height: 100%;
    align-items: center;
}

.btn-acc {
    background: var(--btn-acc-bg);
    border: 1px solid var(--btn-acc-border);
    color: var(--text-main);
    width: 140px;
    height: 90%;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-acc:hover {
    background: var(--btn-acc-hover);
    transform: scale(1.05);
}

.btn-acc.active {
    background: var(--btn-acc-active);
    transform: scale(0.95);
}

.btn-acc svg {
    width: 64px;
    height: 64px;
}

/* Modal de importación */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--overlay-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border-radius: 15px;
    position: relative;
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    box-shadow: 0 10px 30px var(--shadow-strong);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2, .modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.btn-close, .btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.8rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-close:hover, .btn-close-modal:hover {
    transform: scale(1.1);
    color: var(--danger-text);
}

/* Fin Modal */

.btn-acc.play-btn {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.btn-acc.play-btn:hover, .btn-acc.play-btn.active {
    background: var(--accent-soft-strong);
}

.sentence-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    height: 100%;
    padding: 0 15px;
    margin: 0 15px;
    overflow-x: auto;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px inset var(--surface-1-border);
}

/* Items dentro de la frase */
.sentence-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 90%;
    flex: 1 1 0;
    min-width: 40px;
    max-width: 100px;
    border-radius: 12px;
    border: 2px solid var(--cell-edge);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 4px;
}
.sentence-item img {
    height: 75%;
    width: 75%;
    object-fit: contain;
    background: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.sentence-item span {
    font-size: 0.8rem;
    color: #111;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 2px;
    line-height: 1.1;
}

/* Grilla del Tablero */
.grid-container {
    flex: 1;
    display: grid;
    gap: 15px;
    width: 100%;
    max-height: calc(100% - 175px); /* Restando la barra acumuladora (160) + margin (15) */
    align-content: start;
    justify-content: center;
}

.cell {
    background: var(--cell-face); /* Glassmorphism en las celdas */
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 2px solid var(--cell-edge);
    box-shadow: 0 4px 15px var(--shadow);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
    /* Evitar que sean absurdamente grandes en tableros chicos */
    width: 100%;
    height: 100%;
    margin: 0;
}

.dense-grid .cell {
    border-radius: 6px;
    border-width: 1px;
}

.dense-grid .picto-label {
    font-size: 0.9rem;
}

.cell.empty-cell {
    background: transparent;
    border: 1px dashed var(--cell-empty-border);
    box-shadow: none;
    cursor: default;
}

.cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.cell.active {
    border-color: var(--accent-text);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.cell.clicked {
    background: #00ff88;
    transform: scale(0.95);
}

.picto-img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.picto-label {
    font-size: 1.1rem;
    font-weight: 800;
    color: #111;
    text-transform: uppercase;
    text-align: center;
    padding: 0 10px;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    line-height: 1.1;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 8px;
    background: var(--accent);
    width: 0%;
    box-shadow: 0 0 15px var(--accent);
    transition: width 0.1s linear;
}

/* UI Overlay para calibración */
#ui-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000; 
    pointer-events: none;
}

/* Glassmorphism general */
.glass-box {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--cell-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow);
}

/* Barra Inferior (Bottom Bar) */
.bottom-bar {
    height: auto;
    min-height: 70px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bar-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--cell-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 100;
    flex-shrink: 0;
}

.bottom-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

.group-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto; /* Aligns content to the right */
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.divider {
    width: 1px;
    height: 30px;
    background: var(--cell-border);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--spinner-track);
    border-radius: 50%;
    border-top-color: var(--spinner-head);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Auth Box Styles */
.auth-box {
    width: 100%;
    max-width: 420px;
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    text-align: center;
    background: var(--auth-box-bg);
    border: 1px solid var(--auth-box-border);
    box-shadow: 0 20px 50px var(--shadow-strong), inset 0 0 0 1px var(--surface-1-border);
}

.auth-logo {
    margin-bottom: 30px;
}

.auth-logo img {
    height: 70px;
    filter: var(--logo-auth-filter);
}

.auth-box h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    background: var(--auth-title);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-desc {
    color: var(--text-desc);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 25px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.auth-input {
    width: 100%;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--input-border);
    background: var(--auth-field-bg);
    color: var(--text-main);
    font-size: 1.05rem;
    transition: all 0.3s ease;
    outline: none;
}

.auth-input:focus {
    border-color: var(--accent-text);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15);
    background: var(--auth-field-bg-focus);
}

.otp-input {
    text-align: center;
    font-size: 2rem;
    letter-spacing: 12px;
    font-weight: 600;
    padding: 15px 10px;
}

.auth-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

.auth-btn-secondary {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border-radius: 12px;
    background: transparent;
    color: var(--text-desc);
    border: 1px solid var(--btn-border);
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Configuracion Modal */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s;
}
.btn-icon:hover {
    color: var(--text-main);
    background: var(--cell-hover);
}
.setting-group {
    margin-bottom: 20px;
    text-align: left;
}
.setting-group label {
    font-weight: 600;
    color: var(--text-strong);
    font-size: 0.95rem;
}

.auth-btn-secondary:hover {
    background: var(--surface-2);
    color: var(--text-main);
}

/* --- Modo Barrido (SPEC F2-3): resaltado de alto contraste --- */
/* Doble contorno (blanco + verde) para no depender solo del color (WCAG) */
.scan-highlight {
    outline: 6px solid var(--scan-outline) !important;
    outline-offset: -6px;
    box-shadow: inset 0 0 0 9px var(--scan-ring) !important;
    transform: scale(1.03);
    z-index: 5;
    transition: none !important;
}

.scan-highlight-group {
    outline: 6px solid var(--scan-group) !important;
    outline-offset: -6px;
    box-shadow: inset 0 0 0 9px var(--scan-group-ring) !important;
}/* --- Editor F3: Toolbar y Modal Consolidados --- */
#editor-toolbar {
    position: static !important;
    flex: 0 0 auto;
    display: flex; gap: 10px; align-items: center; flex-wrap: nowrap;
    width: 100%; box-sizing: border-box;
    margin: 0 0 12px 0; padding: 10px 16px;
    background: var(--editor-bar-bg) !important;
    border: 1px solid var(--editor-bar-border);
    border-radius: 12px;
}
#editor-toolbar input.et-dark {
    flex: 1 1 auto; min-width: 120px;
    font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 600;
    border-radius: 8px; padding: 8px 12px;
}
#editor-toolbar .btn, #editor-toolbar select.et-dark {
    flex: 0 0 auto; white-space: nowrap;
}
.et-label {
    color: var(--warn-text); font-size: 0.8rem; font-weight: 600; margin-left: 6px; cursor: default;
    white-space: nowrap;
}
#editor-toolbar .et-dark, .ce-dark {
    background: var(--field-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--field-border) !important;
}
#editor-toolbar .et-dark option, .ce-dark option { background: var(--option-bg); color: var(--text-main); }

#editor-toolbar select.et-dark, #cell-editor-modal select.ce-dark {
    -webkit-appearance: none; appearance: none;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.95rem !important;
    padding: 9px 32px 9px 12px !important;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 10px center;
}
#cell-editor-modal select.ce-dark { font-size: 1rem !important; }

body.edit-mode .cell:not(.empty-cell) { cursor: pointer; box-shadow: inset 0 0 0 2px var(--warn-soft); }
.editable-slot {
    cursor: pointer;
    border: 2px dashed var(--warn-soft) !important;
    display: flex; align-items: center; justify-content: center;
}
.editable-slot::after { content: '+'; color: var(--warn-soft); font-size: 2rem; }
.btn-edit-toggle {
    background: transparent; color: var(--warn-text);
    border: 1px solid var(--warn-border);
    cursor: pointer; padding: 8px; border-radius: 8px;
    transition: all 0.2s ease;
}
.btn-edit-toggle:hover { color: var(--warn-text); background: rgba(255, 221, 0, 0.1); border-color: var(--warn-text); }
body.edit-mode .btn-edit-toggle { 
    color: var(--warn-text-active); /* Darker yellow */
    border-color: var(--warn-text-active); 
    background: rgba(204, 164, 0, 0.15); 
}

.ce-label { display: block; margin: 16px 0 4px; font-size: 0.95rem; color: var(--text-label); font-weight: 600; }
.ce-hint { font-size: 0.8rem; color: var(--text-hint); margin: 4px 0 0 0; }
.ce-help { cursor: help; color: var(--warn-text); }
.ce-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .ce-columns { grid-template-columns: 1fr; } }
#cell-editor-modal .ce-dark {
    font-family: 'Inter', sans-serif !important;
    font-size: 1rem !important;
    padding: 10px 12px !important;
    border-radius: 8px;
}
#cell-editor-modal .btn { font-size: 1rem; padding: 10px 22px; }

.ce-results {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px;
    max-height: 300px; overflow-y: auto;
}
.ce-results img {
    width: 100%; aspect-ratio: 1; object-fit: contain; background: white;
    border-radius: 8px; cursor: pointer; border: 3px solid transparent;
}
.ce-results img.selected { border-color: var(--accent-text); }
.ce-preview img { height: 60px; background: white; border-radius: 8px; margin-top: 6px; }

/* En board-view alineamos arriba siempre (Toolbar flujo) */
#board-view { justify-content: flex-start !important; }

/* Botón Eliminar: mismo peso visual que Guardar, en rojo */
.btn-danger {
    background: var(--danger-bg) !important; color: #fff !important;
    border: none; border-radius: 10px;
    font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1rem;
    padding: 10px 22px; cursor: pointer;
}
.btn-danger:hover { background: var(--danger-bg-hover) !important; transform: translateY(-2px); }

/* F4 — accesibilidad de la barra de cuenta y foco visible (revisión UX/CAA 09/10/2026) */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.btn-account { background: transparent; border: 1px solid var(--btn-border); color: var(--accent-text); font-size: 0.95rem; min-height: 44px; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.btn-account:hover { background: var(--cell-hover); }
#btn-settings, .theme-toggle { min-width: 44px; min-height: 44px; }
button:focus-visible, .btn:focus-visible, .btn-icon:focus-visible, [role="button"]:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }

/* F4-4 — Tablet vinculada (modo dispositivo) */
.link-code-input { font-family: monospace; font-size: 1.8rem; letter-spacing: 0.15em; text-align: center; text-transform: uppercase; }
.link-error { color: var(--error-text); min-height: 1.2em; margin: 8px 0 0; font-size: 0.95rem; }
/* Tablet vinculada (vista de adulto): igual a la de profesionales, sin crear/importar/usuarios ni cuenta */
.device-mode #btn-new-board, .device-mode #btn-open-import, .device-mode #btn-nav-users,
.device-mode #btn-account, .device-mode .bottom-group .divider { display: none !important; }
.device-mode #btn-unlink-device { display: inline-flex !important; align-items: center; }
.device-mode #btn-edit-board { display: none; }
.device-mode.copy-editable #btn-edit-board { display: flex; }
.device-title { width: 100%; color: var(--text-main); margin: 0 0 10px; font-size: 1.6rem; }
.device-empty { color: var(--text-soft); font-size: 1.2rem; }
.device-card { min-height: 160px; justify-content: center; align-items: center; position: relative; overflow: hidden; }
.device-card h3 { font-size: 1.8rem; margin: 0; color: var(--text-main); text-align: center; }
/* Esquina para adultos: mantener apretado 3 s (invisible; fuera del alcance del barrido) */
#device-corner { position: fixed; top: 0; right: 0; width: 32px; height: 32px; z-index: 30001; display: none; touch-action: none; -webkit-user-select: none; user-select: none; }

/* F4-3 — Asignar copias (checkboxes) y fichas de "Mis usuarios" */
.assign-content { max-width: 460px; }
.assign-note { color: var(--text-muted); font-size: 0.95rem; margin: 0 0 12px; }
.assign-option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; cursor: pointer; }
.assign-option input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; }
.assign-option.is-assigned { cursor: default; opacity: 0.65; }
.assign-all { margin-bottom: 8px; font-weight: 600; }
.assign-tag { font-size: 0.85em; color: var(--accent-text); }
.assign-permission-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.assign-permission-row select, .copy-permission { min-height: 44px; }
#btn-confirm-assign, #btn-cancel-assign { min-height: 44px; }

.user-card { padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.user-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-head { justify-content: space-between; }
.user-name { font-size: 1.15rem; }
.user-note { color: var(--text-muted); margin: 0; font-size: 0.95rem; }
.user-tablet { display: flex; flex-direction: column; gap: 8px; }
.user-code { font-family: monospace; font-size: 1rem; background: var(--surface-3); padding: 6px 10px; border-radius: 6px; }
.user-btn { min-height: 44px; padding: 8px 14px; font-size: 0.95rem; }
.user-btn-icon { min-width: 44px; min-height: 44px; border-radius: 8px; }
.user-btn-danger { color: var(--error-text); border-color: var(--error-border); }
.user-btn.is-home { border-color: var(--accent-text); color: var(--accent-text); }
.user-copies { border-top: 1px solid var(--cell-border); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.copy-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.copy-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; background: var(--surface-2); border-radius: 8px; }
.copy-info { display: flex; flex-direction: column; gap: 2px; min-width: 160px; }
.copy-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* F4-3 — Profesional editando la copia de un usuario */
#copy-banner { background: var(--banner-bg); color: var(--banner-text); border: 1px solid var(--banner-border); padding: 10px 16px; border-radius: 10px; margin: 0 0 10px; font-weight: 600; font-size: 1rem; }

/* Acceso con Google (10/10/2026) */
.google-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 15px; font-size: 1.1rem; font-weight: 600; border-radius: 12px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; cursor: pointer; min-height: 52px; }
.google-btn:hover { background: #f5f5f5; }
.google-btn:disabled { opacity: 0.7; cursor: wait; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); margin: 26px 0 12px; font-size: 0.9rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--auth-box-border); }

/* F4-6: Configuración de su tablet (por perfil, en "Mis usuarios") */
.user-settings { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--cell-border); padding-top: 10px; }
.user-settings-toggle { align-self: flex-start; }
.user-settings-panel { display: flex; flex-direction: column; gap: 10px; }
.user-settings-panel[hidden], .user-settings-field[hidden] { display: none; }
.user-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.user-settings-field { display: flex; flex-direction: column; gap: 4px; }
.user-settings-label { font-size: 0.95rem; font-weight: 600; }
.user-settings-select { min-height: 44px; width: 100%; }

/* Menú para adultos en la tablet (10/10/2026) */
.adult-menu { max-width: 440px; width: 92vw; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.adult-menu h3 { margin: 0 0 6px; }
.adult-menu label { color: var(--text-muted); font-size: 0.95rem; }
.adult-menu select, .adult-menu .btn { min-height: 48px; font-size: 1.05rem; width: 100%; }

/* Modo de acceso como botones segmentados (10/10/2026: el select nativo se veía mal en iPad) */
.mode-segmented { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--glass-bg); border: 1px solid var(--cell-border); }
.mode-segmented button { min-height: 40px; padding: 6px 14px; border-radius: 10px; border: none; background: transparent; color: var(--text-main); font: 600 0.95rem 'Inter', sans-serif; cursor: pointer; white-space: nowrap; }
.mode-segmented button:hover { background: var(--cell-hover); }
.mode-segmented button[aria-checked="true"] { background: var(--accent); color: #000; }
.mode-selector[hidden] { display: none !important; }
#top-bar { padding-top: env(safe-area-inset-top, 0px); }

/* Modo Dia/Noche (10/10/2026) */
.theme-toggle { color: var(--text-muted); }
.theme-toggle:hover { color: var(--text-main); }
.theme-toggle svg { pointer-events: none; }
.theme-toggle-auth { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; z-index: 5; opacity: 0.8; }
.theme-toggle-auth:hover, .theme-toggle-auth:focus-visible { opacity: 1; }
/* Ajustes que solo hacen falta en modo dia */
:root[data-theme="light"] #board-search { background: #fff; border: 1px solid var(--input-border); }
:root[data-theme="light"] .picto-label { text-shadow: none; }
/* Barra de progreso del dwell en tarjetas (inline en JS con verde translucido): en claro, verde solido */
:root[data-theme="light"] .board-card .progress-bar { background: #00c271 !important; }

/* El tablero de prueba no se edita */
body.test-board #btn-edit-board { display: none !important; }

/* Home: tarjetas con fila de acciones, badges, etiquetas y filtros (10/10/2026) */
.board-card { justify-content: space-between; gap: 14px; overflow: hidden; }
.board-card-info { width: 100%; min-width: 0; }
.board-card-title { margin: 0; font-size: 1.2rem; color: var(--text-main); overflow-wrap: anywhere; }
.board-card-meta { font-size: 0.85rem; color: var(--text-muted); margin: 6px 0 0; }
.board-card-preview { font-size: 0.8rem; color: var(--text-muted); margin: 2px 0 0; font-style: italic; overflow-wrap: anywhere; }
.board-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.board-card-actions { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; padding-top: 10px; border-top: 1px solid var(--cell-border); }
.board-card-actions .card-action { min-width: 44px; min-height: 44px; border-radius: 10px; padding: 6px; }
.card-action-wrap { position: relative; display: inline-flex; }
.board-card-actions .card-action-danger { color: var(--danger-text); margin-left: auto; }
.board-card-actions .card-action-danger:hover { color: var(--danger-text-hover); background: var(--cell-hover); }
.card-badge { position: absolute; top: 0; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #000; font-size: 0.75rem; font-weight: 700; line-height: 20px; text-align: center; pointer-events: none; box-shadow: 0 0 0 2px var(--modal-solid); }
.card-action-wrap[hidden], .card-badge[hidden], .board-card-tags[hidden], .home-filters[hidden], .filter-chips[hidden],
.user-filter[hidden], .home-filter-empty[hidden], #tags-suggestions-wrap[hidden] { display: none !important; }
.board-card.is-filtered-out { display: none !important; }

.tag-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; line-height: 1.5; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-border); overflow-wrap: anywhere; }
.tag-chip-more { color: var(--text-muted); background: var(--surface-2); border-color: var(--cell-border); }
.tag-chip-edit { font-size: 0.95rem; padding: 2px 4px 2px 12px; }
.tag-chip-remove { min-width: 44px; min-height: 44px; margin: -8px -4px -8px 0; border: none; background: transparent; color: inherit; font-size: 1.3rem; cursor: pointer; border-radius: 999px; }
.tag-chip-remove:hover { color: var(--danger-text); }

.home-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 10px 16px 5px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--cell-border); background: var(--cell-bg); color: var(--text-main); font: 600 0.9rem 'Inter', sans-serif; cursor: pointer; }
.filter-chip:hover { background: var(--cell-hover); }
.filter-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #000; }
.filter-chip:disabled { opacity: 0.5; cursor: not-allowed; }
.user-filter { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.user-filter select { min-height: 44px; min-width: 160px; }
.home-filter-empty { color: var(--text-muted); margin: 0 5px 16px; }

/* Pie de modales: acciones alineadas a la derecha */
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.modal-footer .btn { min-height: 44px; }
.btn-primary:disabled, .btn-primary[disabled] { background: var(--surface-3); color: var(--text-muted); border: 1px dashed var(--btn-border); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Modal de etiquetas */
.tags-content { max-width: 480px; }
.tags-current { display: flex; flex-wrap: wrap; gap: 8px; }
.tags-add-row { display: flex; gap: 8px; }
.tags-add-row .glass-input { flex: 1; min-width: 0; }
.tags-add-row .btn { min-height: 44px; }

/* Configuración (rediseño 10/10/2026) */
.settings-panel { max-width: 560px; width: 92vw; max-height: 90dvh; overflow-y: auto; text-align: left; display: flex; flex-direction: column; gap: 16px; }
.settings-panel .modal-header { display: flex; justify-content: space-between; align-items: center; }
.settings-section { border: 1px solid var(--cell-border); border-radius: 14px; padding: 16px; background: var(--cell-bg); display: flex; flex-direction: column; gap: 6px; }
.settings-section h3 { font-size: 1.05rem; margin: 0 0 4px; color: var(--text-main); }
.settings-section label { font-weight: 600; font-size: 0.95rem; color: var(--text-main); margin-top: 4px; }
.settings-section select { width: 100%; }
.settings-help { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 4px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.settings-grid > div { display: flex; flex-direction: column; gap: 6px; }


/* Miniatura del tablero en la tarjeta (se arma en el momento, no se guarda) */
.board-thumb { display: grid; gap: 2px; width: 100%; height: 120px; margin: 8px 0 4px; padding: 4px; border-radius: 10px; background: var(--cell-bg); border: 1px solid var(--cell-border); overflow: hidden; pointer-events: none; }
.board-thumb-cell { border-radius: 3px; background: var(--cell-hover); display: flex; align-items: center; justify-content: center; overflow: hidden; min-width: 0; min-height: 0; }
.board-thumb-cell img { max-width: 100%; max-height: 100%; object-fit: contain; }
.board-thumb-cell span { font-size: 7px; font-weight: 700; color: #111; line-height: 1; text-align: center; overflow: hidden; }
/* Acciones en una sola fila, eliminar a la derecha */
.board-card-actions { flex-wrap: nowrap !important; align-items: center; }
/* Permiso al dar copia */
.assign-permission-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.assign-permission-help { font-size: 0.85rem; color: var(--text-muted); margin: 6px 0 0; }
#assign-permission[hidden] { display: none !important; }

/* El home no empuja la barra inferior fuera de la pantalla: las tarjetas scrollean adentro (10/10/2026) */
#home-view { min-height: 0; overflow: hidden; align-items: stretch; }
#home-view .gallery-container { min-height: 0; margin: 0 auto; }
#home-view .board-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: start; -webkit-overflow-scrolling: touch; }
/* Tarjetas de la tablet con miniatura */
.device-card { flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 8px; padding: 18px; }
.device-card h3 { text-align: left; font-size: 1.4rem; }
.device-card .board-thumb { height: 150px; }

/* Home estilo "Projects" (10/10/2026): título, pestañas de etiquetas, lupa, menú de orden y pie de tarjeta */
:root { --home-tab-active: rgba(255, 255, 255, 0.12); --home-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
:root[data-theme="light"] { --home-tab-active: rgba(15, 23, 42, 0.08); --home-menu-shadow: 0 12px 32px rgba(15, 23, 42, 0.16); }

#home-view .home-title { margin: 0 5px 18px; font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text-main); }
.home-toolbar { flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 10px 18px 5px; }
.home-tabs { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; min-width: 0; }
.home-tabs[hidden] { display: none !important; }
.home-tab { min-height: 44px; padding: 8px 16px; border: none; border-radius: 999px; background: transparent; color: var(--text-muted); font: 500 0.95rem 'Inter', sans-serif; cursor: pointer; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-tab:hover { color: var(--text-main); background: var(--cell-hover); }
.home-tab[aria-pressed="true"] { background: var(--home-tab-active); color: var(--text-main); font-weight: 600; }
.home-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.home-tools .user-filter { margin-right: 6px; }
.home-tool-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 10px; background: transparent; color: var(--text-muted); cursor: pointer; }
.home-tool-btn:hover, .home-tool-btn[aria-expanded="true"] { background: var(--cell-hover); color: var(--text-main); }
.home-tool-btn[hidden], .home-search-field[hidden], .home-sort-menu[hidden], .home-group[hidden], .board-card-footer[hidden] { display: none !important; }

/* Buscador inline */
.home-search { display: flex; align-items: center; }
.home-search-field { display: flex; align-items: center; gap: 6px; width: 260px; max-width: 40vw; min-height: 44px; padding: 0 2px 0 12px; border-radius: 999px; border: 1px solid var(--field-border); background: var(--field-bg); color: var(--text-muted); box-sizing: border-box; }
.home-search-field:focus-within { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-glow); }
.home-search-field svg { flex: 0 0 auto; }
.home-search-field #board-search, :root[data-theme="light"] .home-search-field #board-search { flex: 1 1 auto; min-width: 0; background: transparent; border: none; font-size: 16px; color: var(--text-main); padding: 8px 0; outline: none; }
.home-search-field #board-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.home-search-close { flex: 0 0 auto; min-width: 40px; min-height: 40px; border: none; border-radius: 999px; background: transparent; color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.home-search-close:hover { color: var(--text-main); background: var(--cell-hover); }

/* Menú de orden */
.home-sort { position: relative; }
.home-sort-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 250px; padding: 6px; border-radius: 12px; background: var(--modal-solid); border: 1px solid var(--modal-border); box-shadow: var(--home-menu-shadow); display: flex; flex-direction: column; }
.home-sort-menu [role^="menuitem"] { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 44px; padding: 8px 12px; border: none; border-radius: 8px; background: transparent; color: var(--text-main); font: 500 0.95rem 'Inter', sans-serif; text-align: left; cursor: pointer; }
.home-sort-menu [role^="menuitem"]:hover, .home-sort-menu [role^="menuitem"]:focus-visible { background: var(--cell-hover); }
.home-sort-menu [role^="menuitem"]:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }
.home-menu-check { color: var(--accent-text); font-weight: 700; visibility: hidden; }
.home-sort-menu [aria-checked="true"] .home-menu-check { visibility: visible; }
.home-menu-sep { height: 1px; margin: 6px 4px; background: var(--modal-border); }

/* Secciones al agrupar por etiqueta (el scroll sigue siendo #board-list) */
#home-view .board-grid.is-grouped { display: flex; flex-direction: column; gap: 28px; }
.home-group { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; }
.home-group-title { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--text-main); overflow-wrap: anywhere; }
.home-group-count { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
.home-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
@media (min-width: 1400px) { .home-group-grid { grid-template-columns: repeat(4, 1fr); } }
.home-empty { color: var(--text-muted); }

/* Pie de tarjeta: última modificación + etiquetas discretas */
.board-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; width: 100%; margin-top: -4px; font-size: 0.8rem; color: var(--text-muted); }
.board-card-time { white-space: nowrap; }
.board-card-footer .board-card-tags { margin: 0; justify-content: flex-end; gap: 4px 12px; min-width: 0; }
.tag-label { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 140px; color: var(--text-muted); font-size: 0.8rem; line-height: 1.4; }
.tag-label-icon { display: inline-flex; flex: 0 0 auto; opacity: 0.8; }
.tag-label-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-label-more { font-weight: 600; }

@media (max-width: 820px) {
    .home-tools { margin-left: 0; width: 100%; justify-content: flex-end; }
    .home-search-field { max-width: 60vw; }
}

/* Tablet: misma barra del home (pestañas, lupa, orden y agrupar); solo se oculta el selector de usuario */
.device-mode #user-filter-wrap { display: none !important; }

/* Home sin título (10/10/2026): la barra queda arriba; "Usuario:" va a la derecha de todo */
#home-view .home-toolbar { margin-top: 0; }
.home-tools .user-filter { margin-right: 0; margin-left: 6px; }
.home-tab { display: inline-flex; align-items: center; }
.home-tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-tab-count { flex: 0 0 auto; white-space: pre; color: var(--text-muted); font-weight: 500; }
.home-tab[aria-pressed="true"] .home-tab-count { color: inherit; }

/* Tarjetas cortadas abajo (10/10/2026): #board-list tiene alto fijo (flex + min-height:0 + scroll) y las filas
   implícitas eran `auto`. Como .board-card tiene overflow:hidden, su mínimo automático es 0 y el algoritmo de la
   grilla, sin espacio libre, dejaba cada fila en su min-height (160px), recortando acciones y pie.
   Las filas toman el alto del contenido completo (todas las de una fila igual: align stretch) y el
   contenido de la tarjeta no se encoge. */
.board-grid, .home-group-grid { grid-auto-rows: max-content; }
.board-card { justify-content: flex-start; }
.board-card > * { flex-shrink: 0; }
.board-card .board-card-info { flex: 1 0 auto; } /* acciones y pie quedan alineados abajo en toda la fila */

/* Recalibrar grisado fuera de Rostro */
#btn-recalibrar:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }

/* --- Páginas del tablero en el editor (10/10/2026): selector compacto + panel desplegable --- */
#editor-toolbar input.et-name { flex: 1 1 220px; min-width: 110px; width: auto; }
@media (max-width: 820px) { #editor-toolbar { flex-wrap: wrap !important; row-gap: 8px; } }
#board-view #editor-toolbar { position: relative !important; } /* ancla del panel de páginas */
#editor-toolbar .ep-nav { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; }
#editor-toolbar .ep-arrow { padding: 6px 10px; font-size: 1.1rem; line-height: 1; }
#editor-toolbar .ep-arrow:disabled { opacity: 0.4; cursor: default; }
#editor-toolbar .ep-current {
    display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; max-width: 380px;
    padding: 7px 12px; border-radius: 8px; cursor: pointer;
    background: var(--field-bg); color: var(--text-main); border: 1px solid var(--field-border);
    font: 600 0.9rem 'Inter', sans-serif;
}
#editor-toolbar .ep-current:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }
#editor-toolbar .ep-count { color: var(--warn-text); font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; }
#editor-toolbar .ep-current-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#editor-toolbar .ep-caret { color: var(--text-muted); flex-shrink: 0; }
#editor-pages {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
    width: min(760px, 100%); box-sizing: border-box;
    display: flex; flex-direction: column; gap: 12px; padding: 14px;
    background: var(--editor-bar-bg); border: 1px solid var(--editor-bar-border); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
#editor-pages[hidden] { display: none; }
#editor-pages .ep-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; max-height: 50vh; overflow-y: auto; padding: 2px; }
#editor-pages .ep-page, #editor-pages .ep-add {
    position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    padding: 6px; border-radius: 10px; cursor: pointer; min-width: 0;
    background: var(--surface-1); border: 1px solid var(--surface-1-border); color: var(--text-main);
    font: 600 0.78rem 'Inter', sans-serif; text-align: left;
}
#editor-pages .ep-page:hover, #editor-pages .ep-add:hover { border-color: var(--surface-hover-border); }
#editor-pages .ep-page.is-active { border: 2px solid var(--accent-text); padding: 5px; box-shadow: 0 0 0 3px var(--accent-soft); }
#editor-pages .ep-page:focus-visible, #editor-pages .ep-add:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }
#editor-pages .ep-thumb { display: block; height: 64px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
#editor-pages .ep-thumb .board-thumb { height: 64px; margin: 0; padding: 2px; gap: 1px; border-radius: 6px; }
#editor-pages .ep-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#editor-pages .ep-start {
    position: absolute; top: 4px; left: 4px; padding: 1px 6px; border-radius: 999px;
    background: var(--accent-text); color: var(--bg-color, #fff); font-size: 0.65rem; font-weight: 700;
}
#editor-pages .ep-add { justify-content: center; align-items: center; border-style: dashed; color: var(--text-muted); min-height: 88px; }
#editor-pages .ep-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--editor-bar-border); }
#editor-pages .ep-rename { flex: 1 1 180px; min-width: 140px; border-radius: 8px; padding: 7px 10px; font: 600 0.9rem 'Inter', sans-serif; }
#editor-pages .btn:disabled { opacity: 0.45; cursor: default; }
#editor-pages .ep-autolabels { flex-basis: 100%; display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-main); cursor: pointer; }
#editor-pages .et-dark { background: var(--field-bg) !important; color: var(--text-main) !important; border: 1px solid var(--field-border) !important; }
#dialog-message { white-space: pre-line; }

/* Celda que abre otra página: esquina doblada con flecha, arriba a la derecha (10/10/2026) */
.cell.cell-nav { border-color: var(--text-muted); }
.cell-nav-mark {
    position: absolute; top: 0; right: 0; z-index: 2; pointer-events: none;
    width: clamp(28px, 18%, 56px); aspect-ratio: 1;
    background: var(--text-main); color: var(--bg-color);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    border-top-right-radius: 10px;
}
.cell-nav-mark svg { position: absolute; top: 10%; right: 10%; width: 46%; height: 46%; }
.dense-grid .cell-nav-mark { width: clamp(16px, 22%, 28px); }

/* --- Compatibilidad con Asterics (10/10/2026) --- */
.cell.cell-unavailable { opacity: 0.55 !important; }
.cell-unavailable-badge {
    position: absolute; left: 6px; bottom: 6px; z-index: 2; pointer-events: none;
    padding: 2px 8px; border-radius: 999px; font: 700 0.7rem 'Inter', sans-serif;
    background: var(--text-main); color: var(--bg-color);
}
body.edit-mode .cell.cell-broken { border: 3px dashed #d93025 !important; }
.cell.cell-prediction { background: var(--surface-2); }
.cell.cell-prediction.is-empty { opacity: 0.5; }
.cell.cell-prediction .picto-label { font-weight: 700; }
.cell.cell-collect { align-items: stretch; justify-content: center; padding: 6px 12px; }
.cell-collect .collect-text {
    font: 700 clamp(0.9rem, 2.2vw, 1.6rem) 'Inter', sans-serif; color: var(--text-main);
    display: flex; justify-content: flex-end; white-space: nowrap; overflow: hidden; /* se ve el final de la frase */
}
#webpage-overlay {
    position: fixed; inset: 0; z-index: 20000; display: flex; flex-direction: column; gap: 10px;
    padding: 12px; background: var(--bg-color);
}
#webpage-overlay .webpage-back { align-self: flex-start; font-size: 1.4rem; padding: 18px 36px; }
#webpage-overlay iframe { flex: 1 1 auto; width: 100%; border: 1px solid var(--surface-1-border); border-radius: 12px; background: #fff; }
#webpage-overlay .webpage-note { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
