:root {
  color-scheme: light;
  --bg: #eef3f8;
  --ink: #132033;
  --muted: #5b687a;
  --line: #d3dce8;
  --panel: #ffffff;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --blue: #1d4ed8;
  --blue-soft: #e9f0ff;
  --green: #0f766e;
  --green-soft: #e7f6f3;
  --navy: #334155;
  --gray: #667085;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
}

.blocked-view,
.launcher-view,
.settings-view {
  min-height: calc(100dvh - 28px);
  display: grid;
  align-content: start;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
}

[hidden] {
  display: none !important;
}

.topbar,
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  min-height: 56px;
  justify-content: space-between;
}

.brand {
  min-width: 0;
}

.brand.large {
  margin-top: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
}

.brand p,
.system-card small,
.notice,
.instruction-panel p,
.status-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-panel,
.instruction-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-panel,
.instruction-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.status-panel.danger {
  border-color: #f3aaa5;
  background: var(--danger-bg);
}

.status-panel.danger h2 {
  color: var(--danger);
}

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

.system-card {
  min-height: 104px;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 4px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
}

.system-card.active[data-color="blue"],
.system-card[data-color="blue"]:active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.system-card.active[data-color="green"],
.system-card[data-color="green"]:active {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.system-card.active[data-color="navy"],
.system-card[data-color="navy"]:active {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.system-card.active[data-color="gray"],
.system-card[data-color="gray"]:active {
  border-color: var(--gray);
  background: var(--gray);
  color: #ffffff;
}

.system-card.active small,
.system-card.active .system-name {
  color: rgba(255, 255, 255, 0.82);
}

.system-code {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}

.system-name {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.primary-action,
.secondary-action,
.danger-action,
.settings-button,
.text-action {
  width: 100%;
  min-height: 52px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action,
.secondary-action,
.danger-action,
.settings-button {
  border: 0;
  color: #ffffff;
}

.primary-action {
  background: #0f172a;
}

.secondary-action {
  background: #334155;
}

.danger-action {
  background: #b42318;
}

.settings-button {
  align-self: end;
  background: #475467;
  margin-top: auto;
}

.text-action {
  width: auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.pin-panel,
.settings-panel,
.entry-form {
  display: grid;
  gap: 10px;
}

.pin-panel,
.settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
}

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

.settings-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.settings-entry small {
  display: block;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.settings-entry-actions {
  display: flex;
  gap: 6px;
}

.settings-entry-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (min-width: 620px) {
  .system-grid {
    grid-template-columns: 1fr 1fr;
  }
}
