:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #ffffff;
  --ink: #182026;
  --muted: #66737d;
  --line: #dfe3e2;
  --accent: #0b6b6f;
  --accent-strong: #084e51;
  --gold: #d59f28;
  --coral: #c95f45;
  --shadow: 0 18px 60px rgba(23, 32, 38, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(rgba(11, 107, 111, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 107, 111, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 36px 36px;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: flex;
  align-items: center;
}

.workspace {
  width: 100%;
}

.topbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--accent-strong);
  background: #e9f2ef;
  border: 1px solid #c7ded9;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.generator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-top: 26px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: #314047;
  font-size: 0.9rem;
  font-weight: 750;
}

textarea,
input,
select {
  width: 100%;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid #cad3d1;
  border-radius: 6px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

textarea {
  min-height: 138px;
  padding: 14px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  line-height: 1.5;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(11, 107, 111, 0.12);
  background: #fff;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 112px;
  gap: 12px;
  margin-top: 16px;
}

.actions,
.code-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.primary,
.secondary,
.ghost {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  font-weight: 800;
}

.primary {
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
}

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

.secondary {
  padding: 0 16px;
  color: var(--accent-strong);
  background: #edf6f2;
  border: 1px solid #c5dfd7;
}

.ghost {
  width: 44px;
  color: var(--muted);
  background: #f1f3f2;
}

.danger {
  width: auto;
  padding: 0 12px;
  color: #8f3326;
  background: #fae9e4;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.code-panel {
  min-height: 382px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.code-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(213, 159, 40, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(201, 95, 69, 0.12), transparent 38%);
  pointer-events: none;
}

.code-panel > * {
  position: relative;
}

.timer-visual {
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
}

.progress-ring {
  width: 136px;
  height: 136px;
  transform: rotate(-90deg);
}

.track,
.progress {
  fill: none;
  stroke-width: 8;
}

.track {
  stroke: #e6ecea;
}

.progress {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 250ms linear;
}

.timer-copy {
  position: absolute;
  display: grid;
  place-items: center;
}

.timer-copy span {
  font-size: 2.1rem;
  font-weight: 900;
}

.timer-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.account-name {
  min-height: 24px;
  margin: 18px 0 8px;
  color: var(--muted);
  font-weight: 800;
}

.totp-code {
  display: block;
  min-height: 70px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(3rem, 8vw, 5.4rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
}

.wide {
  flex: 1;
}

.vault {
  margin-top: 18px;
  padding-bottom: 4px;
}

.saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.entry-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  min-height: 68px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.entry-main {
  min-width: 0;
  padding: 12px 14px;
  display: grid;
  gap: 3px;
  text-align: left;
  color: var(--ink);
  background: transparent;
}

.entry-main:hover {
  background: #f6faf8;
}

.entry-title,
.entry-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-title {
  font-weight: 850;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.entry-delete {
  color: #8f3326;
  background: #faeee9;
  font-size: 1.1rem;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 72px;
  padding: 22px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed #cfd8d5;
  border-radius: var(--radius);
  text-align: center;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 640px);
    padding: 20px 0;
    align-items: flex-start;
  }

  .topbar {
    align-items: flex-start;
  }

  .generator-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .privacy-badge {
    margin-top: 4px;
  }
}

@media (max-width: 520px) {
  .topbar,
  .section-heading,
  .actions,
  .code-actions {
    align-items: stretch;
  }

  .topbar,
  .actions,
  .code-actions {
    flex-direction: column;
  }

  .privacy-badge,
  .primary,
  .secondary,
  .ghost {
    width: 100%;
  }

  .input-panel,
  .code-panel {
    padding: 18px;
  }
}
