:root {
  color-scheme: dark;
  --bg: #090b0f;
  --panel: #121722;
  --panel-raised: #171d2a;
  --panel-soft: #202838;
  --text: #edf3f8;
  --muted: #8f9bad;
  --line: #2b3444;
  --primary: #33d6a6;
  --primary-dark: #17a97f;
  --primary-text: #05110e;
  --danger: #ff6b6b;
  --danger-bg: #32191d;
  --warning: #f3c969;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  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(180deg, #101520 0, var(--bg) 320px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 15, 0.84);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(51, 214, 166, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(51, 214, 166, 0.18), rgba(122, 184, 255, 0.1)),
    #101721;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.3),
    0 0 24px rgba(51, 214, 166, 0.12);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: rgba(51, 214, 166, 0.12);
  stroke: var(--primary);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-word {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 18px rgba(51, 214, 166, 0.18);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.topnav form {
  margin: 0;
}

.auth-screen {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-panel,
.settings-panel,
.unlock-panel,
.form-panel,
.list-panel,
.empty-state,
.group-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(440px, 100%);
  padding: 34px;
  background: var(--panel-raised);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  letter-spacing: 0;
}

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

.hint {
  font-size: 13px;
  line-height: 1.45;
}

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

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

.label-username {
  color: #55e0b4;
}

.label-password {
  color: #ff7d86;
}

.label-link {
  color: #7ab8ff;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 13px;
  background: #0c1119;
  color: var(--text);
  outline: none;
}

input::placeholder {
  color: #697586;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 214, 166, 0.16);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.copy-button,
.icon-danger,
.icon-menu {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--primary);
  color: var(--primary-text);
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.danger-button,
.icon-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.copy-button {
  min-height: 30px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
}

.eye-button {
  min-width: 38px;
  padding: 0 10px;
  font-size: 15px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-button span {
  font-size: 18px;
  line-height: 1;
}

.workspace {
  width: min(1180px, calc(100% - 40px));
  margin: 34px auto 64px;
}

.back-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--shadow);
}

.back-button:hover {
  border-color: rgba(51, 214, 166, 0.42);
  color: var(--primary);
  background: #192131;
}

.workspace.narrow {
  width: min(760px, calc(100% - 40px));
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.visibility-toggle {
  width: 52px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 180ms ease, transform 180ms ease;
}

.visibility-toggle:hover,
.visibility-toggle.is-showing-hidden {
  color: var(--primary);
}

.visibility-toggle:hover {
  transform: translateY(-1px);
}

.visibility-icon {
  width: 34px;
  height: 34px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.eye-pupil {
  fill: currentColor;
  stroke: none;
  transform-origin: 12px 12px;
  transition: transform 180ms ease;
}

.eye-slash {
  stroke-width: 2.4;
  filter: drop-shadow(0 0 2px var(--bg));
  transform-origin: 12px 12px;
  transition: transform 220ms ease, opacity 180ms ease;
}

.visibility-toggle.is-showing-hidden .eye-pupil {
  transform: scale(1.08);
}

.visibility-toggle.is-showing-hidden .eye-slash {
  opacity: 0;
  transform: scaleX(0.15) rotate(-8deg);
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-form input {
  min-width: 220px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.group-card {
  position: relative;
  z-index: 1;
  min-height: 112px;
  padding: 18px;
  box-shadow: none;
  background: var(--panel-raised);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.group-card.has-open-menu {
  z-index: 40;
}

.group-card:hover {
  border-color: rgba(51, 214, 166, 0.42);
  background: #192131;
  transform: translateY(-1px);
}

.group-card.is-hidden-group {
  border-color: rgba(143, 155, 173, 0.34);
  background: #111722;
}

.group-card.is-hidden-group .group-name {
  color: var(--muted);
}

.group-hidden-badge {
  width: max-content;
  padding: 3px 8px;
  border: 1px solid rgba(143, 155, 173, 0.3);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.group-link {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  min-height: 74px;
  padding-right: 38px;
}

.group-name {
  font-size: 18px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.group-count {
  color: var(--muted);
  font-size: 13px;
}

.card-menu {
  position: absolute;
  top: 10px;
  right: 10px;
}

.icon-menu {
  width: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.icon-menu:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.card-menu-panel {
  position: absolute;
  top: 38px;
  right: 0;
  z-index: 80;
  display: none;
  min-width: 132px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171d2a;
  box-shadow: var(--shadow);
}

.card-menu-panel.is-open {
  display: grid;
}

.card-menu-panel form {
  margin: 0;
}

.card-menu-panel button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.card-menu-panel button:hover {
  background: var(--panel-soft);
}

.card-menu-panel .menu-danger {
  color: var(--danger);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  box-shadow: none;
  background: var(--panel-raised);
}

.empty-state.compact {
  padding: 20px;
}

.unlock-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: none;
}

.unlock-panel h2 {
  margin-bottom: 4px;
}

.unlock-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.vault-unlocked .unlock-panel {
  border-color: rgba(19, 111, 99, 0.4);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.list-panel,
.form-panel,
.settings-panel {
  padding: 22px;
  box-shadow: none;
  background: var(--panel-raised);
}

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

.section-title h2 {
  margin-bottom: 0;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.vault-list {
  display: grid;
  gap: 12px;
}

.vault-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f141e;
}

.vault-main {
  min-width: 0;
  flex: 1;
}

.vault-main h3 {
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

dl div {
  display: grid;
  gap: 4px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

dd:has(.copy-button) {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.secret-row span {
  min-width: 0;
}

.secret-link {
  max-width: min(620px, 100%);
  color: var(--primary);
  overflow-wrap: anywhere;
}

.secret-link:hover {
  color: #76eccb;
}

.vault-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

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

.status-good {
  color: var(--primary);
  font-weight: 800;
}

.secret-box {
  padding: 14px;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  background: rgba(51, 214, 166, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  margin: 16px 0;
}

.small-form {
  max-width: 320px;
}

.break-word {
  overflow-wrap: anywhere;
}

.flash {
  width: min(1180px, calc(100% - 40px));
  margin: 18px auto 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
}

.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.35);
}

.flash-success {
  background: rgba(51, 214, 166, 0.12);
  color: var(--primary);
  border: 1px solid rgba(51, 214, 166, 0.32);
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin-bottom: 16px;
}

.modal-copy {
  color: var(--muted);
  line-height: 1.5;
}

.modal-copy strong {
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 820px) {
  .topbar,
  .page-head,
  .page-actions,
  .unlock-panel,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    height: auto;
    padding: 16px 20px;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .vault-item {
    flex-direction: column;
  }

  .vault-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .inline-form input {
    min-width: 0;
  }

  .workspace {
    width: min(100% - 24px, 1180px);
    margin-top: 22px;
  }

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