/*
 * NieboGuard — Profile Engine UI.
 * Additive styles for the existing welcome dialog, "More" sheet and map
 * settings. It does not change map controls, tabbar height or the seven tabs.
 */

/* ── profile entries in existing settings surfaces ────────────────────── */
.ng-profile-open-row { border-color: rgba(91, 140, 255, .28); }
.ms-profile-app {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid rgba(91, 140, 255, .26);
  border-radius: 11px;
  background: rgba(91, 140, 255, .08);
}
.ms-profile-app-copy { display: grid; gap: 1px; min-width: 0; }
.ms-profile-app-copy > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.ms-profile-app-copy > b { color: var(--text); font-size: 14px; }
.ms-profile-app-copy > small { color: var(--muted); font-size: 10.5px; line-height: 1.35; }
.ms-profile-app .chip { flex: 0 0 auto; }

/* Top actions may be reordered by a profile; no button is removed. */
.top-actions > [data-ng-profile-primary="1"] {
  box-shadow: inset 0 0 0 1px rgba(91, 140, 255, .38);
}

/* One highlighted bottom tab; its size, label and position stay unchanged. */
#tabbar .tab-btn.ng-profile-primary-tab:not(.active)::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  width: 16px;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: var(--accent, #5b8cff);
  opacity: .85;
  pointer-events: none;
}
#tabbar .tab-btn.ng-profile-primary-tab > span { color: #cfe0fb; }

/* Profile shortcuts highlight existing menu tiles; nothing is duplicated. */
#more-panel-main .menu-tile.ng-profile-featured {
  border-color: rgba(91, 140, 255, .38);
  background: rgba(91, 140, 255, .10);
}
#more-panel-main .menu-tile.ng-profile-featured .menu-name { color: #f0f6ff; }

/* Basic detail level: the existing Advanced group becomes a closed details
   block. Every link remains in the DOM and reachable after one tap. */
#menu-groups .ng-profile-advanced {
  margin: 4px 0;
  border: 1px solid var(--panel-border, #22314a);
  border-radius: 12px;
  background: rgba(18, 26, 43, .56);
}
#menu-groups .ng-profile-advanced > summary {
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
#menu-groups .ng-profile-advanced > .menu-category { margin: 0; padding: 0 4px 6px; }
#menu-groups .ng-profile-advanced > .menu-category > .menu-section-title { display: none; }

/* Compact density only touches the More sheet, never map controls. */
html[data-ng-profile-density="compact"] #more-panel-main .menu-tile,
html[data-ng-profile-density="compact"] #more-panel-main .sheet-row {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* ── onboarding profile step (inside #ng-welcome) ─────────────────────── */
.ng-profile-step {
  margin: 14px 0 10px;
  padding: 12px;
  border: 1px solid #2b4661;
  border-radius: 13px;
  background: rgba(10, 22, 38, .82);
}
.ng-profile-step-head { margin-bottom: 10px; }
.ng-profile-kicker {
  margin: 0 0 3px;
  color: #8fa2c2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.ng-profile-step-head h3 { margin: 0 0 4px; color: #f5f9ff; font-size: 15px; }
.ng-profile-step-head p:not(.ng-profile-kicker) { margin: 0; color: #b8cbe2; font-size: 11.5px; line-height: 1.45; }
.ng-profile-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ng-profile-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  width: 100%;
  min-height: 100px;
  padding: 11px;
  border: 1px solid #263a52;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(22, 35, 58, .84), rgba(9, 17, 30, .94));
  color: #dce6f7;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.ng-profile-card:hover,
.ng-profile-card:focus-visible { border-color: #5b8cff; background: rgba(22, 35, 58, .98); }
.ng-profile-card.active {
  border-color: rgba(91, 140, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(91, 140, 255, .24);
}
.ng-profile-card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(91, 140, 255, .12);
  color: #8ec0ff;
}
.ng-profile-card-icon svg { width: 22px; height: 22px; display: block; }
.ng-profile-card-copy { display: grid; gap: 3px; min-width: 0; }
.ng-profile-card-copy b { color: #f2f7ff; font-size: 13.5px; line-height: 1.25; }
.ng-profile-card-copy small { color: #a9bdd8; font-size: 10.5px; line-height: 1.4; }
.ng-profile-card-copy em { color: #7f93b0; font-size: 10px; font-style: normal; line-height: 1.35; }
.ng-profile-card-state {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(54, 214, 177, .16);
  color: #9fffe6;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
}
.ng-profile-cards--compact { margin-top: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ng-profile-card--compact {
  grid-template-columns: 26px minmax(0, 1fr);
  min-height: 72px;
  padding: 8px;
}
.ng-profile-card--compact .ng-profile-card-icon { width: 26px; height: 26px; border-radius: 8px; }
.ng-profile-card--compact .ng-profile-card-icon svg { width: 17px; height: 17px; }
.ng-profile-card--compact .ng-profile-card-copy b { font-size: 11.5px; }
.ng-profile-card--compact .ng-profile-card-copy small { font-size: 9.5px; }
.ng-profile-card--compact .ng-profile-card-copy em { font-size: 9px; }
.ng-profile-step > .text-button {
  margin-top: 8px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #2b4661;
  border-radius: 9px;
  background: rgba(15, 26, 44, .8);
  color: #b8cbe2;
  font: 600 11px/1.2 var(--font-ui);
  cursor: pointer;
}
.ng-profile-step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}
.ng-profile-step-actions .chip { min-height: 38px; }
.ng-profile-step-actions .fineprint { margin: 0; flex: 1 1 180px; }
.ng-profile-step-actions a { color: #8ec5ff; }

/* ── URL preview banner ───────────────────────────────────────────────── */
.ng-profile-banner {
  position: fixed;
  left: 50%;
  top: calc(64px + env(safe-area-inset-top));
  z-index: 68;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: min(620px, 94vw);
  padding: 9px 12px;
  border: 1px solid rgba(91, 140, 255, .5);
  border-radius: 12px;
  background: rgba(16, 24, 40, .98);
  color: var(--text, #dbe4f5);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
}
.ng-profile-banner[hidden] { display: none; }
.ng-profile-banner-copy { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.ng-profile-banner-copy b { font-size: 12.5px; }
.ng-profile-banner-copy small { color: var(--muted, #7c8aa5); font-size: 10.5px; line-height: 1.35; }
.ng-profile-banner-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ng-profile-banner-actions .chip { min-height: 34px; }

/* ── profile management dialog ───────────────────────────────────────── */
.ng-profile-dialog { width: min(600px, 96vw); padding: 0; overflow-y: auto; overflow-x: hidden; }
.ng-profile-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--panel-border, #22314a);
}
.ng-profile-dialog-head > div { min-width: 0; flex: 1; }
.ng-profile-dialog-head h3 { margin: 0 0 4px; font-size: 18px; }
.ng-profile-lead { margin: 0; color: var(--muted, #7c8aa5); font-size: 11.5px; line-height: 1.45; }
.ng-profile-dialog-head .about-x { position: static; flex: 0 0 auto; }
.ng-profile-current { padding: 10px 18px 8px; }
.ng-profile-current-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(91, 140, 255, .3);
  border-radius: 11px;
  background: rgba(91, 140, 255, .08);
}
.ng-profile-current-card > div { display: grid; gap: 2px; min-width: 0; }
.ng-profile-current-card b { color: #f2f7ff; font-size: 14px; }
.ng-profile-current-card small { color: #a9bdd8; font-size: 10.5px; line-height: 1.4; }
.ng-profile-current-card em { color: #7f93b0; font-size: 10px; font-style: normal; }
.ng-profile-badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 176, 32, .16);
  color: #ffd98a;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.ng-profile-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 176, 32, .3);
  border-radius: 10px;
  background: rgba(255, 176, 32, .07);
}
.ng-profile-preview-row .fineprint { margin: 0; flex: 1 1 200px; }
.ng-profile-preview-row .chip { min-height: 34px; }
.ng-profile-section.is-locked { opacity: .68; }
.ng-profile-dialog > .ng-profile-section {
  margin: 0 18px 10px;
  border: 1px solid var(--panel-border, #22314a);
  border-radius: 12px;
  background: rgba(18, 26, 43, .55);
}
.ng-profile-section > summary {
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  color: #e6eefc;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
}
.ng-profile-section > p,
.ng-profile-section > h4,
.ng-profile-section > .ng-profile-fields,
.ng-profile-section > .ng-profile-order,
.ng-profile-section > .ng-profile-add,
.ng-profile-section > .ng-profile-favorites,
.ng-profile-section > .ng-profile-map-actions,
.ng-profile-section > .ng-profile-danger,
.ng-profile-section > select,
.ng-profile-section > .ng-profile-list { margin-left: 12px; margin-right: 12px; }
.ng-profile-section > h4 { margin-top: 12px; margin-bottom: 3px; color: #dce6f7; font-size: 12px; }
.ng-profile-section > p { margin-top: 4px; }
.ng-profile-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.ng-profile-list .ng-profile-card { min-height: 92px; }
.ng-profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.ng-profile-field { display: grid; gap: 3px; min-width: 0; }
.ng-profile-field:first-child { grid-column: 1 / -1; }
.ng-profile-field > span { color: var(--muted, #7c8aa5); font-size: 10.5px; font-weight: 600; }
.ng-profile-field select,
.ng-profile-section > select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid #2b4661;
  border-radius: 8px;
  background: #07111e;
  color: #dce6f7;
  font: 12px var(--font-ui, system-ui, sans-serif);
  text-overflow: ellipsis;
}
.ng-profile-dialog input,
.ng-profile-dialog select,
.ng-profile-dialog button { max-width: 100%; }
.ng-profile-dialog select,
.ng-profile-dialog input { min-width: 0; }
.ng-profile-order { display: grid; gap: 5px; margin-top: 6px; margin-bottom: 4px; }
.ng-profile-order-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 6px;
  border: 1px solid rgba(120, 150, 210, .18);
  border-radius: 8px;
  background: rgba(9, 17, 30, .55);
}
.ng-profile-order-check { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; color: #dce6f7; font-size: 11.5px; }
.ng-profile-order-check input { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; }
.ng-profile-shortcut-name { padding-left: 2px; }
.ng-profile-order-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.ng-profile-order-actions .chip {
  min-width: 32px;
  min-height: 32px;
  padding: 2px 6px;
  font-size: 13px;
  line-height: 1;
}
.ng-profile-add { display: flex; gap: 6px; margin-top: 6px; }
.ng-profile-add select { flex: 1 1 0; width: 0; min-width: 0; max-width: 100%; }
.ng-profile-add .chip { flex: 0 0 auto; min-height: 38px; }
.ng-profile-favorites {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  margin-top: 6px;
  margin-bottom: 4px;
}
.ng-profile-favorite-row { display: flex; align-items: center; gap: 7px; min-height: 32px; color: #dce6f7; font-size: 11.5px; }
.ng-profile-favorite-row input { width: 17px; height: 17px; flex: 0 0 17px; margin: 0; }
.ng-profile-map-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; margin-bottom: 4px; }
.ng-profile-map-actions .chip { min-height: 36px; }
.ng-profile-danger {
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 138, 151, .28);
  border-radius: 10px;
  background: rgba(255, 138, 151, .06);
}
.ng-profile-danger p { margin: 0 0 7px; }
.ng-profile-danger .chip { min-height: 36px; }
.ng-profile-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px calc(14px + var(--safe-b));
  border-top: 1px solid var(--panel-border, #22314a);
}
.ng-profile-dialog-footer .chip { min-height: 38px; }

@media (max-width: 520px) {
  .ng-profile-step { margin: 10px 0 8px; padding: 10px; }
  .ng-profile-cards { grid-template-columns: 1fr; }
  .ng-profile-cards--compact { grid-template-columns: 1fr; }
  .ng-profile-card { min-height: 84px; }
  .ng-profile-list { grid-template-columns: 1fr; }
  .ng-profile-fields { grid-template-columns: 1fr; }
  .ng-profile-field:first-child { grid-column: auto; }
  .ng-profile-favorites { grid-template-columns: 1fr; }
  .ng-profile-dialog-head { padding: 13px 12px 8px; }
  .ng-profile-current { padding: 8px 12px 6px; }
  .ng-profile-dialog > .ng-profile-section { margin-left: 10px; margin-right: 10px; }
  .ng-profile-dialog > .ng-profile-section > p,
  .ng-profile-dialog > .ng-profile-section > h4,
  .ng-profile-dialog > .ng-profile-section > .ng-profile-fields,
  .ng-profile-dialog > .ng-profile-section > .ng-profile-order,
  .ng-profile-dialog > .ng-profile-section > .ng-profile-add,
  .ng-profile-dialog > .ng-profile-section > .ng-profile-favorites,
  .ng-profile-dialog > .ng-profile-section > .ng-profile-map-actions,
  .ng-profile-dialog > .ng-profile-section > .ng-profile-danger,
  .ng-profile-dialog > .ng-profile-section > select,
  .ng-profile-dialog > .ng-profile-section > .ng-profile-list { margin-left: 9px; margin-right: 9px; }
  .ng-profile-dialog-footer { padding-left: 12px; padding-right: 12px; }
  .ng-profile-banner { top: calc(56px + env(safe-area-inset-top)); width: 94vw; }
  .ng-profile-banner-actions { width: 100%; margin-left: 0; }
  .ng-profile-banner-actions .chip { flex: 1 1 auto; }
  .ms-profile-app { align-items: flex-start; }
  .ms-profile-app .chip { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .ng-profile-card,
  .ng-profile-order-row,
  .ng-profile-banner { transition: none !important; }
}
