:root {
  --bg: #f4f7f6;
  --ink: #151719;
  --muted: #69737d;
  --line: #dbe3e4;
  --surface: #ffffff;
  --dark: #171b1d;
  --lime: #d7ff62;
  --green: #13795b;
  --red: #c64d5c;
  --blue: #2864d9;
  --amber: #cf8a22;
  --shadow: 0 20px 70px rgba(25, 33, 38, 0.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 0%, rgba(215, 255, 98, 0.20), transparent 28rem),
    linear-gradient(180deg, #fbfcfb 0%, var(--bg) 56%, #edf3f2 100%);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  color: #eef3f0;
  background: var(--dark);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--lime);
  color: #111;
  font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand small { color: #a9b3b1; font-size: 12px; }
.nav { display: grid; gap: 7px; }
.nav a {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #c7cfcc;
  font-weight: 800;
}
.nav a.active, .nav a:hover { background: #292f31; color: #fff; }
body.is-locked .nav a { color: #b8c3c0; }
body.is-locked .nav a::after {
  content: "🔒";
  margin-left: auto;
  font-size: 13px;
  opacity: 0.72;
}
body.is-locked .nav a:hover {
  background: #322c20;
  color: #fff;
}
.security-mini {
  margin-top: auto;
  border: 1px solid #3a4245;
  border-radius: 8px;
  padding: 14px;
}
.security-mini span, .security-mini strong, .security-mini small { display: block; }
.security-mini span { color: #a9b3b1; font-size: 12px; }
.security-mini strong { margin: 4px 0; font-size: 22px; }
.security-mini small { color: #a9b3b1; }

.shell { margin-left: 260px; padding: 34px; max-width: 1360px; }
.view { animation: fadeIn 180ms ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.head-actions, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
h1, h2 { margin: 0; letter-spacing: -0.04em; }
h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.02; }
h2 { font-size: 19px; }

.panel, .metric, .empty-state {
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 20px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lock-hero {
  min-height: 280px;
  padding: 34px;
  margin-bottom: 20px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(20, 24, 26, 0.97), rgba(19, 58, 51, 0.96)),
    radial-gradient(circle at 86% 18%, rgba(215, 255, 98, 0.35), transparent 22rem);
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-end;
}
.lock-hero h1 { max-width: 760px; }
.lock-hero p:not(.eyebrow) { color: #dbe4df; max-width: 620px; font-size: 16px; }
.trust-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.trust-strip span {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 9px 12px;
  white-space: nowrap;
}
.lock-grid, .vault-grid, .editor-grid, .settings-grid {
  display: grid;
  gap: 18px;
}
.lock-grid { grid-template-columns: 1fr 1fr; }
.vault-grid { grid-template-columns: minmax(0, 1fr) 370px; }
.editor-grid, .settings-grid { grid-template-columns: minmax(0, 1fr) 380px; }
.settings-grid { align-items: start; }
.accent-panel { border-top: 4px solid var(--lime); }

.metrics-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}
.metric { padding: 20px; display: grid; gap: 8px; border-top: 4px solid var(--green); }
.metric span, label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.metric strong { font-size: 30px; line-height: 1; }
.metric small, .microcopy { color: var(--muted); }

.empty-state {
  padding: 24px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border-left: 5px solid var(--green);
}

form { display: grid; gap: 14px; }
.field-row, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.filters { grid-template-columns: 1.35fr 0.9fr 0.9fr; margin-bottom: 16px; }
label { display: grid; gap: 7px; }
input, select, textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(40, 100, 217, 0.18);
  border-color: var(--blue);
}
.button, .icon-button {
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 900;
  cursor: pointer;
}
.button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.button.danger { color: var(--red); }
.button.ghost { background: #f7faf9; color: #3d474b; }
.button:hover, .icon-button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(25, 33, 38, 0.10); }
.file-button input { display: none; }

.secret-field, .password-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.icon-button { width: 46px; padding: 0; }
.secret-field {
  border-radius: 10px;
  transition: box-shadow 160ms ease, background 160ms ease;
}
.secret-field.is-visible input {
  border-color: rgba(207, 138, 34, 0.55);
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px rgba(207, 138, 34, 0.12);
}
.secret-field.is-visible .secret-toggle {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.secret-toggle {
  font-size: 18px;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.secret-hint {
  margin-top: -4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}
.strength-meter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.strength-meter span {
  height: 9px;
  border-radius: 99px;
  background: #e7ecec;
  overflow: hidden;
}
.strength-meter span::before {
  content: "";
  display: block;
  width: var(--strength-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--strength-color, var(--red));
}

.credential-list, .review-list { display: grid; gap: 10px; }
.credential-card, .review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}
.credential-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.credential-card h3 { margin: 0; font-size: 18px; }
.credential-card p { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.credential-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  color: #3d474b;
  background: #edf4f2;
  font-size: 12px;
  font-weight: 800;
}
.risk-pill {
  color: #fff;
  background: var(--green);
}
.risk-pill.weak, .risk-pill.reused, .risk-pill.stale { background: var(--red); }
.risk-pill.fair { background: var(--amber); }

.review-item strong, .review-item small { display: block; }
.review-item small { color: var(--muted); margin-top: 3px; }
.review-item.ok { border-color: rgba(19, 121, 91, 0.35); background: #f1faf6; }
.review-item.warn { border-color: rgba(207, 138, 34, 0.35); background: #fff8ec; }
.review-item.danger { border-color: rgba(198, 77, 92, 0.35); background: #fff1f3; }

.generator-panel { position: sticky; top: 22px; align-self: start; }
.toggle-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.toggle-grid label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}
.generated-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}
.generated-password {
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed #b8c7c7;
  border-radius: 8px;
  background: #f7faf9;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.generated-password.is-obscured {
  color: #586468;
  background:
    linear-gradient(135deg, rgba(23, 27, 29, 0.04), transparent),
    #f7faf9;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(380px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--dark);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  font-weight: 900;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.warning { background: #8a5b16; }

.lock-view.nudge .panel {
  animation: securityNudge 360ms ease;
}
@keyframes securityNudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(6px); }
  55% { transform: translateX(-5px); }
  78% { transform: translateX(3px); }
}

@media (max-width: 1100px) {
  .sidebar { position: static; width: auto; }
  .shell { margin-left: 0; padding: 22px; }
  .lock-grid, .vault-grid, .editor-grid, .settings-grid, .metrics-grid { grid-template-columns: 1fr; }
  .generator-panel { position: static; }
}

@media (max-width: 640px) {
  .shell { padding: 18px; }
  .page-head, .empty-state, .lock-hero { flex-direction: column; align-items: stretch; }
  .lock-hero { padding: 24px; min-height: auto; }
  .field-row, .filters { grid-template-columns: 1fr; }
  .generated-shell { grid-template-columns: 1fr; }
  .credential-card { grid-template-columns: 1fr; }
  .credential-actions { justify-content: flex-start; }
  h1 { font-size: 34px; }
}
