:root {
  --ink: #FFFFFF;
  --card: rgba(255,255,255,0.1);
  --list: rgba(255,255,255,0.1);
  --btn: rgba(255,255,255,0.2);
  --btn-ink: #FFFFFF;
  --connect: rgba(255,255,255,0.2);
  --radius-xl: 5px;
  --radius-2xl: 10px;
}
* { box-sizing: border-box }
html, body {
  height: 100%;
  margin: 0;
  font-family: "noto-sans", sans-serif;
  color: var(--ink);
  /* Background moved to a fixed safe-area layer (see body::before) */
}
/* Prevent the root from scrolling; the body will be our scroll container */
html { overflow: hidden; }

/* Ensure page content scrolls within the safe area */
body {
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  /* Constrain content to the device safe area (iOS notch, etc.) */
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  /* Older iOS fallback */
  padding-top: constant(safe-area-inset-top);
  padding-right: constant(safe-area-inset-right);
  padding-bottom: constant(safe-area-inset-bottom);
  padding-left: constant(safe-area-inset-left);
}

/* Fixed background that only occupies the safe area and does not scroll */
body::before {
  content: "";
  position: fixed;
  top: env(safe-area-inset-top);
  right: env(safe-area-inset-right);
  bottom: env(safe-area-inset-bottom);
  left: env(safe-area-inset-left);
  /* Older iOS fallback */
  top: constant(safe-area-inset-top);
  right: constant(safe-area-inset-right);
  bottom: constant(safe-area-inset-bottom);
  left: constant(safe-area-inset-left);
  background-color: #5d7ab4;
  background: url("../img/background.webp") no-repeat center / cover;
  z-index: -1; /* behind page content */
  pointer-events: none;
}
.frame {
  min-height: 100%;
  place-items: center;
  padding: 24px;
}
.panel {
  max-width: 640px;
  position: relative;
}
.logo {
  position: relative;
  height: 48px;
  text-align: right;
}

/* Overlay container uses the same background as the main page (no transparency) */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: url("../img/background.webp") fixed;
  background-size: 100% 100%;
  z-index: 9999;
}

#overlayContent {
  width: 100%;
  height: 100%;
  overflow: auto;
}
@supports (height: 100dvh) {
  html, body { min-height: 100dvh; }
  .frame { min-height: 100dvh; }
  #overlayContent { min-height: 100dvh; height: auto; }
}
.logo img {
    width: 48px;
    height: 48px;
    top: 24px;
    right: 24px;
    position: absolute;
}
h1 {
  font-weight: 700;
  font-size: 24px;
  margin: 0;
}
.subhead {
  font-size: 20px;
  font-weight: 500;
}
p.lead {
  font-size: 16px;
  font-weight: 400;
  margin: 24px 0;
}
.section-title {
  font-size: 18px;
  font-weight: 500;
  margin: 24px 0 12px;
}
.icon-square {
  width: 48px;
  height: 48px;
  margin: 12px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  flex: 0 0 auto;
  background: #000;
  display: grid;
  place-items: center;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
}
.status-chip .tick {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: url("../img/checkmark.svg") no-repeat center;
  display: grid;
  place-items: center;
}
.connect {
  margin-left: auto;
  margin-right: 12px;
  padding: 0 16px;
  height: 32px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-ink);
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  font-size: 14px;
  line-height: 32px;
}
.list {
  background: var(--list);
  border-radius: var(--radius-2xl);
}
.source-item {
  display: flex;
  align-items: center;
  border-radius: 18px;
}
.name {
  font-size: 16px;
  font-weight: 500;
  flex: 1;
}
.disconnect {
  width: 72px;
  height: 72px;
  opacity: .4;
  margin-left: auto;
}
img.icon-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.message {
width: 100%;
	height: 100%;
	text-align: center;
}

.message-visual {
  position: relative;
  height: 48px;
}
.message-visual img {
  width: 48px;
  height: 48px;
}

.message-text {
  font-size: 20px;
  font-weight: 500;
	margin: 24px 0;
}

.message-button {
  padding: 0 16px;
  height: 48px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-ink);
  font-weight: 600;
  text-decoration: none;
  font-size: 20px;
  line-height: 48px;
	display: block;
	width: 160px;
	text-align: center;
	margin: 12px auto;
}

.destructive {
	background: rgba(229,0,0,.4);
}

/* Phone Number Design */

/* FORM WRAPPER (optional utility for spacing) */
.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}

/* PHONE INPUT */
.input-field {
  flex: 1;
  height: 48px;
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: rgba(255,255,255,0.08);         /* aligns with translucent cards */
  border: 1px solid rgba(255,255,255,0.25);   /* subtle outline */
  border-radius: var(--radius-2xl);           /* 10px from your tokens */
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

/* Focus/hover states to match your glow-y aesthetic */
.input-field:hover {
  background: rgba(255,255,255,0.12);
}
.input-field:focus {
  border-color: rgba(255,255,255,0.5);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

/* Primary button — consistent with .connect/.message-button */
.btn-primary {
  padding: 0 20px;
  height: 48px;                               /* same vertical rhythm as .message-button */
  border-radius: 999px;                        /* pill */
  background: var(--btn);                      /* rgba(255,255,255,0.2) */
  color: var(--btn-ink);                       /* #fff */
  font-weight: 600;
  text-decoration: none;
  font-size: 16px;
  line-height: 48px;                           /* center text vertically */
  text-transform: uppercase;                   /* matches your .connect style */
  border: none;
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Inline “Edit” link — subtle, but discoverable */
.link-edit {
  margin-left: 8px;
  color: var(--btn-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;                  /* aligns with your action labels */
  padding: 4px 10px;
  border-radius: 999px;
  background: transparent;
  transition: background-color .15s ease, opacity .15s ease, text-decoration-color .15s ease;
}
.link-edit:hover { background: rgba(255,255,255,0.08); }
.link-edit:active { opacity: 0.8; }

/* Result text alignment to match your typography scale */
.result-line {
  font-size: 16px;
  font-weight: 500;
}

/* White, semi-transparent placeholder (works cross-browser) */
.input-field::placeholder {
  color: rgba(255, 255, 255, 0.6); /* tweak 0.6 as you like */
  opacity: 1;                      /* Safari/WebKit ensure custom color shows */
}

/* Older browser prefixes (safe to include) */
.input-field::-webkit-input-placeholder { color: rgba(255,255,255,0.6); opacity:1; }
.input-field::-moz-placeholder { color: rgba(255,255,255,0.6); opacity:1; }
.input-field:-ms-input-placeholder { color: rgba(255,255,255,0.6); }
.input-field::-ms-input-placeholder { color: rgba(255,255,255,0.6); }

/* Error state for input field */
.input-field.error {
  border-color: rgba(255, 200, 80, 0.9);
  background: rgba(255, 200, 80, 0.15);
  box-shadow: 0 0 0 2px rgba(255, 200, 80, 0.4);
}

/* Error message styling */
.error-message {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: #ffd966;
  background: rgba(255, 200, 80, 0.2);
  border-left: 3px solid #ffc850;
  border-radius: 4px;
}

/* Success message styling */
.error-message.success {
  color: #7dff7d;
  background: rgba(100, 255, 100, 0.2);
  border-left: 3px solid #5dff5d;
}

/* ============================================================================
   ADMIN SCREEN STYLES (Hidden Debug/Admin Interface)
   ============================================================================ */

/* Full-screen overlay */
.admin-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  overflow-y: auto;
  padding: 20px;
}

/* Header with close button */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.admin-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Content container */
.admin-content {
  max-width: 800px;
  margin: 0 auto;
}

/* Section styling */
.admin-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.admin-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Field styling */
.admin-field {
  margin-bottom: 16px;
}

.admin-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
}

.admin-value {
  font-size: 16px;
  color: var(--ink);
  font-family: 'Courier New', monospace;
  padding: 8px 0;
}

.admin-field-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Input styling */
.admin-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  outline: none;
  transition: all 0.15s ease;
  font-family: 'Courier New', monospace;
}

.admin-input:focus {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

/* Button styling */
.admin-btn {
  padding: 0 20px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.admin-btn-small {
  padding: 0 16px;
  height: 40px;
}

.admin-btn-danger {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 80, 80, 0.5);
  color: #ff6b6b;
}

.admin-btn-danger:hover {
  background: rgba(255, 80, 80, 0.3);
}

.admin-btn-primary {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.5);
  color: #60a5fa;
}

.admin-btn-primary:hover {
  background: rgba(37, 99, 235, 0.3);
}

.admin-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Profile card (expandable) */
.admin-profile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.admin-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.admin-profile-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.admin-profile-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.admin-profile-id {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Courier New', monospace;
  margin-left: 10px;
}

.admin-profile-toggle {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease;
}

.admin-profile.expanded .admin-profile-toggle {
  transform: rotate(180deg);
}

.admin-profile-body {
  display: none;
  padding: 0 16px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-profile.expanded .admin-profile-body {
  display: block;
}

/* Provider list within profile */
.admin-providers {
  margin-top: 16px;
}

.admin-provider {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
}

.admin-provider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.admin-provider-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.admin-provider-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.admin-provider-status.connected {
  background: rgba(100, 255, 100, 0.2);
  color: #7dff7d;
}

.admin-provider-status.disconnected {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

.admin-provider-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.admin-btn-xs {
  padding: 0 12px;
  height: 32px;
  font-size: 12px;
}

/* Preference display */
.admin-preferences {
  margin-top: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: rgba(255, 255, 255, 0.7);
  max-height: 200px;
  overflow-y: auto;
}

.admin-preferences pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Admin Modal */
.admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-content {
  background: rgba(20, 20, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.admin-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.admin-modal-body {
  padding: 20px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

.admin-modal-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-modal-item:last-child {
  border-bottom: none;
}

.admin-modal-item.legacy-matched {
  color: #7dff7d;
}

.admin-modal-item.legacy-synced {
  color: #7dff7d;
  font-weight: 600;
}

.admin-modal-item .badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 8px;
}

.admin-modal-item .badge-legacy {
  background: rgba(100, 255, 100, 0.2);
  color: #7dff7d;
}

.admin-modal-item .badge-synced {
  background: rgba(100, 200, 255, 0.2);
  color: #7dc8ff;
}