:root {
  --bg: #eef3ff;
  --surface: #ffffff;
  --soft: #e7eeff;
  --text: #111827;
  --muted: #5d6b82;
  --accent: #1f4fd6;
  --ok: #16724d;
  --warn: #9a5d12;
  --bad: #b33f37;
  --border: rgba(31, 79, 214, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, rgba(31, 79, 214, 0.18), transparent 34%), var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 3.2rem;
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: white;
  font-weight: 900;
}

button.finish {
  background: var(--ok);
}

input,
select {
  width: 100%;
  min-height: 3.2rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: white;
  font-size: 1.05rem;
  font-weight: 750;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 900;
}

.ipad-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  color: white;
  background: #1f4fd6;
  box-shadow: 0 12px 32px rgba(31, 79, 214, 0.24);
}

.ipad-topbar p,
.ipad-topbar h1 {
  margin: 0;
}

.ipad-topbar p {
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.ipad-topbar h1 {
  font-size: 1.65rem;
}

.ipad-topbar span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.25rem;
  font-weight: 800;
}

.connection-pill i {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: #f4c542;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.24);
}

.connection-pill.online i {
  background: #22c55e;
}

.connection-pill.offline i {
  background: #ef4444;
}

.connection-pill.checking i {
  background: #f4c542;
}

.ipad-shell {
  padding: 1rem;
}

.ipad-grid {
  display: grid;
  grid-template-columns: minmax(20rem, 1fr) minmax(18rem, 0.85fr);
  gap: 1rem;
}

.ipad-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08);
}

.setup-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

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

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.scan-panel {
  display: grid;
  gap: 0.8rem;
}

.manual-panel {
  display: grid;
  gap: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(231, 238, 255, 0.45);
}

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

.manual-results {
  display: grid;
  gap: 0.55rem;
}

.manual-card {
  display: grid;
  grid-template-columns: 1fr minmax(12rem, 16rem);
  gap: 0.7rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: white;
}

.manual-card strong,
.manual-card small {
  display: block;
}

.manual-actions {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.45rem;
}

.scan-form {
  display: grid;
  grid-template-columns: 1fr 8rem;
  gap: 0.75rem;
}

.scan-form button {
  grid-column: 1 / -1;
  min-height: 3.6rem;
  font-size: 1.12rem;
}

.message {
  border-radius: 10px;
  padding: 0.8rem;
  font-weight: 850;
  background: var(--soft);
}

.message.ok {
  color: var(--ok);
  background: rgba(22, 114, 77, 0.1);
}

.message.bad {
  color: var(--bad);
  background: rgba(179, 63, 55, 0.1);
}

.message.warn {
  color: var(--warn);
  background: rgba(154, 93, 18, 0.12);
}

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

.status-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.status-cards article {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  background: var(--soft);
}

.status-cards span {
  display: block;
  color: var(--muted);
  font-weight: 850;
}

.status-cards strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--accent);
  font-size: 2rem;
}

.recent-list {
  display: grid;
  gap: 0.55rem;
}

.recent-list article {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: white;
}

.recent-list strong,
.recent-list small {
  display: block;
}

@media (max-width: 820px) {
  .ipad-grid,
  .setup-panel {
    grid-template-columns: 1fr;
    display: grid;
  }

  .manual-card,
  .manual-actions {
    grid-template-columns: 1fr;
  }
}
