:root {
  --bg: #100e0c;
  --bg-elev: #181512;
  --bg-soft: #221e1a;
  --bg-hover: #2a251f;
  --line: rgba(244, 236, 224, 0.1);
  --line-strong: rgba(244, 236, 224, 0.18);
  --text: #f6efe4;
  --muted: #9e9488;
  --accent: #dff86a;
  --accent-ink: #14110c;
  --danger: #ff7d6a;
  --ok: #8dffb0;
  --radius: 18px;
  --font: "DM Sans", sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(223, 248, 106, 0.09), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(255, 125, 106, 0.06), transparent 50%),
    linear-gradient(180deg, #161310 0%, var(--bg) 40%, #0c0b0a 100%);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem clamp(1.1rem, 3vw, 2.5rem) 3.5rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15em 0.4em;
  border-radius: 6px;
  border: 1px solid transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.eyebrow, .section-label {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 4.5vw, 3.1rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 40rem;
}
.lede.tight { margin: 0; font-size: 0.92rem; }

.hint {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}
.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(223, 248, 106, 0.12);
  flex-shrink: 0;
}
.brand-mark.lg {
  width: 14px;
  height: 14px;
  display: block;
  margin-bottom: 1.1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  animation: rise 0.55s ease both;
}

.top-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.vault-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  color: var(--muted);
}
.vault-chip.is-open { border-color: rgba(141, 255, 176, 0.28); color: var(--ok); }
.vault-chip.is-locked { border-color: rgba(255, 125, 106, 0.25); }
.vault-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

.wrap {
  display: grid;
  gap: 1rem;
}

.panel {
  background: color-mix(in srgb, var(--bg-elev) 88%, black);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.35rem 1.4rem 1.4rem;
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
}
.panel.create { animation-delay: 0.05s; }
.panel.list { animation-delay: 0.1s; }

.panel-head, .list-toolbar, .panel-kicker {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.15rem;
}
.panel-kicker {
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status-pill.ok {
  background: rgba(141, 255, 176, 0.12);
  color: var(--ok);
}

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn.primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.compact { padding: 0.45rem 0.85rem; font-size: 0.82rem; }
.btn.tiny {
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  margin-left: 0.25rem;
}
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.danger, .more-item.danger { color: var(--danger); }

.linkish {
  appearance: none;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { text-decoration: underline; }

.flash {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.flash.ok { border-color: rgba(141, 255, 176, 0.35); color: var(--ok); }
.flash.error { border-color: rgba(255, 125, 106, 0.4); color: var(--danger); }

.create-form {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(140px, 0.7fr) auto;
  gap: 0.75rem;
  align-items: end;
}
.field { display: grid; gap: 0.4rem; min-width: 0; }
.field-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.path-input,
.field > input,
.stack input,
.search {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
}
.path-input {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.path-input:focus-within,
.field > input:focus,
.search:focus-within,
.stack input:focus {
  outline: none;
  border-color: rgba(223, 248, 106, 0.45);
  box-shadow: 0 0 0 3px rgba(223, 248, 106, 0.12);
}
.path-input .prefix {
  padding: 0.8rem 0.7rem 0.8rem 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
}
.path-input input,
.field > input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.8rem 0.9rem;
  outline: none;
}
.create-submit { min-height: 48px; padding-inline: 1.35rem; }

.search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.75rem;
  min-width: min(320px, 100%);
  position: relative;
}
.search-icon { color: var(--muted); display: flex; }
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.7rem 0;
  outline: none;
  min-width: 0;
}
.search-kbd {
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
  background: rgba(255,255,255,0.03);
}

.site-list {
  display: grid;
  gap: 0.7rem;
}
.site-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.site-card:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
}
.site-card.is-hidden { display: none; }

.site-main {
  display: grid;
  grid-template-columns: minmax(160px, 0.85fr) minmax(0, 1.4fr);
  gap: 1.1rem;
  align-items: start;
  min-width: 0;
}
.site-path {
  font-weight: 700;
  color: var(--text);
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}
.site-path:hover { color: var(--accent); }
.site-title {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-created {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.site-created-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}
.tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.68rem;
  color: var(--muted);
  vertical-align: middle;
}

.site-secrets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  min-width: 0;
}
.secret-group {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.secret-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.secret-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.pass-mask {
  letter-spacing: 0.1em;
  background: transparent;
  padding: 0;
  border: 0;
  color: var(--text);
  font-size: 0.84rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.muted { color: var(--muted); }

.site-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}

.more-menu { position: relative; }
.more-menu > summary {
  list-style: none;
  cursor: pointer;
}
.more-menu > summary::-webkit-details-marker { display: none; }
.more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 220px;
  padding: 0.35rem;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #1a1714;
  box-shadow: var(--shadow);
  z-index: 20;
  display: grid;
  gap: 0.15rem;
  animation: pop 0.15s ease both;
}
.more-item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
}
.more-item:hover { background: rgba(255, 255, 255, 0.05); }
.more-item.danger:hover { background: rgba(255, 125, 106, 0.1); }

.creds-url {
  display: inline-block;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--text);
}
.creds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.creds-block {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}
.creds-block.accented {
  border-color: rgba(223, 248, 106, 0.22);
  background: rgba(223, 248, 106, 0.04);
}
.secret-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.secret-row > span:first-child {
  min-width: 6.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.secret-row.stack {
  display: grid;
  gap: 0.35rem;
}
.wrap-code {
  word-break: break-all;
  white-space: normal;
  display: inline-block;
}

.empty-state, .empty-filter {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.empty-title {
  margin: 0 0 0.35rem;
  color: var(--text);
  font-weight: 600;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}
.auth-card {
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--bg-elev) 90%, black);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.9rem;
  box-shadow: var(--shadow);
}
.stack { display: grid; gap: 0.95rem; }
.stack label { display: grid; gap: 0.4rem; }
.stack label span { color: var(--muted); font-size: 0.84rem; }
.stack input {
  font: inherit;
  padding: 0.85rem 0.95rem;
}

dialog {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #1a1714;
  color: var(--text);
  padding: 1.5rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.fade-in { animation: rise 0.45s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
  .site-main { grid-template-columns: 1fr; }
  .site-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .site-actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .create-form,
  .creds-grid,
  .site-secrets { grid-template-columns: 1fr; }
  .list-toolbar,
  .panel-head,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .search { min-width: 0; width: 100%; }
  .search-kbd { display: none; }
  .top-actions { justify-content: flex-start; }
}
