/* ==========================================================================
   Web portal — the app's own look: light, teal, the week grid of the landscape view.
   Builds on home.css (tokens, header, buttons, Play button).
   ========================================================================== */

body.portal { background: var(--bg-soft); min-height: 100vh; }
.portal main { padding-top: 28px; padding-bottom: 60px; }

/* ── Code entry ──────────────────────────────────────────────────────── */
.p-entry { display: flex; justify-content: center; padding: 40px 0 80px; }
.p-entry[hidden], .p-tabs[hidden] { display: none; }
.p-entry-card {
    width: min(100%, 520px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 36px 32px;
    text-align: center;
    box-shadow: var(--shadow);
}
.p-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand);
    font-weight: 700; font-size: 0.85rem;
}
.p-entry-icon { width: 64px; height: 64px; border-radius: 18px; margin: 22px auto 14px; }
.p-entry-card h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.p-entry-card p { color: var(--ink-2); margin-bottom: 24px; }
.p-form { display: flex; gap: 10px; }
.p-input {
    flex: 1; min-width: 0;
    font: inherit; font-size: 1.25rem; font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase; text-align: center;
    padding: 12px 16px;
    border: 1.5px solid var(--line); border-radius: 14px;
    background: var(--bg); color: var(--ink);
}
.p-input::placeholder { letter-spacing: 0; font-weight: 500; font-size: 1rem; color: var(--ink-3); text-transform: none; }
.p-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.p-open { border-radius: 14px; padding: 12px 22px; }
html[dir="rtl"] .p-open i { transform: scaleX(-1); }
.p-msg { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--brand); font-weight: 600; }
.p-msg[hidden] { display: none; }
.p-err { color: #C0392B; }

/* ── Header card ─────────────────────────────────────────────────────── */
.p-dash { padding: 0; }
.p-dash[hidden] { display: none; }
.p-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
    padding: 20px 24px; margin-bottom: 16px;
}
.p-role {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 0.82rem;
}
.p-head h1 { font-size: 1.5rem; font-weight: 800; margin: 8px 0 2px; }
.p-head p { color: var(--ink-3); font-size: 0.92rem; }
.p-print-what { display: none; }
.p-head-actions { display: flex; gap: 10px; }
.p-head-actions .btn { padding: 9px 16px; font-size: 0.92rem; }

/* ── Tabs + selector (segmented, like the app) ───────────────────────── */
.p-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.p-tabs { display: inline-flex; padding: 4px; gap: 4px; background: #E6EDEB; border-radius: 999px; }
.p-tabs button {
    display: inline-flex; align-items: center; gap: 8px;
    border: 0; background: transparent; cursor: pointer;
    font: inherit; font-weight: 700; font-size: 0.92rem; color: var(--ink-2);
    padding: 9px 16px; border-radius: 999px;
}
.p-tabs button.on { background: var(--brand); color: #fff; box-shadow: 0 4px 12px -4px rgba(31, 122, 114, 0.6); }
.p-tabs button[hidden] { display: none; }
.p-select { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink-2); }
.p-select select {
    font: inherit; font-weight: 700; color: var(--ink);
    padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    max-width: 60vw;
}
.p-select .who { padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* ── Week grid: periods across the top, days down the side ───────────── */
.wk-scroll {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}
.wk {
    display: grid;
    grid-template-columns: var(--cols);
    gap: 6px;
    min-width: max-content;
}
.wk .ph {
    border-radius: 10px; background: #E3F1F1; color: #2B6C66;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 0.82rem; font-weight: 600; line-height: 1.25; padding: 6px 4px; text-align: center;
}
.wk .ph b { font-size: 0.95rem; }
.wk .corner { background: transparent; }
.wk .day {
    position: sticky; inset-inline-start: 0; z-index: 1;
    border-radius: 12px; background: #E3F1F1; color: #3F8C84;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; padding: 0 6px;
    box-shadow: 0 0 0 6px var(--surface);
}
.wk .brk {
    border-radius: 6px;
    background: repeating-linear-gradient(180deg, #F3D9CF 0 6px, transparent 6px 12px);
    width: 4px; justify-self: center;
}
.wk .brk-head {
    display: flex; align-items: center; justify-content: center;
    color: #E8957D; font-size: 0.9rem;
}
.wk .c {
    border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; padding: 8px 6px; text-align: center; min-height: 70px;
    color: #23302F;
}
.wk .c b { font-size: 0.92rem; font-weight: 700; line-height: 1.25; }
.wk .c small { font-size: 0.8rem; color: #3F4B49; }
.wk .c i.sub { font-style: normal; font-size: 0.72rem; color: #55615F; }
.wk .c.empty { background: #F8F9FB; border: 1.5px dashed #DCE1E0; min-height: 70px; }
.p-empty { text-align: center; color: var(--ink-3); padding: 40px 0; font-weight: 600; }

/* ── Toolbar: picker + cards/grid toggle ─────────────────────────────── */
.p-tools { display: flex; align-items: center; gap: 10px; }
.p-view { display: inline-flex; padding: 3px; gap: 3px; background: #E6EDEB; border-radius: 12px; }
.p-view[hidden] { display: none; }
.p-view button { border: 0; background: transparent; cursor: pointer; width: 40px; height: 36px; border-radius: 9px; color: var(--ink-2); font-size: 1rem; }
.p-view button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(15, 31, 29, 0.15); }

/* ── Cards view: the phone's day list ────────────────────────────────── */
.cards { display: grid; gap: 8px; max-width: 640px; }
.lc {
    display: grid; grid-template-columns: 88px 28px 1fr; align-items: stretch;
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    box-shadow: 0 1px 3px rgba(15, 31, 29, 0.06); overflow: hidden; min-height: 76px;
}
.lc-time { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 0 12px; font-size: 0.86rem; color: var(--ink-2); }
.lc-time b { font-size: 0.98rem; color: var(--ink); }
.lc-rail { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; }
.lc-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 3px; background: #5CB85C; opacity: 0.85; }
.lc-rail i { position: relative; width: 22px; height: 22px; border-radius: 50%; background: #5CB85C; color: #fff; font-style: normal; font-size: 0.72rem; font-weight: 800; display: grid; place-items: center; }
.lc-body { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; padding: 10px 14px; }
.lc-body b { font-size: 1.05rem; }
.lc-body em { font-style: normal; font-size: 0.82rem; color: var(--ink-3); }
.lc-room { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 7px; background: #F1F3F3; color: var(--ink-2); font-size: 0.85rem; }
.lc-room i { font-size: 0.75rem; }
.lunch { display: flex; align-items: center; gap: 12px; color: #E8957D; max-width: 640px; padding: 4px 0; }
.lunch::before, .lunch::after { content: ""; flex: 1; border-top: 2px dashed #F4C3B3; }

/* ── Vacant rooms ────────────────────────────────────────────────────── */
.v-days { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.v-days button {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
    font: inherit; font-weight: 700; font-size: 0.9rem;
    padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.v-days button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.v-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.v-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.v-card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.95rem; margin-bottom: 10px; }
.v-card h3 span { color: var(--ink-3); font-weight: 600; font-size: 0.82rem; }
.v-card .n { color: var(--brand); font-size: 0.8rem; font-weight: 700; }
.v-rooms { display: flex; flex-wrap: wrap; gap: 6px; }
.v-rooms span { padding: 4px 10px; border-radius: 8px; background: #BCF5DC; color: #1D4D3C; font-weight: 600; font-size: 0.85rem; }
.v-rooms em { font-style: normal; color: var(--ink-3); font-size: 0.85rem; }
.v-brk { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: #E8957D; font-weight: 700; font-size: 0.85rem; }
.v-brk::before, .v-brk::after { content: ""; flex: 1; height: 1px; background: #F3D9CF; }

/* ── Install banner ──────────────────────────────────────────────────── */
.p-cta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
    margin-top: 24px; padding: 22px 24px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
}
.p-cta img { width: 52px; height: 52px; border-radius: 14px; }
.p-cta div { flex: 1; min-width: 200px; }
.p-cta h2 { font-size: 1.15rem; font-weight: 800; }
.p-cta p { color: var(--ink-2); font-size: 0.95rem; }

@media (max-width: 640px) {
    .p-entry { padding: 12px 0 40px; }
    .p-entry-card { padding: 28px 18px; }
    .p-entry-card h1 { font-size: 1.5rem; }
    .p-input { font-size: 1.4rem; padding: 16px 12px; letter-spacing: 0.14em; }
    .p-open { padding: 0 16px; font-size: 0.95rem; flex: none; }
    .p-head { padding: 16px; }
    .p-head-actions { width: 100%; }
    .p-head-actions .btn { flex: 1; justify-content: center; }
    .p-tabs { width: 100%; }
    .p-tabs button { flex: 1; justify-content: center; padding: 9px 6px; font-size: 0.82rem; white-space: nowrap; }
    .p-tabs button i { display: none; }
    .p-tools { width: 100%; }
    .p-select { flex: 1; min-width: 0; }
    .lc { grid-template-columns: 74px 26px 1fr; }
    .p-select select { flex: 1; max-width: none; min-width: 0; }
    .p-cta { flex-direction: column; text-align: center; }
    .p-cta .play-btn { width: 100%; justify-content: center; }
    .wk-scroll { padding: 8px; border-radius: 16px; }
}

@media (max-width: 360px) {
    .p-tabs button { font-size: 0.74rem; padding: 9px 4px; }
}

/* ── Print: the week grid on one A4 landscape page ─────────────────── */
@page { size: A4 landscape; margin: 8mm; }
@media print {
    .site-header, .p-head-actions, .p-bar, .p-cta, .v-days { display: none !important; }
    body.portal { background: #fff; font-size: 11px; }
    .portal main { padding: 0; max-width: none; }
    .p-head { border: 0; padding: 0 0 6px; margin: 0; }
    .p-head h1 { font-size: 16px; margin: 2px 0; }
    .p-role { display: none; }
    .p-print-what { display: block; font-size: 20px; font-weight: 800; color: #1F7A72; margin: 2px 0; }
    .wk-scroll { border: 0; padding: 0; overflow: visible; }
    .wk { grid-template-columns: var(--pcols) !important; min-width: 0 !important; width: 100%; gap: 3px; }
    .wk .ph { font-size: 9px; padding: 3px 2px; }
    .wk .ph b { font-size: 10px; }
    .wk .day { position: static; box-shadow: none; font-size: 10px; }
    .wk .c, .wk .c.empty { min-height: 76px; padding: 4px 2px; gap: 3px; }
    .wk .c b { font-size: 11px; }
    .wk .c small, .wk .c i.sub { font-size: 9.5px; }
    .wk .day { font-size: 11px; }
    .wk .c, .wk .ph, .wk .day, .wk .brk { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
