.reception-page .container {
    width: 100%;
    max-width: 1880px;
    padding-inline: clamp(1rem, 2vw, 2.5rem);
}

.reception-layout {
    display: grid;
    grid-template-columns: minmax(285px, 0.78fr) minmax(540px, 2.15fr) minmax(285px, 0.85fr);
    gap: 1.25rem;
    align-items: stretch;
}

.reception-header-tool {
    position: relative;
    padding: 0.65rem 0.9rem;
}

.reception-header-tool b {
    min-width: 23px;
    height: 23px;
    padding: 0 0.38rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: white;
    background: var(--primary);
    font-size: 0.72rem;
    line-height: 1;
}

.reception-header-tool.has-unread {
    border-color: rgba(6, 182, 212, 0.48);
    background: rgba(6, 182, 212, 0.1);
}

.reception-chat-unread {
    position: static !important;
    border: 0 !important;
}

/* Reception opens chat from the header, without an extra floating button. */
.reception-page .chat-launcher {
    display: none !important;
}

.left-column,
.registration-panel {
    height: 100%;
}

/* Left panel - registration form */
.registration-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 520px;
}

.registration-panel form {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.registration-panel form > button[type="submit"] {
    margin-top: auto;
}

.registration-panel h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, white, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

html[data-theme="light"] .registration-panel h2 {
    background: linear-gradient(135deg, #172033, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Office selector grid */
.office-selector-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.office-selector-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition-smooth);
}

.office-selector-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

.office-selector-btn.active {
    background: linear-gradient(135deg, var(--primary-glow), rgba(59, 130, 246, 0.2));
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.office-selector-btn span.num {
    font-size: 1.25rem;
}

.office-selector-btn span.label {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
}

/* Dashboard status & control (TV remote) */
.tv-control-panel {
    grid-column: 1 / 3;
    margin-top: 0;
    padding: 1rem 1.25rem;
    border-color: rgba(139, 92, 246, 0.2);
}

.tv-control-panel h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tv-playback-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.65rem;
    align-items: stretch;
    margin-top: 0;
}

.tv-main-row {
    display: grid;
    grid-template-columns: minmax(320px, 1.05fr) minmax(360px, 1.45fr) minmax(300px, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.tv-main-row .now-playing-card {
    margin-bottom: 0;
}

.tv-youtube-source,
.local-video-upload {
    display: flex;
    flex-direction: column;
}

.tv-youtube-source .form-group,
.tv-main-row .local-video-upload {
    margin: 0;
}

.tv-youtube-source button,
.tv-main-row .local-video-upload button {
    width: 100%;
    margin-top: auto;
}

.tv-controls-row {
    display: grid;
    grid-template-columns: minmax(420px, 1.8fr) minmax(220px, 0.8fr) minmax(260px, 1fr);
    gap: 0.75rem;
    align-items: stretch;
    margin-top: 0.65rem;
}

.now-playing-card {
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(6, 182, 212, 0.24);
    border-radius: 12px;
    background: rgba(6, 182, 212, 0.06);
}

.now-playing-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.now-playing-card strong {
    display: block;
    margin: 0.2rem 0 0.45rem;
}

.media-progress {
    height: 5px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
}

.media-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.4s linear;
}

.now-playing-card small { color: var(--text-muted); }

.local-video-upload {
    margin-top: 0;
    padding: 0;
    border-top: 0;
}

.local-video-upload input { margin-bottom: 0.6rem; }
.local-video-upload small { display: block; margin-top: 0.5rem; color: var(--success); }

.tv-transport-controls {
    display: grid;
    grid-template-columns: 1fr 1.25fr 1.4fr 1fr;
    gap: 0.55rem;
    margin: 0;
}

.tv-restart-control {
    width: 100%;
    margin-bottom: 0;
}

.office-state-needs_cleaning { color: var(--warning) !important; }
.office-state-cleaning { color: var(--secondary) !important; }
.office-state-attending { color: var(--primary) !important; }

.tv-playback-controls > button:not(.next-track-btn) {
    width: 46px;
    padding: 0;
}

.tv-volume-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}

.tv-volume-display span {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.tv-volume-display strong {
    color: var(--primary);
    font-size: 1rem;
}

.next-track-btn {
    grid-column: 1 / -1;
    width: 100%;
    padding: 0.7rem 1rem;
}

/* Right panel - Queues view */
.queues-overview-panel {
    padding: 2rem;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.queues-overview-panel h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: white;
}

.office-queues-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    flex: 1;
}

.office-queue-column {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    transition: var(--transition-smooth);
}

.office-queue-column:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.office-queue-header {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.office-queue-header .title {
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.office-queue-header .assigned-doctor {
    min-height: 2.2rem;
    margin-top: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.15rem;
    color: var(--primary);
    overflow-wrap: anywhere;
}

.office-queue-header .status {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
}

.office-queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    overflow-y: auto;
}

/* Queue Patient Card */
.patient-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-smooth);
    animation: slide-in 0.3s ease-out;
}

.patient-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-hover);
}

.patient-card .name {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    word-break: break-word;
    padding-right: 1.25rem;
}

html[data-theme="light"] .queues-overview-panel h2,
html[data-theme="light"] .office-queue-header .title,
html[data-theme="light"] .patient-card .name {
    color: var(--text-main);
}

html[data-theme="light"] .office-queue-column,
html[data-theme="light"] .patient-card {
    background: rgba(255, 255, 255, 0.58);
}

.patient-card .time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.patient-card .remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.patient-card .remove-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.empty-queue-msg {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.8rem;
    margin: auto 0;
    font-style: italic;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(16, 185, 129, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition-smooth);
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

/* Separate reception checklist section */
.reception-tasks-section {
    grid-column: 3;
    grid-row: 1 / span 2;
    margin-top: 0;
    padding: 1.5rem;
    min-height: 780px;
    max-height: none;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tasks-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-direction: column;
}

.tasks-section-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.35rem;
}

.tasks-section-header p,
.encounter-meta {
    color: var(--text-muted);
}

.tasks-section-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
}

.tasks-section-actions button {
    flex: 1;
}

.queue-count-badge {
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.4rem 0.8rem;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.task-traffic-light {
    --task-glow-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    position: relative;
    isolation: isolate;
    overflow: visible;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.task-traffic-light::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -8px;
    border-radius: 50%;
    background: var(--task-glow-color);
    filter: blur(9px);
    opacity: 0;
    pointer-events: none;
}

.task-light-green {
    --task-glow-color: #16a34a;
    color: white;
    background: #16a34a;
    box-shadow: 0 0 16px rgba(22, 163, 74, 0.5);
}

.task-light-yellow {
    --task-glow-color: #facc15;
    color: #422006;
    background: #facc15;
    box-shadow: 0 0 16px rgba(250, 204, 21, 0.5);
}

.task-light-yellow::before {
    animation: task-glow-pulse 2.4s ease-in-out infinite;
}

.task-light-orange {
    --task-glow-color: #f97316;
    color: white;
    background: #f97316;
    box-shadow: 0 0 16px rgba(249, 115, 22, 0.5);
}

.task-light-orange::before {
    animation: task-glow-pulse 1.35s ease-in-out infinite;
}

.task-light-red {
    --task-glow-color: #dc2626;
    color: white;
    background: #dc2626;
    box-shadow: 0 0 16px rgba(220, 38, 38, 0.55);
}

.task-light-red::before {
    animation: task-glow-pulse 0.65s ease-in-out infinite;
}

@keyframes task-glow-pulse {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.88);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .task-light-yellow::before,
    .task-light-orange::before,
    .task-light-red::before {
        animation: none;
        opacity: 0.45;
        transform: scale(1.05);
    }
}

.reception-tasks-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    overflow-y: auto;
    padding-right: 0.25rem;
    flex: 1;
}

.encounter-task-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.encounter-task-card.completed {
    border-color: rgba(16, 185, 129, 0.35);
}

.administrative-task-card {
    border-left: 3px solid rgba(139, 92, 246, .58);
    background: rgba(139, 92, 246, .035);
}

.administrative-task-card.overdue {
    border-color: rgba(220, 38, 38, .48);
}

.administrative-task-description {
    color: var(--text-muted);
    font-size: .84rem;
    overflow-wrap: anywhere;
}

.encounter-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.encounter-identity {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

.encounter-label,
.task-list-title {
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.encounter-patient {
    font-size: 1.2rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.encounter-office {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid rgba(6, 182, 212, 0.32);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    background: rgba(6, 182, 212, 0.08);
    font-size: 0.82rem;
}

.encounter-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.encounter-meta-pills > span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.025);
    font-size: 0.8rem;
}

.encounter-meta-pills svg {
    width: 15px;
    height: 15px;
    color: var(--secondary);
}

.encounter-meta-pills b {
    color: var(--text-main);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.task-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.1);
}

.task-check-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
    line-height: 1.35;
    padding: 0.65rem 0;
    border-top: 1px solid var(--border-color);
}

.task-check-item input {
    width: 18px;
    height: 18px;
    margin-top: 0.05rem;
    accent-color: var(--primary);
    flex: 0 0 auto;
}

.task-check-item.done span {
    color: var(--text-muted);
    text-decoration: line-through;
}

.no-assigned-tasks {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.encounter-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.encounter-card-footer button {
    margin-left: auto;
}

.complete-task-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.completed-at {
    color: var(--success);
    font-size: 0.75rem;
}

@media (max-width: 900px) {
    .reception-layout {
        grid-template-columns: 1fr;
    }

    .tasks-section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .tasks-section-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 1180px) {
    .reception-layout {
        grid-template-columns: minmax(320px, 0.9fr) minmax(0, 2fr);
    }

    .reception-tasks-section {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 360px;
        max-height: 620px;
    }

    .tv-control-panel { grid-column: 1 / -1; }

    .tasks-section-header {
        flex-direction: row;
        align-items: center;
    }

    .tasks-section-actions {
        width: auto;
        justify-content: flex-end;
    }

    .tasks-section-actions button { flex: initial; }

    .tv-main-row {
        grid-template-columns: 1fr 1fr;
    }

    .tv-main-row .local-video-upload {
        grid-column: 1 / -1;
    }

    .tv-controls-row {
        grid-template-columns: 1fr 1fr;
    }

    .tv-controls-row .tv-transport-controls {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .reception-layout { grid-template-columns: 1fr; }
    .registration-panel { min-height: auto; }
    .reception-tasks-section { grid-column: auto; grid-row: auto; min-height: 420px; max-height: 620px; }
    .tv-control-panel { grid-column: auto; }
    .tasks-section-header { flex-direction: column; align-items: flex-start; }
    .tasks-section-actions { width: 100%; justify-content: flex-start; }
    .tasks-section-actions button { flex: 1; }
    .tv-main-row,
    .tv-controls-row { grid-template-columns: 1fr; }
    .tv-main-row .local-video-upload,
    .tv-controls-row .tv-transport-controls { grid-column: auto; }
}

@media (max-width: 480px) {
    .reception-header-tool span { display: none; }
    .reception-header-tool { padding: 0.65rem; }
    .reception-tasks-section { padding: 1rem; }
    .reception-tasks-list { grid-template-columns: minmax(0, 1fr); }
    .encounter-card-header { flex-direction: column; }
    .encounter-card-footer button { width: 100%; margin-left: 0; }
}
.media-error {
    color: var(--danger) !important;
}
