/* Interactive Browser Sandbox (try.html) — CSP-clean external stylesheet */

.sb-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 44px) 0 clamp(24px, 3vw, 36px);
  background:
    radial-gradient(900px 420px at 14% 12%, rgba(28, 126, 214, 0.34), transparent 62%),
    radial-gradient(760px 380px at 88% 85%, rgba(186, 134, 68, 0.18), transparent 64%),
    linear-gradient(155deg, #07192e 0%, #0a2540 52%, #0e3154 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(124, 196, 250, 0.24);
}

.sb-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.sb-hero-copy {
  max-width: 760px;
}

.sb-hero .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(28, 126, 214, 0.24);
  border: 1px solid rgba(124, 196, 250, 0.38);
  color: #e6f2ff;
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0 0 12px;
}

.sb-hero .kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.22);
}

.sb-hero h1 {
  color: #ffffff;
  font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.65rem);
  line-height: 1.12;
  margin: 0 0 10px;
}

.sb-hero p.lede {
  color: #d6e4f5;
  font-size: 1.025rem;
  line-height: 1.55;
  margin: 0;
}

.sb-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Control bar */
.sb-controls-section {
  padding: 18px 0 10px;
  background: #ebe3d5;
  border-bottom: 1px solid #d5c7b2;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(10, 37, 64, 0.07);
}

.sb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sb-mode-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: #dfd4c2;
  border: 1px solid #cbbba2;
}

.sb-mode-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #1b2330;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sb-mode-btn:hover {
  background: rgba(255, 255, 255, 0.55);
}

.sb-mode-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #133b68 0%, #0a2540 100%);
  color: #ffffff;
  border-color: rgba(124, 196, 250, 0.4);
  box-shadow: 0 4px 12px rgba(10, 37, 64, 0.25);
}

.sb-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1c7ed6;
}

.sb-mode-btn[aria-pressed="true"] .sb-mode-dot {
  background: #4ade80;
}

.sb-util-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sb-util-btn {
  appearance: none;
  border: 1px solid #c5b49a;
  background: linear-gradient(180deg, #fcfaf6 0%, #efe6d7 100%);
  color: #0a2540;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(15, 28, 46, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.sb-util-btn:hover {
  transform: translateY(-1px);
  border-color: #a89272;
}

.sb-util-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  border-color: #475569;
}

/* Guided tour bar */
.sb-tour-bar {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(185, 168, 142, 0.5);
}

.sb-tour-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #3b4859;
  margin-right: 4px;
}

.sb-tour-chip {
  appearance: none;
  border: 1px solid #cbbba2;
  background: #faf6ef;
  color: #0a2540;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.sb-tour-chip:hover {
  background: #0a2540;
  color: #ffffff;
  border-color: #0a2540;
}

.sb-tour-chip.is-done {
  background: #e6f4ea;
  border-color: #84c99a;
  color: #0f5132;
}

/* Live sync banner */
.sb-sync-banner {
  margin: 14px 0 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, #0a2540 0%, #133b68 100%);
  color: #ffffff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
  box-shadow: 0 6px 18px rgba(10, 37, 64, 0.14);
}

.sb-sync-banner strong {
  color: #7cc4fa;
}

.sb-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.45);
  color: #bbf7d0;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Workspace stage */
.sb-stage-wrap {
  padding: 24px 0 60px;
  background: linear-gradient(180deg, #e2d5c1 0%, #d6c5ab 100%);
  border-bottom: 1px solid rgba(105, 78, 44, 0.32);
}

.sb-stage {
  display: grid;
  gap: 22px;
  align-items: start;
}

.sb-stage[data-mode="split"] {
  grid-template-columns: minmax(0, 1fr) 375px;
}

.sb-stage[data-mode="staff"] {
  grid-template-columns: minmax(0, 1fr);
}

.sb-stage[data-mode="portal"] {
  grid-template-columns: minmax(0, 420px);
  justify-content: center;
}

.sb-stage[data-mode="staff"] .sb-phone-col {
  display: none;
}

.sb-stage[data-mode="portal"] .sb-staff-col {
  display: none;
}

@media (max-width: 1120px) {
  .sb-stage[data-mode="split"] {
    grid-template-columns: minmax(0, 1fr);
  }
  .sb-stage[data-mode="split"] .sb-phone-col {
    max-width: 420px;
    margin: 0 auto;
    width: 100%;
  }
}

/* Staff app shell */
.sb-app {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #c9bba5;
  background: #f6f1e8;
  color: #1b2330;
  box-shadow: 0 22px 50px rgba(10, 37, 64, 0.16);
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  min-height: 690px;
}

.sb-app[data-theme="dark"] {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

@media (max-width: 820px) {
  .sb-app {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Sidebar */
.sb-sidebar {
  background: linear-gradient(180deg, #0a2540 0%, #07192e 100%);
  color: #e2e8f0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid rgba(124, 196, 250, 0.18);
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 14px;
}

.sb-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(145deg, #1c7ed6, #0f4c8a);
  color: #ffffff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.sb-brand-text strong {
  display: block;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.2;
}

.sb-brand-text span {
  display: block;
  color: #9ec5eb;
  font-size: 0.75rem;
}

.sb-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.sb-nav-btn {
  width: 100%;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #cfe0f2;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  transition: all 0.14s ease;
}

.sb-nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sb-nav-btn[aria-current="page"] {
  background: linear-gradient(90deg, rgba(28, 126, 214, 0.38) 0%, rgba(28, 126, 214, 0.16) 100%);
  border-color: rgba(124, 196, 250, 0.42);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #7cc4fa;
}

.sb-nav-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
}

.sb-nav-badge.is-alert {
  background: #d97706;
  color: #ffffff;
}

.sb-sidebar-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  color: #b8cce4;
}

.sb-sidebar-foot strong {
  display: block;
  color: #ffffff;
  font-size: 0.84rem;
}

/* Staff main workspace */
.sb-main {
  padding: 20px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sb-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ded3c1;
}

.sb-app[data-theme="dark"] .sb-topbar {
  border-bottom-color: #334155;
}

.sb-topbar-title h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #0a2540;
}

.sb-app[data-theme="dark"] .sb-topbar-title h2 {
  color: #f8fafc;
}

.sb-topbar-title p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: #5b6574;
}

.sb-app[data-theme="dark"] .sb-topbar-title p {
  color: #94a3b8;
}

.sb-topbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sb-select, .sb-input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid #c7b8a1;
  background: #ffffff;
  color: #1b2330;
}

.sb-app[data-theme="dark"] .sb-select,
.sb-app[data-theme="dark"] .sb-input {
  background: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}

.sb-action-btn {
  appearance: none;
  border: 1px solid #0a2540;
  background: linear-gradient(180deg, #164375 0%, #0a2540 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.sb-action-btn:hover {
  background: linear-gradient(180deg, #1d528d 0%, #0f3256 100%);
}

.sb-action-btn.is-secondary {
  background: #ffffff;
  color: #0a2540;
  border-color: #c5b59c;
}

.sb-app[data-theme="dark"] .sb-action-btn.is-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #475569;
}

.sb-action-btn.is-gold {
  background: linear-gradient(180deg, #d99b26 0%, #b7791f 100%);
  border-color: #975a16;
  color: #ffffff;
}

/* KPI grid */
.sb-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 1200px) {
  .sb-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .sb-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sb-kpi-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8f3ea 100%);
  border: 1px solid #d8cbb8;
  border-radius: 12px;
  padding: 12px 13px;
  box-shadow: 0 4px 10px rgba(10, 37, 64, 0.05);
}

.sb-app[data-theme="dark"] .sb-kpi-card {
  background: #1e293b;
  border-color: #334155;
}

.sb-kpi-card.is-highlight {
  border-color: #1c7ed6;
  box-shadow: 0 0 0 2px rgba(28, 126, 214, 0.18);
}

.sb-kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5b6574;
  display: block;
}

.sb-app[data-theme="dark"] .sb-kpi-label {
  color: #94a3b8;
}

.sb-kpi-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0a2540;
  display: block;
  margin-top: 3px;
}

.sb-app[data-theme="dark"] .sb-kpi-val {
  color: #f8fafc;
}

.sb-kpi-sub {
  font-size: 0.75rem;
  color: #4b5563;
  display: block;
  margin-top: 2px;
}

.sb-app[data-theme="dark"] .sb-kpi-sub {
  color: #cbd5e1;
}

/* Panels & Columns */
.sb-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 960px) {
  .sb-cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sb-panel {
  background: #ffffff;
  border: 1px solid #d8cbb8;
  border-radius: 14px;
  padding: 15px 16px;
  box-shadow: 0 6px 16px rgba(10, 37, 64, 0.05);
}

.sb-app[data-theme="dark"] .sb-panel {
  background: #1e293b;
  border-color: #334155;
}

.sb-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ede5d8;
}

.sb-app[data-theme="dark"] .sb-panel-head {
  border-bottom-color: #334155;
}

.sb-panel-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #0a2540;
}

.sb-app[data-theme="dark"] .sb-panel-head h3 {
  color: #f8fafc;
}

.sb-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.sb-task-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #faf6ef;
  border: 1px solid #e6dccb;
  font-size: 0.83rem;
}

.sb-app[data-theme="dark"] .sb-task-item {
  background: #0f172a;
  border-color: #334155;
}

.sb-task-item.is-done {
  opacity: 0.62;
  text-decoration: line-through;
}

.sb-task-item strong {
  display: block;
  color: #0a2540;
}

.sb-app[data-theme="dark"] .sb-task-item strong {
  color: #f1f5f9;
}

.sb-task-meta {
  display: block;
  font-size: 0.75rem;
  color: #5b6574;
  margin-top: 2px;
}

.sb-app[data-theme="dark"] .sb-task-meta {
  color: #94a3b8;
}

.sb-mini-btn {
  appearance: none;
  border: 1px solid #c5b49a;
  background: #ffffff;
  color: #0a2540;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.sb-mini-btn:hover {
  background: #0a2540;
  color: #ffffff;
  border-color: #0a2540;
}

.sb-mini-btn.is-active {
  background: #0f5132;
  color: #ffffff;
  border-color: #0f5132;
}

.sb-mini-btn.is-warn {
  background: #9a3412;
  color: #ffffff;
  border-color: #9a3412;
}

.sb-mini-btn.is-pass {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

/* Tables inside Staff view */
.sb-table-wrap {
  overflow-x: auto;
}

.sb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.sb-table th {
  text-align: left;
  padding: 9px 10px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5b6574;
  border-bottom: 1px solid #ded3c1;
  background: #faf6ef;
}

.sb-app[data-theme="dark"] .sb-table th {
  background: #0f172a;
  color: #94a3b8;
  border-bottom-color: #334155;
}

.sb-table td {
  padding: 10px;
  border-bottom: 1px solid #eee6d8;
  vertical-align: middle;
}

.sb-app[data-theme="dark"] .sb-table td {
  border-bottom-color: #334155;
}

.sb-table tr.is-clickable {
  cursor: pointer;
}

.sb-table tr.is-clickable:hover {
  background: rgba(28, 126, 214, 0.06);
}

.sb-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.sb-badge.is-green {
  background: #dcfce7;
  color: #166534;
}

.sb-badge.is-blue {
  background: #dbeafe;
  color: #1e40af;
}

.sb-badge.is-amber {
  background: #fef3c7;
  color: #92400e;
}

.sb-badge.is-red {
  background: #fee2e2;
  color: #991b1b;
}

.sb-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Resident Detail / Modal Box inside Staff view */
.sb-detail-drawer {
  margin-top: 12px;
  padding: 16px;
  border-radius: 12px;
  background: #faf6ef;
  border: 1px solid #cbbba2;
}

.sb-app[data-theme="dark"] .sb-detail-drawer {
  background: #0f172a;
  border-color: #475569;
}

.sb-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .sb-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Mobile Phone Portal Column */
.sb-phone-shell {
  background: #07192e;
  border-radius: 34px;
  padding: 12px;
  border: 3px solid #1e3a5f;
  box-shadow: 0 24px 54px rgba(7, 25, 46, 0.28);
}

.sb-phone-notch {
  width: 110px;
  height: 18px;
  background: #04101f;
  border-radius: 0 0 12px 12px;
  margin: 0 auto 8px;
}

.sb-phone-screen {
  background: #f6f1e8;
  color: #1b2330;
  border-radius: 24px;
  overflow: hidden;
  min-height: 640px;
  display: flex;
  flex-direction: column;
}

.sb-phone-header {
  background: linear-gradient(145deg, #0a2540 0%, #133b68 100%);
  color: #ffffff;
  padding: 16px;
}

.sb-phone-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9ec5eb;
  margin-bottom: 6px;
}

.sb-phone-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.15rem;
}

.sb-phone-header p {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: #d6e4f5;
}

.sb-phone-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.sb-phone-card {
  background: #ffffff;
  border: 1px solid #d8cbb8;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 10px rgba(10, 37, 64, 0.05);
}

.sb-phone-card h4 {
  margin: 0 0 8px;
  font-size: 0.92rem;
  color: #0a2540;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sb-phone-field {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: #4b5563;
}

.sb-phone-cta {
  width: 100%;
  appearance: none;
  border: none;
  border-radius: 11px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, #1c7ed6 0%, #0f4c8a 100%);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(28, 126, 214, 0.28);
  transition: transform 0.12s ease;
}

.sb-phone-cta:hover {
  transform: translateY(-1px);
}

.sb-phone-cta.is-return {
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.28);
}

.sb-check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid #eee6d8;
  font-size: 0.82rem;
  cursor: pointer;
}

.sb-check-row:last-child {
  border-bottom: none;
}

.sb-receipt-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #14532d;
  font-size: 0.83rem;
}

.sb-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

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