/* VCUBE Studio Plus: styles for add-on parts only. Uses the portal's colour variables so it matches light and dark mode. */

/* Install button in the top bar and on login pages */
.stp-install { width: auto; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; font: inherit; font-size: 13.5px; font-weight: 650; color: var(--text-2, #334155); }
.stp-install[hidden] { display: none; }
.stp-install svg, .stp-sheet svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 720px) {
  .stp-install { width: 42px; padding: 0; justify-content: center; }
  .stp-install-label { display: none; }
}
@media (pointer: coarse) { .stp-install { min-height: 44px; min-width: 44px; } }

/* iPhone steps sheet */
.stp-backdrop { position: fixed; inset: 0; z-index: 95; background: rgba(2, 6, 23, .55); }
.stp-sheet { position: fixed; z-index: 96; left: 50%; bottom: 0; transform: translateX(-50%); width: min(480px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--surface, #fff); color: var(--text, #0f172a);
  box-shadow: 0 -20px 50px -20px rgba(2, 6, 23, .5); animation: stp-up .28s cubic-bezier(.2, .8, .2, 1); }
.stp-sheet:focus { outline: none; }
@keyframes stp-up { from { transform: translate(-50%, 24px); opacity: 0; } }
.stp-sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.stp-sheet-head > div { flex: 1; min-width: 0; }
.stp-sheet-head h2 { margin: 0; font-size: 18px; }
.stp-sheet-head p { margin: 2px 0 0; font-size: 14px; color: var(--muted, #5a6a80); }
.stp-sheet-icon { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.stp-sheet-x { flex: none; width: 44px; height: 44px; }
.stp-steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.stp-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--surface-2, #f8f9fc); }
.stp-steps strong { display: block; font-size: 15px; }
.stp-steps span:not(.stp-step-ic) { display: block; font-size: 13.5px; color: var(--muted, #5a6a80); }
.stp-step-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft, rgba(99, 102, 241, .1)); color: var(--brand-1, #6366f1); font-weight: 800; }

@media (prefers-reduced-motion: reduce) { .stp-sheet { animation: none; } }
@media print { .stp-install, .stp-sheet, .stp-backdrop { display: none !important; } }

/* ---------- Phase 2: live notifications ---------- */
.stp-bell-count { position: absolute; top: 3px; right: 3px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px;
  background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; line-height: 1; border: 2px solid var(--surface, #fff); animation: stp-pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes stp-pop { from { transform: scale(.4); } }
.stp-menu-gear { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted, #5a6a80); cursor: pointer; margin-left: 4px; }
.stp-menu-gear:hover { background: var(--surface-3, #eef0f6); color: var(--text, #0f172a); }
.stp-menu-gear svg, .stp-card svg, .stp-urgent svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.stp-cards { position: fixed; z-index: 85; top: calc(var(--topbar-h, 64px) + 12px); right: 16px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.stp-card { pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; padding: 14px 10px 14px 14px; border-radius: 16px; background: var(--surface, #fff); color: var(--text, #0f172a);
  border: 1px solid var(--border, #e6e8f0); border-left: 4px solid var(--brand-1, #6366f1); box-shadow: 0 20px 40px -16px rgba(15, 23, 42, .35);
  opacity: 0; transform: translateX(24px); transition: opacity .25s, transform .3s cubic-bezier(.2, 1, .3, 1); }
.stp-card.stp-in { opacity: 1; transform: none; }
.stp-tone-success { border-left-color: #047857; } .stp-tone-warning { border-left-color: #b45309; } .stp-tone-danger { border-left-color: #b91c1c; } .stp-tone-violet { border-left-color: #6d28d9; } .stp-tone-info { border-left-color: #1d4ed8; }
.stp-card-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft, rgba(99, 102, 241, .1)); color: var(--brand-1, #6366f1); animation: stp-ring .6s ease 2; }
@keyframes stp-ring { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.stp-card-text { flex: 1; min-width: 0; }
.stp-card-text strong { display: block; font-size: 14.5px; }
.stp-card-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; color: var(--muted, #5a6a80); overflow-wrap: anywhere; }
.stp-card-text em { display: block; margin-top: 2px; font-style: normal; font-size: 12.5px; font-weight: 650; color: var(--muted, #5a6a80); }
.stp-card-go { flex: none; align-self: center; min-height: 44px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 10px; font-weight: 700; font-size: 14px; text-decoration: none !important; }
.stp-card-go:hover { background: var(--brand-soft, rgba(99, 102, 241, .1)); }
.stp-card-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted, #5a6a80); cursor: pointer; }
.stp-card-x:hover { background: var(--surface-3, #eef0f6); }

.stp-urgent { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 20px; padding: 12px 14px; border-radius: 16px;
  background: var(--danger-bg, #fef2f2); border: 1px solid var(--danger-bd, #fecaca); color: var(--danger, #b91c1c); }
.stp-urgent-head { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.stp-urgent-head svg { animation: stp-pulse 1.6s ease-in-out infinite; }
@keyframes stp-pulse { 50% { opacity: .35; } }
.stp-urgent-links { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.stp-urgent-links a { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 99px; background: var(--surface, #fff); color: var(--danger, #b91c1c) !important;
  border: 1px solid var(--danger-bd, #fecaca); font-size: 13.5px; font-weight: 700; text-decoration: none !important; }
.stp-urgent-links a:hover { filter: brightness(.97); }
.stp-urgent-hide { min-height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.stp-urgent-hide:hover { background: rgba(0, 0, 0, .05); }

.stp-sheet-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
span.stp-sheet-icon { display: grid; place-items: center; background: var(--brand-soft, rgba(99, 102, 241, .1)); color: var(--brand-1, #6366f1); }
span.stp-sheet-icon img { width: 100%; height: 100%; border-radius: 14px; }
.stp-settings { display: flex; flex-direction: column; gap: 10px; }
.stp-toggle { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2, #f8f9fc); cursor: pointer; min-height: 56px; }
.stp-toggle span { flex: 1; min-width: 0; }
.stp-toggle strong { display: block; font-size: 15px; }
.stp-toggle small { display: block; font-size: 13px; color: var(--muted, #5a6a80); }
.stp-toggle input { width: 22px; height: 22px; flex: none; accent-color: var(--brand-1, #6366f1); }
.stp-perm, .stp-save-msg { margin: 0; font-size: 13px; color: var(--danger, #b91c1c); }
.stp-perm:empty, .stp-save-msg:empty { display: none; }
.stp-hours { display: flex; gap: 10px; padding: 0 4px; }
.stp-hours[hidden] { display: none; }
.stp-hours label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 650; }
.stp-hours select { min-height: 44px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--border-strong, #d5d9e5); background: var(--surface, #fff); color: var(--text, #0f172a); font: inherit; font-size: 16px; }

@media (max-width: 720px) {
  .stp-cards { top: calc(var(--topbar-h, 64px) + 8px); left: 12px; right: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .stp-card, .stp-card-ic, .stp-bell-count, .stp-urgent-head svg { animation: none !important; transition: none !important; }
}
@media print { .stp-cards, .stp-urgent { display: none !important; } }
/* Text colours chosen for at least 4.5:1 contrast in both themes */
.stp-urgent, .stp-urgent-links a, .stp-perm, .stp-save-msg { color: #b91c1c !important; }
.stp-card-go { color: #4f46e5 !important; }
:root[data-theme="dark"] .stp-urgent, :root[data-theme="dark"] .stp-urgent-links a, :root[data-theme="dark"] .stp-perm, :root[data-theme="dark"] .stp-save-msg { color: #fca5a5 !important; }
:root[data-theme="dark"] .stp-card-go { color: #a5b4fc !important; }

/* ---------- Phase 3: tour, checklist, help ---------- */
.stp-help svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { .stp-help { min-width: 44px; min-height: 44px; } }
.stp-tour-shade { position: fixed; inset: 0; z-index: 97; background: transparent; }
.stp-tour-shade.stp-tour-dim { background: rgba(2, 6, 23, .62); }
.stp-tour-hole { position: fixed; z-index: 98; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(2, 6, 23, .62), 0 0 0 3px #a5b4fc;
  transition: left .3s cubic-bezier(.2, .8, .2, 1), top .3s cubic-bezier(.2, .8, .2, 1), width .3s, height .3s; }
.stp-tour-hole[hidden] { display: none; }
.stp-tour { position: fixed; z-index: 99; width: min(340px, calc(100vw - 24px)); padding: 18px; border-radius: 18px; background: var(--surface, #fff); color: var(--text, #0f172a);
  box-shadow: 0 30px 60px -20px rgba(2, 6, 23, .6); }
.stp-tour:focus { outline: none; }
.stp-tour.stp-tour-center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
.stp-tour-count { font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #5a6a80); }
.stp-tour h2 { margin: 6px 0 6px; font-size: 18px; }
.stp-tour p { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; color: var(--text-2, #334155); }
.stp-tour-row { display: flex; align-items: center; gap: 8px; }
.stp-tour-row .btn { min-height: 44px; }
.stp-tour-skip { margin-right: auto; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--muted, #5a6a80); font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer; border-radius: 10px; }
.stp-tour-skip:hover { background: var(--surface-3, #eef0f6); color: var(--text, #0f172a); }

.stp-checklist { margin-bottom: 20px; padding: 18px 20px; }
.stp-check-head { display: flex; align-items: flex-start; gap: 12px; }
.stp-check-head > div { flex: 1; }
.stp-check-head h3 { margin: 0; font-size: 16px; }
.stp-check-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted, #5a6a80); }
.stp-check-head .stp-tour-skip { margin-right: 0; }
.stp-check-bar { height: 8px; margin: 12px 0 10px; border-radius: 99px; background: var(--surface-3, #eef0f6); overflow: hidden; }
.stp-check-bar span { display: block; height: 100%; border-radius: inherit; background: #4f46e5; transition: width .6s; }
.stp-check-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.stp-check-list li { display: flex; align-items: center; gap: 10px; }
.stp-check-mark { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--border-strong, #d5d9e5); font-size: 12px; font-weight: 800; color: #fff; }
.stp-done .stp-check-mark { background: #047857; border-color: #047857; }
.stp-check-list button { flex: 1; min-height: 44px; padding: 0; border: 0; background: transparent; text-align: left; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--text, #0f172a); cursor: pointer; }
.stp-check-list button:hover { text-decoration: underline; }
.stp-done button { color: var(--muted, #5a6a80); text-decoration: line-through; }
.stp-help-sub { margin: 18px 0 6px; font-size: 14px; }
.stp-help-alerts { margin-top: 10px; }
.stp-welcome-note { margin: 0 0 14px; font-size: 14px; color: var(--muted, #5a6a80); }
@media (prefers-reduced-motion: reduce) { .stp-tour-hole, .stp-check-bar span { transition: none; } }
@media print { .stp-checklist, .stp-help, .stp-tour, .stp-tour-hole, .stp-tour-shade { display: none !important; } }
/* Small phones: "?" moves into the bell menu so the page title keeps its room */
.stp-menu-help { display: none; }
@media (max-width: 480px) {
  .stp-help { display: none !important; }
  .stp-menu-help { display: grid; }
}

/* ---------- Phase 4: quick search, shortcuts, What's new, logout warning, connection banner ---------- */
.stp-search-btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 8px 0 12px; border-radius: 12px; border: 1px solid var(--border, #e6e8f0);
  background: var(--surface-2, #f8f9fc); color: var(--muted, #5a6a80); font: inherit; font-size: 13.5px; cursor: pointer; }
.stp-search-btn:hover { border-color: var(--border-strong, #d5d9e5); color: var(--text, #0f172a); }
.stp-search-btn kbd, .stp-keys kbd { font: inherit; font-size: 11.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-strong, #d5d9e5); background: var(--surface, #fff); color: var(--text-2, #334155); }
.stp-search-btn svg, .stp-search-fab svg, .stp-search-ic svg, .stp-net svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stp-search-fab { display: none; }
@media (max-width: 720px) {
  .stp-search-btn { display: none; }
  .stp-search-fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom) + 16px); z-index: 36;
    width: 56px; height: 56px; border: 0; border-radius: 50%; background: #4f46e5; color: #fff; box-shadow: 0 14px 30px -10px rgba(79, 70, 229, .7); cursor: pointer; }
  .stp-search-fab svg { width: 22px; height: 22px; }
  .area-admin .content { padding-bottom: calc(var(--tabbar-h, 68px) + 96px) !important; }
}

.stp-search { position: fixed; z-index: 96; left: 50%; top: 12vh; transform: translateX(-50%); width: min(620px, calc(100vw - 24px)); max-height: 72vh; display: flex; flex-direction: column;
  border-radius: 18px; background: var(--surface, #fff); color: var(--text, #0f172a); box-shadow: 0 40px 80px -24px rgba(2, 6, 23, .6); overflow: hidden; }
.stp-search-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--border, #e6e8f0); }
.stp-search-ic { color: var(--muted, #5a6a80); display: grid; }
.stp-search-bar input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 17px; }
.stp-search-bar input::-webkit-search-cancel-button { display: none; }
.stp-search-esc { min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong, #d5d9e5); background: var(--surface-2, #f8f9fc); color: var(--muted, #5a6a80); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.stp-results { overflow-y: auto; padding: 6px 8px 8px; }
.stp-results-head { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #5a6a80); }
.stp-opt { display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: 6px 12px; border-radius: 12px; cursor: pointer; }
.stp-opt strong { font-size: 14.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stp-opt span { font-size: 13px; color: var(--muted, #5a6a80); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stp-opt[aria-selected="true"] { background: var(--brand-soft, rgba(99, 102, 241, .1)); box-shadow: inset 3px 0 0 #4f46e5; }
.stp-search-status { margin: 0; padding: 10px 18px 0; font-size: 13.5px; color: var(--muted, #5a6a80); }
.stp-search-status:empty { display: none; }
.stp-search-hint { margin: 0; padding: 8px 16px; border-top: 1px solid var(--border, #e6e8f0); font-size: 12px; color: var(--muted, #5a6a80); }
@media (max-width: 720px) {
  .stp-search { top: 0; width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .stp-search-hint { display: none; }
}

.stp-keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0 0 6px; align-items: center; }
.stp-keys dt { display: flex; gap: 4px; }
.stp-keys dd { margin: 0; font-size: 14.5px; }
.stp-news { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.stp-news li { padding: 12px 14px; border-radius: 14px; background: var(--surface-2, #f8f9fc); }
.stp-news strong { display: block; font-size: 15px; }
.stp-news span { display: block; font-size: 13.5px; color: var(--muted, #5a6a80); }

.stp-idle { position: fixed; z-index: 94; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); padding: 16px;
  border-radius: 16px; background: #0f172a; color: #fff; box-shadow: 0 30px 60px -20px rgba(2, 6, 23, .7); }
.stp-idle[hidden] { display: none; }
.stp-idle p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.5; }
.stp-idle-row { display: flex; gap: 8px; justify-content: flex-end; }
.stp-idle-row .btn { min-height: 44px; }
.stp-idle-row .btn:not(.btn-primary) { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, .35); background: transparent; color: #fff; }
@media (max-width: 1024px) { .stp-idle { bottom: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom) + 12px); } }

.stp-net { position: fixed; z-index: 93; left: 50%; top: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 8px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 650; box-shadow: 0 16px 30px -14px rgba(2, 6, 23, .5); }
.stp-net[hidden] { display: none; }
.stp-net-off { background: #7f1d1d; color: #fff; }
.stp-net-slow { background: #78350f; color: #fff; }
.stp-net-on { background: #065f46; color: #fff; }
.stp-net-x { width: 32px; height: 32px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.stp-net-x:hover { background: rgba(255, 255, 255, .15); }
@media print { .stp-search-btn, .stp-search-fab, .stp-idle, .stp-net { display: none !important; } }
