:root {
  --bg: #f7f9fc;
  --panel: #fff;
  --ink: #182230;
  --muted: #65748a;
  --line: #dfe6ef;
  --red: #c81e3a;
  --red-soft: #fff0f3;
  --blue: #2a6fdb;
  --blue-soft: #edf4ff;
  --green-soft: #edf8f1;
  --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 46px;
  padding: 0 16px;
  background: var(--blue-soft);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

button:active {
  transform: scale(.96);
  filter: brightness(.96);
}

.app {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 30px;
}

.topbar,
.quick,
.tabs,
menu,
.grid.two {
  display: grid;
  gap: 10px;
}

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

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

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

.topbar {
  margin-bottom: 22px;
}

.account-pill {
  width: 100%;
  min-height: 38px;
  margin: -10px 0 18px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.ghost {
  background: #f8f4e8;
}

.ghost.blue,
.tabs button.active {
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(42, 111, 219, .18);
}

.red-soft {
  background: var(--red-soft);
  color: var(--red);
}

.green-soft {
  background: var(--green-soft);
  color: #168552;
}

.title {
  text-align: center;
  padding: 4px 0 18px;
}

.logo {
  width: 70px;
  height: 70px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--red), #f05b72);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

h1 {
  margin: 0;
  color: var(--red);
  font-size: clamp(34px, 10vw, 52px);
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 22px;
  letter-spacing: 0;
}

p {
  line-height: 1.45;
}

.title p,
.status,
.hint,
.last {
  color: var(--muted);
}

.summary,
.primary {
  background: var(--red);
  color: white;
}

.summary {
  width: 100%;
  margin: 14px 0;
  min-height: 54px;
  font-size: 18px;
  box-shadow: 0 10px 22px rgba(200, 30, 58, .18);
}

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

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 48px;
  padding: 10px 12px;
  outline: 0;
  font-size: 17px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(42, 111, 219, .65);
  box-shadow: 0 0 0 3px rgba(42, 111, 219, .12);
}

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

.chart-panel {
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 330px;
  display: block;
  margin-top: 10px;
  background: #fff;
  border-radius: 8px;
  touch-action: none;
}

dialog {
  width: min(620px, calc(100% - 22px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .28);
}

dialog::backdrop {
  background: rgba(15, 23, 42, .55);
}

.dialog-body {
  padding: 20px;
}

menu {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  margin: 18px 0 0;
}

.dialog-label {
  margin: 10px 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.pre {
  white-space: pre-wrap;
  max-height: 58vh;
  overflow: auto;
  color: var(--ink);
  line-height: 1.45;
}

.danger {
  background: var(--red-soft);
  color: var(--red);
}

.loading {
  padding: 28px;
  display: grid;
  place-items: center;
  gap: 12px;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid #e5eaf2;
  border-top-color: var(--red);
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
  .app {
    padding-left: 12px;
    padding-right: 12px;
  }

  .quick button,
  .tabs button {
    min-height: 44px;
    padding: 0 8px;
    font-size: 14px;
  }

  .panel {
    padding: 14px;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }
}
