:root {
  color-scheme: dark;
  --bg: #101413;
  --ink: #edf4ef;
  --muted: #9aaea4;
  --panel: #171d1b;
  --panel-strong: #1f2825;
  --line: #2f3d38;
  --accent: #38c295;
  --accent-strong: #5ed9ad;
  --accent-ink: #07120e;
  --danger: #ff6b76;
  --danger-bg: #33191d;
  --focus: #f2c94c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  padding: 0 11px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d1110;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: #121716;
  padding: 16px clamp(18px, 4vw, 40px);
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

h2 {
  font-size: 1.25rem;
}

.brand-title {
  color: var(--accent);
  font-size: clamp(1.55rem, 2.5vw, 2.25rem);
  font-weight: 900;
  letter-spacing: 0;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.ghost:hover {
  background: var(--panel-strong);
}

.danger-button {
  border: 1px solid #6b2830;
  background: transparent;
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger-bg);
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-form {
  display: grid;
  width: min(100%, 430px);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
  box-shadow: 0 18px 50px rgb(23 33 28 / 8%);
}

.message {
  min-height: 1.3em;
  margin: 0;
  color: var(--muted);
}

.create-prompt {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101514;
  padding: 14px;
}

.create-prompt p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

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

.vault {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  min-height: 0;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #121716;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.entry-list {
  overflow: auto;
  padding: 8px;
}

.entry-item {
  display: grid;
  width: 100%;
  height: 62px;
  justify-items: start;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.entry-item:hover,
.entry-item.active {
  border-color: var(--line);
  background: var(--panel-strong);
}

.entry-item strong,
.entry-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-item span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.editor {
  min-width: 0;
  padding: clamp(18px, 4vw, 40px);
}

.entry-form,
.detail-panel {
  display: grid;
  max-width: 760px;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.small-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.8rem;
}

.eye-icon {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.detail-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 6px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-password-label {
  display: grid;
  grid-template-columns: auto 32px;
  align-items: center;
  justify-content: start;
  gap: 6px;
}

.reveal-button {
  display: inline-grid;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  place-items: center;
  padding: 0;
  border-color: transparent;
  color: var(--muted);
  font-size: 0;
  justify-self: start;
}

.reveal-button:hover {
  background: var(--panel-strong);
  color: var(--ink);
}

.reveal-button.is-hiding .eye-open {
  display: none;
}

.reveal-button.is-hiding .eye-closed {
  display: block;
}

.detail-password {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  align-items: center;
  gap: 8px;
}

#detailPassword {
  margin-top: 1px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.5;
}

#detailPassword.is-visible {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.copy-action {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 58px;
  justify-self: end;
}

#copyDetailPasswordButton {
  min-width: 58px;
  white-space: nowrap;
}

.detail-list a {
  color: var(--accent-strong);
}

.copy-toast {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  border: 1px solid #4c7568;
  border-radius: 999px;
  background: #203a33;
  color: var(--accent-strong);
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.eye-closed {
  display: none;
}

.detail-footer {
  display: none;
  justify-content: space-between;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgb(5 8 7 / 68%);
  padding: 18px;
}

.confirm-modal {
  display: grid;
  width: min(100%, 380px);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 35%);
}

.confirm-modal p {
  margin: 0;
  color: var(--muted);
}

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

.password-row {
  display: grid;
  grid-template-columns: 1fr 32px auto;
  align-items: center;
  gap: 6px;
}

.icon-button {
  min-width: 58px;
}

.password-row .reveal-button {
  min-width: 32px;
}

.generator {
  display: grid;
  grid-template-columns: minmax(100px, 160px) minmax(100px, 160px) auto;
  align-items: end;
  gap: 8px;
}

.generator .custom-length.hidden {
  display: none !important;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    padding: 14px 16px;
  }

  .topbar-right {
    justify-content: flex-end;
  }

  h1 {
    font-size: 1.45rem;
  }

  .auth-panel {
    align-items: start;
    padding: 18px 14px;
  }

  .auth-form {
    width: 100%;
    padding: 18px;
  }

  .vault {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .sidebar {
    min-height: 0;
    max-height: none;
    border-right: 0;
  }

  .vault.has-panel {
    grid-template-rows: minmax(180px, 34vh) auto;
  }

  .vault.has-panel .sidebar {
    border-bottom: 1px solid var(--line);
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }

  .entry-list {
    padding: 6px;
  }

  .entry-item {
    height: 58px;
  }

  .editor {
    padding: 16px;
  }

  .entry-form,
  .detail-panel {
    max-width: none;
  }

  .detail-header {
    align-items: flex-start;
    flex-direction: row;
  }

  .detail-actions {
    justify-content: flex-end;
  }

  .desktop-edit-button {
    display: none;
  }

  .desktop-delete-button {
    display: none;
  }

  .detail-footer {
    display: flex;
    justify-content: space-between;
  }

  #lockButton,
  #closeDetailButton {
    display: inline-grid;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    place-items: center;
    padding: 0;
    border-color: transparent;
    color: var(--muted);
    font-size: 0;
  }

  #lockButton::before,
  #closeDetailButton::before {
    content: "×";
    font-size: 1.15rem;
    line-height: 1;
  }

  #lockButton:hover,
  #closeDetailButton:hover {
    background: var(--panel-strong);
    color: var(--ink);
  }

  .copy-action {
    min-width: 62px;
  }

  .copy-toast {
    position: fixed;
    top: auto;
    right: 50%;
    bottom: 18px;
    transform: translateX(50%);
    z-index: 20;
    box-shadow: 0 10px 30px rgb(0 0 0 / 28%);
  }

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

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

  .actions {
    flex-direction: column-reverse;
  }
}

@media (max-width: 420px) {
  .topbar {
    align-items: center;
    flex-direction: row;
  }

  .topbar-right {
    width: auto;
  }

  .actions button,
  .password-row button,
  .generator button {
    width: 100%;
  }
}