/*
 * Doctor token queue screen.
 *
 * Large targets and one column, because this is used standing up with a queue in
 * front of it. Colours follow the counter so it does not look like a different app.
 */

#dt-screen {
    position: fixed;
    inset: 0;
    z-index: 1080;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#dt-screen[hidden] { display: none; }

.dt-head {
    background: linear-gradient(158deg, #0b3f61 0%, #075985 45%, #0369a1 100%);
    color: #fff;
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dt-title { font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.dt-title small { display: block; font-weight: 400; font-size: 0.76rem; opacity: 0.85; margin-top: 2px; }

.dt-head-spacer { margin-left: auto; }

.dt-head .dt-btn {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.dt-bar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.dt-bar select {
    flex: 1 1 180px;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font: inherit;
    padding: 0 10px;
}

.dt-list { flex: 1; overflow-y: auto; padding: 12px 14px 96px; }

.dt-empty {
    text-align: center;
    color: #64748b;
    font-size: 0.95rem;
    padding: 40px 10px;
}

.dt-row {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 64px 1fr auto;
    grid-template-areas:
        'token who state'
        'acts acts acts';
    gap: 10px;
    align-items: center;
}

.dt-row.is-arrived { border-color: #86efac; background: #f0fdf4; }

.dt-token {
    grid-area: token;
    text-align: center;
    background: #e0f2fe;
    border-radius: 12px;
    padding: 8px 4px;
}

.dt-token span { display: block; font-weight: 800; font-size: 1.25rem; color: #075985; line-height: 1; }
.dt-token small { display: block; font-size: 0.66rem; color: #075985; opacity: 0.8; margin-top: 3px; }

.dt-who { grid-area: who; min-width: 0; }
.dt-who strong { display: block; font-size: 1rem; }
.dt-who small { display: block; font-size: 0.8rem; color: #5b6b82; }
.dt-who .dt-doc { color: #64748b; }

.dt-state {
    grid-area: state;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 5px 10px;
    background: #e2e8f0;
    color: #334155;
    white-space: nowrap;
}

.dt-state.st-called { background: #dcfce7; color: #14532d; }
.dt-state.st-completed { background: #dbeafe; color: #1e3a8a; }
.dt-state.st-cancelled, .dt-state.st-no_show { background: #fee2e2; color: #7f1d1d; }

.dt-acts { grid-area: acts; display: flex; gap: 8px; }

.dt-btn {
    font: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
}

.dt-btn:disabled { opacity: 0.45; }
.dt-acts .dt-btn { flex: 1; }
.dt-arrive { background: #0369a1; border-color: #0369a1; color: #fff; }
.dt-done { background: #15803d; border-color: #15803d; color: #fff; }
.dt-drop { background: #fff; border-color: #fca5a5; color: #b91c1c; }

.dt-foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 12px;
}

.dt-stat { font-size: 0.8rem; color: #5b6b82; }
.dt-stat strong { display: block; font-size: 1.15rem; color: #0f172a; line-height: 1.1; }
.dt-stat.is-arrived strong { color: #15803d; }

.dt-foot .dt-btn { margin-left: auto; }

#dt-walkin {
    position: absolute;
    inset: auto 0 0 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.18);
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    z-index: 2;
}

#dt-walkin[hidden] { display: none; }

#dt-walkin h3 { margin: 0 0 12px; font-size: 1rem; }

#dt-walkin label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #5b6b82;
    margin-bottom: 5px;
}

#dt-walkin input, #dt-walkin select {
    width: 100%;
    min-height: 48px;
    margin-bottom: 10px;
    padding: 0 12px;
    font: inherit;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.dt-walkin-actions { display: flex; gap: 10px; }
.dt-walkin-actions .dt-btn { flex: 1; }

#dt-error { margin: 10px 14px 0; color: #b91c1c; font-weight: 700; font-size: 0.86rem; }
#dt-w-error { color: #b91c1c; font-weight: 700; font-size: 0.82rem; margin-bottom: 8px; }

#dt-toast {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(12px + env(safe-area-inset-top));
    z-index: 1090;
    background: #052e16;
    color: #fff;
    border-radius: 16px;
    padding: 14px 40px 14px 16px;
    box-shadow: 0 16px 40px rgba(5, 46, 22, 0.35);
    font-size: 0.92rem;
    line-height: 1.4;
}

#dt-toast[hidden] { display: none; }
#dt-toast small { opacity: 0.8; }
#dt-toast-close {
    position: absolute;
    right: 8px;
    top: 8px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    padding: 6px 8px;
    cursor: pointer;
}

body.dt-open { overflow: hidden; }

/* ---------------------------------------------------------------- settings */

.dt-docset {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
}

.dt-docset-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.dt-docset-head strong { font-size: 1rem; }

.dt-switch {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #5b6b82;
}

.dt-switch input { width: 22px; height: 22px; }

.dt-field {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #5b6b82;
    margin-bottom: 10px;
    flex: 1;
}

.dt-field input, .dt-field select {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
    padding: 0 10px;
    font: inherit;
    font-weight: 400;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #f8fafc;
}

.dt-field-row { display: flex; gap: 10px; }

.dt-docset-save { width: 100%; margin-top: 4px; }

.dt-docset-note {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #15803d;
    text-align: center;
}

@media (min-width: 720px) {
    .dt-list { padding: 16px 24px 96px; }
    .dt-row {
        grid-template-columns: 72px 1fr auto auto;
        grid-template-areas: 'token who state acts';
    }
    .dt-acts { flex: 0 0 auto; }
    .dt-btn { min-width: 96px; }
}

/* Day pills: one row of fat targets, because this is edited standing up. */
.dt-days { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.dt-day { flex: 0 0 auto; }

.dt-day input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.dt-day span {
    display: inline-block;
    min-width: 46px;
    text-align: center;
    padding: 9px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    background: #fff;
}

.dt-day input:checked + span {
    background: #0369a1;
    border-color: #0369a1;
    color: #fff;
}
