:root {
  color-scheme: light;
  --bg: #f5f7ef;
  --ink: #121712;
  --muted: #5f6757;
  --line: #d9ddcf;
  --panel: #ffffff;
  --accent: #2f6f4f;
  --accent-strong: #1e5238;
  --lime: #d9ff5a;
  --danger: #a23a32;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(circle at top left, #eef7d1, transparent 34rem), var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

button.secondary:hover {
  background: #f0f3e7;
}

button.compact {
  min-height: 34px;
  padding: 0 12px;
}

button:disabled {
  cursor: wait;
  opacity: .62;
}

.shell {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.brand {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.3rem, 7vw, 4.7rem);
  line-height: .95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.3rem;
}

.panel,
.empty,
.codes article,
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 18px 40px rgba(18, 23, 18, .08);
}

.panel,
.empty {
  padding: 22px;
}

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

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.workspace {
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.install-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #fff;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  gap: 12px;
}

.codes {
  display: grid;
  gap: 12px;
}

.codes article {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.account-name {
  margin-bottom: 5px;
  font-weight: 800;
}

.account-meta {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.account-group {
  display: inline-block;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--accent-strong);
  background: #f1f6e4;
  font-size: .85rem;
  font-weight: 800;
}

.code-block {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.totp-code {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 900;
  letter-spacing: .08em;
}

.timer {
  width: 104px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: #dde3d2;
}

.timer span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left;
  background: var(--lime);
}

.danger {
  color: #fff;
  background: var(--danger);
}

.icon-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1.5rem;
}

.empty {
  text-align: center;
}

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

.status-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.status-grid span,
.status-grid strong {
  display: block;
}

.status-grid span {
  color: var(--muted);
  font-size: .9rem;
}

.status-grid strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

dialog {
  width: min(620px, calc(100vw - 28px));
  padding: 0;
}

dialog::backdrop {
  background: rgba(18, 23, 18, .45);
}

.dialog {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.dialog header,
.dialog menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.dialog header h2 {
  margin: 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tab {
  min-height: 40px;
  border-radius: 0;
  color: var(--ink);
  background: #fff;
}

.tab.is-active {
  color: #fff;
  background: var(--accent);
}

.tab-panel {
  display: grid;
  gap: 14px;
}

.camera-panel video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
  background: #101510;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  max-width: min(520px, calc(100vw - 28px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .codes article {
    grid-template-columns: 1fr;
  }

  .code-block {
    justify-items: start;
  }

  .account-actions {
    justify-content: flex-start;
  }

  .toolbar button {
    flex: 1 1 150px;
  }

  .filters,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .install-hint {
    align-items: flex-start;
    flex-direction: column;
  }
}
