:root {
  color-scheme: light;
  --ink: #1e2930;
  --muted: #66727d;
  --line: #d9e0e6;
  --surface: #ffffff;
  --page: #f4f7f8;
  --green: #22795c;
  --red: #c84444;
  --yellow: #c58a14;
  --teal: #157a8a;
  --blue: #315e9e;
  --charcoal: #22313a;
  --shadow: 0 18px 46px rgba(36, 49, 58, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .login-screen {
  display: none;
}

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

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(34, 121, 92, 0.08), rgba(49, 94, 158, 0.08)),
    var(--page);
}

.login-panel {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  grid-column: 1 / -1;
  color: var(--ink);
}

.login-brand .brand span {
  color: var(--muted);
}

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

.login-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.login-users {
  display: grid;
  gap: 10px;
  grid-column: 2;
}

.account-badge {
  display: grid;
  min-width: 190px;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.account-badge strong,
.account-badge span {
  display: block;
}

.account-badge strong {
  font-size: 13px;
}

.account-badge span {
  color: var(--muted);
  font-size: 12px;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  color: #edf5f3;
  background: #24333b;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #102621;
  background: #7ee0bd;
  font-weight: 900;
}

.brand strong,
.brand span,
.sidebar-status strong,
.sidebar-status span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span,
.sidebar-status span {
  color: #b9c7c9;
  font-size: 12px;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dfe8e8;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(126, 224, 189, 0.42);
  background: rgba(126, 224, 189, 0.12);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: #132720;
  background: #d9f5ec;
  font-size: 13px;
  font-weight: 900;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--yellow);
}

.status-dot.online {
  background: #71d99f;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 5px;
  font-size: 21px;
}

h3 {
  margin-bottom: 14px;
  font-size: 16px;
}

p {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.search-box {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button {
  color: #ffffff;
  background: var(--green);
}

.secondary-button {
  color: var(--charcoal);
  background: #ffffff;
  border-color: var(--line);
}

.mode-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.mode-banner strong,
.mode-banner span {
  display: block;
}

.mode-banner strong {
  margin-bottom: 4px;
  font-size: 18px;
}

.mode-banner span {
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 34px;
}

.tile-ok {
  border-top: 5px solid var(--green);
}

.tile-warn {
  border-top: 5px solid var(--red);
}

.tile-calm {
  border-top: 5px solid var(--blue);
}

.tile-device {
  border-top: 5px solid var(--yellow);
}

.view-panel {
  display: none;
}

.active-view {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.section-header p {
  margin-bottom: 0;
}

.enterprise-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented-control,
.map-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.map-tools label,
.map-import-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.map-import-control input {
  max-width: 230px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.map-status-grid {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(280px, 1fr) minmax(300px, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.map-status-grid h3 {
  margin-bottom: 10px;
}

.map-meta-list {
  display: grid;
  gap: 8px;
}

.map-meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.map-meta-list div:last-child {
  border-bottom: 0;
}

.map-meta-list strong {
  color: var(--ink);
  text-align: right;
}

.segment {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  border-color: var(--green);
  color: #ffffff;
  background: var(--green);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.activity-details {
  min-width: 260px;
}

.activity-details summary {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.activity-detail-grid {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 5px 10px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.activity-detail-grid span {
  color: var(--muted);
  font-weight: 800;
}

.activity-detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.activity-checkpoints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.activity-checkpoints em {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  color: #12523a;
  background: #d9f5e8;
}

.pill.warn {
  color: #754c05;
  background: #fff0c9;
}

.pill.bad {
  color: #842929;
  background: #ffe0e0;
}

.text-ok {
  color: var(--green);
}

.text-warn {
  color: var(--yellow);
}

.text-bad {
  color: var(--red);
}

.access-layout,
.enterprise-layout,
.config-layout {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.access-layout,
.enterprise-layout {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.access-layout {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.config-layout {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr) minmax(280px, 420px);
}

.translation-layout {
  display: grid;
  grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.plan-limits-layout {
  display: grid;
  grid-template-columns: minmax(240px, 330px) minmax(280px, 380px) minmax(0, 1fr);
  gap: 14px;
}

.translation-editor {
  min-width: 0;
}

.compact-table table {
  min-width: 760px;
}

.holiday-preview {
  display: grid;
  gap: 12px;
}

.holiday-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.holiday-list div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.holiday-list span {
  color: var(--muted);
  font-size: 12px;
}

.setup-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-list,
.setup-form {
  display: grid;
  gap: 10px;
}

.setup-card {
  position: relative;
  display: grid;
  width: 100%;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--ink);
  text-align: left;
}

.setup-card:hover,
.setup-card.selected {
  border-color: var(--green);
  background: #eef9f4;
}

.setup-card strong,
.setup-card span,
.setup-card small,
.setup-card em {
  display: block;
}

.setup-card span,
.setup-card small {
  color: var(--muted);
}

.setup-card em {
  color: var(--teal);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.setup-card .pill {
  width: max-content;
}

.setup-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.setup-form input[type="number"],
.setup-form input[type="text"] {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
}

.checkbox-row {
  grid-template-columns: 22px 1fr;
  align-items: center;
  min-height: 42px;
  padding: 0 2px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.payload-preview {
  min-height: 302px;
  max-height: 420px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid #c8d4da;
  border-radius: 8px;
  color: #dcebf0;
  background: #17242b;
  font-size: 12px;
  line-height: 1.55;
}

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

.pairing-layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.onboarding-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(300px, 420px) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.pairing-panel {
  display: grid;
  gap: 16px;
}

.pairing-panel p {
  margin-bottom: 0;
}

.pairing-qr {
  display: grid;
  place-items: center;
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.setup-code-card {
  display: grid;
  place-items: center;
  gap: 10px;
  width: min(100%, 260px);
  min-height: 176px;
  padding: 22px;
  border: 1px solid #cbd7dc;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.setup-code-card span,
.setup-code-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.setup-code-card strong {
  color: var(--green);
  font-size: 24px;
  line-height: 1.2;
}

.pairing-details {
  display: grid;
  gap: 8px;
}

.pairing-details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.pairing-details div:last-child {
  border-bottom: 0;
}

.pairing-details span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pairing-details strong {
  text-align: right;
}

.compact-payload {
  min-height: 250px;
}

.copy-button {
  margin-top: 12px;
}

.phone-actions,
.phone-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phone-actions {
  margin-top: 12px;
}

.phone-card-actions {
  margin-top: 14px;
}

.phone-card-actions .secondary-button,
.phone-actions .secondary-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.selected-device {
  border-color: var(--green);
  background: #f4fbf8;
}

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

.entity-card,
.device-card,
.checkpoint-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.entity-card,
.device-card {
  padding: 16px;
}

.entity-card header,
.device-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  font-weight: 900;
}

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

.field-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.field-list strong {
  color: var(--ink);
  text-align: right;
}

.device-meter {
  height: 9px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebef;
}

.device-meter span {
  display: block;
  height: 100%;
  background: var(--green);
}

.designer-layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.phone-preview {
  display: grid;
  place-items: center;
  min-height: 650px;
}

.phone-frame {
  width: min(100%, 360px);
  aspect-ratio: 9 / 18.4;
  display: grid;
  grid-template-rows: 34px 58px 1fr 74px;
  padding: 14px;
  border: 10px solid #1c252b;
  border-radius: 34px;
  background: #f7fbfa;
  box-shadow: 0 28px 64px rgba(26, 38, 45, 0.24);
}

.phone-status,
.mobile-header,
.mobile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.phone-status {
  color: #697780;
  font-size: 12px;
  font-weight: 800;
}

.mobile-header strong {
  font-size: 19px;
}

.mobile-header span {
  color: var(--teal);
  font-weight: 800;
}

.map-canvas {
  position: relative;
  overflow: hidden;
  border: 1px solid #cbd7dc;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(55, 95, 113, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(55, 95, 113, 0.12) 1px, transparent 1px),
    #eaf2ef;
  background-size: 32px 32px;
}

.map-canvas.has-background {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.78) 0 12%, transparent 12% 16%, rgba(255, 255, 255, 0.72) 16% 36%, transparent 36% 39%, rgba(255, 255, 255, 0.74) 39% 62%, transparent 62% 66%, rgba(255, 255, 255, 0.7) 66% 100%),
    linear-gradient(rgba(42, 79, 94, 0.28) 2px, transparent 2px),
    linear-gradient(90deg, rgba(42, 79, 94, 0.24) 2px, transparent 2px),
    #dce8e6;
  background-size: auto, 72px 72px, 72px 72px, auto;
}

.map-canvas::before {
  content: "";
  position: absolute;
  left: 38px;
  right: 40px;
  top: 52px;
  bottom: 58px;
  border: 3px solid #4c6973;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 0 34%, #4c6973 34% 36%, transparent 36% 66%, #4c6973 66% 68%, transparent 68%),
    linear-gradient(transparent 0 47%, #4c6973 47% 49%, transparent 49%);
  opacity: 0.58;
}

.route-line {
  position: absolute;
  height: 3px;
  transform-origin: left center;
  border-radius: 999px;
  background: #315e9e;
}

.checkpoint-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  border: 3px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  background: var(--red);
  box-shadow: 0 8px 18px rgba(39, 52, 61, 0.24);
  font-size: 12px;
  font-weight: 900;
}

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

.checkpoint-pin.next {
  background: var(--yellow);
  color: #2e2102;
}

.mobile-footer button {
  width: 86px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--green);
  font-weight: 900;
}

.mobile-footer span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.checkpoint-panel {
  padding: 18px;
}

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

.checkpoint-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.order-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--blue);
  font-weight: 900;
}

.checkpoint-item strong,
.checkpoint-item span {
  display: block;
}

.checkpoint-item span {
  color: var(--muted);
  font-size: 13px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .sidebar-status {
    display: none;
  }

  .summary-grid,
  .entity-grid,
  .device-grid,
  .pairing-layout,
  .onboarding-layout,
  .access-layout,
  .enterprise-layout,
  .config-layout,
  .plan-limits-layout,
  .translation-layout,
  .map-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .designer-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .login-screen {
    padding: 16px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .login-users {
    grid-column: auto;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-header,
  .topbar-actions,
  .segmented-control,
  .map-tools,
  .enterprise-actions,
  .mode-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list,
  .summary-grid,
  .entity-grid,
  .device-grid,
  .pairing-layout,
  .onboarding-layout,
  .access-layout,
  .enterprise-layout,
  .config-layout,
  .plan-limits-layout,
  .translation-layout,
  .map-status-grid {
    grid-template-columns: 1fr;
  }

  .nav-item {
    grid-template-columns: 28px 1fr;
  }

  .phone-preview {
    min-height: auto;
  }
}
