:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #65727a;
  --line: #d8e0e4;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(23, 32, 38, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #f8fbfa 0%, #eef4f5 42%, #f6f1e9 100%);
}

button, input, select { font: inherit; }

.shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0 48px;
}

.shell.is-locked {
  width: min(460px, calc(100vw - 32px));
  display: grid;
  align-content: center;
  justify-items: stretch;
  padding: 32px 0;
}

.shell.is-locked .topbar {
  display: block;
  margin-bottom: 18px;
}

.shell.is-locked .auth-panel {
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(32px, 5vw, 56px); line-height: 1; }
h2 { margin-bottom: 8px; font-size: 22px; }
h3 { margin-bottom: 4px; font-size: 18px; }

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  max-width: 460px;
  padding: 28px;
}

.add-panel { padding: 22px; }
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f3;
}

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

.segmented label {
  display: block;
  font-size: 14px;
  font-weight: 750;
}

.segmented input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
}

.segmented input:checked + span {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 5px rgba(23, 32, 38, 0.1);
}

.admin-tools {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}

.admin-tools[hidden] { display: none; }

.password-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.password-form {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(280px, 1fr) minmax(110px, 120px);
  gap: 12px;
  align-items: start;
}

.password-field {
  grid-template-rows: auto 44px;
  gap: 8px;
}

.password-field > span:first-child {
  color: #16242a;
  font-weight: 750;
}

.password-field input,
.password-field select {
  height: 44px;
  border: 1px solid #aebfc7;
  background: #fbfdfd;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(25, 39, 46, .05);
}

.password-field input:hover,
.password-field select:hover {
  border-color: #7f969f;
  background: #fff;
}

.select-box {
  position: relative;
  display: block;
  border-radius: 6px;
  background: #fbfdfd;
}

.select-box select {
  appearance: none;
  padding-right: 42px;
}

.select-box::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 9px;
  height: 9px;
  border-right: 2px solid #52666f;
  border-bottom: 2px solid #52666f;
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.password-form .ghost {
  align-self: end;
  min-width: 120px;
}

.confirm-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  color: #304047;
  font-weight: 700;
}

.confirm-row input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
}

.confirm-row[hidden] {
  display: none;
}

.compact {
  margin: 6px 0 0;
  font-size: 14px;
}
.panel-head { display: flex; justify-content: space-between; gap: 16px; }
.muted { color: var(--muted); margin-bottom: 16px; }
.hint { min-height: 20px; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.hint.error { color: var(--danger); }
.hint.ok { color: var(--accent-strong); }

.stack, .add-form {
  display: grid;
  gap: 14px;
}

.add-form {
  grid-template-columns: minmax(130px, .85fr) minmax(150px, 1fr) minmax(180px, 1.15fr) minmax(220px, 1.55fr) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: #304047;
  font-size: 14px;
  font-weight: 650;
}

input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd6dc;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

button:active { transform: translateY(1px); }
.primary { padding: 0 18px; color: white; background: var(--accent); font-weight: 750; }
.primary:hover { background: var(--accent-strong); }
.ghost { padding: 0 16px; background: rgba(255,255,255,.65); border: 1px solid var(--line); color: var(--text); }
.ghost:hover { border-color: var(--accent); }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.section-title h2 { margin-bottom: 0; }
.countdown { color: var(--accent-strong); font-weight: 800; }
.group-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 18px;
}

.group-filters[hidden] { display: none; }

.group-filters button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #31434a;
  background: rgba(255,255,255,.72);
  font-size: 14px;
  font-weight: 750;
}

.group-filters button:hover { border-color: var(--accent); }
.group-filters button.active { color: #fff; border-color: var(--accent); background: var(--accent); }

.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.token-card { padding: 18px; }
.token-meta { display: flex; justify-content: space-between; gap: 12px; }
.account { color: var(--muted); margin-bottom: 8px; overflow-wrap: anywhere; }
.group-name {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 16px;
  padding: 3px 8px;
  border: 1px solid #d5e2e2;
  border-radius: 6px;
  color: var(--accent-strong);
  background: #eef7f5;
  font-size: 12px;
  font-weight: 750;
}
.icon-btn {
  width: 34px;
  min-height: 34px;
  height: 34px;
  color: var(--muted);
  background: #f1f4f5;
  font-size: 22px;
  line-height: 1;
}
.icon-btn:hover { color: var(--danger); }
.code {
  width: 100%;
  min-height: 74px;
  color: #10201d;
  background: #e8f3f1;
  font-size: 36px;
  font-weight: 850;
  letter-spacing: 0;
}
.code:hover { background: #dcefed; }
.code.copied { color: white; background: var(--accent); }
.progress { height: 8px; margin-top: 14px; background: #edf1f2; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left center; }
.empty { padding: 28px; color: var(--muted); text-align: center; }

@media (max-width: 800px) {
  .topbar { align-items: flex-start; }
  .shell.is-locked { align-content: start; padding-top: 48px; }
  .add-form, .password-form { grid-template-columns: 1fr; }
  .primary, .password-form .ghost { width: 100%; }
}
