:root {
  color-scheme: dark;
  --bg: #07100f;
  --panel: #0d1b19;
  --panel-2: #122621;
  --line: rgba(189, 214, 199, 0.16);
  --text: #eef7f1;
  --muted: #9fb3aa;
  --soft: #cfe6d8;
  --green: #39d98a;
  --lime: #b8f35a;
  --amber: #f6b64b;
  --blue: #46a6ff;
  --red: #ff6b6b;
  --violet: #a78bfa;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(57, 217, 138, 0.18), transparent 34rem),
    linear-gradient(135deg, #081210 0%, #0a1518 48%, #121315 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 28px;
  background:
    radial-gradient(circle at 22% 18%, rgba(57, 217, 138, 0.2), transparent 28rem),
    linear-gradient(135deg, #07100f 0%, #0f1c1f 58%, #101314 100%);
}

.login-active .login-screen {
  display: flex;
}

body.login-active { overflow: hidden; }

.login-active .app-shell {
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
}

.login-shell {
  margin: auto;
  flex-shrink: 0;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: stretch;
}

.login-intro,
.login-profile,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 27, 25, 0.92);
  box-shadow: var(--shadow);
}

.login-intro {
  display: grid;
  align-content: center;
  padding: 26px;
}

.login-intro h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.login-intro p {
  color: var(--muted);
  line-height: 1.6;
}

.login-profiles {
  display: grid;
  gap: 12px;
}

.login-profile {
  display: grid;
  gap: 7px;
  padding: 18px;
  color: var(--text);
  text-align: left;
}

.login-profile:hover,
.login-profile:focus-visible {
  border-color: rgba(184, 243, 90, 0.62);
  background: rgba(18, 38, 33, 0.98);
}

.login-profile span {
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.login-profile strong {
  font-size: 1.22rem;
}

.login-profile small {
  color: var(--muted);
  line-height: 1.45;
}

.primary-profile {
  border-color: rgba(57, 217, 138, 0.55);
}

.demo-login-hint {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(184, 243, 90, 0.18);
  border-radius: 8px;
  background: rgba(184, 243, 90, 0.06);
}

.demo-login-hint span {
  color: var(--lime);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.demo-login-hint strong {
  font-size: 0.92rem;
}

.login-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
  min-width: 0;
  overflow: visible;
}

.auth-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-heading-row h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.auth-tools { display: flex; gap: 4px; flex-shrink: 0; }
.auth-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.auth-icon[hidden] { display: none; }
.auth-icon:hover, .auth-icon.active { color: var(--text); background: rgba(255,255,255,.08); }
.auth-icon:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.auth-form {
  display: none;
  gap: 12px;
}

.auth-form.active {
  display: grid;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.auth-result {
  min-height: 22px;
  color: var(--lime);
  font-size: 0.9rem;
}

.auth-result strong {
  display: block;
  color: var(--soft);
}

.avatar-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.avatar-choice {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.avatar-choice:hover,
.avatar-choice:focus-visible,
.appearance-drawer .avatar-choice-grid,
#employeeAvatarGrid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.appearance-drawer .avatar-choice span,
#employeeAvatarGrid .avatar-choice span {
  white-space: normal;
  overflow-wrap: anywhere;
}

.avatar-choice.selected {
  border-color: rgba(184, 243, 90, 0.72);
  background: rgba(184, 243, 90, 0.09);
}

.avatar-choice .rpg-avatar {
  width: 74px;
  height: 88px;
}

.avatar-choice strong,
.avatar-choice span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-choice strong {
  font-size: 0.84rem;
}

.avatar-choice span {
  color: var(--muted);
  font-size: 0.72rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(7, 16, 15, 0.82);
  backdrop-filter: blur(20px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand-mark,
.avatar {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), #1f8fff);
  color: #03100b;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--lime);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.login-card,
.player-card,
.panel,
.details-panel,
.stats-grid > div,
.task-card,
.ranking-card {
  border: 1px solid var(--line);
  background: rgba(13, 27, 25, 0.88);
  box-shadow: var(--shadow);
}

.login-card {
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.account-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(184, 243, 90, 0.22);
  border-radius: 8px;
  background: rgba(184, 243, 90, 0.06);
}

.account-summary span {
  color: var(--lime);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.account-summary strong {
  color: var(--text);
  font-size: 1.05rem;
}

.account-summary small {
  color: var(--muted);
  line-height: 1.4;
}

.logout-action {
  width: fit-content;
  padding: 7px 10px;
  color: var(--soft);
  font-size: 0.78rem;
}

.account-switcher {
  display: none;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0a1413;
  color: var(--text);
  padding: 10px 12px;
}

input::placeholder {
  color: rgba(238, 247, 241, 0.42);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.nav-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.nav-tabs button,
.primary-action,
.small-action {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(18, 38, 33, 0.88);
  padding: 11px 12px;
  font-weight: 800;
}

.nav-tabs button.active,
.primary-action {
  background: linear-gradient(135deg, var(--green), #2ea7ff);
  color: #04110c;
  border-color: transparent;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stats-grid > div {
  border-radius: 8px;
  padding: 14px;
}

.stats-grid span,
.coins span,
.meta,
.task-card small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.stats-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.player-card {
  margin-top: auto;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 12px;
  align-items: center;
}

.player-main span {
  display: block;
  font-weight: 900;
}

.player-main strong {
  display: block;
  margin-top: 3px;
  color: var(--soft);
}

.progress-track {
  height: 8px;
  margin-top: 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 30%;
  height: 100%;
  background: var(--lime);
}

.coins {
  min-width: 62px;
  text-align: right;
}

.coins strong {
  display: block;
  margin-bottom: 4px;
}

main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar select {
  min-width: 150px;
}

.view {
  display: none;
  min-height: 0;
  padding: 24px 28px 28px;
}

.view.active {
  display: block;
}

.view-map.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  min-height: 0;
}

#map {
  height: calc(100vh - 136px);
  min-height: 560px;
  max-height: calc(100vh - 136px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #0e1715;
}

.details-panel {
  border-radius: 8px;
  padding: 18px;
  overflow: auto;
  max-height: calc(100vh - 136px);
}

.density-preview-toggle {
  display: none;
  width: 100%;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(70, 166, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.density-preview-toggle:hover {
  border-color: rgba(70, 166, 255, 0.7);
  background: rgba(70, 166, 255, 0.2);
}

.density-preview-toggle.active {
  border-color: rgba(184, 243, 90, 0.44);
  background: rgba(184, 243, 90, 0.1);
}

.quick-lead-panel {
  display: block;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(184, 243, 90, 0.22);
  border-radius: 8px;
  background: rgba(184, 243, 90, 0.06);
}

.quick-lead-panel > summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.quick-lead-panel[open] > summary { margin-bottom: 12px; }

.quick-lead-panel h3 {
  margin-bottom: 0;
}

.quick-lead-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.quick-lead-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.quick-lead-result {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

body[data-role="tech"] .toolbar,
body[data-role="tech"] #createTaskBtn {
  display: none;
}

body[data-role="tech"] .topbar {
  padding-bottom: 14px;
}

body[data-role="tech"] .view-map.active {
  grid-template-columns: minmax(0, 1fr) 360px;
}

body[data-role="tech"] .details-panel {
  padding: 14px;
}

body[data-role="tech"] .density-preview-toggle {
  display: block;
}

.tech-address-panel {
  display: grid;
  gap: 14px;
}

.tech-address-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.tech-address-head h2 {
  font-size: 1.35rem;
}

.tech-address-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tech-address-summary span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.82rem;
}

.tech-address-summary strong {
  display: block;
  color: var(--text);
  font-size: 1.45rem;
}

.tech-action-list {
  display: grid;
  gap: 8px;
}

.tech-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(184, 243, 90, 0.24);
  border-radius: 8px;
  background: rgba(184, 243, 90, 0.07);
}

.tech-action.done {
  border-color: rgba(207, 230, 216, 0.14);
  background: rgba(255, 255, 255, 0.04);
  opacity: 0.82;
}

.tech-action strong,
.tech-action span {
  display: block;
}

.tech-action span,
.tech-empty {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.tech-history,
.address-history {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.tech-history summary,
.address-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: var(--soft);
  font-weight: 850;
}

.address-history summary span {
  min-width: 28px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--lime);
  font-size: 0.76rem;
  text-align: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 18px;
}

.readiness {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.location-review-box {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(246, 182, 75, 0.32);
  border-radius: 8px;
  background: rgba(246, 182, 75, 0.08);
}

.location-review-box strong,
.location-review-box span {
  display: block;
}

.location-review-box span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.location-action {
  width: 100%;
  border-color: rgba(246, 182, 75, 0.42);
  background: rgba(246, 182, 75, 0.12);
}

.position-edit-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(246, 182, 75, 0.26);
  border-radius: 8px;
  background: rgba(246, 182, 75, 0.08);
}

.position-edit-box strong,
.position-edit-box span {
  display: block;
}

.position-edit-box span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.position-edit-active {
  border-color: rgba(246, 182, 75, 0.6);
  background: rgba(246, 182, 75, 0.16);
}

.inventory-status-box {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(184, 243, 90, 0.24);
  border-radius: 8px;
  background: rgba(184, 243, 90, 0.07);
}

.inventory-status-box strong,
.inventory-status-box span {
  display: block;
}

.inventory-status-box span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.inventory-stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inventory-stage {
  min-height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  padding: 9px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  text-align: left;
}

.inventory-stage.done {
  border-color: rgba(57, 217, 138, 0.42);
  background: rgba(57, 217, 138, 0.12);
  color: var(--text);
}

.inventory-stage.current {
  box-shadow: inset 0 0 0 1px rgba(184, 243, 90, 0.44);
}

.inventory-stage span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--green);
  font-size: 0.72rem;
}

.connection-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  margin: 10px 0 14px;
}
.connection-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 36px;
  min-width: 0;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: transparent;
  color: #8d969b;
}
.connection-stage.stage-in_progress { color: #46a6ff; background: rgba(70,166,255,.1); }
.connection-stage.stage-done { color: #39d98a; background: rgba(57,217,138,.1); }
.connection-stage[aria-expanded="true"], .connection-stage:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.connection-icon { width: 19px; height: 19px; background: currentColor; mask: var(--stage-icon) center / contain no-repeat; -webkit-mask: var(--stage-icon) center / contain no-repeat; }
.stage-state-symbol { position: absolute; right: 1px; bottom: -2px; font-size: 9px; line-height: 12px; }
.connection-stage-action { display: grid; gap: 8px; padding: 0 0 14px; font-size: 13px; }
.connection-stage-action > span { color: var(--muted); }
.connection-stage-action input[type="checkbox"] { width: auto; min-height: auto; }
.connection-edit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stage-cost-form { display: grid; gap: 10px; margin: 10px 0; }
.stage-cost-form input { width: 100%; min-width: 0; box-sizing: border-box; }
.stage-cost-calculator > summary { cursor: pointer; }
.stage-cost-row { display: grid; grid-template-columns: 22px minmax(0,1fr) 64px; gap: 8px; align-items: center; font-size: 12px; }
.stage-cost-row small { display: block; color: var(--muted); margin-top: 3px; }
.stage-cost-row input { padding: 6px; }
.stage-cost-total { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.compact-address-section { border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 8px; }
.compact-address-section > summary { cursor: pointer; font-size: 13px; font-weight: 700; }
.compact-address-section[open] > summary { margin-bottom: 10px; }

.work-quote-box {
  display: block;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(70, 166, 255, 0.28);
  border-radius: 8px;
  background: rgba(70, 166, 255, 0.08);
}

.work-quote-box strong,
.work-quote-box span,
.work-quote-box small {
  display: block;
}

.work-quote-box span,
.work-quote-box small,
.work-quote-summary p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.work-quote-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.work-quote-box > summary { cursor: pointer; font-weight: 700; }
.work-quote-box > summary strong { margin-top: 4px; }
.custom-work-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 32px; gap: 8px; align-items: end; margin: 8px 0; }
.custom-work-row label { min-width: 0; font-size: 12px; }
.custom-work-row input { width: 100%; min-width: 0; box-sizing: border-box; }
.custom-work-row button { padding: 0; width: 32px; height: 38px; }
@media (max-width: 480px) {
  .custom-work-row { grid-template-columns: minmax(0, 1fr) 32px; }
  .custom-work-row label:first-child { grid-column: 1 / -1; }
}

.work-quote-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.work-quote-row input {
  min-height: 38px;
  text-align: right;
}

.work-quote-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.work-quote-summary div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
}

.work-quote-summary strong {
  color: var(--text);
  font-size: 1.1rem;
}

.work-quote-summary p {
  grid-column: 1 / -1;
  margin: 0;
}

.approval-action {
  width: 100%;
  border-color: rgba(246, 182, 75, 0.42);
  background: rgba(246, 182, 75, 0.13);
}

.service-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(70, 166, 255, 0.28);
  border-radius: 8px;
  background: rgba(70, 166, 255, 0.08);
}

.service-box strong,
.service-box span {
  display: block;
}

.service-box span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.service-box.active-service {
  border-color: rgba(246, 182, 75, 0.38);
  background: rgba(246, 182, 75, 0.1);
}

.service-action {
  border-color: rgba(70, 166, 255, 0.42);
  background: rgba(70, 166, 255, 0.14);
}

.delete-box {
  display: grid;
  gap: 9px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(255, 107, 107, 0.28);
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.08);
}

.danger-action {
  width: 100%;
  border-color: rgba(255, 107, 107, 0.42);
  background: rgba(255, 107, 107, 0.16);
  color: #ffd8d8;
}

.empty-details {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.readiness-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.timeline-item {
  border-left: 2px solid rgba(184, 243, 90, 0.55);
  padding-left: 12px;
}

.timeline-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.character-layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.character-hero {
  min-height: calc(100vh - 196px);
  grid-row: span 3;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(57, 217, 138, 0.18), rgba(70, 166, 255, 0.12)),
    rgba(13, 27, 25, 0.88);
  box-shadow: var(--shadow);
}

.character-stage {
  display: grid;
  gap: 10px;
}

.character-avatar {
  width: min(100%, 430px);
  height: min(66vh, 540px);
  min-height: 430px;
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  border-radius: 8px;
  background: rgba(7, 16, 15, 0.58);
  overflow: hidden;
}

.rpg-avatar {
  width: 100%;
  height: 100%;
  display: block;
}

.character-sprite {
  width: min(76%, 340px);
  max-width: 100%;
  height: auto;
  max-height: 100%;
  justify-self: center;
  object-fit: contain;
  image-rendering: pixelated;
}

.rpg-avatar.approved-character {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.avatar-choice .approved-character {
  height: 180px;
  aspect-ratio: 2 / 3;
  object-fit: contain;
}

.fine-pixel-avatar {
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.portrait-pixel-avatar {
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.full-pixel-avatar {
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.avatar-aura {
  filter: blur(1px);
}

.avatar-item {
  transform-origin: 110px 110px;
}

.equipment-ring,
.inventory-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.equipment-slot {
  min-height: 74px;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 8px;
  border: 1px dashed rgba(207, 230, 216, 0.22);
  border-radius: 8px;
  background: rgba(7, 16, 15, 0.45);
  color: var(--muted);
}

.equipment-slot.filled {
  border-style: solid;
  border-color: rgba(184, 243, 90, 0.45);
  background: rgba(184, 243, 90, 0.08);
  color: var(--soft);
}

.equipment-slot span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 950;
}

.equipment-slot small {
  max-width: 100%;
  color: currentColor;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.character-summary {
  min-width: 0;
}

.character-summary h2 {
  margin-bottom: 6px;
  font-size: 1.8rem;
}

.character-summary strong {
  display: block;
  margin-bottom: 12px;
  color: var(--soft);
}

.player-quick-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.player-quick-stats span {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 15, 0.42);
  color: var(--muted);
  font-size: 0.78rem;
}

.player-quick-stats strong {
  margin: 0;
  color: var(--soft);
  font-size: 0.95rem;
}

.appearance-drawer {
  margin-top: 12px;
  border: 1px solid rgba(207, 230, 216, 0.14);
  border-radius: 8px;
  background: rgba(7, 16, 15, 0.26);
}

.appearance-drawer summary {
  cursor: pointer;
  padding: 11px 12px;
  color: var(--soft);
  font-weight: 850;
}

.appearance-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 12px;
}

.appearance-editor label {
  display: grid;
  gap: 6px;
}

.appearance-editor select {
  min-height: 40px;
}

.skill-progress-list,
.inventory-list {
  display: grid;
  gap: 10px;
}

.skill-progress,
.inventory-item,
.shop-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.skill-progress {
  display: grid;
  gap: 7px;
  padding: 11px;
}

.skill-progress div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.skill-progress span,
.skill-progress small,
.inventory-item span,
.shop-item p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.skill-progress small {
  font-weight: 800;
}

.inventory-item {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.shop-item {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.shop-item h4 {
  margin: 12px 0 6px;
  font-size: 1rem;
}

.shop-item p {
  margin: 0;
}

.shop-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shop-bottom .small-action {
  min-width: 86px;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.task-card,
.ranking-card,
.panel {
  border-radius: 8px;
  padding: 16px;
}

.task-card {
  display: grid;
  gap: 12px;
}

.task-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.reward-row,
.assignment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.management-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.management-kpis div,
.management-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.management-kpis div {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
}

.management-kpis span,
.management-row span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.management-kpis strong {
  font-size: 1.8rem;
}

.management-list {
  display: grid;
  gap: 10px;
}

.management-row {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.management-row strong {
  color: var(--soft);
}

.panel-wide {
  grid-column: 1 / -1;
}

.address-form {
  display: grid;
  gap: 10px;
}

.address-form .primary-action {
  margin-top: 4px;
}

.compact-result {
  margin-top: 12px;
}

.panel p {
  color: var(--muted);
  line-height: 1.55;
}

.import-result {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(57, 217, 138, 0.1);
}

.import-result span {
  display: block;
  color: var(--lime);
  font-weight: 800;
  font-size: 0.82rem;
}

.import-table {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.import-table div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.import-table b,
.import-table span {
  display: block;
}

.import-table span {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}

.role-list,
.economy-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.skill-catalog {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.skill-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.skill-card strong,
.skill-card span {
  display: block;
}

.skill-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.role-list li,
.economy-item {
  display: grid;
  gap: 3px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.role-list span,
.economy-item span {
  color: var(--muted);
  font-size: 0.88rem;
}

.ranking-list {
  display: grid;
  gap: 12px;
}

.ranking-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 16px;
}

.rank-number {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(184, 243, 90, 0.14);
  color: var(--lime);
  font-weight: 900;
}

.leaflet-container {
  background: #111;
  font-family: inherit;
}

.leaflet-container {
  position: relative;
  overflow: hidden;
  outline-offset: 1px;
  touch-action: none;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile {
  filter: saturate(0.7) brightness(0.78) contrast(1.08);
  max-width: none !important;
  max-height: none !important;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: visiblePainted;
  pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  float: left;
  clear: both;
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-top .leaflet-control {
  margin-top: 12px;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: 12px;
}

.leaflet-left .leaflet-control {
  margin-left: 12px;
}

.leaflet-right .leaflet-control {
  margin-right: 12px;
}

.leaflet-control-zoom {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
}

.leaflet-control-zoom a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: rgba(7, 16, 15, 0.92);
  color: var(--text);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 900;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.leaflet-control-attribution {
  padding: 4px 7px;
  border-radius: 7px 0 0 0;
  background: rgba(7, 16, 15, 0.78);
  color: var(--soft);
  font-size: 0.72rem;
}

.leaflet-control-attribution a {
  color: var(--lime);
}

.map-location-control { position: relative; }
.map-location-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #78868b;
  border-radius: 6px;
  background: #fff;
  color: #163d5c;
  box-shadow: 0 2px 8px #0003;
  touch-action: manipulation;
}
.map-location-button:focus-visible { outline: 3px solid #2684ff; outline-offset: 2px; }
.map-location-button:disabled { opacity: .6; cursor: wait; }
.map-location-message {
  position: absolute;
  right: 52px;
  bottom: 0;
  width: 230px;
  max-width: calc(100vw - 90px);
  padding: 10px;
  box-sizing: border-box;
  border-radius: 6px;
  background: #fff;
  color: #183d50;
  box-shadow: 0 2px 8px #0003;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.map-location-message[hidden] { display: none; }

.map-hint[hidden] { display: none !important; }
.map-hint {
  width: max-content;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(12, 25, 21, .70);
  color: #f0f3ec;
  pointer-events: none;
}
.map-hint .connection-legend {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 7px;
}
.map-hint .connection-legend span { margin: 0; gap: 3px; font-size: 10px; line-height: 1.2; }
.map-hint .connection-legend i { width: 7px; height: 7px; }
.leaflet-tooltip {
  position: absolute;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(7, 16, 15, 0.92);
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.leaflet-popup {
  position: absolute;
  text-align: center;
  margin-bottom: 20px;
}

.leaflet-popup-content-wrapper {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(7, 16, 15, 0.96);
  color: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

.leaflet-popup-content {
  margin: 0;
}

.leaflet-popup-tip-container,
.leaflet-popup-tip {
  display: none;
}

.leaflet-popup-close-button {
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--soft);
  font-size: 1.15rem;
  text-decoration: none;
}

.map-add-popup {
  display: grid;
  gap: 8px;
  min-width: 190px;
  padding: 14px;
  text-align: left;
}

.map-add-popup strong,
.map-add-popup span,
.map-status-popup strong,
.map-status-popup span {
  display: block;
}

.map-add-popup strong {
  padding-right: 18px;
  color: var(--lime);
}

.map-add-popup span,
.map-status-popup span {
  color: var(--muted);
  font-size: 0.82rem;
}

.map-add-action {
  width: 100%;
  cursor: pointer;
}

.map-status-popup {
  display: grid;
  gap: 10px;
  min-width: 230px;
  padding: 14px;
  text-align: left;
}

.map-status-popup strong {
  padding-right: 18px;
  color: var(--lime);
}

.map-status-actions {
  display: grid;
  gap: 6px;
}

.map-status-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--soft);
  padding: 8px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  text-align: left;
}

.map-status-actions button.done {
  border-color: rgba(57, 217, 138, 0.42);
  background: rgba(57, 217, 138, 0.13);
  color: var(--text);
}

.lantech-marker {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #04110c;
  border: 3px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
  font-size: 0.78rem;
  font-weight: 900;
}

.marker-needs-review {
  outline: 4px solid rgba(246, 182, 75, 0.55);
  outline-offset: 3px;
}

.marker-lead {
  background: var(--violet);
}

.marker-planned {
  background: var(--amber);
}

.marker-progress {
  background: var(--blue);
}

.marker-active {
  background: var(--green);
}

.marker-connection-active { background: #39d98a; }
.marker-connection-progress { background: #f6c451; }
.marker-connection-disconnected { background: #a1a8ad; }
.lantech-marker { position: relative; }
.marker-service-badge {
  position: absolute;
  right: -7px;
  top: -7px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #b82332;
  color: white;
  border: 1px solid white;
  text-align: center;
  line-height: 15px;
}
.connection-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; max-width: 300px; }
.connection-legend span { display: inline-flex; align-items: center; gap: 5px; }
.connection-legend i { width: 10px; height: 10px; border-radius: 50%; }
.connection-legend b { color: #ff6b6b; }
.map-status-popup { min-width: 0; width: 280px; max-width: calc(100vw - 70px); box-sizing: border-box; }
.map-status-popup strong { overflow-wrap: anywhere; }
.map-completion-list { display: grid; gap: 9px; padding: 0; margin: 3px 0; list-style: none; }
.map-completion-list li { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.map-completion-list li.done > span { color: #39d98a; }
.map-status-popup summary { cursor: pointer; font-size: 12px; }
.map-status-popup .map-status-actions { margin-top: 8px; }
.map-popup-history { max-height: 150px; overflow-y: auto; overflow-wrap: anywhere; font-size: 12px; }

.marker-churn {
  background: var(--red);
}

.marker-tech-mine {
  background: var(--blue);
}

.marker-tech-open {
  background: var(--amber);
}

.marker-tech-done {
  background: var(--green);
}

.marker-tech-problem {
  background: var(--red);
}

.marker-position-editing {
  outline: 4px solid rgba(246, 182, 75, 0.55);
  outline-offset: 3px;
  box-shadow: 0 0 0 9px rgba(246, 182, 75, 0.18), 0 10px 24px rgba(0, 0, 0, 0.35);
  cursor: grab;
}

.cluster-marker {
  display: grid;
  place-items: center;
  width: var(--cluster-size, 52px);
  height: var(--cluster-size, 52px);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), var(--blue));
  color: #04110c;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
  font-size: 0.98rem;
  font-weight: 950;
}

.cluster-marker::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(70, 166, 255, 0.25);
  border-radius: 50%;
}

.dense-address-marker {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
  color: #04110c;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.dense-open {
  background: var(--amber);
}

.dense-done {
  background: var(--green);
}

.density-preview-panel {
  display: grid;
  gap: 14px;
}

.density-preview-panel h2,
.density-preview-panel p {
  margin: 0;
}

.density-preview-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.density-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.density-stat-grid span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.8rem;
}

.density-stat-grid strong {
  display: block;
  color: var(--text);
  font-size: 1.25rem;
}

.density-legend {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.density-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.density-legend i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.82);
}

.legend-cluster {
  background: linear-gradient(135deg, var(--amber), var(--blue));
}

.legend-open {
  background: var(--amber);
}

.legend-done {
  background: var(--green);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .player-card {
    margin-top: 0;
  }

  .view-map.active,
  .task-board,
  .admin-grid,
  .management-grid,
  .character-layout,
  .shop-grid,
  .skill-catalog {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .avatar-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .management-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .character-hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .character-avatar {
    width: min(100%, 410px);
    height: 470px;
    min-height: 420px;
  }

  .appearance-editor {
    grid-template-columns: 1fr;
  }

  #map {
    min-height: 58vh;
  }

  .details-panel {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .sidebar,
  .topbar,
  .view {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .player-card,
  .ranking-card {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .coins {
    text-align: left;
  }

  .auth-grid,
  .avatar-choice-grid {
    grid-template-columns: 1fr;
  }

  .login-screen {
    padding: 14px;
  }

  .login-panel {
    max-height: none;
  }
}

/* One scroll surface keeps every auth field reachable on short/mobile screens. */
@media (max-width: 1080px) {
  .login-shell { max-width: 580px; gap: 12px; }
  .login-intro { padding: 16px 18px; }
  .login-intro h1 { margin: 0; font-size: 1.5rem; }
  .login-intro .eyebrow { margin: 0 0 6px; }
  .login-intro > p:not(.eyebrow), .login-intro .demo-login-hint { display: none; }
  .login-panel { padding: 16px; }
  .login-panel .avatar-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-panel .avatar-choice { min-width: 0; }
  .login-panel .avatar-choice strong, .login-panel .avatar-choice span {
    white-space: normal; overflow-wrap: anywhere;
  }
  .login-panel input, .login-panel select { font-size: 16px; min-height: 44px; min-width: 0; width: 100%; }
  .login-panel .auth-icon { width: 44px; height: 44px; }
  .login-panel .primary-action { min-height: 48px; width: 100%; }
  .login-screen {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    scroll-padding-block: 20px;
  }
}
.team-layout { display:grid; grid-template-columns:minmax(260px, 1fr) minmax(300px, 1.4fr); gap:24px; align-items:start; }
.team-list { min-width:0; }
.team-member { width:100%; display:flex; align-items:center; gap:14px; padding:12px 0; border:0; border-bottom:1px solid #354944; border-radius:0; background:transparent; color:inherit; text-align:left; cursor:pointer; }
.team-member:hover, .team-member[aria-pressed="true"] { background:#203933; }
.team-member .rpg-avatar.approved-character { width:72px; height:108px; flex:0 0 72px; object-fit:contain; }
.team-member-info { display:grid; gap:6px; min-width:0; overflow-wrap:anywhere; }
.team-member-count { margin-left:auto; font-size:12px; max-width:90px; color:#b5c9c0; }
.team-profile { min-width:0; border-left:1px solid #354944; padding-left:24px; }
.team-profile[hidden] { display:none; }
.team-profile-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.team-profile-heading h3 { overflow-wrap:anywhere; }
.team-profile-heading button { width:36px; height:36px; flex-shrink:0; font-size:24px; color:inherit; background:transparent; border:1px solid #354944; border-radius:4px; cursor:pointer; }
.team-profile-body { display:grid; grid-template-columns:minmax(100px, .8fr) minmax(150px, 1fr); gap:20px; }
.team-portrait { aspect-ratio:2/3; max-height:420px; }
.team-portrait .rpg-avatar.approved-character { width:100%; height:100%; object-fit:contain; }
.team-facts, .team-completed { padding:0; list-style:none; }
.team-facts li { display:flex; justify-content:space-between; gap:10px; padding:7px 0; border-bottom:1px solid #354944; font-size:13px; }
.team-facts strong { white-space:nowrap; }
.team-completed li { display:grid; gap:4px; padding:10px 0; border-bottom:1px solid #354944; overflow-wrap:anywhere; }
@media(max-width:1000px) { .team-layout { grid-template-columns:minmax(0,1fr); } .team-profile { border-left:0; border-top:1px solid #354944; padding:18px 0 0; } }
@media(max-width:420px) { .team-profile-body { grid-template-columns:minmax(0,1fr); } .team-portrait { max-width:230px; width:100%; margin:auto; } }
.item-pouch { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px; width:100%; margin-top:14px; }
.item-slot { min-width:0; aspect-ratio:1; position:relative; padding:5px; border:1px solid #53685e; border-radius:4px; background:#1c2b26; box-shadow:inset 2px 2px 0 #34483c, inset -2px -2px 0 #0c1713; color:#eef5f0; }
.item-slot.empty { opacity:.45; }
.item-slot.filled { cursor:pointer; }
.item-slot.filled:hover, .item-slot.filled:focus-visible { outline:2px solid #b0e65b; outline-offset:1px; }
.item-thumbnail { display:block; width:100%; height:100%; object-fit:contain; }
.item-slot span { position:absolute; left:50%; bottom:100%; transform:translateX(-50%); width:140px; max-width:70vw; padding:6px; background:#091611; border:1px solid #53685e; border-radius:4px; font-size:12px; pointer-events:none; opacity:0; z-index:3; }
.item-slot:hover span, .item-slot:focus-visible span { opacity:1; }
.item-details { display:grid; gap:4px; min-height:48px; margin-top:10px; font-size:13px; color:#c4d5ca; }
.shop-item > .item-thumbnail { width:100%; height:130px; margin-bottom:10px; }
.team-owned-items { display:grid; grid-template-columns:repeat(auto-fill,minmax(64px,1fr)); gap:8px; }
.team-owned-items figure { margin:0; min-width:0; }
.team-owned-items .item-thumbnail { height:64px; }
.team-owned-items figcaption { font-size:11px; overflow-wrap:anywhere; text-align:center; }
.recognition-panel { display:grid; gap:10px; padding:14px 0; border-bottom:1px solid #53685e; }
.recognition-panel[hidden] { display:none; }
.recognition-panel summary { cursor:pointer; color:#c5ed8f; padding:8px 0; }
.recognition-form { display:grid; gap:12px; margin:12px 0; }
.recognition-form label { display:grid; gap:6px; font-size:13px; }
.recognition-form select, .recognition-form textarea { width:100%; min-width:0; box-sizing:border-box; background:#13221c; color:#edf4ef; border:1px solid #53685e; border-radius:4px; padding:8px; font:inherit; }
.recognition-form textarea { resize:vertical; }
.recognition-message { font-size:13px; overflow-wrap:anywhere; }
.item-stars { display:block; color:#e6bd59; font-size:14px; white-space:nowrap; font-style:normal; }
.item-stars i { color:#72847a; font-style:normal; }
.item-slot .item-stars { position:absolute; bottom:3px; left:2px; right:2px; background:#14231de8; font-size:12px; line-height:18px; text-align:center; }
.item-stars.level-5 { color:#f8d96e; }
.employee-admin-list { display:grid; gap:0; }
.employee-admin-list button { display:flex; flex-wrap:wrap; gap:8px 20px; justify-content:space-between; border:0; border-bottom:1px solid #53685e; border-radius:0; padding:14px 4px; color:inherit; background:transparent; text-align:left; cursor:pointer; }
.employee-admin-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding-top:16px; }
.employee-admin-form h4,.employee-admin-form details,.employee-admin-actions,.employee-admin-form [role=status] { grid-column:1/-1; }
.employee-admin-form label { display:grid; gap:6px; }
.employee-admin-form input,.employee-admin-form select,.employee-admin-form textarea { min-width:0; width:100%; box-sizing:border-box; background:#13221c; color:#edf4ef; padding:8px; border:1px solid #53685e; border-radius:4px; }
.employee-admin-actions { display:flex; flex-wrap:wrap; gap:8px; }
.employee-audit { margin-top:20px; }
.employee-audit pre { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; }
@media(max-width:600px){.employee-admin-form{grid-template-columns:minmax(0,1fr)}}

.google-signin {display:flex;align-items:center;justify-content:center;min-height:48px;padding:12px;border-radius:6px;background:#fff;color:#1f1f1f;border:1px solid #747775;text-decoration:none;font-weight:600;font-size:16px;}
.google-signin:focus-visible{outline:3px solid var(--lime);outline-offset:3px;}
#googleAccessPanel{border-bottom:1px solid var(--line);padding-bottom:20px;margin-bottom:20px;}
.google-access-form,.google-access-form label,#googleNewUser{display:grid;gap:8px;}
.google-access-form input,.google-access-form select{width:100%;min-width:0;min-height:44px;font-size:16px;}
.google-access-list>div{display:grid;gap:6px;padding:12px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere;}
#googleNewUser[hidden]{display:none;}

/* Google entry and first character selection */
.google-entry [hidden], .login-intro [hidden] {display:none !important;}
.google-entry > div > p {line-height:1.5;}
.legacy-login {margin-top:24px;}
.legacy-login summary {cursor:pointer;color:var(--muted,#a9bbb4);padding:12px 0;font-size:14px;}
.first-character-dialog {width:min(800px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;box-sizing:border-box;background:#10221e;color:#e8f2ed;border:1px solid #456354;border-radius:20px;padding:24px;}
.first-character-dialog::backdrop {background:rgba(0,0,0,.78);}
.first-character-dialog .avatar-choice-grid {grid-template-columns:repeat(auto-fit,minmax(135px,1fr));}
.first-character-dialog .avatar-choice {min-width:0;}
.first-character-dialog .primary-action {width:100%;margin-top:16px;min-height:48px;}
.first-character-dialog button:disabled {opacity:.5;}
@media(max-width:480px){.first-character-dialog{padding:16px;}.first-character-dialog .avatar-choice-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
.address-editor-dialog{width:min(480px,calc(100vw - 24px));box-sizing:border-box;max-height:calc(100dvh - 24px);overflow:auto;padding:24px;border:1px solid #456354;border-radius:16px;background:#10221e;color:#e8f2ed;}
.address-editor-dialog::backdrop{background:#000a;}
.address-editor-dialog label{display:grid;gap:6px;margin:16px 0;}
.address-editor-dialog input{box-sizing:border-box;width:100%;font-size:16px;min-height:44px;}
.address-edit-actions{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0;}
.map-add-control{display:block;margin-bottom:8px;font-size:28px;font-weight:bold;}
.picking-address{cursor:crosshair;}
#cancelAddressPick{position:absolute;top:12px;left:50%;transform:translateX(-50%);z-index:1001;background:#10221e;color:white;}
#newAddressDialog .quick-lead-panel{border:0;padding:0;}
#newAddressDialog .quick-lead-form{display:grid;gap:12px;}
.connection-edit-actions small{display:block;width:100%;color:#a9bbb4;}

.tariff-row{border-bottom:1px solid #395047;padding:12px 0;}.tariff-title{display:flex;gap:8px;align-items:center;font-size:14px;}.tariff-fields{display:grid;grid-template-columns:1fr 1fr;gap:8px;}.tariff-fields label{font-size:12px;display:grid;gap:4px;margin:8px 0;}.tariff-fields input{width:100%;min-width:0;box-sizing:border-box;font-size:16px;}.tariff-fields .tariff-height{grid-column:1/-1;display:flex;align-items:center;}.tariff-height input,#surveyDialog input[type=checkbox]{width:20px;min-height:20px;}.tariff-row output{display:block;text-align:right;font-weight:bold;}.address-editor-dialog [hidden]{display:none!important;}

/* Mapa: główna, pierwsza pozycja nawigacji. */
.nav-tabs button[data-view="map"] { grid-column: 1 / -1; }

/* Operational management summary */
#managementKpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.management-note { color: var(--muted); font-size: .8rem; line-height: 1.5; margin: 12px 0 0; }
.management-worker { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.management-worker > div { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.management-work-count { font-size: 1.4rem; flex-shrink: 0; }
@media (max-width: 400px) { #managementKpis { grid-template-columns: 1fr; } }

.performer-editor { margin-top: 10px; }
.performer-editor summary { cursor: pointer; padding: 8px 0; }
.performer-editor fieldset { max-height: 240px; overflow-y: auto; margin: 8px 0; }
.performer-editor .performer-choice { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.performer-editor .performer-choice input { width: 20px; height: 20px; flex: 0 0 20px; }
.performer-editor textarea { width: 100%; box-sizing: border-box; }
/* Preserve permission-driven visibility even when layout rules set display. */
[hidden] { display: none !important; }

.stats-grid > button { display: grid; gap: 6px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.05); color: var(--soft); cursor: pointer; }
.stats-grid > button:hover, .stats-grid > button:focus-visible { border-color: var(--accent); }
.weekly-detail-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.weekly-detail-row button { margin-top: 6px; }

/* Operational permissions: checkbox and description share one row. */
.employee-admin-form > fieldset { grid-column: 1 / -1; min-width: 0; }
.employee-admin-form > fieldset > label > span {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 8px 0;
  box-sizing: border-box;
  line-height: 1.4;
  cursor: pointer;
}
.employee-admin-form > fieldset input[type="checkbox"] {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 2px 0 0;
  padding: 0;
}

.map-appointment-labels { position:absolute; bottom:39px; left:17px; transform:translateX(-50%); display:flex; flex-direction:column; align-items:center; gap:3px; white-space:nowrap; pointer-events:none; }
.map-appointment-label { display:block; padding:4px 7px; border:1px solid #fff9; border-radius:5px; font:700 12px/1.3 system-ui,sans-serif; box-shadow:0 1px 4px #0007; }
.map-appointment-survey { background:#f59e0b; color:#201400; }
.map-appointment-connection { background:#c62828; color:#fff; }

/* Recent connections retain their green center and readable house number. */
.lantech-marker.connection-recent-week, .connection-legend i.connection-recent-week { background: #39d98a; border-color: #168bff; box-shadow: 0 0 0 2px #168bff, 0 5px 12px #0005; }
.lantech-marker.connection-recent-month, .connection-legend i.connection-recent-month { background: #39d98a; border-color: #b26bfa; box-shadow: 0 0 0 2px #b26bfa, 0 5px 12px #0005; }
