/* ---------------------------------------------------------------------------
   Tracker de horas — hoja de estilo única.
   Neutros cálidos, un solo acento. Claro y oscuro según el sistema.
   --------------------------------------------------------------------------- */

:root {
    --bg: #faf9f7;
    --surface: #ffffff;
    --surface-2: #f4f2ef;
    --border: #e4dfd9;
    --border-strong: #d0c9c1;
    --text: #232120;
    --muted: #6f6a64;
    --faint: #9c958d;
    --accent: #b4552f;
    --accent-soft: #f7ece6;
    --ok: #3f7d52;
    --ok-soft: #e9f2ea;
    --warn: #9a6b1e;
    --warn-soft: #f8f0df;
    --alert: #b4382c;
    --alert-soft: #fbeae7;
    --shadow: 0 1px 2px rgba(35, 33, 32, .06), 0 4px 12px rgba(35, 33, 32, .04);
    --radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #171614;
        --surface: #211f1d;
        --surface-2: #2a2724;
        --border: #383431;
        --border-strong: #4a4541;
        --text: #ece8e3;
        --muted: #a49d95;
        --faint: #7d766f;
        --accent: #e08256;
        --accent-soft: #33231b;
        --ok: #7fb98d;
        --ok-soft: #1e2c22;
        --warn: #ddab60;
        --warn-soft: #322718;
        --alert: #e8806f;
        --alert-soft: #35201d;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .2);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -.011em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.08rem; }
h3 { font-size: .94rem; }
p { margin: 0 0 .8rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem 5rem; }

/* --- Navegación --------------------------------------------------------- */

.topbar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.75rem;
}
.topbar-inner {
    max-width: 1180px; margin: 0 auto; padding: .7rem 1.25rem;
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand {
    font-weight: 660; letter-spacing: -.02em; color: var(--text);
    display: flex; align-items: center; gap: .5rem; font-size: .96rem;
}
.brand:hover { text-decoration: none; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.navlinks { display: flex; gap: .15rem; flex-wrap: wrap; flex: 1; }
.navlinks a {
    padding: .38rem .7rem; border-radius: 7px; color: var(--muted);
    font-size: .89rem; font-weight: 500;
}
.navlinks a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.navlinks a.on { background: var(--accent-soft); color: var(--accent); font-weight: 570; }

/* --- Bloques ------------------------------------------------------------ */

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 1.25rem; overflow: hidden;
}
.card-head {
    padding: .85rem 1.1rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.card-head .grow { flex: 1; }
.card-body { padding: 1.1rem; }
.card-body.tight { padding: .7rem 1.1rem; }

.section-title {
    display: flex; align-items: baseline; gap: .6rem;
    margin: 2rem 0 .8rem;
}
.step {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: .78rem; font-weight: 700;
    flex: none;
}
.step.done { background: var(--ok); }

.pagehead {
    display: flex; align-items: center; gap: 1rem;
    flex-wrap: wrap; margin-bottom: 1.25rem;
}
.pagehead .grow { flex: 1; }
.sub { color: var(--muted); font-size: .88rem; margin: .15rem 0 0; }

/* --- Tiles de métricas -------------------------------------------------- */

.tiles {
    display: grid; gap: .8rem;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    margin-bottom: 1.5rem;
}
.tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .85rem .95rem;
}
.tile .k {
    font-size: .73rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--faint); font-weight: 600; margin-bottom: .3rem;
}
.tile .v { font-size: 1.42rem; font-weight: 640; letter-spacing: -.02em; line-height: 1.15; }
.tile .n { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.tile.is-alert { border-color: var(--alert); background: var(--alert-soft); }
.tile.is-alert .v { color: var(--alert); }
.tile.is-ok .v { color: var(--ok); }

/* --- Tablas ------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .7rem; text-align: left; vertical-align: middle; }
th {
    font-size: .73rem; text-transform: uppercase; letter-spacing: .045em;
    color: var(--faint); font-weight: 640; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 620; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .84rem; }
.tiny { font-size: .76rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84em; }
.nowrap { white-space: nowrap; }
.text-alert { color: var(--alert); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }

/* --- Badges ------------------------------------------------------------- */

.badge {
    display: inline-block; padding: .13rem .45rem; border-radius: 5px;
    font-size: .73rem; font-weight: 600; white-space: nowrap;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.alert { background: var(--alert-soft); color: var(--alert); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.kind-sesion { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.kind-produccion { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.kind-comercial { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.kind-admin { background: var(--surface-2); color: var(--muted); }

/* --- Avisos ------------------------------------------------------------- */

.notice {
    display: flex; gap: .6rem; align-items: flex-start;
    padding: .7rem .9rem; border-radius: 8px; margin-bottom: .55rem;
    font-size: .89rem; border: 1px solid transparent;
}
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.error, .notice.alert { background: var(--alert-soft); color: var(--alert); }
.notice.info { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.notice .ico { font-weight: 700; flex: none; line-height: 1.45; }

.alert-stack { margin-bottom: 1.5rem; }

/* --- Formularios -------------------------------------------------------- */

label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .28rem; }
input[type=text], input[type=password], input[type=date], input[type=number],
input[type=search], select, textarea {
    width: 100%; padding: .5rem .65rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 7px;
    font: inherit; font-size: .9rem;
}
textarea { min-height: 5rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field { margin-bottom: .9rem; }
.field .help { font-size: .78rem; color: var(--faint); margin-top: .28rem; font-weight: 400; }
.grid { display: grid; gap: .9rem; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); }

.check { display: flex; align-items: flex-start; gap: .5rem; font-size: .88rem; color: var(--text); font-weight: 500; }
.check input { width: auto; margin-top: .22rem; flex: none; }

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

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .48rem .85rem; border-radius: 7px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: .875rem; font-weight: 560; cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--alert); border-color: var(--alert); background: transparent; }
.btn.danger:hover { background: var(--alert-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: .3rem .6rem; font-size: .8rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* --- Barras de progreso ------------------------------------------------- */

.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: .35rem; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.bar > span.warn { background: var(--warn); }
.bar > span.alert { background: var(--alert); }

/* --- Bitácora ----------------------------------------------------------- */

.timeline { position: relative; padding-left: 1.35rem; }
.timeline::before {
    content: ''; position: absolute; left: 4px; top: .4rem; bottom: .4rem;
    width: 2px; background: var(--border);
}
.tl-item { position: relative; padding-bottom: 1.15rem; }
.tl-item::before {
    content: ''; position: absolute; left: -1.35rem; top: .42rem;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--accent);
}
.item-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .35rem; }
.item-list li {
    display: flex; gap: .55rem; align-items: flex-start;
    font-size: .88rem; padding: .3rem 0;
}
.item-list .badge { flex: none; margin-top: .08rem; }
.item-row {
    display: flex; gap: .6rem; align-items: flex-start;
    padding: .55rem .7rem; border: 1px solid var(--border);
    border-radius: 7px; margin-bottom: .4rem; background: var(--surface);
}
.item-row.done { opacity: .55; }

.empty {
    text-align: center; padding: 2.25rem 1rem; color: var(--faint); font-size: .9rem;
}

/* --- Tablero de tareas -------------------------------------------------- */

.board {
    display: grid; gap: .8rem;
    grid-template-columns: repeat(4, minmax(210px, 1fr));
    overflow-x: auto; padding-bottom: .5rem;
}
.board-col {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); display: flex; flex-direction: column; min-width: 210px;
}
.board-head {
    padding: .6rem .75rem; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
    font-size: .84rem;
}
.board-body { padding: .5rem; display: grid; gap: .5rem; align-content: start; }

.task {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: .6rem .7rem;
    cursor: grab;
}
.task:active { cursor: grabbing; }
.task.arrastrando { opacity: .4; }
.board-col.encima { background: var(--accent-soft); border-color: var(--accent); }
.board-col.encima .board-body { min-height: 3rem; }
.col-vacia { padding: .8rem; text-align: center; }

/* En pantallas táctiles el drag nativo no existe: quedan los botones ← → */
@media (hover: none) {
    .task { cursor: default; }
}
.task.done { opacity: .55; }
.task.done .task-title { text-decoration: line-through; }
.task-title { font-size: .88rem; font-weight: 550; line-height: 1.35; }
.task-meta { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .45rem; }
.task-meta .badge { font-size: .68rem; }
.task-actions {
    display: flex; gap: .1rem; margin-top: .4rem;
    padding-top: .4rem; border-top: 1px solid var(--border);
}
.task-actions .btn { padding: .15rem .4rem; font-size: .78rem; }

@media (max-width: 900px) {
    .board { grid-template-columns: repeat(4, minmax(180px, 1fr)); }
}

/* --- Login -------------------------------------------------------------- */

.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.login-card { width: 100%; max-width: 340px; }
.login-card .brand { justify-content: center; margin-bottom: 1.4rem; font-size: 1.05rem; }

/* --- Utilidades --------------------------------------------------------- */

.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack-sm > * + * { margin-top: .45rem; }
.mt { margin-top: 1.1rem; }
.mt-lg { margin-top: 2rem; }
.mb0 { margin-bottom: 0; }
.divider { height: 1px; background: var(--border); margin: 1.1rem 0; }
.pill-row { display: flex; gap: .35rem; flex-wrap: wrap; }

details.inline-form > summary {
    cursor: pointer; font-size: .87rem; color: var(--accent);
    font-weight: 560; padding: .3rem 0; list-style: none;
}
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form > summary::before { content: '+ '; font-weight: 700; }
details.inline-form[open] > summary::before { content: '− '; }
details.inline-form > div { padding-top: .7rem; }

@media (max-width: 640px) {
    .wrap { padding: 0 .85rem 4rem; }
    .topbar-inner { padding: .6rem .85rem; }
    h1 { font-size: 1.22rem; }
    .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
