/* Grape PRO 2026 operations UI. Keeps legacy DOM selectors intact while
   removing the old duplicate compatibility layer. */
:root {
    --gp-bg: #f5eef8;
    --gp-bg-strong: #eadff0;
    --gp-panel: #ffffff;
    --gp-panel-muted: #fbf7fd;
    --gp-panel-strong: #f0e6f6;
    --gp-border: #d8c8e2;
    --gp-border-strong: #b99bc8;
    --gp-text: #211827;
    --gp-muted: #725d7d;
    --gp-accent: #532e61;
    --gp-accent-strong: #40214c;
    --gp-accent-soft: #f4eef7;
    --gp-call: #0f766e;
    --gp-call-strong: #115e59;
    --gp-call-soft: #e6fffb;
    --gp-manager: #1d4ed8;
    --gp-manager-strong: #1e3a8a;
    --gp-manager-soft: #eff6ff;
    --gp-clear-soft: #f8f4fb;
    --gp-success: #15803d;
    --gp-success-soft: #dcfce7;
    --gp-warning: #9a5b00;
    --gp-warning-soft: #fff4d6;
    --gp-danger: #b3365b;
    --gp-danger-strong: #922746;
    --gp-danger-soft: #fde8ef;
    --gp-focus: rgba(83, 46, 97, 0.32);
    --gp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --gp-shadow-md: 0 18px 40px rgba(15, 23, 42, 0.14);
    --gp-shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.24);
    --gp-shadow-action: 0 16px 30px rgba(15, 118, 110, 0.22);
    --gp-radius: 8px;
    --gp-radius-lg: 14px;
    --gp-touch: clamp(58px, 9.5vh, 96px);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--gp-text);
    background: linear-gradient(180deg, var(--gp-bg) 0%, var(--gp-bg-strong) 100%);
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
    letter-spacing: 0;
}

button {
    touch-action: manipulation;
}

.loading {
    cursor: progress !important;
}

.disabled {
    pointer-events: none !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.w-full { width: 100%; }
.h-full { height: 100%; }
.absolute { position: absolute; }
.top-8 { top: 2rem; }
.right-32 { right: 8rem; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.text-center { text-align: center; }
.bg-white { background: #fff; }
.bg-gray-500 { background: var(--gp-muted); }
.font-bold { font-weight: 800; }
.font-semibold { font-weight: 700; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.text-purple-600 { color: var(--gp-accent); }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.ml-12 { margin-left: 3rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.rounded-lg { border-radius: var(--gp-radius); }
.cursor-pointer { cursor: pointer; }
.hover\:text-purple-800:hover { color: var(--gp-accent-strong); }
.transition-colors {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.select-none {
    user-select: none;
    -webkit-user-select: none;
}

.login-box,
.intercom-box {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--gp-bg);
}

.login-shell {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: clamp(20px, 4vw, 56px);
}

.login-panel {
    width: min(720px, 100%);
    min-height: min(760px, calc(100vh - 56px));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: clamp(24px, 4vh, 44px);
    padding: clamp(28px, 4vw, 52px);
    background: var(--gp-panel);
    border: 1px solid var(--gp-border);
    border-radius: var(--gp-radius-lg);
    box-shadow: var(--gp-shadow-lg);
}

.login-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.brand-block,
.intercom-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark,
.intercom-brand__mark {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: var(--gp-radius);
    background: var(--gp-accent);
    color: #fff;
    font-weight: 900;
    box-shadow: var(--gp-shadow-sm);
}

.brand-kicker {
    margin: 0 0 6px;
    color: var(--gp-muted);
    font-size: 0.95rem;
    font-weight: 800;
}

.brand-title {
    margin: 0;
    font-size: clamp(2.3rem, 5vw, 4rem);
    line-height: 1;
    font-weight: 900;
}

.language-control {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gp-muted);
    font-weight: 800;
}

.language-control select,
.field-control input {
    border: 1px solid var(--gp-border);
    background: var(--gp-panel-muted);
    color: var(--gp-text);
    border-radius: var(--gp-radius);
}

.language-control select {
    min-height: 52px;
    padding: 0 42px 0 14px;
}

.login-fields {
    display: grid;
    gap: 22px;
}

.field-control {
    display: grid;
    gap: 10px;
    text-align: left;
    color: var(--gp-muted);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 900;
}

.field-control input {
    width: 100%;
    min-height: 76px;
    padding: 0 20px;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
}

.field-control input:focus,
.language-control select:focus {
    outline: 4px solid var(--gp-focus);
    outline-offset: 2px;
    border-color: var(--gp-accent);
    background: #fff;
}

.field-control input:user-invalid {
    border-color: var(--gp-danger);
    background: var(--gp-danger-soft);
}

.login-submit {
    min-height: 82px;
    border: 1px solid var(--gp-accent-strong);
    border-radius: var(--gp-radius);
    background: var(--gp-accent);
    color: #fff;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 900;
    box-shadow: 0 16px 30px rgba(83, 46, 97, 0.24);
}

.login-submit:active,
.call-button:active,
.call-button-wide:active,
.key:active {
    opacity: 0.96;
}

.intercom-box {
    display: flex;
    flex-direction: column;
    padding: clamp(14px, 2vw, 24px);
}

.intercom-topbar {
    height: clamp(58px, 8vh, 78px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
}

.intercom-brand {
    color: var(--gp-text);
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    font-weight: 900;
}

.intercom-brand__mark {
    width: 44px;
    height: 44px;
    font-size: 0.95rem;
}

.logout-button {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 132px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: var(--gp-radius);
    background: var(--gp-panel);
    color: var(--gp-danger);
    border: 1px solid var(--gp-danger-soft);
    box-shadow: var(--gp-shadow-sm);
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.container-box {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 0;
}

.keypad-container {
    width: min(760px, 100%);
    height: 100%;
    max-width: none;
    container-type: inline-size;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: clamp(10px, 1.5vh, 16px);
    padding: clamp(16px, 2.5vw, 28px);
    margin: 0 auto;
    background: var(--gp-panel);
    border: 1px solid var(--gp-border);
    border-radius: var(--gp-radius-lg);
    box-shadow: var(--gp-shadow-md);
    overflow: hidden;
}

.keypad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
}

.video-text,
.title-message-text,
.keypad-container > .title-message-text {
    margin: 0 !important;
    padding: 0 !important;
    color: var(--gp-muted);
    font-size: clamp(1.05rem, 2.2vh, 1.45rem) !important;
    line-height: 1.25;
    font-weight: 900;
}

.debug-unlock-button {
    position: static;
    min-width: 52px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: var(--gp-radius);
    background: var(--gp-warning-soft);
    color: var(--gp-warning);
    box-shadow: none;
}

.display {
    width: 100%;
    height: clamp(58px, 10vh, 108px);
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 clamp(18px, 3vw, 32px);
    border: 1px solid var(--gp-border-strong);
    border-left: 8px solid var(--gp-accent);
    border-radius: var(--gp-radius);
    background: #f9fbfd;
    color: var(--gp-text);
    font-size: clamp(2.4rem, 8vh, 5.2rem);
    line-height: 1;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(15, 23, 42, 0.06);
}

.display:empty::before {
    content: "----";
    color: #cbd5e1;
}

.keypad {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(var(--gp-touch), 1fr);
    gap: clamp(10px, 1.5vh, 14px);
    padding: 0;
    align-content: stretch;
}

.keypad.tato-mode .keypad-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.key,
.call-button,
.manager-call-button,
.call-button-wide,
.manager-call-button-wide {
    border-radius: var(--gp-radius);
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    transition: background-color 0.08s ease, border-color 0.08s ease, color 0.08s ease, opacity 0.08s ease;
}

.key {
    width: 100%;
    min-width: 0;
    min-height: var(--gp-touch);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--gp-border);
    background: linear-gradient(180deg, #ffffff, #f5f8fb);
    color: var(--gp-text);
    font-size: clamp(2rem, 6vh, 4.4rem);
    font-size: clamp(2rem, 7.5cqw, 5.2rem);
    line-height: 1;
    text-align: center;
    box-shadow: var(--gp-shadow-sm);
}

.key:hover {
    background: #fff;
    border-color: var(--gp-border-strong);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.key:active {
    background: var(--gp-panel-strong);
    box-shadow: var(--gp-shadow-sm);
}

.key-clear,
#clearButton,
#clearButtonWide,
#tatoModeButtons .clear-button {
    background: linear-gradient(180deg, #ffffff, var(--gp-clear-soft));
    color: var(--gp-accent-strong);
    border-color: var(--gp-border-strong);
    box-shadow: var(--gp-shadow-sm);
}

.key-clear:hover,
#clearButton:hover,
#clearButtonWide:hover,
#tatoModeButtons .clear-button:hover {
    background: var(--gp-accent-soft);
    border-color: var(--gp-accent);
    color: var(--gp-accent-strong);
    box-shadow: 0 10px 22px rgba(83, 46, 97, 0.12);
}

.key-clear:active,
#clearButton:active,
#clearButtonWide:active,
#tatoModeButtons .clear-button:active {
    background: #eadff0;
    box-shadow: var(--gp-shadow-sm);
}

#dashButton {
    background: var(--gp-panel-muted);
}

.key-span-3 {
    grid-column: span 3;
}

.keypad-row {
    width: 100%;
}

#clearButtonRow {
    width: 100%;
    padding: 0;
    margin: 0;
}

#tatoModeButtons {
    grid-template-columns: minmax(84px, 0.8fr) minmax(180px, 2.2fr);
    gap: clamp(10px, 1.5vh, 14px);
    margin: 0;
    padding: 0;
}

#tatoModeButtons.no-manager-call {
    grid-template-columns: minmax(84px, 0.8fr) minmax(180px, 2.2fr);
}

#tatoModeButtons.has-manager-call {
    grid-template-columns: minmax(84px, 0.8fr) minmax(180px, 1.7fr) minmax(132px, 1.1fr);
}

#tatoModeButtons .clear-button {
    grid-column: 1;
}

#tatoModeButtons .call-button-wide {
    grid-column: 2;
}

#tatoModeButtons .manager-call-button-wide {
    grid-column: 3;
}

.action-button-row {
    display: flex;
    gap: clamp(10px, 1.5vh, 14px);
    margin: 0;
    align-items: stretch;
}

.call-button,
.call-button-wide {
    flex: 2;
    min-height: clamp(72px, 10vh, 92px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gp-call-strong);
    background: linear-gradient(180deg, #10857d, var(--gp-call));
    color: #fff;
    font-size: clamp(1.5rem, 4vh, 2.8rem);
    font-size: clamp(1.5rem, 5.4cqw, 3.6rem);
    box-shadow: var(--gp-shadow-action);
}

.call-button:hover,
.call-button-wide:hover {
    background: linear-gradient(180deg, var(--gp-call), var(--gp-call-strong));
}

.manager-call-button,
.manager-call-button-wide {
    flex: 1;
    min-width: 0;
    min-height: clamp(72px, 10vh, 92px);
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid rgba(29, 78, 216, 0.32);
    background: var(--gp-manager-soft);
    color: var(--gp-manager-strong);
    font-size: clamp(1rem, 2.2vh, 1.35rem);
    font-size: clamp(1rem, 2.35cqw, 1.65rem);
    line-height: 1.15;
    white-space: normal;
    word-break: keep-all;
    text-align: center;
    box-shadow: var(--gp-shadow-sm);
}

.manager-call-button:hover,
.manager-call-button-wide:hover {
    background: #dbeafe;
    border-color: var(--gp-manager);
}

.call-button:disabled,
.call-button-wide:disabled,
.manager-call-button:disabled,
.manager-call-button-wide:disabled,
.key:disabled,
.delivery-notification-button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

.key:focus-visible,
.call-button:focus-visible,
.manager-call-button:focus-visible,
.call-button-wide:focus-visible,
.manager-call-button-wide:focus-visible,
.logout-button:focus-visible,
.delivery-notification-button:focus-visible,
.end-call-btn:focus-visible,
.round-button:focus-visible {
    outline: 4px solid var(--gp-focus);
    outline-offset: 3px;
}

.toast {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    left: 50%;
    bottom: max(22px, env(safe-area-inset-bottom));
    z-index: 2400;
    min-width: min(520px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    padding: clamp(18px, 3vh, 30px) clamp(22px, 4vw, 38px);
    border-radius: var(--gp-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(17, 24, 39, 0.96);
    color: #fff;
    font-size: clamp(1.25rem, 3vh, 2.1rem);
    line-height: 1.3;
    font-weight: 900;
    text-align: center;
    box-shadow: var(--gp-shadow-lg);
    transform: translateX(-50%) translateY(12px) scale(0.98);
}

.toast::before {
    content: "";
    display: inline-block;
    width: 0.62em;
    height: 0.62em;
    margin-right: 0.55em;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.72;
    vertical-align: 0.08em;
}

.toast.show {
    visibility: visible;
    animation: gpToastIn 0.18s ease-out forwards, gpToastOut 0.25s ease-in 4.7s forwards;
}

.toast.toast--modal-active {
    bottom: clamp(28px, 7vh, 72px);
    transform: translateX(-50%) translateY(12px) scale(0.98);
    min-width: min(420px, calc(100vw - 32px));
    padding: clamp(14px, 2vh, 22px) clamp(18px, 3vw, 30px);
    font-size: clamp(1rem, 2.2vh, 1.45rem);
}

.toast.toast--intercom-active {
    top: max(78px, calc(env(safe-area-inset-top) + 78px));
    bottom: auto;
    min-width: min(440px, calc(100vw - 32px));
    padding: clamp(12px, 1.9vh, 20px) clamp(18px, 3vw, 28px);
    border-color: rgba(255, 255, 255, 0.2);
    font-size: clamp(1rem, 2vh, 1.45rem);
    box-shadow: var(--gp-shadow-action);
}

.token-status {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    z-index: 2200;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    font-size: 0.86rem;
    font-weight: 800;
    box-shadow: var(--gp-shadow-sm);
}

.token-status__dot,
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--gp-warning);
}

.token-status.valid,
.status-dot.connected {
    background: var(--gp-success);
}

.token-status.warning,
.token-status.refreshing,
.status-dot.token-refreshing {
    background: var(--gp-warning);
}

.token-status.expired,
.status-dot.error {
    background: var(--gp-danger);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    width: 100%;
    height: 100%;
    padding: clamp(18px, 3vw, 36px);
    overflow: hidden;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
}

#mediaStreamsCompleteModal,
#skywayModal {
    align-items: center;
    justify-content: center;
}

#mediaStreamsCompleteModal.modal {
    place-items: center;
}

#mediaStreamsCompleteModal.modal[style]:not([style*="none"]) {
    display: grid !important;
    align-items: center;
    justify-items: center;
    min-height: 100dvh;
    box-sizing: border-box;
}

#mediaStreamsCompleteModal[style*="block"],
#skywayModal[style*="block"] {
    display: flex !important;
}

#mediaStreamsCompleteModal[style*="block"] {
    display: grid !important;
}

.media-streams-complete-content,
.modal-content {
    width: min(720px, calc(100vw - 48px));
    margin: 0;
    padding: clamp(26px, 4vw, 48px);
    border-radius: var(--gp-radius-lg);
    background: var(--gp-panel);
    color: var(--gp-text);
    border: 1px solid var(--gp-border);
    box-shadow: var(--gp-shadow-lg);
    text-align: center;
}

.media-streams-complete-content {
    width: min(640px, calc(100vw - 48px));
    padding: clamp(30px, 4vw, 44px) clamp(26px, 5vw, 52px);
}

.call-info {
    display: grid;
    gap: clamp(16px, 2vh, 24px);
}

#complete-room-number,
#skyway-heya {
    margin: 0;
    color: var(--gp-text);
    font-size: clamp(2.5rem, 8vw, 5.5rem);
    line-height: 1;
    font-weight: 900;
}

#mediaStreamsCompleteModal .call-info {
    gap: clamp(18px, 2.4vh, 26px);
}

#complete-room-number {
    max-width: 100%;
    font-size: clamp(2.7rem, 5.8vw, 4.35rem);
    line-height: 1.06;
    letter-spacing: 0;
    text-wrap: balance;
    word-break: keep-all;
}

#complete-call-status,
#skyway-calling-message,
.status-text {
    margin: 0;
    color: var(--gp-text);
    font-size: clamp(1.5rem, 4vw, 3rem);
    line-height: 1.12;
    font-weight: 900;
    text-shadow: none;
}

#complete-call-status {
    font-size: clamp(1.65rem, 3.2vw, 2.6rem);
    line-height: 1.18;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    justify-self: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--gp-panel-muted);
    color: var(--gp-muted);
    font-weight: 900;
}

#mediaStreamsCompleteModal .connection-status {
    min-height: 38px;
    padding: 0 14px;
    gap: 8px;
    font-size: clamp(0.95rem, 1.6vw, 1.08rem);
}

#mediaStreamsCompleteModal .status-dot {
    width: 11px;
    height: 11px;
}

.dtmf-history {
    padding: 16px;
    border-radius: var(--gp-radius);
    background: var(--gp-panel-muted);
    color: var(--gp-text);
}

.unlock-message {
    display: grid;
    gap: 8px;
    padding: 22px;
    border-radius: var(--gp-radius-lg);
    border: 1px solid #86efac;
    background: var(--gp-success-soft);
    color: #14532d;
    box-shadow: none;
    animation: none;
}

.unlock-message p {
    margin: 0;
}

.success-icon {
    justify-self: center;
    display: grid;
    place-items: center;
    min-width: 76px;
    height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--gp-success);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 900;
    animation: none;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 0;
}

.end-call-btn,
.round-button.end-call {
    min-width: 176px;
    min-height: 68px;
    border: 1px solid var(--gp-danger-strong);
    border-radius: var(--gp-radius);
    background: var(--gp-danger);
    color: #fff;
    font-size: clamp(1.15rem, 2.6vw, 1.55rem);
    font-weight: 900;
    box-shadow: 0 16px 30px rgba(185, 28, 28, 0.25);
}

.round-button.end-call {
    min-width: 184px;
    padding: 0 24px;
}

.end-call-btn:hover:not(:disabled),
.round-button.end-call:hover:not(:disabled) {
    background: var(--gp-danger-strong);
    transform: translateY(-1px);
}

.end-call-btn:disabled,
.round-button.end-call:disabled {
    background: #6b7280 !important;
    border-color: #4b5563;
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

#mediaStreamsCompleteModal .action-buttons {
    margin-top: 2px;
}

#mediaStreamsCompleteModal .end-call-btn {
    min-width: 156px;
    min-height: 58px;
    padding: 0 22px;
    font-size: clamp(1.08rem, 2.1vw, 1.36rem);
}

#skywayModal {
    display: none;
    grid-template-columns: minmax(320px, 1fr) minmax(280px, 420px);
    gap: clamp(18px, 3vw, 28px);
    align-items: center;
    padding: clamp(12px, 2vw, 24px);
}

#skywayModal[style*="block"] {
    display: grid !important;
}

#skywayModal .modal-content {
    width: 100%;
    max-width: none;
    height: auto;
    display: grid;
    place-items: center;
    gap: clamp(18px, 3vh, 30px);
}

.round-button {
    width: auto;
    height: auto;
    margin: 0;
    border-radius: var(--gp-radius);
}

.round-button span {
    font-size: 1.18rem;
    line-height: 1;
}

#skyway-message-box {
    width: 100%;
    max-width: 100%;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--gp-radius);
    background: #111827 !important;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.24);
    font-size: clamp(1.35rem, 4vw, 2.8rem);
    line-height: 1.15;
    word-break: keep-all;
}

.skyway-side-panel {
    position: static;
    width: 100%;
    max-width: none;
    max-height: calc(100vh - clamp(24px, 4vw, 48px));
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
}

.video-display {
    width: 100%;
    max-height: min(34vh, 260px);
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--gp-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: #111827;
    box-shadow: var(--gp-shadow-md);
}

#my-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111827;
}

.delivery-notification-panel {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 16px;
    border-radius: var(--gp-radius-lg);
    background: var(--gp-panel);
    color: var(--gp-text);
    border: 1px solid var(--gp-border);
    box-shadow: var(--gp-shadow-md);
}

.delivery-notification-title {
    margin: 0 0 12px;
    color: var(--gp-text);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 900;
}

.delivery-notification-buttons {
    display: grid;
    gap: 10px;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 2px;
}

.delivery-notification-button {
    width: 100%;
    min-height: 56px;
    padding: 11px 14px 11px 16px;
    border: 1px solid var(--gp-border);
    border-left: 5px solid var(--gp-manager);
    border-radius: var(--gp-radius);
    background: var(--gp-panel-muted);
    color: var(--gp-text);
    font-size: clamp(0.95rem, 1.7vw, 1.08rem);
    line-height: 1.25;
    font-weight: 900;
    text-align: left;
    white-space: normal;
    word-break: keep-all;
}

.delivery-notification-button:hover:not(:disabled) {
    border-color: var(--gp-manager);
    background: var(--gp-manager-soft);
}

.delivery-notification-button.sending {
    border-color: #f59e0b;
    border-left-color: #f59e0b;
    background: var(--gp-warning-soft);
    color: #7c2d12;
    opacity: 1;
}

.delivery-notification-button.selected,
.delivery-notification-button.selected:disabled {
    border-color: #22c55e;
    border-left-color: #16a34a;
    background: var(--gp-success-soft);
    color: #14532d;
    opacity: 1;
}

.room-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    padding: 14px;
    background: var(--gp-panel);
    border-radius: var(--gp-radius-lg);
    border: 1px solid var(--gp-border);
}

.room,
.grayRoom {
    min-height: 120px;
    display: grid;
    place-items: center;
    border-radius: var(--gp-radius);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
}

.room {
    background: var(--gp-accent-soft);
    color: var(--gp-accent-strong);
    border: 1px solid rgba(83, 46, 97, 0.28);
}

.grayRoom {
    background: var(--gp-panel-strong);
    color: var(--gp-muted);
}

.microphone-settings-button,
.modal-btn {
    border-radius: var(--gp-radius);
    font-weight: 900;
}

.microphone-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    overflow: auto;
    padding: 24px;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
}

.microphone-modal-content {
    width: min(600px, 100%);
    margin: 8vh auto;
    padding: clamp(24px, 5vw, 40px);
    border-radius: var(--gp-radius-lg);
    background: var(--gp-panel);
    color: var(--gp-text);
    box-shadow: var(--gp-shadow-lg);
}

.device-list {
    max-height: 300px;
    margin: 20px 0;
    overflow-y: auto;
}

.device-item {
    margin: 10px 0;
    padding: 15px;
    border-radius: var(--gp-radius);
    border: 1px solid var(--gp-border);
    background: var(--gp-panel-muted);
    cursor: pointer;
}

.device-item:hover {
    border-color: var(--gp-border-strong);
    background: var(--gp-accent-soft);
}

.device-item.selected {
    background: var(--gp-success-soft);
    border-color: var(--gp-success);
}

.device-name {
    margin-bottom: 5px;
    font-size: 1.1rem;
    font-weight: 900;
}

.device-id {
    color: var(--gp-muted);
    font-size: 0.9rem;
    word-break: break-all;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.mic-empty-state {
    color: var(--gp-muted);
    font-weight: 800;
}

.is-hidden {
    display: none !important;
}

.centered-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.unlock-complete-inline {
    color: var(--gp-success);
    font-size: 1.3rem;
    font-weight: 900;
}

.call-icon-large {
    font-size: 1.4em;
    line-height: 1;
}

@keyframes gpToastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes gpToastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(12px) scale(0.98);
    }
}

@media (orientation: portrait) {
    .keypad-container {
        width: min(92vw, 46vh, 1800px);
        height: auto;
        max-height: 100%;
        aspect-ratio: 9 / 16;
    }

    #skywayModal {
        grid-template-columns: 1fr;
        overflow-y: auto;
        align-content: start;
    }

    .skyway-side-panel {
        width: min(520px, 100%);
        justify-self: center;
    }
}

@media (orientation: portrait) and (min-width: 701px) and (min-height: 1000px) {
    :root {
        --gp-touch: clamp(72px, 7vh, 128px);
    }

    .keypad-container {
        width: min(92vw, 46vh, 1800px);
        height: auto;
        max-height: 100%;
        aspect-ratio: 9 / 16;
    }
}

@media (orientation: landscape) and (min-width: 900px) {
    :root {
        --gp-touch: clamp(62px, 10vh, 88px);
    }

    .keypad-container {
        width: min(1200px, 72vw, 69vh);
        height: auto;
        max-height: 100%;
        aspect-ratio: 9 / 13;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr) auto auto;
        gap: clamp(10px, 1.5vh, 16px);
    }

    .display {
        height: clamp(58px, 10vh, 96px);
        min-height: 58px;
        font-size: clamp(2.4rem, 7vh, 4.8rem);
    }

    .keypad {
        grid-auto-rows: minmax(var(--gp-touch), 1fr);
    }

    #tatoModeButtons {
        grid-template-columns: minmax(84px, 0.8fr) minmax(180px, 2.2fr);
        grid-template-rows: none;
    }

    #tatoModeButtons.has-manager-call {
        grid-template-columns: minmax(84px, 0.8fr) minmax(180px, 1.7fr) minmax(132px, 1.1fr);
        grid-template-rows: none;
    }

    #tatoModeButtons .clear-button,
    #tatoModeButtons .call-button-wide,
    #tatoModeButtons .manager-call-button-wide {
        min-height: clamp(64px, 10vh, 86px);
    }

    #tatoModeButtons .clear-button {
        grid-column: 1;
    }

    #tatoModeButtons .call-button-wide {
        grid-column: 2;
    }

    #tatoModeButtons.has-manager-call .manager-call-button-wide {
        grid-column: 3;
    }

    .call-button,
    .call-button-wide,
    .manager-call-button,
    .manager-call-button-wide {
        min-height: clamp(64px, 10vh, 86px);
    }

    .action-button-row.has-manager-call .call-button {
        flex: 2;
    }

    .action-button-row.has-manager-call .manager-call-button {
        flex: 1;
    }
}

@media (orientation: landscape) and (min-width: 1600px) and (min-height: 1000px) {
    :root {
        --gp-touch: clamp(78px, 8vh, 132px);
    }

    .keypad-container {
        width: min(1600px, 72vw, 69vh);
        height: auto;
        max-height: 100%;
        aspect-ratio: 9 / 13;
    }

    .display {
        height: clamp(72px, 7vh, 112px);
        font-size: clamp(3rem, 6vh, 5.4rem);
    }

    .call-button,
    .call-button-wide,
    .manager-call-button,
    .manager-call-button-wide {
        min-height: clamp(78px, 7vh, 112px);
    }
}

@media (max-width: 700px) {
    html,
    body {
        overflow-y: auto;
    }

    .login-shell,
    .intercom-box,
    .modal {
        padding: 12px;
    }

    .login-panel {
        min-height: calc(100vh - 24px);
        padding: 22px;
    }

    .login-panel__header {
        flex-direction: column;
    }

    .language-control {
        width: 100%;
        justify-content: space-between;
    }

    .language-control select {
        flex: 1;
    }

    .intercom-topbar {
        height: auto;
        min-height: 56px;
    }

    .keypad-container {
        height: auto;
        min-height: calc(100vh - 92px);
        padding: 14px;
        gap: 10px;
    }

    .keypad {
        grid-auto-rows: minmax(66px, 1fr);
        gap: 8px;
    }

    .display {
        height: clamp(58px, 9vh, 72px);
        min-height: 58px;
        font-size: clamp(2rem, 12vw, 3.4rem);
    }

    .call-button,
    .call-button-wide,
    .manager-call-button,
    .manager-call-button-wide {
        min-height: 66px;
    }

    .action-button-row,
    #tatoModeButtons.has-manager-call,
    #tatoModeButtons {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    #tatoModeButtons .clear-button,
    #tatoModeButtons .call-button-wide,
    #tatoModeButtons .manager-call-button-wide {
        grid-column: 1;
    }

    #skywayModal {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .media-streams-complete-content,
    .modal-content {
        width: 100%;
        padding: 20px;
    }

    .media-streams-complete-content {
        padding: 26px 20px;
    }

    #complete-room-number {
        font-size: clamp(2.25rem, 11vw, 3.5rem);
    }

    #complete-call-status {
        font-size: clamp(1.45rem, 6vw, 2.15rem);
    }

    .delivery-notification-button {
        min-height: 52px;
    }
}

@media (max-height: 760px) and (min-width: 701px) {
    :root {
        --gp-touch: clamp(48px, 8.2vh, 72px);
    }

    .intercom-box {
        padding: 8px 14px 12px;
    }

    .intercom-topbar {
        height: clamp(44px, 7vh, 54px);
    }

    .keypad-container {
        width: min(880px, 108vh, calc(100vw - 28px));
        height: 100%;
        gap: clamp(6px, 1.1vh, 10px);
        padding: clamp(10px, 1.8vh, 14px);
    }

    .display {
        height: clamp(48px, 8.8vh, 66px);
        min-height: 48px;
    }

    .call-button,
    .call-button-wide,
    .manager-call-button,
    .manager-call-button-wide {
        min-height: clamp(48px, 8.4vh, 58px);
    }
}

@media (orientation: landscape) and (min-width: 900px) and (max-height: 760px) {
    .keypad-container {
        width: min(860px, 108vh, calc(100vw - 28px));
    }

    .display {
        height: clamp(48px, 8.8vh, 66px);
        min-height: 48px;
    }

    .call-button,
    .call-button-wide,
    .manager-call-button,
    .manager-call-button-wide {
        min-height: clamp(48px, 8.4vh, 58px);
    }
}

@media (max-height: 620px) and (min-width: 701px) {
    :root {
        --gp-touch: clamp(42px, 7.6vh, 56px);
    }

    .intercom-brand__mark {
        width: 36px;
        height: 36px;
    }

    .intercom-topbar {
        min-height: 40px;
    }

    .keypad-container {
        width: min(720px, 112vh, calc(100vw - 20px));
        gap: 6px;
        padding: 10px;
    }

    .video-text,
    .title-message-text,
    .keypad-container > .title-message-text {
        font-size: clamp(0.85rem, 2vh, 1.05rem) !important;
    }

    .display {
        height: clamp(42px, 8vh, 56px);
        min-height: 42px;
        font-size: clamp(1.9rem, 6.8vh, 3.2rem);
    }

    .keypad {
        gap: 6px;
    }

    .call-button,
    .call-button-wide,
    .manager-call-button,
    .manager-call-button-wide {
        min-height: clamp(42px, 7.8vh, 54px);
        font-size: clamp(1rem, 3vh, 1.75rem);
    }
}
