/* MeatMeet — dashboard de cocina.
   Diseñado para tablet y KDS de 21,5" (Premier PCP-215W): alto contraste,
   objetivos grandes para dedos y legible a distancia. Tema oscuro. */

:root {
    --bg: #0f1115;
    --panel: #191d24;
    --panel-2: #222833;
    --line: #2c333f;
    --text: #f2f5f8;
    --muted: #97a3b4;
    --accent: #ff7a3c;      /* naranja brasa */
    --cooking: #3b82f6;     /* azul: cocinando */
    --ready: #22c55e;       /* verde: listo para retirar */
    --danger: #ef4444;
    --radius: 16px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.wrap { max-width: 1600px; margin: 0 auto; padding: clamp(16px, 2vw, 28px); }

/* Cabecera */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand h1 { font-size: clamp(22px, 2.4vw, 34px); margin: 0; letter-spacing: -0.02em; }
.brand .dot { color: var(--accent); }
.brand small { color: var(--muted); font-weight: 500; }

.nav { display: flex; gap: 10px; }

/* Botones */
.btn {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 20px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { border-color: var(--muted); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1a0e07; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: #5a2a2a; color: #ff9d9d; }
.btn-danger:hover { border-color: var(--danger); }
.btn-lg { padding: 18px 26px; font-size: 1.15rem; }
.btn-block { width: 100%; justify-content: center; }

/* Rejillas */
.grid { display: grid; gap: 18px; }
.grid-cuts { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-cooks { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 30px 0 14px;
}

/* Tarjeta de corte (pantalla principal, para pinchar) */
.cut-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 150px;
    transition: transform .05s ease, border-color .15s ease;
}
.cut-card:active { transform: scale(.98); }
.cut-card:hover { border-color: var(--accent); }
.cut-card .emoji { font-size: 2.6rem; line-height: 1; }
.cut-card .name { font-size: 1.4rem; font-weight: 700; }
.cut-card .meta { color: var(--muted); font-size: .95rem; }

/* Tarjeta de cocción activa */
.cook-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 6px solid var(--cooking);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cook-card.ready {
    border-color: var(--ready);
    border-left-color: var(--ready);
    background: linear-gradient(180deg, rgba(34,197,94,.14), rgba(34,197,94,.04));
    animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.0); }
    50% { box-shadow: 0 0 0 6px rgba(34,197,94,.18); }
}
.cook-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cook-title { font-size: 1.35rem; font-weight: 700; }
.cook-sub { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.badge {
    font-size: .8rem; font-weight: 700; padding: 5px 10px; border-radius: 999px;
    background: var(--panel-2); color: var(--muted); white-space: nowrap;
}

.temps { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.temp-now { font-size: 3.2rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.temp-now .unit { font-size: 1.4rem; color: var(--muted); font-weight: 600; }
.temp-target { color: var(--muted); font-size: 1rem; }
.temp-target strong { color: var(--text); }

.no-reading { color: var(--muted); font-size: 1.1rem; padding: 8px 0; }

.bar { height: 12px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--cooking); border-radius: 999px; transition: width .4s ease; }
.cook-card.ready .bar > span { background: var(--ready); }

.ready-banner {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.5rem; font-weight: 800; color: var(--ready);
    text-transform: uppercase; letter-spacing: 0.02em;
}

/* Panel de inicio de cocción (elegir punto + sonda) */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.panel h2 { margin: 0 0 4px; font-size: 1.5rem; }
.panel .step { color: var(--muted); margin: 18px 0 10px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip {
    border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
    border-radius: 12px; padding: 14px 18px; font-size: 1.05rem; font-weight: 600;
    cursor: pointer; transition: border-color .15s ease, background .15s ease;
    display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
}
.chip:hover { border-color: var(--accent); }
.chip.selected { border-color: var(--accent); background: rgba(255,122,60,.14); }
.chip small { color: var(--muted); font-weight: 500; }
.chip.disabled { opacity: .4; cursor: not-allowed; }

/* Gestión de cortes */
.manage-cut { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.manage-cut header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.manage-cut header h3 { margin: 0; font-size: 1.3rem; }
.points-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.point-row { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 10px; padding: 10px 14px; }
.point-row .pname { font-weight: 600; flex: 1; }
.point-row .ptemp { color: var(--muted); }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.input {
    background: var(--bg); border: 1px solid var(--line); color: var(--text);
    border-radius: 10px; padding: 12px 14px; font-size: 1rem; min-width: 0;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.input-sm { width: 90px; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 1.1rem; }
.pill-muted { color: var(--muted); font-size: .9rem; }

/* Enlaces */
a { color: var(--accent); }

/* En pantallas grandes (KDS 21,5") agranda un punto la temperatura */
@media (min-width: 1400px) {
    .temp-now { font-size: 3.8rem; }
}

/* --- Monitor de sondas en vivo (/monitor) --------------------------------- */
.mon-card { border-left-color: var(--accent); gap: 12px; }
.mon-card.is-stale { border-left-color: var(--line); opacity: .72; }

.live-badge { display: inline-flex; align-items: center; gap: 7px; }
.live-badge.is-live { color: var(--ready); }
.live-dot {
    width: 9px; height: 9px; border-radius: 50%; background: var(--muted);
    display: inline-block;
}
.live-badge.is-live .live-dot {
    background: var(--ready);
    animation: live-pulse 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
    50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

.spark {
    width: 100%; height: 64px; display: block;
    background: var(--panel-2); border-radius: 10px; padding: 2px;
}
.spark polyline {
    fill: none; stroke: var(--accent); stroke-width: 2.5;
    stroke-linejoin: round; stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}
.mon-card.is-stale .spark polyline { stroke: var(--muted); }

.mon-foot {
    display: flex; justify-content: space-between;
    color: var(--muted); font-size: .9rem;
}

/* --- Back office: foto por corte -------------------------------------- */
.cut-id { display: flex; align-items: center; gap: 16px; }
.cut-thumb {
    width: 76px; height: 76px; flex: 0 0 auto; border-radius: 50%;
    overflow: hidden; background: var(--panel-2); border: 2px solid var(--line);
    display: grid; place-items: center; text-align: center;
    color: var(--muted); font-size: .72rem; font-weight: 700; line-height: 1.1;
}
.cut-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-btn { margin-top: 6px; display: inline-flex; cursor: pointer; }

/* --- Back office: editar temperatura de un punto (± y entrada directa) --- */
.temp-stepper { display: flex; align-items: center; gap: 12px; }
.temp-stepper .step {
    width: 60px; height: 60px; flex: 0 0 auto; border-radius: 14px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
    font-size: 2.1rem; font-weight: 800; line-height: 1; cursor: pointer;
    display: grid; place-items: center; transition: transform .1s, background .2s;
}
.temp-stepper .step:active { transform: scale(.9); background: var(--line); }
/* número: solo visualización, grande y centrado entre los botones */
.temp-stepper .step-val {
    min-width: 108px; text-align: center; font-size: 2rem; font-weight: 800;
    color: var(--text); letter-spacing: -.01em; user-select: none;
}
.temp-stepper .step-val small { font-size: .5em; font-weight: 700; color: var(--muted); margin-left: 3px; }

/* Back office: nombre de punto editable */
.pname-input {
    flex: 1; min-width: 90px; background: var(--panel-2); color: var(--text);
    border: 1px solid transparent; border-radius: 8px; padding: 9px 11px;
    font-weight: 600; font-size: 1rem; font-family: inherit;
}
.pname-input:focus { border-color: var(--accent); background: var(--panel); outline: none; }

/* Back office: interruptor activar/desactivar corte */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    width: 54px; height: 30px; border-radius: 999px; flex: 0 0 auto;
    background: var(--panel-2); border: 1px solid var(--line); position: relative;
    transition: background .2s, border-color .2s;
}
.switch-knob {
    position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.switch input:checked + .switch-track { background: var(--ready); border-color: var(--ready); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(24px); }
.switch-text { font-weight: 700; color: var(--muted); min-width: 48px; }
.switch input:checked ~ .switch-text { color: var(--ready); }

/* Back office: selector de sonido de aviso */
.sound-options { display: flex; flex-wrap: wrap; gap: 12px; }
.sound-opt {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    background: var(--panel-2); color: var(--text); border: 2px solid var(--line);
    border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 1.05rem;
    font-family: inherit; transition: transform .1s, border-color .2s, background .2s;
}
.sound-opt:active { transform: scale(.96); }
.sound-opt.sel { border-color: var(--accent); background: rgba(255, 122, 60, .16); }
.sound-opt .sound-play {
    display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent); color: #1a0e07; font-size: .78rem;
}

/* Back office: informes */
.rep-periods { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.rep-total { text-align: center; }
.rep-total-num { font-size: clamp(48px, 8vw, 84px); font-weight: 800; line-height: 1; color: var(--accent); letter-spacing: -.02em; }
.rep-total-lbl { color: var(--muted); font-weight: 600; margin-top: 6px; }
.rep-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; }
.rep-name { flex: 0 0 140px; font-weight: 700; }
.rep-bar { flex: 1; height: 14px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.rep-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; min-width: 3px; transition: width .4s ease; }
.rep-count { flex: 0 0 auto; min-width: 42px; text-align: right; font-weight: 800; font-size: 1.15rem; }
