/* Horario semanal — pedrogomez.dev/horario
   Mismo lenguaje que el resto de la web (login.css, admin.css): blanco, tinta #111, grises,
   filetes finos, Inter apretada en los titulares y etiquetas en versalitas espaciadas.
   El color solo aparece en las actividades, y cada una elige el suyo. */

:root {
    color-scheme: light;

    --bg: #ffffff;
    --ink: #111111;
    --muted: #696969;
    --soft: #a0a0a0;
    --line: #e9e9e9;
    --line-soft: #f3f3f3;
    --wash: #f7f7f5;
    --danger: #a32d2d;

    --space: clamp(16px, 4vw, 56px);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --float: 0 24px 48px -24px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.04);
    --lift: 0 18px 36px -14px rgba(0, 0, 0, 0.45);

    --gutter: 58px;
    --hour: 48px;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--ink);
    color: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.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;
}

.eyebrow,
.editor-label,
.menu-label {
    margin: 0;
    color: var(--soft);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

kbd {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 0.35em;
    border: 1px solid var(--ink);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    text-align: center;
}

/* ---------- Botones ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s, transform 0.16s var(--ease);
}

.btn:active {
    transform: scale(0.97);
}

.btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 1.8;
}

.btn-primary {
    background: var(--ink);
    color: var(--bg);
}

.btn-primary:hover {
    background: #333;
}

.btn-quiet {
    padding: 0 4px;
    color: var(--ink);
    box-shadow: inset 0 -1px 0 transparent;
}

.btn-quiet:hover {
    box-shadow: inset 0 -1px 0 var(--ink);
}

.btn-danger {
    color: var(--danger);
}

.btn-danger:hover {
    box-shadow: inset 0 -1px 0 var(--danger);
}

.btn[hidden] {
    display: none;
}

.btn-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    transition: border-color 0.2s var(--ease), transform 0.16s var(--ease);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: none;
}

.btn-icon:hover,
.btn-icon[aria-expanded="true"] {
    border-color: var(--line);
}

.btn-icon:active {
    transform: scale(0.94);
}

/* =====================================================================
   Login (mismo esquema que /login)
   ===================================================================== */

.login {
    min-height: 100vh;
    min-height: 100dvh;
}

.login-nav {
    height: 96px;
    padding: 0 var(--space);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 500;
}

.login-nav a {
    transition: opacity 0.3s ease;
}

.login-nav a:hover {
    opacity: 0.55;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    transition: opacity 0.3s ease;
}

.brand:hover {
    opacity: 0.55;
}

.login-main {
    min-height: calc(100vh - 96px);
    min-height: calc(100dvh - 96px);
    padding: clamp(4rem, 10vh, 8rem) var(--space);
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    gap: 8vw;
    align-items: start;
}

.login-intro h1 {
    margin: 1.6rem 0 2.2rem;
    font-size: clamp(4rem, 7.5vw, 8rem);
    font-weight: 700;
    line-height: 0.88;
    letter-spacing: -0.075em;
}

.login-intro h1 span {
    color: #6b6b6b;
    font-weight: 500;
}

.login-intro > p:last-child {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
    font-size: clamp(1.1rem, 1.4vw, 1.4rem);
    line-height: 1.55;
}

.login-card {
    border-top: 1px solid var(--ink);
    padding-top: 1.4rem;
}

.login-card h2 {
    margin: 1.2rem 0 2.4rem;
    font-size: clamp(2rem, 3vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.fields {
    display: grid;
    gap: 1.6rem;
}

.field {
    display: grid;
    gap: 0.55rem;
}

.field-label {
    order: -1;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.field input {
    width: 100%;
    padding: 0.8rem 0 1rem;
    border: 0;
    border-bottom: 1px solid #bdbdbd;
    border-radius: 0;
    background: transparent;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.2s var(--ease);
}

.field input:focus {
    border-color: var(--ink);
}

.submit {
    position: relative;
    margin-top: 0.7rem;
    padding: 1rem 0;
    border: 0;
    border-bottom: 1px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    transition: opacity 0.2s;
}

.submit:hover {
    opacity: 0.55;
}

.submit svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s var(--ease);
}

.submit:hover .arrow {
    transform: translateX(4px);
}

.submit .spinner,
.submit .check,
.is-loading .submit .arrow,
.is-done .submit .arrow {
    display: none;
}

.is-loading .submit .spinner {
    display: block;
    animation: spin 0.8s linear infinite;
}

.is-done .submit .check {
    display: block;
}

.login-error {
    min-height: 22px;
    margin: 1.2rem 0 0;
    color: var(--danger);
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}

.login-error.is-visible {
    opacity: 1;
    transform: none;
}

.is-shaking .fields {
    animation: shake 0.42s var(--ease);
}

.is-leaving .login-main {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s var(--ease-in), transform 0.3s var(--ease-in);
}

@media (prefers-reduced-motion: no-preference) {
    .login-intro > *,
    .login-card {
        animation: rise 0.8s var(--ease) both;
        animation-delay: calc(var(--i, 0) * 70ms);
    }
}

@media (max-width: 800px) {
    .login-nav {
        height: 76px;
    }

    .login-main {
        min-height: auto;
        grid-template-columns: 1fr;
        gap: 4rem;
        padding-top: 3.5rem;
    }

    .login-intro h1 {
        font-size: clamp(3.6rem, 16vw, 6rem);
    }
}

/* =====================================================================
   App
   ===================================================================== */

.app {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bar {
    flex: none;
}

.topnav {
    height: 72px;
    padding: 0 var(--space);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-right: 8px;
    color: var(--soft);
    font-size: 0.8rem;
    white-space: nowrap;
    transition: opacity 0.4s var(--ease);
}

.sync svg {
    width: 13px;
    height: 13px;
    stroke-width: 2;
}

.sync-dot {
    width: 6px;
    height: 6px;
    background: currentColor;
}

.sync[data-state="saving"] .sync-dot {
    animation: pulse 1s var(--ease) infinite;
}

.sync[data-state="error"] {
    color: var(--danger);
}

.sync button {
    padding: 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: none;
    color: var(--ink);
    font-size: 0.8rem;
}

.bar-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 28px var(--space) 22px;
}

.bar-lead {
    min-width: 0;
}

.bar-title {
    margin: 0.7rem 0 0;
    font-size: clamp(2.4rem, 4.6vw, 4.2rem);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -0.07em;
}

.bar-title span {
    color: #6b6b6b;
    font-weight: 500;
}

.bar-summary {
    min-height: 1.4em;
    margin: 0.9rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* Pestañas Semana / Día (como las de estado del panel) */

.seg {
    display: flex;
    gap: 1.8rem;
    flex: none;
}

.seg-thumb {
    display: none;
}

.seg-item {
    padding: 0 0 0.45rem;
    border: 0;
    border-bottom: 1px solid transparent;
    background: none;
    color: var(--soft);
    font-size: 0.95rem;
    transition: color 0.2s var(--ease), border-color 0.3s var(--ease);
}

.seg-item:hover {
    color: var(--ink);
}

.seg-item[aria-selected="true"] {
    color: var(--ink);
    border-color: var(--ink);
}

/* Tira de días (vista de día) */

.daybar {
    display: none;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin: 0 var(--space);
    border-top: 1px solid var(--ink);
}

body[data-view="day"] .daybar {
    display: grid;
}

.daybar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 0 12px;
    border: 0;
    border-right: 1px solid var(--line);
    background: none;
    color: var(--muted);
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.daybar button:last-child {
    border-right: 0;
}

.daybar button:hover {
    background: var(--wash);
}

.daybar-name {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.daybar button.is-today {
    color: var(--ink);
}

.daybar button[aria-selected="true"] {
    background: var(--ink);
    color: var(--bg);
}

.daybar-dots {
    display: flex;
    gap: 3px;
    height: 4px;
}

.daybar-dots i {
    width: 4px;
    height: 4px;
    background: currentColor;
    opacity: 0.5;
}

/* ---------- Tablero ---------- */

.board {
    position: relative;
    flex: 1;
    min-height: 0;
    margin: 0 var(--space);
    border-top: 1px solid var(--ink);
}

body[data-view="day"] .board {
    border-top-color: var(--line);
}

.grid-wrap {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cfcfcf transparent;
}

.grid-wrap::-webkit-scrollbar {
    width: 8px;
}

.grid-wrap::-webkit-scrollbar-thumb {
    border: 2px solid var(--bg);
    background: #cfcfcf;
}

.grid {
    --cols: 7;
}

.grid[data-view="day"] {
    --cols: 1;
}

.grid-head,
.grid-body {
    display: grid;
    grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr));
}

.grid-head {
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.col-head {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 14px 10px 12px;
    border: 0;
    border-left: 1px solid var(--line);
    background: none;
    color: var(--muted);
    text-align: left;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.col-head:hover {
    background: var(--wash);
    color: var(--ink);
}

.col-head:focus-visible {
    outline-offset: -2px;
}

.col-name {
    overflow: hidden;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.col-meta {
    min-height: 18px;
    color: var(--soft);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.col-head.is-today {
    color: var(--ink);
}

.col-head.is-today::before {
    content: "";
    position: absolute;
    left: -1px;
    right: 0;
    top: -1px;
    height: 3px;
    background: var(--ink);
}

.col-short {
    display: none;
}

.grid-body {
    position: relative;
    padding-bottom: 16px;
}

.gutter {
    position: relative;
    height: calc(var(--hours) * var(--hour));
}

.hour {
    position: absolute;
    right: 10px;
    top: calc(var(--i) * var(--hour));
    color: var(--soft);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transform: translateY(-50%);
}

.hour:first-child {
    transform: translateY(3px);
}

.now-label {
    position: absolute;
    right: 4px;
    top: var(--now-y);
    z-index: 2;
    padding: 2px 5px;
    background: var(--ink);
    color: var(--bg);
    font-size: 10.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    transform: translateY(-50%);
}

.col {
    position: relative;
    height: calc(var(--hours) * var(--hour));
    border-left: 1px solid var(--line);
    background-image:
        linear-gradient(to bottom, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
    background-size: 100% var(--hour), 100% calc(var(--hour) / 2);
    background-position: 0 0, 0 calc(var(--hour) / 2);
    cursor: crosshair;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.col.is-today {
    background-color: #fbfbfa;
}

.now {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--now-y);
    z-index: 3;
    height: 1px;
    background: var(--ink);
    pointer-events: none;
}

.now::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -3px;
    width: 7px;
    height: 7px;
    background: var(--ink);
}

/* ---------- Actividades ---------- */

.ev {
    --bg-ev: #111111;
    --fg-ev: #ffffff;
    --hover: rgba(255, 255, 255, 0.1);
    position: absolute;
    top: var(--top);
    left: calc(var(--l) * 1% + 2px);
    width: calc(var(--w) * 1% - 3px);
    height: max(16px, calc(var(--h) - 2px));
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    padding: 6px 8px;
    overflow: hidden;
    border: 0;
    border-radius: 2px;
    background: var(--bg-ev);
    color: var(--fg-ev);
    text-align: left;
    cursor: grab;
    touch-action: pan-y;
    transition:
        top 0.3s var(--ease),
        left 0.3s var(--ease),
        width 0.3s var(--ease),
        height 0.3s var(--ease),
        box-shadow 0.24s var(--ease),
        transform 0.24s var(--ease),
        opacity 0.2s var(--ease);
}

.ev::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--hover);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
}

.ev:hover::after {
    opacity: 1;
}

.ev:focus-visible {
    z-index: 4;
    outline-offset: 2px;
}

.ev[hidden] {
    display: none;
}

.ev[data-color="graphite"] { --bg-ev: #4a4a4a; }
.ev[data-color="stone"] { --bg-ev: #9a9a9a; --fg-ev: #111111; --hover: rgba(0, 0, 0, 0.06); }
.ev[data-color="mist"] { --bg-ev: #ececec; --fg-ev: #111111; --hover: rgba(0, 0, 0, 0.04); }
.ev[data-color="paper"] { --bg-ev: #ffffff; --fg-ev: #111111; --hover: rgba(0, 0, 0, 0.03); box-shadow: inset 0 0 0 1px var(--ink); }
.ev[data-color="red"] { --bg-ev: #9e3b32; }
.ev[data-color="blue"] { --bg-ev: #34558b; }
.ev[data-color="green"] { --bg-ev: #3f6e52; }
.ev[data-color="yellow"] { --bg-ev: #8a6a1f; }
.ev[data-color="purple"] { --bg-ev: #5d4b82; }
.ev[data-color="teal"] { --bg-ev: #2f6b6e; }
.ev[data-color="orange"] { --bg-ev: #a5552a; }

.ev-title {
    flex: none;
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--lines, 2);
    overflow-wrap: anywhere;
}

.ev-meta {
    flex: none;
    overflow: hidden;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    opacity: 0.75;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ev.is-compact {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding-top: 0;
    padding-bottom: 0;
}

.ev.is-compact .ev-title {
    max-width: 100%;
    -webkit-line-clamp: 1;
    white-space: nowrap;
}

.ev.is-tiny .ev-meta {
    display: none;
}

.ev-resize {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 8px;
    cursor: ns-resize;
}

.ev-resize::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 16px;
    height: 1px;
    margin-left: -8px;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.2s;
}

.ev:hover .ev-resize::before {
    opacity: 0.6;
}

.ev.is-dragging,
.ev.is-resizing {
    z-index: 6;
    cursor: grabbing;
    box-shadow: var(--lift);
    transition: box-shadow 0.24s var(--ease), transform 0.24s var(--ease), height 0.08s linear;
}

.ev[data-color="paper"].is-dragging,
.ev[data-color="paper"].is-resizing {
    box-shadow: inset 0 0 0 1px var(--ink), var(--lift);
}

.ev.is-dragging {
    transform: scale(1.02);
}

/* Ctrl + arrastrar: la actividad que se mueve es la copia */
.ev.is-copying::before {
    content: "+";
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    background: var(--bg);
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    animation: pop-in 0.18s var(--ease);
}

.ev.is-ghost {
    z-index: 6;
    pointer-events: none;
    opacity: 0.85;
    outline: 1px dashed var(--ink);
    outline-offset: 2px;
    transition: height 0.08s linear, top 0.08s linear;
}

.ev.is-selected {
    z-index: 4;
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.ev.is-leaving {
    opacity: 0;
    transform: scale(0.94);
    pointer-events: none;
}

.ev.is-flash {
    animation: flash 0.6s var(--ease);
}

@media (prefers-reduced-motion: no-preference) {
    .ev.is-entering {
        animation: ev-in 0.5s var(--ease) both;
        animation-delay: var(--d, 0ms);
    }
}

/* Vista de día */

.grid[data-view="day"] .col-head:not(.is-active),
.grid[data-view="day"] .col:not(.is-active) {
    display: none;
}

.grid[data-view="day"] .col-name {
    font-size: 0.85rem;
}

.grid[data-view="day"] .ev {
    padding: 9px 12px;
}

.grid[data-view="day"] .ev-title {
    font-size: 15px;
}

.grid[data-view="day"] .ev-meta {
    font-size: 12.5px;
}

/* Transiciones de vista */

::view-transition-group(*) {
    animation-duration: 0.42s;
    animation-timing-function: var(--ease);
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.26s;
}

.vt-slide-next::view-transition-old(day-col) { animation: 0.32s var(--ease) both slide-out-left; }
.vt-slide-next::view-transition-new(day-col) { animation: 0.32s var(--ease) both slide-in-right; }
.vt-slide-prev::view-transition-old(day-col) { animation: 0.32s var(--ease) both slide-out-right; }
.vt-slide-prev::view-transition-new(day-col) { animation: 0.32s var(--ease) both slide-in-left; }

/* ---------- Vacío ---------- */

.empty {
    position: absolute;
    left: 50%;
    top: 46%;
    z-index: 7;
    width: min(calc(100% - 32px), 380px);
    padding: 22px 24px 24px;
    border-top: 1px solid var(--ink);
    background: var(--bg);
    box-shadow: var(--float);
    transform: translate(-50%, -50%);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.empty[hidden] {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -46%);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0s 0.2s;
}

.empty-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.05em;
}

.empty-copy {
    margin: 0.8rem 0 1.4rem;
    color: var(--muted);
    font-size: 0.92rem;
}

/* ---------- Menú ---------- */

.menu {
    position: fixed;
    z-index: 30;
    width: 260px;
    padding: 8px 0;
    border: 1px solid var(--ink);
    background: var(--bg);
    box-shadow: var(--float);
    transform-origin: top right;
    animation: pop-in 0.2s var(--ease);
}

.menu[hidden] {
    display: none;
}

.menu.is-closing {
    animation: pop-out 0.14s var(--ease-in) forwards;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 38px;
    padding: 0 16px;
    border: 0;
    background: none;
    color: var(--ink);
    font-size: 0.9rem;
    text-align: left;
    transition: background-color 0.12s;
}

.menu-item svg {
    width: 17px;
    height: 17px;
    color: var(--muted);
}

.menu-item:hover,
.menu-item:focus-visible {
    outline: none;
    background: var(--wash);
}

.menu-item-danger,
.menu-item-danger svg {
    color: var(--danger);
}

.menu-sep {
    height: 1px;
    margin: 8px 16px;
    background: var(--line);
}

.menu-range {
    padding: 8px 16px;
}

.menu-label {
    display: block;
    margin-bottom: 8px;
}

.menu-range-fields {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--soft);
}

.menu-range-fields label {
    flex: 1;
}

.menu-hints {
    padding: 4px 16px 6px;
}

.menu-hints dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 7px 12px;
    margin: 0;
    font-size: 0.8rem;
}

.menu-hints dt {
    color: var(--muted);
}

.menu-hints dd {
    margin: 0;
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

@media (hover: none) {
    .menu-hints,
    .menu-hints + .menu-sep {
        display: none;
    }
}

.menu select {
    width: 100%;
    height: 34px;
    padding: 0 2px;
    border: 0;
    border-bottom: 1px solid #bdbdbd;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

/* ---------- Editor ---------- */

.editor {
    position: fixed;
    inset: auto;
    width: 360px;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    color: var(--ink);
}

.editor::backdrop {
    background: transparent;
}

.editor-card {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 20px 22px 18px;
    border: 1px solid var(--ink);
    background: var(--bg);
    box-shadow: var(--float);
    transform-origin: var(--origin, center);
}

.editor[open] .editor-card {
    animation: pop-in 0.26s var(--ease);
}

.editor.is-closing .editor-card {
    animation: pop-out 0.16s var(--ease-in) forwards;
}

.editor-name {
    width: 100%;
    margin-bottom: 18px;
    padding: 0 0 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: none;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.045em;
    outline: none;
    transition: border-color 0.2s var(--ease);
}

.editor-name:focus {
    border-color: var(--ink);
}

.editor-name::placeholder {
    color: #c4c4c4;
}

.editor-days {
    margin: 0 0 6px;
    padding: 0;
    border: 0;
}

.editor-label {
    margin-bottom: 8px;
    padding: 0;
}

.day-chips {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border: 1px solid var(--line);
}

.day-chip {
    height: 36px;
    padding: 0;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: var(--bg);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.day-chip:last-child {
    border-right: 0;
}

.day-chip:hover {
    background: var(--wash);
    color: var(--ink);
}

.day-chip[aria-pressed="true"] {
    background: var(--ink);
    color: var(--bg);
}

.day-chip:focus-visible {
    outline-offset: -2px;
}

.editor-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    border-bottom: 1px solid var(--line);
}

.editor-row:first-of-type {
    margin-top: 10px;
}

.editor-row-top {
    align-items: flex-start;
    padding-top: 13px;
}

.editor-row > svg {
    flex: none;
    width: 17px;
    height: 17px;
    color: var(--soft);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.editor-row input,
.editor-row textarea {
    min-width: 0;
    flex: 1;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.95rem;
    outline: none;
}

.editor-row textarea {
    min-height: 44px;
    max-height: 140px;
    padding-bottom: 8px;
    resize: none;
    field-sizing: content;
}

.editor-row input::placeholder,
.editor-row textarea::placeholder {
    color: var(--soft);
}

.editor-time label {
    flex: none;
}

.editor-time input {
    width: auto;
    height: 30px;
    padding: 0 2px;
    border-bottom: 1px solid #bdbdbd;
    border-radius: 0;
    font-variant-numeric: tabular-nums;
}

.editor-time input:focus {
    border-color: var(--ink);
}

.editor-time input::-webkit-calendar-picker-indicator {
    display: none;
}

.editor-dash {
    color: var(--soft);
}

.editor-duration {
    margin-left: auto;
    color: var(--soft);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 16px 0 4px;
    padding: 0 2px;
    border: 0;
}

.swatch {
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: var(--c);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.swatch[value="paper"],
.swatch[value="mist"] {
    box-shadow: inset 0 0 0 1px #cfcfcf;
}

.swatch:hover {
    transform: translateY(-2px);
}

.swatch:checked {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ink);
}

.swatch[value="paper"]:checked,
.swatch[value="mist"]:checked {
    box-shadow: inset 0 0 0 1px #cfcfcf, 0 0 0 2px var(--bg), 0 0 0 3px var(--ink);
}

.swatch:focus-visible {
    outline-offset: 4px;
}

.editor-error {
    margin: 12px 0 0;
    color: var(--danger);
    font-size: 0.85rem;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
}

.editor-spacer {
    flex: 1;
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: calc(100vw - 32px);
    padding: 12px 14px 12px 18px;
    background: var(--ink);
    color: var(--bg);
    font-size: 0.9rem;
    transform: translateX(-50%);
    transition: opacity 0.26s var(--ease), transform 0.26s var(--ease), visibility 0s;
}

.toast[hidden] {
    display: flex;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 14px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0s 0.2s;
}

.toast-action {
    padding: 0 0 1px;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: none;
    color: var(--bg);
    font-size: 0.9rem;
    font-weight: 600;
}

.toast-action:empty {
    display: none;
}

.toast-action:hover {
    opacity: 0.7;
}

/* ---------- Animaciones ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.3; } }

@keyframes shake {
    15% { transform: translateX(-8px); }
    35% { transform: translateX(6px); }
    55% { transform: translateX(-3px); }
    75% { transform: translateX(2px); }
}

@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes ev-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(4px); } }
@keyframes flash { 30% { outline: 2px solid var(--ink); outline-offset: 3px; } }
@keyframes slide-out-left { to { opacity: 0; transform: translateX(-10%); } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(10%); } }
@keyframes slide-out-right { to { opacity: 0; transform: translateX(10%); } }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-10%); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after,
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Tableta ---------- */

@media (max-width: 1080px) {
    .col-long {
        display: none;
    }

    .col-short {
        display: inline;
    }

    .grid[data-view="day"] .col-long {
        display: inline;
    }

    .grid[data-view="day"] .col-short {
        display: none;
    }
}

/* ---------- Móvil: la semana entera en siete columnas estrechas ---------- */

@media (max-width: 759px) {
    :root {
        --gutter: 34px;
        --hour: 46px;
    }

    .topnav {
        height: 60px;
        padding: 0 16px;
    }

    .brand {
        font-size: 1.1rem;
    }

    .bar-actions {
        gap: 6px;
    }

    .sync-label {
        display: none;
    }

    .sync {
        margin-right: 2px;
    }

    #new-event {
        width: 38px;
        padding: 0;
    }

    #new-event span {
        display: none;
    }

    .bar-inner {
        gap: 12px;
        padding: 14px 16px 12px;
    }

    .eyebrow {
        font-size: 0.62rem;
    }

    .bar-title {
        margin-top: 0.35rem;
        font-size: 1.85rem;
        white-space: nowrap;
    }

    .bar-summary {
        display: none;
    }

    .seg-item {
        font-size: 0.9rem;
    }

    .seg {
        gap: 1.2rem;
    }

    .daybar {
        margin: 0;
    }

    .grid[data-view="day"] .grid-head {
        display: none;
    }

    .board {
        margin: 0;
    }

    .col-head {
        align-items: center;
        padding: 9px 0 8px;
    }

    .col-head:hover {
        background: none;
    }

    .col-name {
        font-size: 0.62rem;
        letter-spacing: 0.04em;
    }

    .col-meta {
        display: none;
    }

    .col {
        cursor: default;
    }

    .hour {
        right: 5px;
        font-size: 9.5px;
        letter-spacing: -0.02em;
    }

    .now-label {
        right: 1px;
        padding: 1px 2px;
        font-size: 9px;
    }

    /* En columnas de ~50 px no caben dos actividades lado a lado: se escalonan en cascada. */
    .grid[data-view="week"] .ev {
        left: calc(var(--lane, 0) * 7px + 1px);
        width: calc(100% - var(--lane, 0) * 7px - 2px);
        z-index: calc(1 + var(--lane, 0));
        padding: 3px 3px 2px;
        border-radius: 1px;
        box-shadow: 0 0 0 1px var(--bg);
    }

    .grid[data-view="week"] .ev[data-color="paper"] {
        box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 1px var(--bg);
    }

    .grid[data-view="week"] .ev-title {
        font-size: 10px;
        line-height: 1.15;
        letter-spacing: -0.02em;
        -webkit-line-clamp: var(--lines-m, 3);
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .grid[data-view="week"] .ev-meta,
    .grid[data-view="week"] .ev-resize {
        display: none;
    }

    .grid[data-view="week"] .ev.is-compact {
        align-items: flex-start;
        padding-top: 2px;
    }

    .grid[data-view="week"] .ev.is-compact .ev-title {
        white-space: normal;
    }

    .editor {
        inset: auto 0 0 0 !important;
        width: 100%;
        max-width: none;
    }

    .editor::backdrop {
        background: rgba(17, 17, 17, 0.3);
        animation: fade-in 0.24s var(--ease);
    }

    .editor-card {
        padding: 18px 18px max(18px, env(safe-area-inset-bottom));
        border: 0;
        border-top: 1px solid var(--ink);
    }

    .editor[open] .editor-card {
        animation: sheet-in 0.34s var(--ease);
    }

    .editor.is-closing .editor-card {
        animation: sheet-out 0.22s var(--ease-in) forwards;
    }

    .day-chip {
        height: 42px;
    }

    .swatches {
        gap: 8px;
    }

    .swatch {
        width: 26px;
        height: 26px;
    }

    .editor-actions .btn {
        height: 42px;
    }
}

/* ---------- Impresión: el horario de papel de toda la vida ---------- */

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    :root {
        --gutter: 14mm;
    }

    .grid {
        --hour: calc(160mm / var(--hours));
    }

    .app {
        height: auto;
        overflow: visible;
    }

    .topnav,
    .seg,
    .daybar,
    .empty,
    .toast,
    .menu,
    .editor,
    .now,
    .now-label {
        display: none !important;
    }

    .bar-inner {
        padding: 0 0 4mm;
    }

    .bar-title {
        font-size: 24pt;
    }

    .board {
        margin: 0;
        overflow: visible;
    }

    .grid-wrap {
        height: auto;
        overflow: visible;
    }

    .grid {
        --cols: 7 !important;
    }

    .grid-head {
        position: static;
        display: grid !important;
    }

    .grid .col-head {
        display: flex !important;
    }

    .grid .col {
        display: block !important;
        background-color: transparent !important;
    }

    .col-head.is-today::before {
        display: none;
    }

    .col-long {
        display: inline !important;
    }

    .col-short {
        display: none !important;
    }

    .ev {
        animation: none !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* =====================================================================
   Acceso: pestañas Entrar / Crear cuenta
   ===================================================================== */

.login-tabs {
    display: flex;
    gap: 1.6rem;
}

.login-tab {
    padding-bottom: 0.35rem;
    color: var(--soft);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: inset 0 -1px 0 transparent;
    transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.login-tab:hover {
    color: var(--ink);
}

.login-tab[aria-current="page"] {
    color: var(--ink);
    box-shadow: inset 0 -1px 0 var(--ink);
}

.field-hint {
    display: none;
    color: var(--muted);
    font-size: 0.8rem;
}

.is-signup .field-hint {
    display: block;
}

.menu-account {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* =====================================================================
   Panel del administrador (/horario/admin)
   ===================================================================== */

.admin {
    min-height: 100vh;
    min-height: 100dvh;
}

.admin-main {
    padding: clamp(2.5rem, 7vh, 5rem) var(--space) 5rem;
}

.admin-head .bar-title {
    margin-top: 0.9rem;
}

.admin-section {
    margin-top: clamp(3rem, 7vh, 4.5rem);
    padding-top: 1.2rem;
    border-top: 1px solid var(--ink);
}

.admin-title {
    margin: 0 0 1.4rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.admin-note {
    max-width: 60ch;
    margin: -0.6rem 0 1.6rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.admin code {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.admin-table th {
    padding: 0 16px 10px 0;
    color: var(--soft);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 16px 14px 0;
    border-top: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
}

.admin-user {
    font-weight: 600;
}

.admin-ip {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.82rem;
}

.admin-tag {
    margin-left: 6px;
    padding: 2px 6px;
    background: var(--wash);
    color: var(--danger);
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-actions {
    text-align: right;
}

.admin-actions .btn + .btn {
    margin-left: 12px;
}

.btn.is-armed {
    background: var(--danger);
    color: var(--bg);
    padding: 0 12px;
}

.admin-empty {
    margin: 1rem 0 0;
    color: var(--muted);
}

.admin-block {
    display: grid;
    grid-template-columns: minmax(160px, 260px) minmax(200px, 1fr) auto;
    gap: 1.4rem;
    align-items: end;
    max-width: 820px;
    margin-bottom: 1.6rem;
}

.admin-block .field input {
    padding: 0.5rem 0 0.7rem;
    font-size: 1rem;
}

.admin-blocked {
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-blocked li {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.admin-meta {
    flex: 1;
    min-width: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* En el móvil cada cuenta es una ficha con sus datos etiquetados */
@media (max-width: 800px) {
    .admin-table thead {
        display: none;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
    }

    .admin-table tr {
        padding: 12px 0;
        border-top: 1px solid var(--line);
    }

    .admin-table td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        padding: 4px 0;
        border-top: 0;
        white-space: normal;
    }

    .admin-table td[data-label]::before {
        content: attr(data-label);
        color: var(--soft);
        font-family: 'Inter', sans-serif;
        font-size: 0.72rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .admin-table td.admin-actions {
        justify-content: flex-end;
        padding-top: 8px;
    }

    .admin-block {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   Semana tipo / cambios de la semana
   Lo fijo baja a gris por debajo y lo de esta semana va en color, encima.
   ===================================================================== */

.modes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    margin-top: 1.1rem;
}

.modebar {
    display: flex;
    border: 1px solid var(--ink);
}

.mode-item {
    height: 34px;
    padding: 0 14px;
    border: 0;
    background: var(--bg);
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.mode-item + .mode-item {
    border-left: 1px solid var(--ink);
}

.mode-item:hover {
    background: var(--wash);
}

.mode-item[aria-selected="true"] {
    background: var(--ink);
    color: var(--bg);
}

.mode-item:focus-visible {
    outline-offset: 2px;
}

.weeknav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.weeknav[hidden] {
    display: none;
}

.week-step svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.week-label {
    min-width: 7.5em;
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.week-today {
    height: 30px;
    font-size: 0.82rem;
}

.week-today[hidden] {
    display: none;
}

body[data-mode="week"] .board {
    border-top-width: 3px;
}

.col-date {
    margin-left: 0.4em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.col-date:empty {
    display: none;
}

/* Capa gris: la semana tipo cuando se editan los cambios de una semana */
.ev.is-base {
    --bg-ev: #efefed;
    --fg-ev: #7d7d7d;
    z-index: 0;
    box-shadow: inset 0 0 0 1px #e2e2df;
    pointer-events: none;
}

.ev.is-base[data-color] {
    --bg-ev: #efefed;
    --fg-ev: #7d7d7d;
}

.ev.is-base .ev-resize {
    display: none;
}

/* Lo de esta semana, encima y algo desplazado para que asome lo gris de debajo */
.ev.is-week {
    left: calc(10% + var(--l) * 0.9% + 1px);
    width: calc(var(--w) * 0.9% - 3px);
    z-index: 2;
    box-shadow: 0 0 0 2px var(--bg);
}

.ev.is-week[data-color="paper"] {
    box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 2px var(--bg);
}

.ev.is-week.is-dragging,
.ev.is-week.is-resizing {
    z-index: 6;
}

@media (max-width: 759px) {
    .modes {
        width: 100%;
        gap: 8px 12px;
        margin-top: 0.7rem;
    }

    .mode-item {
        height: 32px;
        padding: 0 10px;
        font-size: 0.78rem;
    }

    .weeknav {
        margin-left: -6px;
    }

    .week-label {
        min-width: 6.5em;
        font-size: 0.82rem;
    }

    .col-date {
        margin-left: 0.25em;
    }

    .grid[data-view="week"] .ev.is-week {
        left: calc(var(--lane, 0) * 7px + 6px);
        width: calc(100% - var(--lane, 0) * 7px - 7px);
        z-index: calc(2 + var(--lane, 0));
        box-shadow: 0 0 0 1px var(--bg);
    }

    .grid[data-view="week"] .ev.is-week[data-color="paper"] {
        box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 1px var(--bg);
    }
}

@media print {
    .modes {
        display: none;
    }

    .ev.is-base {
        box-shadow: inset 0 0 0 1px #bbb !important;
    }
}

/* =====================================================================
   Hecho y registro
   ===================================================================== */

.ev.is-done {
    opacity: 0.55;
}

.ev.is-done .ev-title,
.ev.is-done .ev-meta {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.log-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

/* Panel lateral del registro */
.log {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(17, 17, 17, 0.16);
    animation: fade-in 0.2s var(--ease);
}

.log[hidden] {
    display: none;
}

.log.is-closing {
    animation: fade-out 0.18s var(--ease-in) forwards;
}

.log-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(460px, 100%);
    overflow-y: auto;
    padding: 28px 32px 40px;
    border-left: 1px solid var(--ink);
    background: var(--bg);
    animation: log-in 0.32s var(--ease);
}

.log.is-closing .log-panel {
    animation: log-out 0.18s var(--ease-in) forwards;
}

.log-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.log-title {
    margin: 0.5rem 0 0;
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.log-close svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

.log-summary {
    margin: 1rem 0 1.6rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.log-week {
    padding: 18px 0 20px;
    border-top: 1px solid var(--ink);
}

.log-week + .log-week {
    border-top-color: var(--line);
}

.log-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.log-head h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.log-tag {
    color: var(--soft);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.log-open {
    height: 26px;
    margin-left: auto;
    font-size: 0.8rem;
}

.log-stats {
    margin: 0.35rem 0 0.6rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.log-bar {
    position: relative;
    height: 3px;
    background: var(--line);
}

.log-bar::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--p, 0) * 1%);
    background: var(--ink);
    transition: width 0.4s var(--ease);
}

.log-items {
    display: grid;
    gap: 6px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.88rem;
}

.log-items li {
    display: grid;
    grid-template-columns: 4.2em 3.4em 1fr;
    align-items: baseline;
}

.log-day {
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.log-time {
    color: var(--soft);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.log-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

@keyframes log-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes log-out { to { transform: translateX(30px); opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

@media (max-width: 759px) {
    .log-button span {
        display: none;
    }

    .log-button {
        width: 34px;
        padding: 0;
    }

    .log-panel {
        top: auto;
        width: 100%;
        max-height: 88dvh;
        padding: 22px 18px max(24px, env(safe-area-inset-bottom));
        border-left: 0;
        border-top: 1px solid var(--ink);
        animation: sheet-in 0.34s var(--ease);
    }

    .log.is-closing .log-panel {
        animation: sheet-out 0.2s var(--ease-in) forwards;
    }

    .log-title {
        font-size: 2.1rem;
    }
}

@media print {
    .log,
    .log-button {
        display: none !important;
    }
}

/* Tareas cortas: la letra baja con la altura de la caja (--fs y --fs-m los calcula app.js) */
.ev.is-tiny .ev-title {
    font-size: var(--fs, 12.5px);
    line-height: 1.1;
}

.ev.is-tiny {
    padding-top: 1px;
    padding-bottom: 1px;
}

@media (max-width: 759px) {
    .grid[data-view="week"] .ev.is-tiny .ev-title {
        font-size: var(--fs-m, 10px);
        line-height: 1.05;
    }

    .grid[data-view="week"] .ev.is-tiny {
        padding-top: 1px;
    }
}
