:root {
  --bg: #09131b;
  --bg-soft: rgba(12, 26, 37, 0.78);
  --panel: rgba(10, 22, 32, 0.84);
  --panel-2: rgba(16, 34, 47, 0.88);
  --line: rgba(127, 202, 244, 0.16);
  --line-strong: rgba(127, 202, 244, 0.34);
  --text: #edf7ff;
  --text-dim: #9fb7ca;
  --accent: #63d7ff;
  --accent-2: #31b7f3;
  --accent-warm: #f2b25b;
  --success: #87f7bd;
  --danger: #ff8f8f;
  --shadow: 0 24px 70px rgba(1, 8, 14, 0.5);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Menlo", "Monaco", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(50, 144, 189, 0.2), transparent 28%),
    radial-gradient(circle at right center, rgba(242, 178, 91, 0.13), transparent 22%),
    linear-gradient(180deg, #08131c 0%, #071018 100%);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  content: "";
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 96%);
}

.app-shell {
  position: relative;
  padding: 28px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.16;
  pointer-events: none;
  animation: drift 16s ease-in-out infinite;
}

.ambient-a {
  top: -8rem;
  right: -4rem;
  background: #4fb1db;
}

.ambient-b {
  bottom: -12rem;
  left: -6rem;
  background: #efaa59;
  animation-delay: -8s;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(1.5rem, 1rem, 0) scale(1.08);
  }
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 24px;
  padding: 26px 28px;
  max-width: 1580px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(18, 38, 52, 0.9), rgba(7, 19, 28, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-lockup h1,
.hero h2,
.section-header h3,
.view-header h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-lockup h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.subhead,
.hero-copy,
.helper-copy,
.panel-body,
.section-header p,
.view-header p,
.soft-note,
.empty-state p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.55;
}

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

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 360px;
  gap: 20px;
  margin: 0 auto;
  max-width: 1580px;
}

.sidebar,
.inspector,
.workspace {
  min-width: 0;
}

.sidebar,
.inspector {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-soft {
  padding: 22px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  margin-bottom: 20px;
  padding: 24px 28px;
  border: 1px solid rgba(99, 215, 255, 0.18);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(120deg, rgba(34, 73, 95, 0.54), rgba(12, 23, 34, 0.86)),
    linear-gradient(180deg, rgba(242, 178, 91, 0.08), transparent);
  box-shadow: var(--shadow);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 12px;
  align-self: stretch;
}

.hero-stat,
.metric-card,
.mini-stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.hero-stat span,
.metric-card span,
.mini-stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.hero-stat strong,
.metric-card strong,
.mini-stat strong {
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  color: #04111a;
  background: linear-gradient(135deg, var(--accent), #8ce8ff);
  box-shadow: 0 14px 28px rgba(55, 188, 237, 0.22);
}

.button-secondary {
  color: var(--text);
  background: linear-gradient(180deg, rgba(242, 178, 91, 0.22), rgba(242, 178, 91, 0.12));
  border: 1px solid rgba(242, 178, 91, 0.28);
}

.button-ghost,
.button-subtle {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.button-subtle {
  padding-inline: 0.95rem;
}

.button-danger {
  color: #2a0909;
  background: linear-gradient(135deg, #ffc7c7, #ff9d9d);
}

.status-badge,
.tag,
.pill,
.state-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.88rem;
  white-space: nowrap;
}

.status-badge::before,
.state-chip::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  content: "";
}

.status-badge[data-state="connected"]::before,
.state-chip[data-state="on"]::before {
  background: var(--success);
  box-shadow: 0 0 16px rgba(135, 247, 189, 0.7);
}

.status-badge[data-state="demo"]::before,
.state-chip[data-state="standby"]::before {
  background: var(--accent-warm);
  box-shadow: 0 0 16px rgba(242, 178, 91, 0.55);
}

.status-badge[data-state="disconnected"]::before,
.state-chip[data-state="off"]::before {
  background: rgba(159, 183, 202, 0.55);
}

.nav-grid {
  display: grid;
  gap: 10px;
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.nav-button:hover,
.nav-button[aria-current="page"] {
  border-color: var(--line-strong);
  background: rgba(99, 215, 255, 0.08);
  transform: translateX(2px);
}

.main-panel {
  display: grid;
  gap: 20px;
}

.view-grid,
.dual-grid,
.triple-grid,
.metrics-grid,
.insight-grid {
  display: grid;
  gap: 20px;
}

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

.dual-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
}

.triple-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.feature-card,
.content-card,
.relay-card,
.sensor-card,
.group-card,
.dimmer-card,
.form-card,
.schedule-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.feature-card,
.content-card,
.form-card,
.schedule-card {
  padding: 24px;
}

.feature-card {
  min-height: 220px;
  cursor: pointer;
  transition:
    transform 200ms ease,
    border-color 200ms ease,
    box-shadow 200ms ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 215, 255, 0.3);
  box-shadow: 0 30px 72px rgba(1, 8, 14, 0.58);
}

.feature-card::after {
  position: absolute;
  inset: auto -15% -45% auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  content: "";
}

.feature-card h3,
.content-card h3,
.form-card h3,
.schedule-card h3,
.relay-card h3,
.sensor-card h3,
.group-card h3,
.dimmer-card h3 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.feature-card p,
.content-card p,
.form-card p,
.schedule-card p,
.relay-card p,
.sensor-card p,
.group-card p,
.dimmer-card p {
  color: var(--text-dim);
}

.feature-card--lighting {
  background:
    linear-gradient(160deg, rgba(45, 114, 147, 0.48), rgba(9, 24, 33, 0.9)),
    radial-gradient(circle at 75% 25%, rgba(99, 215, 255, 0.18), transparent 24%);
}

.feature-card--standby {
  background:
    linear-gradient(160deg, rgba(115, 76, 30, 0.46), rgba(19, 20, 23, 0.88)),
    radial-gradient(circle at 75% 25%, rgba(242, 178, 91, 0.22), transparent 24%);
}

.feature-card strong {
  display: block;
  margin-top: 18px;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.section-header,
.view-header,
.toolbar,
.card-header,
.relay-meta,
.group-meta,
.sensor-meta,
.log-entry,
.button-row,
.inline-fields {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.view-header,
.toolbar {
  flex-wrap: wrap;
}

.button-row {
  flex-wrap: wrap;
}

.toolbar {
  margin-bottom: 16px;
}

.segmented {
  display: inline-flex;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.segmented button {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 0.95rem;
  color: var(--text-dim);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segmented button.is-active {
  color: #021018;
  background: linear-gradient(135deg, var(--accent), #98ebff);
}

.relay-grid,
.sensor-grid,
.group-grid,
.dimmer-grid,
.checkbox-grid,
.weekly-grid {
  display: grid;
  gap: 16px;
}

.relay-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sensor-grid,
.group-grid,
.dimmer-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.relay-card,
.sensor-card,
.group-card,
.dimmer-card {
  padding: 18px;
  transition:
    transform 180ms ease,
    border-color 180ms ease;
}

.relay-card:hover,
.sensor-card:hover,
.group-card:hover,
.dimmer-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.relay-card.is-on {
  border-color: rgba(135, 247, 189, 0.28);
  background:
    linear-gradient(180deg, rgba(135, 247, 189, 0.08), transparent),
    var(--panel-2);
}

.relay-card.is-expanded {
  box-shadow: 0 24px 60px rgba(13, 80, 96, 0.2);
}

.relay-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at center, rgba(99, 215, 255, 0.24), rgba(99, 215, 255, 0.02));
  position: relative;
}

.relay-icon::before {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: var(--text);
  content: "";
}

.relay-icon.is-off::before {
  color: rgba(255, 255, 255, 0.38);
}

.relay-icon.is-on::before {
  color: var(--accent);
  box-shadow: 0 0 14px rgba(99, 215, 255, 0.3);
}

.relay-body,
.group-body,
.sensor-body,
.dimmer-body {
  display: grid;
  gap: 14px;
}

.relay-details,
.network-fields,
.schedule-table,
.command-preview,
.helper-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.relay-details,
.command-preview,
.helper-box {
  padding: 16px;
}

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

.detail-row span,
.detail-row strong {
  display: block;
}

.detail-row span,
.table-head,
.table-cell-label {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.detail-row strong,
.metric-value {
  margin-top: 4px;
  font-size: 1.06rem;
}

.stack-form,
.form-grid,
.control-stack,
.settings-grid {
  display: grid;
  gap: 16px;
}

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

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

label,
fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
}

label > span,
legend {
  color: var(--text-dim);
  font-size: 0.88rem;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(99, 215, 255, 0.16);
  border-radius: 14px;
  padding: 0.9rem 0.95rem;
  color: var(--text);
  background: rgba(5, 15, 23, 0.8);
  font: inherit;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(99, 215, 255, 0.46);
  box-shadow: 0 0 0 4px rgba(99, 215, 255, 0.08);
}

input[type="range"] {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

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

.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.checkbox-chip input {
  width: auto;
}

.metrics-grid {
  margin-top: 16px;
}

.metric-card {
  min-height: 118px;
}

.metric-value {
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.schedule-table {
  overflow: hidden;
}

.schedule-table-head,
.schedule-row {
  display: grid;
  grid-template-columns: 0.9fr 1fr 0.9fr 1fr 0.8fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
}

.schedule-table-head {
  background: rgba(255, 255, 255, 0.04);
}

.schedule-row + .schedule-row {
  border-top: 1px solid var(--line);
}

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

.mini-stat {
  min-height: 100px;
}

.log-panel {
  min-height: 340px;
}

.log-list {
  display: grid;
  gap: 12px;
  max-height: 470px;
  overflow: auto;
}

.log-entry {
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.log-entry strong,
.log-entry code {
  font-family: var(--font-mono);
}

.log-entry code {
  white-space: pre-wrap;
  word-break: break-word;
  color: #c9f4ff;
}

.log-meta {
  display: grid;
  gap: 6px;
  min-width: 88px;
}

.log-direction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.log-direction.tx {
  color: #04111a;
  background: var(--accent);
}

.log-direction.rx {
  color: #0c1b07;
  background: var(--success);
}

.log-direction.draft {
  color: #2a1b07;
  background: var(--accent-warm);
}

.empty-state {
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 14px 18px;
  border: 1px solid rgba(99, 215, 255, 0.2);
  border-radius: 999px;
  background: rgba(9, 20, 29, 0.94);
  box-shadow: var(--shadow);
  color: var(--text);
  z-index: 20;
}

.mono {
  font-family: var(--font-mono);
}

.soft-note {
  font-size: 0.92rem;
}

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .workspace {
    order: 1;
  }

  .sidebar {
    order: 2;
  }

  .inspector {
    order: 3;
  }

  .sidebar,
  .inspector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .dual-grid,
  .relay-grid,
  .sensor-grid,
  .group-grid,
  .dimmer-grid,
  .metrics-grid,
  .settings-grid,
  .weekly-grid,
  .view-grid,
  .triple-grid,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .topbar,
  .hero {
    padding: 22px;
  }

  .topbar,
  .hero,
  .sidebar,
  .inspector {
    display: grid;
  }

  .topbar-actions,
  .hero-metrics,
  .sidebar,
  .inspector,
  .dual-grid,
  .relay-grid,
  .sensor-grid,
  .group-grid,
  .dimmer-grid,
  .metrics-grid,
  .settings-grid,
  .weekly-grid,
  .view-grid,
  .triple-grid,
  .insight-grid,
  .form-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .schedule-table-head,
  .schedule-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

/* Mobile-first refresh based on the original Android app */

:root {
  --bg: #d8e7f3;
  --bg-soft: #eef4f8;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --line: #d8d8d8;
  --line-strong: #8f8f8f;
  --text: #202020;
  --text-dim: #686868;
  --accent: #ef9428;
  --accent-2: #57514d;
  --accent-warm: #ef9428;
  --success: #8cc63e;
  --danger: #d35b5b;
  --shadow: 0 5px 16px rgba(0, 0, 0, 0.08);
  --radius-xl: 12px;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --font-sans: "Avenir Next", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

body {
  color: var(--text);
  background: linear-gradient(180deg, #d8e7f3 0%, #edf4f8 100%);
}

body::before,
.ambient,
#demoToggleButton,
.advanced-panel,
.feature-card::after,
.hero {
  display: none;
}

.app-shell {
  max-width: 460px;
  margin: 0 auto;
  padding: 12px 12px calc(20px + env(safe-area-inset-bottom));
}

.topbar,
.layout {
  max-width: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #3f3a36;
  border-radius: 12px;
  background: linear-gradient(180deg, #3e3935, #262321);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
  backdrop-filter: none;
}

.eyebrow,
.panel-kicker {
  color: #ffffff;
  letter-spacing: 0.08em;
}

.brand-lockup h1 {
  color: #ffffff;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.subhead {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.86rem;
}

.layout {
  grid-template-columns: 1fr;
  gap: 12px;
}

.workspace,
.sidebar,
.inspector {
  order: initial;
}

.sidebar,
.inspector {
  gap: 12px;
}

.panel,
.feature-card,
.content-card,
.relay-card,
.sensor-card,
.group-card,
.dimmer-card,
.form-card,
.schedule-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.panel-soft,
.feature-card,
.content-card,
.form-card,
.schedule-card {
  padding: 16px;
}

.nav-grid,
.settings-grid,
.dual-grid,
.view-grid,
.insight-grid,
.metrics-grid,
.triple-grid,
.group-grid,
.sensor-grid,
.dimmer-grid,
.relay-grid,
.checkbox-grid,
.weekly-grid,
.form-grid {
  grid-template-columns: 1fr;
}

.nav-button {
  border-color: var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: #ffffff;
  font-weight: 700;
}

.nav-button:hover,
.nav-button[aria-current="page"] {
  border-color: #403a36;
  color: #ffffff;
  background: #403a36;
  transform: none;
}

.pill,
.tag {
  color: var(--text-dim);
  border-color: #e5e5e5;
  background: #f6f6f6;
}

.nav-button[aria-current="page"] .pill {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
}

.status-badge {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.state-chip {
  border-color: #d9d9d9;
  background: #f7f7f7;
  color: #444444;
}

.sidebarStats .mini-stat,
.mini-stat,
.metric-card,
.helper-box,
.relay-details,
.schedule-table {
  background: #fbfbfb;
}

.section-header h3,
.view-header h3,
.feature-card h3,
.content-card h3,
.form-card h3,
.schedule-card h3,
.relay-card h3,
.sensor-card h3,
.group-card h3,
.dimmer-card h3 {
  font-size: 1.1rem;
  color: var(--text);
}

.section-header p,
.view-header p,
.soft-note,
.content-card p,
.form-card p,
.schedule-card p,
.relay-card p,
.sensor-card p,
.group-card p,
.dimmer-card p {
  color: var(--text-dim);
}

.button {
  border: 1px solid #c7c7c7;
  border-radius: 6px;
  padding: 0.78rem 0.95rem;
  color: #2a2a2a;
  background: linear-gradient(180deg, #f8f8f8, #dddddd);
  box-shadow: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.button:hover,
.button:active {
  transform: none;
}

.button-primary,
.button-secondary,
.button-ghost,
.button-subtle {
  color: #2a2a2a;
  background: linear-gradient(180deg, #f9f9f9, #dddddd);
  border-color: #c8c8c8;
  box-shadow: none;
}

.button-danger {
  color: #651d1d;
  background: linear-gradient(180deg, #f9e1e1, #efbcbc);
  border-color: #e4b1b1;
}

.feature-card--entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: auto;
  border-color: #5e5955;
  background: linear-gradient(180deg, #5d5955, #4e4946);
  color: #ffffff;
  cursor: pointer;
}

.feature-card--entry .entry-label {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.feature-card--entry .entry-arrow {
  font-size: 1.5rem;
}

.home-screen {
  display: grid;
  gap: 16px;
}

.home-guide-grid {
  grid-template-columns: 1fr;
}

.segmented {
  width: 100%;
  padding: 4px;
  border-color: #d4d4d4;
  border-radius: 8px;
  background: #f3f3f3;
}

.segmented-lighting button,
.segmented button {
  flex: 1;
  color: #444444;
}

.segmented-lighting button.is-active,
.segmented button.is-active {
  color: #ffffff;
  background: #4d4844;
}

input,
select,
textarea {
  border: 1px solid #dfdfdf;
  border-radius: 4px;
  color: var(--text);
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(239, 148, 40, 0.12);
}

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

.relay-card,
.sensor-card,
.group-card,
.dimmer-card {
  padding: 14px;
}

.relay-card.is-on {
  border-color: #d5e8bf;
  background: #ffffff;
}

.relay-icon {
  border-color: #d3d3d3;
  background: #f8f8f8;
}

.relay-icon.is-on::before {
  color: #76c7f0;
  box-shadow: none;
}

.log-direction.tx {
  background: #dfe8f7;
  color: #345;
}

.log-direction.rx {
  background: #eaf6d8;
  color: #35511d;
}

.log-direction.draft {
  background: #f7ead6;
  color: #705020;
}

.settings-menu-card {
  background: #ffffff;
}

.settings-detail-grid {
  grid-template-columns: 1fr;
}

.settings-detail-header {
  position: sticky;
  top: 76px;
  z-index: 5;
}

.settings-shortcuts {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.menu-link {
  width: 100%;
  border: 0;
  display: block;
  padding: 14px 16px;
  border-top: 1px solid #ececec;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  background: #ffffff;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.menu-link:first-child {
  border-top: 0;
}

.menu-link:hover {
  background: #f7f7f7;
}

.network-row {
  gap: 10px;
}

.operation-guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.operation-box {
  padding: 12px 14px;
}

.operation-box span {
  display: block;
  margin-bottom: 4px;
  color: #6d6d6d;
  font-size: 0.82rem;
  font-weight: 700;
}

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

.operation-box-save {
  border-color: #f0d4a8;
  background: #fff8ef;
}

.button-row-split .button {
  flex: 1 1 0;
}

.network-inline-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.network-inline-fields.is-mac {
  gap: 6px;
}

.network-field {
  gap: 0;
  flex: 1 1 0;
}

.network-field input {
  min-width: 0;
  text-align: center;
}

.network-inline-fields.is-mac .network-field {
  flex-basis: 0;
}

.network-separator {
  flex: 0 0 auto;
  color: #6d6d6d;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.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;
}

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

.schedule-table-head,
.schedule-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px;
}

.schedule-table-head .table-head:last-child,
.schedule-row button {
  grid-column: 1 / -1;
}

@media (max-width: 420px) {
  .network-inline-fields {
    gap: 5px;
  }

  .network-field input {
    padding-inline: 0.45rem;
  }

  .network-separator {
    font-size: 1rem;
  }
}

html {
  scroll-behavior: smooth;
}
