:root {
  --bg: #000000;
  --surface: #020306;
  --surface-2: #05080c;
  --input: #030303;
  --border: #0d1218;
  --border-blue: #2b4c75;
  --ice: #bce3ff;
  --ice-2: #9bd0ff;
  --cyan: #5bc0e4;
  --text: #e8f0f8;
  --text-soft: #c8d6e5;
  --muted: #8b9aad;
  --muted-2: #5b7194;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --violet: #9b87f5;
  --radius: 20px;
  --radius-sm: 10px;
  --halo: 0 0 34px rgba(188, 227, 255, .20), inset 0 0 18px rgba(188, 227, 255, .025);
  --halo-soft: 0 0 20px rgba(91, 192, 228, .10);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  color: var(--text);
  font-family: "Helvetica Neue", Inter, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  border-bottom: 1px solid #0a1628;
  background: #000;
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand-lockup { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ice);
  border-radius: 15px;
  color: var(--ice);
  box-shadow: var(--halo);
  background: #01050b;
  flex: 0 0 auto;
}
.brand-mark svg { width: 25px; height: 25px; }
.brand-title {
  color: #d9efff;
  font-size: clamp(24px, 3vw, 48px);
  font-weight: 600;
  letter-spacing: .22em;
  text-shadow: 0 0 18px rgba(188, 227, 255, .45);
  white-space: nowrap;
}
.brand-sub { margin-top: 3px; color: #6e829b; font-size: 10px; font-weight: 800; letter-spacing: .34em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.save-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(34,197,94,.9); }

.halo-card {
  background: #000;
  border: 1px solid var(--ice);
  border-radius: var(--radius);
  box-shadow: var(--halo);
}
.halo-soft { box-shadow: var(--halo-soft); }
.halo-button {
  min-height: 42px;
  border: 1px solid var(--ice);
  border-radius: 12px;
  background: #02060b;
  color: var(--text);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(188, 227, 255, .16);
  transition: .16s ease;
}
.halo-button:hover { background: rgba(188,227,255,.08); box-shadow: 0 0 24px rgba(188,227,255,.24); }
.halo-button.primary { color: #eaf7ff; border-color: #6ec7ff; background: #07121d; }
.halo-button.danger { color: #fecaca; border-color: rgba(239,68,68,.75); box-shadow: 0 0 18px rgba(239,68,68,.12); }
.halo-button.danger:hover { background: rgba(239,68,68,.10); }
.halo-button.compact { min-height: 38px; padding: 0 13px; }
.halo-button.full { width: 100%; }
.button-icon { display: inline-grid; place-items: center; font-size: 16px; }
.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #1d2b3e;
  border-radius: 10px;
  background: #030609;
  color: var(--muted);
}
.icon-button:hover { color: #fff; border-color: var(--ice); }

.login-view { min-height: calc(100vh - 92px); display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(470px, 100%); padding: 34px; }
.login-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: var(--ice);
  border: 1px solid #284e72;
  border-radius: 16px;
  background: #02070d;
  box-shadow: 0 0 28px rgba(91,192,228,.17);
  margin-bottom: 18px;
}
.login-icon svg { width: 31px; height: 31px; }
.eyebrow { color: var(--muted-2); font-size: 10px; font-weight: 900; letter-spacing: .24em; }
.login-card h1 { margin: 7px 0 8px; font-size: 30px; }
.login-card p { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.form-error { min-height: 20px; color: #f87171; font-size: 12px; margin-top: 10px; }

.field-label { display: grid; gap: 7px; color: var(--text-soft); font-size: 12px; font-weight: 750; }
.field-label + .field-label { margin-top: 13px; }
.input-shell, .textarea-shell, .search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--border-blue);
  border-radius: 8px;
  background: var(--input);
}
.input-shell:focus-within, .textarea-shell:focus-within, .search-box:focus-within { border-color: var(--ice); box-shadow: 0 0 16px rgba(188,227,255,.10); }
.input-icon { color: #78a8d6; display: inline-grid; place-items: center; flex: 0 0 auto; }
.input-icon.top { margin-top: 2px; align-self: flex-start; }
.input-shell input, .textarea-shell textarea, .search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 0;
}
.input-shell input::placeholder, .textarea-shell textarea::placeholder, .search-box input::placeholder { color: #536174; }
.textarea-shell { align-items: flex-start; padding-top: 9px; }
.textarea-shell textarea { min-height: 84px; resize: vertical; }
.inline-action { border: 0; background: transparent; color: var(--cyan); font-size: 11px; font-weight: 800; }
.inline-action:hover { color: var(--ice); }
.login-card .halo-button { margin-top: 20px; }

.vault-view { min-height: calc(100vh - 92px); display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.sidebar {
  min-height: calc(100vh - 92px);
  border-right: 1px solid #0a1628;
  background: #000;
  padding: 20px 14px;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.user-name { margin-top: 4px; font-size: 20px; font-weight: 800; }
.search-box { margin-top: 18px; }
.sidebar-divider { height: 1px; background: #101820; margin: 18px 0 14px; }
.record-list { display: grid; gap: 7px; }
.record-empty { color: var(--muted-2); font-size: 12px; padding: 12px; }
.record-item {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.record-item:hover { background: #01050b; border-color: var(--ice-2); }
.record-item.active { background: #01050b; border-color: var(--ice); box-shadow: 0 0 20px rgba(188,227,255,.16); }
.record-service-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #22344c;
  border-radius: 12px;
  color: #83b9e7;
  background: #03070c;
}
.record-service-icon svg { width: 20px; height: 20px; }
.record-title { font-size: 14px; font-weight: 800; }
.record-sub { margin-top: 3px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workspace { min-width: 0; padding: 22px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
  min-height: 94px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid #1d3d59;
  border-radius: 14px;
  background: #02070b;
}
.stat-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #06101a;
  border: 1px solid currentColor;
}
.stat-icon svg { width: 27px; height: 27px; }
.stat-icon.cyan { color: #5bc0e4; }
.stat-icon.green { color: var(--green); }
.stat-icon.violet { color: var(--violet); }
.stat-icon.amber { color: var(--amber); }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 800; }
.stat-value { margin-top: 3px; font-size: 28px; font-weight: 900; }

.content-card { min-height: 540px; overflow: hidden; }
.empty-state { min-height: 540px; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; }
.empty-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #5f87aa;
  border: 1px solid #203752;
  background: #02070c;
  box-shadow: 0 0 25px rgba(91,192,228,.10);
}
.empty-icon svg { width: 34px; height: 34px; }
.empty-state h2 { margin: 15px 0 4px; font-size: 22px; }
.empty-state p { margin: 0; color: var(--muted); }

.detail-card { min-height: 540px; }
.detail-head { min-height: 92px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 17px 20px; border-bottom: 1px solid rgba(188,227,255,.40); }
.detail-title-wrap { display: flex; align-items: center; gap: 13px; min-width: 0; }
.service-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--ice);
  border-radius: 13px;
  color: var(--ice);
  background: #02070c;
  box-shadow: 0 0 18px rgba(188,227,255,.12);
}
.service-icon svg { width: 24px; height: 24px; }
.detail-head h2, .dialog-head h2 { margin: 4px 0 0; font-size: 23px; }
.detail-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; }
.detail-actions { display: flex; gap: 9px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 18px; }
.data-field {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0,1fr);
  gap: 11px;
  align-items: start;
  padding: 13px;
  border: 1px solid #19314a;
  border-radius: 11px;
  background: #020508;
}
.data-field.full { grid-column: 1 / -1; }
.data-field-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #050b11;
  border: 1px solid #223d58;
  color: #7eb5e2;
}
.data-field-icon.sensitive { color: var(--violet); border-color: rgba(155,135,245,.45); }
.data-field-icon.twofa { color: var(--green); border-color: rgba(34,197,94,.45); }
.data-field-main { min-width: 0; }
.data-label { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.data-value-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.data-value { flex: 1; min-width: 0; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.micro-btn {
  min-height: 28px;
  border: 1px solid #294560;
  border-radius: 7px;
  background: #07101a;
  color: var(--text-soft);
  padding: 0 9px;
  font-size: 10px;
  font-weight: 800;
}
.micro-btn:hover { border-color: var(--ice); color: #fff; }

.record-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--ice);
  border-radius: 20px;
  background: #000;
  color: var(--text);
  box-shadow: 0 0 45px rgba(188,227,255,.22), 0 30px 120px rgba(0,0,0,.85);
}
.record-dialog::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(5px); }
.record-dialog form { padding: 0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 20px; border-bottom: 1px solid rgba(188,227,255,.40); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; padding: 20px; }
.form-grid .full { grid-column: 1 / -1; }
.custom-section { padding: 0 20px 20px; }
.custom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid #101820; }
.custom-head strong { display: block; margin-top: 4px; font-size: 14px; }
.custom-fields { display: grid; gap: 10px; margin-top: 12px; }
.custom-row { display: grid; grid-template-columns: minmax(0,.7fr) minmax(0,1fr) auto; gap: 8px; }
.custom-row input {
  min-height: 40px;
  border: 1px solid var(--border-blue);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  padding: 0 10px;
  outline: 0;
}
.custom-row input:focus { border-color: var(--ice); }
.custom-remove { width: 40px; border: 1px solid rgba(239,68,68,.5); border-radius: 8px; background: rgba(239,68,68,.07); color: #fca5a5; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 17px 20px 20px; border-top: 1px solid #101820; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  min-width: 180px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 11px 14px;
  border: 1px solid var(--ice);
  border-radius: 10px;
  background: #02060b;
  color: var(--text);
  box-shadow: 0 0 24px rgba(188,227,255,.18);
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .topbar { min-height: 70px; padding: 10px 14px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .brand-title { font-size: 22px; letter-spacing: .16em; }
  .brand-sub, .save-state { display: none; }
  .vault-view { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; border-right: 0; border-bottom: 1px solid #0a1628; }
  .workspace { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .stat-card { min-height: 80px; padding: 11px; }
  .stat-icon { width: 42px; height: 42px; }
  .stat-value { font-size: 23px; }
  .content-card, .detail-card, .empty-state { min-height: 420px; }
  .detail-head { align-items: flex-start; flex-direction: column; }
  .detail-actions { width: 100%; }
  .detail-actions .halo-button { flex: 1; }
  .field-grid, .form-grid { grid-template-columns: 1fr; }
  .data-field.full, .form-grid .full { grid-column: auto; }
  .custom-row { grid-template-columns: 1fr; }
  .custom-remove { width: 100%; min-height: 36px; }
}

@media (max-width: 470px) {
  .topbar-actions .halo-button span:last-child { display: none; }
  .topbar-actions .halo-button { width: 40px; padding: 0; }
  .login-card { padding: 25px 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { gap: 9px; }
  .stat-label { font-size: 10px; }
}
