:root {
  --ink: #0d1412;
  --deep: #111a17;
  --panel: #17221e;
  --panel-soft: #1d2925;
  --line: rgba(234, 240, 228, 0.14);
  --line-strong: rgba(234, 240, 228, 0.28);
  --paper: #edf0e8;
  --muted: #98a39b;
  --acid: #d4ff4f;
  --orange: #ff8d55;
  --red: #ff6b63;
  --white: #f8faf4;
  --radius: 2px;
  --font: Inter, "Noto Sans Thai", "Leelawadee UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  color: var(--paper);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.brand-large {
  position: relative;
  z-index: 1;
}

.brand-mark {
  position: relative;
  width: 27px;
  height: 27px;
  border: 1px solid var(--acid);
  transform: rotate(45deg);
}

.brand-mark::before,
.brand-mark span {
  position: absolute;
  content: "";
  background: var(--acid);
}

.brand-mark::before {
  left: 5px;
  top: 5px;
  width: 6px;
  height: 15px;
}

.brand-mark span {
  right: 5px;
  bottom: 5px;
  width: 7px;
  height: 7px;
}

.eyebrow,
.step-label,
.section-number,
.metric-foot {
  margin: 0;
  color: var(--acid);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.16em;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.18fr) minmax(380px, 0.82fr);
}

.login-story {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 5vw, 76px);
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(13, 20, 18, 0.18), rgba(13, 20, 18, 0.93)),
    repeating-linear-gradient(90deg, transparent 0, transparent 79px, rgba(212, 255, 79, 0.055) 80px),
    radial-gradient(circle at 73% 40%, rgba(212, 255, 79, 0.24), transparent 0 5%, transparent 31%),
    linear-gradient(135deg, #314537, #14221c 52%, #0d1412);
}

.login-story::before,
.login-story::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(212, 255, 79, 0.28);
  border-radius: 50%;
}

.login-story::before {
  width: 46vw;
  height: 46vw;
  right: -15vw;
  top: 13vh;
}

.login-story::after {
  width: 30vw;
  height: 30vw;
  right: -7vw;
  top: 25vh;
}

.story-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 9vh 0 7vh;
}

.story-copy h1,
.dashboard-intro h1 {
  margin: 22px 0 28px;
  font-size: clamp(52px, 6vw, 94px);
  font-weight: 560;
  line-height: 0.93;
  letter-spacing: -0.055em;
}

.story-copy h1 em,
.dashboard-intro h1 em {
  color: var(--acid);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.story-copy > p:last-child {
  max-width: 540px;
  margin: 0;
  color: #bac4bc;
  font-size: 16px;
  line-height: 1.8;
}

.story-footer,
.sync-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.pulse-dot,
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 5px rgba(212, 255, 79, 0.1);
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--paper);
  color: var(--ink);
}

.login-card {
  width: min(100%, 430px);
}

.login-card-heading {
  margin-bottom: 46px;
}

.login-card-heading h2 {
  margin: 18px 0 7px;
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 620;
  letter-spacing: -0.045em;
}

.login-card-heading > p:last-child {
  margin: 0;
  color: #677169;
  font-size: 14px;
}

.step-label {
  color: #63712e;
}

.field {
  display: block;
  margin-bottom: 22px;
}

.field > span {
  display: block;
  margin-bottom: 10px;
  color: #4f5952;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

.field input {
  width: 100%;
  min-height: 56px;
  padding: 0 17px;
  border: 1px solid #bbc3b9;
  border-radius: var(--radius);
  outline: none;
  background: transparent;
  color: var(--ink);
  transition: border-color 160ms, box-shadow 160ms;
}

.field input:focus {
  border-color: #71802b;
  box-shadow: 0 0 0 3px rgba(113, 128, 43, 0.12);
}

.form-error {
  min-height: 22px;
  margin: -7px 0 12px;
  color: #a62e29;
  font-size: 13px;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms, background 160ms;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #202d28;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 38px 0 0;
  color: #737c75;
  font-size: 11px;
  line-height: 1.6;
}

.privacy-note span {
  color: #74822f;
  font-size: 7px;
  line-height: 22px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(13, 20, 18, 0.92);
  backdrop-filter: blur(16px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.product-nav {
  position: absolute;
  left: 50%;
  display: flex;
  height: 100%;
  align-items: stretch;
  gap: 30px;
  transform: translateX(-50%);
}

.product-nav a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.product-nav a:hover,
.product-nav a.is-active {
  color: var(--paper);
}

.product-nav a.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--acid);
}

.header-rule {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.ghost-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
}

.ghost-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.ghost-button:hover,
.text-button:hover {
  color: var(--acid);
}

.connection-error .sync-status .pulse-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(255, 107, 99, 0.12);
}

.dashboard-shell {
  width: min(1500px, calc(100% - clamp(32px, 8vw, 128px)));
  margin: 0 auto;
}

.dashboard-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: 60px;
  align-items: end;
  padding: clamp(70px, 9vw, 140px) 0 clamp(55px, 7vw, 104px);
}

.dashboard-intro h1 {
  margin-bottom: 0;
  font-size: clamp(58px, 7vw, 112px);
}

.intro-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  padding: 25px 0 5px;
  border-top: 1px solid var(--line-strong);
}

.note-index {
  color: var(--acid);
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: italic;
}

.intro-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.metric-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--deep);
}

.metric-card.metric-primary {
  background: var(--acid);
  color: var(--ink);
}

.metric-card strong {
  font-size: clamp(55px, 6vw, 88px);
  font-weight: 520;
  line-height: 1;
  letter-spacing: -0.06em;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-primary .metric-label,
.metric-primary .metric-foot {
  color: #35401b;
}

.metric-foot {
  color: #69756e;
}

.status-dot.online {
  background: var(--acid);
}

.status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(255, 107, 99, 0.09);
}

.section-block {
  padding: clamp(80px, 10vw, 150px) 0 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 34px;
}

.section-heading h2 {
  margin: 10px 0 0;
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 540;
  letter-spacing: -0.045em;
}

.section-caption {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: right;
}

.text-button {
  padding: 8px 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 12px;
}

.text-button.is-active {
  border-color: var(--acid);
  color: var(--acid);
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.device-card-shell {
  display: grid;
  min-width: 0;
  grid-template-rows: 1fr auto;
  background: var(--deep);
}

.device-card {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 410px;
  flex-direction: column;
  padding: 26px;
  border: 0;
  outline: none;
  background: var(--deep);
  color: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: background 180ms, box-shadow 180ms;
}

.device-card:hover,
.device-card:focus-visible,
.device-card.is-selected {
  background: var(--panel-soft);
  box-shadow: inset 0 -3px 0 var(--acid);
}

.device-card-top,
.device-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-index {
  color: #5e6a63;
  font-family: Georgia, serif;
  font-size: 20px;
  font-style: italic;
}

.device-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.device-status .status-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.device-status.is-offline .status-dot {
  background: var(--red);
}

.device-title {
  margin: 37px 0 28px;
}

.device-title h3 {
  margin: 0 0 6px;
  overflow: hidden;
  font-size: 24px;
  font-weight: 560;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-title p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-details {
  display: grid;
  gap: 15px;
  margin-bottom: 30px;
}

.device-detail {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.device-detail-label {
  color: #647069;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.device-detail-value {
  overflow: hidden;
  color: #cbd2cb;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card-foot {
  margin-top: auto;
  color: #69756e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.device-card-actions {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px 10px 26px;
  border-top: 1px solid var(--line);
  background: #101916;
}

.device-delete-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 107, 99, 0.55);
  background: rgba(255, 107, 99, 0.06);
  color: #ff8b84;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  transition: border-color 160ms, background 160ms, color 160ms;
}

.device-delete-button:hover:not(:disabled),
.device-delete-button:focus-visible {
  border-color: var(--red);
  outline: none;
  background: rgba(255, 107, 99, 0.14);
  color: #ffd4d1;
}

.device-delete-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.device-delete-hint {
  margin-left: auto;
  color: #5f6d65;
  font-size: 8px;
  line-height: 1.45;
  text-align: right;
}

.device-delete-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid #33443c;
  background: #101916;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.device-delete-dialog::backdrop {
  background: rgba(2, 7, 5, 0.82);
  backdrop-filter: blur(5px);
}

.device-delete-dialog-panel {
  padding: clamp(24px, 5vw, 42px);
}

.device-delete-dialog h2 {
  max-width: 520px;
  margin: 12px 0 10px;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.15;
}

.device-delete-target {
  margin: 0;
  color: var(--acid);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.device-delete-description {
  margin: 26px 0 14px;
  color: #9eaaa3;
  font-size: 13px;
}

.device-delete-options {
  display: grid;
  gap: 10px;
}

.device-delete-option {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid #2a3a33;
  background: #0d1512;
}

.device-delete-option strong {
  color: #dce6df;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.device-delete-option span {
  color: #8e9b94;
  font-size: 12px;
  line-height: 1.55;
}

.device-delete-option.is-danger {
  border-color: rgba(255, 107, 99, 0.3);
}

.device-delete-option.is-danger strong {
  color: #ff8b84;
}

.device-delete-error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--red);
  background: rgba(255, 107, 99, 0.08);
  color: #ffc1bd;
  font-size: 12px;
}

.device-delete-dialog-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.dialog-button {
  min-height: 46px;
  border: 1px solid #405149;
  background: transparent;
  color: #c7d0ca;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.dialog-button:hover:not(:disabled),
.dialog-button:focus-visible {
  outline: none;
  border-color: var(--acid);
  color: var(--acid);
}

.dialog-button.is-delete {
  border-color: rgba(212, 255, 79, 0.48);
  background: rgba(212, 255, 79, 0.06);
}

.dialog-button.is-discard {
  border-color: rgba(255, 107, 99, 0.58);
  background: rgba(255, 107, 99, 0.1);
  color: #ff9c96;
}

.dialog-button.is-discard:hover:not(:disabled),
.dialog-button.is-discard:focus-visible {
  border-color: var(--red);
  color: #ffd4d1;
}

.dialog-button:disabled {
  cursor: wait;
  opacity: 0.45;
}

.device-arrow {
  color: var(--acid);
  font-size: 18px;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.7fr) minmax(0, 2fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: stretch;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.map-panel-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.map-section-heading {
  display: block;
  margin-bottom: 0;
}

.map-section-heading .section-caption {
  margin-top: 18px;
  text-align: left;
}

.device-map-shell {
  position: relative;
  height: clamp(340px, 32vw, 460px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--deep);
}

.device-map {
  width: 100%;
  height: 100%;
  background: #16201d;
}

.device-map .leaflet-tile-pane {
  filter: saturate(0.58) brightness(0.72) contrast(1.12);
}

.device-map .leaflet-control-zoom a {
  border-color: var(--line);
  background: rgba(13, 20, 18, 0.92);
  color: var(--paper);
}

.device-map .leaflet-control-zoom a:hover {
  background: var(--panel-soft);
  color: var(--acid);
}

.device-map .leaflet-control-attribution {
  padding: 4px 7px;
  background: rgba(13, 20, 18, 0.82);
  color: #aab5ad;
  font-size: 9px;
}

.device-map .leaflet-control-attribution a {
  color: var(--acid);
}

.map-empty {
  position: absolute;
  z-index: 500;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent 79px, rgba(212, 255, 79, 0.035) 80px),
    var(--deep);
  color: var(--muted);
  font-size: 13px;
}

.map-empty[hidden] {
  display: none !important;
}

.map-legend {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
  margin-top: auto;
  padding: 22px 0 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-legend span:last-child {
  margin-left: 0;
  line-height: 1.7;
}

.map-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.map-legend-dot.online {
  background: var(--acid);
  box-shadow: 0 0 0 4px rgba(212, 255, 79, 0.1);
}

.map-legend-dot.offline {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 107, 99, 0.1);
}

.field-map-marker-shell {
  border: 0;
  background: transparent;
}

.field-map-marker {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px solid rgba(13, 20, 18, 0.9);
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 7px rgba(212, 255, 79, 0.17), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.field-map-marker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}

.field-map-marker-shell.is-offline .field-map-marker {
  background: var(--red);
  box-shadow: 0 0 0 7px rgba(255, 107, 99, 0.15), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.field-map-marker-shell.is-selected .field-map-marker {
  border-width: 3px;
  border-color: var(--paper);
  box-shadow: 0 0 0 10px rgba(212, 255, 79, 0.22), 0 10px 30px rgba(0, 0, 0, 0.45);
}

.device-map .leaflet-popup-content-wrapper,
.device-map .leaflet-popup-tip {
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
}

.device-map .leaflet-popup-content {
  margin: 18px;
}

.device-map .leaflet-popup-close-button {
  color: var(--muted);
}

.map-popup {
  display: grid;
  gap: 7px;
}

.map-popup-title {
  padding-right: 16px;
  font-size: 15px;
}

.map-popup-status {
  color: var(--acid);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.map-popup-status.is-offline {
  color: var(--red);
}

.map-popup-coordinate {
  color: #dce2db;
  font-size: 11px;
}

.map-popup-meta {
  color: var(--muted);
  font-size: 10px;
}

.map-popup-link {
  margin-top: 6px;
  color: var(--acid);
  font-size: 10px;
  text-underline-offset: 3px;
}

.permission-grid {
  display: grid;
  gap: 18px;
}

.permission-card {
  border: 1px solid var(--line);
  background: var(--deep);
}

.permission-card-header {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.permission-device h3 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.025em;
}

.permission-device p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.permission-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--acid);
}

.permission-summary strong {
  font-size: 30px;
  font-weight: 530;
  letter-spacing: -0.04em;
}

.permission-summary span,
.permission-total {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.permission-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-group {
  min-width: 0;
  padding: 28px;
}

.permission-group + .permission-group {
  border-left: 1px solid var(--line);
}

.permission-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.permission-group-heading h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.permission-item {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.permission-item.is-granted {
  border-color: rgba(212, 255, 79, 0.34);
  color: #dce8b4;
  background: rgba(212, 255, 79, 0.055);
}

.permission-item.is-not-granted {
  color: #8d9690;
}

.permission-state {
  flex: 0 0 auto;
  color: var(--acid);
}

.permission-item.is-not-granted .permission-state {
  color: var(--orange);
}

.permission-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-empty {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.table-section {
  padding-bottom: 100px;
}

.table-heading {
  align-items: flex-end;
}

.search-field {
  display: flex;
  width: min(100%, 360px);
  height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font-size: 12px;
}

.search-field input::placeholder {
  color: #657069;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--deep);
}

table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
}

th,
td {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #67736b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

td {
  font-size: 11px;
}

tbody tr {
  transition: background 140ms;
}

tbody tr:hover {
  background: rgba(212, 255, 79, 0.035);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-primary,
.table-secondary {
  display: block;
}

.table-primary {
  max-width: 260px;
  overflow: hidden;
  color: #dce2db;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-secondary {
  margin-top: 6px;
  color: #68736c;
  font-size: 10px;
}

.mono {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.signal-pill {
  display: inline-block;
  min-width: 70px;
  padding: 7px 9px;
  border: 1px solid currentColor;
  border-radius: 20px;
  text-align: center;
}

.signal-pill.excellent {
  color: var(--acid);
}

.signal-pill.good {
  color: #9ddc88;
}

.signal-pill.fair {
  color: #ffcc73;
}

.signal-pill.weak {
  color: var(--orange);
}

.location-link {
  color: #c8d3ca;
  text-underline-offset: 3px;
}

.location-link:hover {
  color: var(--acid);
}

.path-value {
  display: block;
  max-width: 270px;
  overflow: hidden;
  color: #929d95;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 70px 24px;
  background: var(--deep);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.table-empty {
  border-top: 1px solid var(--line);
}

.dashboard-footer {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 64px);
  border-top: 1px solid var(--line);
  color: #59655e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

@media (max-width: 1050px) {
  .login-shell {
    grid-template-columns: 1fr 430px;
  }

  .story-copy h1 {
    font-size: clamp(48px, 6.5vw, 72px);
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .device-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .permission-columns {
    grid-template-columns: 1fr;
  }

  .permission-group + .permission-group {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .map-layout {
    grid-template-columns: minmax(210px, 0.65fr) minmax(0, 1.6fr);
    gap: 30px;
  }

  .device-map-shell {
    height: 390px;
  }
}

@media (max-width: 760px) {
  .login-shell {
    display: block;
  }

  .login-story {
    min-height: 52vh;
    padding: 28px 24px 36px;
  }

  .login-story::before {
    width: 80vw;
    height: 80vw;
  }

  .story-copy {
    margin: 70px 0 50px;
  }

  .story-copy h1 {
    font-size: 50px;
  }

  .story-copy > p:last-child {
    font-size: 13px;
  }

  .login-panel {
    min-height: 60vh;
    padding: 58px 24px;
  }

  .topbar {
    min-height: 66px;
  }

  .sync-status,
  .header-rule,
  .ghost-button span {
    display: none;
  }

  .product-nav {
    position: static;
    height: 66px;
    gap: 18px;
    transform: none;
  }

  .product-nav a {
    font-size: 10px;
  }

  .dashboard-shell {
    width: calc(100% - 32px);
  }

  .dashboard-intro {
    grid-template-columns: 1fr;
    gap: 42px;
    padding: 70px 0 55px;
  }

  .dashboard-intro h1 {
    font-size: 58px;
  }

  .metric-grid,
  .device-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 175px;
  }

  .device-card {
    min-height: 390px;
  }

  .section-heading,
  .table-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-caption {
    text-align: left;
  }

  .permission-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .permission-group {
    padding: 22px;
  }

  .map-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 22px;
  }

  .map-panel-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
  }

  .map-legend {
    min-width: 190px;
    margin-top: 0;
    padding: 0 0 2px 22px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .device-map-shell {
    height: 340px;
    min-height: 0;
  }

  .device-map {
    height: 100%;
  }

  .map-section-heading .section-caption {
    margin-top: 12px;
  }

  .search-field {
    width: 100%;
  }

  .dashboard-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }
}

@media (max-width: 520px) {
  .device-delete-option {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .device-delete-dialog-actions {
    grid-template-columns: 1fr;
  }

  .product-nav {
    margin-left: auto;
  }

  .product-nav a:first-child {
    display: none;
  }

  .topbar-actions {
    gap: 0;
  }

  .ghost-button {
    display: none;
  }
}

@media (max-width: 520px) {
  .map-panel-copy {
    display: flex;
    align-items: stretch;
  }

  .map-legend {
    min-width: 0;
    margin-top: 22px;
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .device-map-shell {
    height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
