/* Vaulten Password — Bitwarden layout, Vaulten teal palette */
:root {
  --pw-sidebar: #0f4c5c;
  --pw-sidebar-hover: rgba(255, 255, 255, 0.08);
  --pw-sidebar-active: rgba(255, 255, 255, 0.16);
  --pw-sidebar-text: #e8f4f6;
  --pw-sidebar-muted: rgba(232, 244, 246, 0.65);
  --pw-primary: #175e7d;
  --pw-primary-hover: #134e68;
  --pw-accent: #0f766e;
  --pw-danger: #c62828;
  --pw-bg: #f3f5f7;
  --pw-surface: #ffffff;
  --pw-border: #e0e4e8;
  --pw-text: #1a2332;
  --pw-muted: #6b7785;
  --pw-row-hover: #f0f7f9;
  --pw-row-active: #e3f0f4;
  --pw-avatar: #0f766e;
  --pw-radius: 8px;
  --pw-sidebar-w: 250px;
  --pw-list-w: minmax(320px, 420px);
  --pw-font: "Segoe UI", "DM Sans", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--pw-font);
  color: var(--pw-text);
  background: var(--pw-bg);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

[hidden] {
  display: none !important;
}

/* —— Unlock / Setup —— */
.pw-lock {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(15, 118, 110, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(23, 94, 125, 0.2), transparent 50%),
    linear-gradient(160deg, #0b2f38 0%, #134e5e 45%, #0f4c5c 100%);
}

.pw-lock__card {
  width: min(400px, 100%);
  background: var(--pw-surface);
  border-radius: 12px;
  padding: 36px 32px 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

.pw-lock__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.pw-lock__brand svg {
  width: 40px;
  height: 40px;
}

.pw-lock__brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--pw-primary);
}

.pw-lock__brand small {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--pw-muted);
}

.pw-lock__title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 650;
}

.pw-lock__hint {
  margin: 0 0 22px;
  color: var(--pw-muted);
  font-size: 0.9rem;
}

.pw-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.pw-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pw-muted);
}

.pw-field input,
.pw-field select,
.pw-field textarea,
.pw-input {
  width: 100%;
  border: 1px solid var(--pw-border);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  outline: none;
}

.pw-field input:focus,
.pw-field select:focus,
.pw-field textarea:focus,
.pw-input:focus {
  border-color: var(--pw-primary);
  box-shadow: 0 0 0 3px rgba(23, 94, 125, 0.15);
}

.pw-field--row {
  position: relative;
}

.pw-field--row .pw-reveal {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px;
  color: var(--pw-muted);
}

.pw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.pw-btn--primary {
  background: var(--pw-primary);
  color: #fff;
  width: 100%;
  margin-top: 8px;
}

.pw-btn--primary:hover {
  background: var(--pw-primary-hover);
}

.pw-btn--ghost {
  color: var(--pw-primary);
  margin-top: 12px;
  width: 100%;
}

.pw-btn--ghost:hover {
  background: var(--pw-row-hover);
}

a.pw-btn--primary,
a.pw-btn--secondary {
  text-decoration: none;
}

a.pw-btn--primary {
  margin-top: 8px;
}

.pw-btn--block {
  display: flex;
  width: 100%;
  margin-top: 10px;
}

.pw-gate-brand {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--pw-muted);
}

.pw-error {
  color: var(--pw-danger);
  font-size: 0.85rem;
  margin: 8px 0 0;
  min-height: 1.2em;
}

/* —— App shell (3 columns) —— */
.pw-app {
  display: grid;
  grid-template-columns: var(--pw-sidebar-w) var(--pw-list-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

.pw-app.is-collapsed {
  --pw-sidebar-w: 64px;
}

/* Sidebar */
.pw-sidebar {
  background: var(--pw-sidebar);
  color: var(--pw-sidebar-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pw-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 18px;
  flex-shrink: 0;
}

.pw-sidebar__brand svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.pw-sidebar__brand-text {
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
}

.pw-app.is-collapsed .pw-sidebar__brand-text,
.pw-app.is-collapsed .pw-nav-label,
.pw-app.is-collapsed .pw-nav-section__title,
.pw-app.is-collapsed .pw-nav-tools span {
  display: none;
}

.pw-sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.pw-nav-section {
  margin-bottom: 10px;
}

.pw-nav-section__title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pw-sidebar-muted);
  padding: 8px 10px 4px;
  font-weight: 650;
}

.pw-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--pw-sidebar-text);
  font-size: 0.88rem;
  text-align: left;
}

.pw-nav-item:hover {
  background: var(--pw-sidebar-hover);
}

.pw-nav-item.is-active {
  background: var(--pw-sidebar-active);
  font-weight: 600;
}

.pw-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.95;
}

.pw-nav-item--indent {
  padding-left: 28px;
}

.pw-nav-tools {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 8px 8px;
  flex-shrink: 0;
}

.pw-sidebar__foot {
  padding: 6px 8px 10px;
  flex-shrink: 0;
}

.pw-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--pw-sidebar-muted);
}

.pw-collapse:hover {
  background: var(--pw-sidebar-hover);
  color: #fff;
}

.pw-collapse svg {
  width: 18px;
  height: 18px;
}

/* List pane */
.pw-list {
  background: var(--pw-surface);
  border-right: 1px solid var(--pw-border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pw-list__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  gap: 12px;
}

.pw-list__head h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.pw-list__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pw-btn--new {
  background: var(--pw-primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 650;
}

.pw-btn--new:hover {
  background: var(--pw-primary-hover);
}

.pw-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--pw-avatar);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.pw-search {
  margin: 0 18px 12px;
  position: relative;
}

.pw-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--pw-muted);
  pointer-events: none;
}

.pw-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--pw-border);
  border-radius: 6px;
  background: #fafbfc;
}

.pw-list__cols {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 6px 18px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--pw-muted);
  border-bottom: 1px solid var(--pw-border);
}

.pw-list__body {
  flex: 1;
  overflow-y: auto;
}

.pw-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 18px;
  border-bottom: 1px solid var(--pw-border);
  text-align: left;
  color: inherit;
}

.pw-item:hover {
  background: var(--pw-row-hover);
}

.pw-item.is-selected {
  background: var(--pw-row-active);
}

.pw-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eef4f6;
  display: grid;
  place-items: center;
  color: var(--pw-primary);
}

.pw-item__icon svg {
  width: 20px;
  height: 20px;
}

.pw-item__name {
  font-weight: 650;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pw-item__sub {
  font-size: 0.78rem;
  color: var(--pw-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pw-item__opts {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}

.pw-item:hover .pw-item__opts,
.pw-item.is-selected .pw-item__opts {
  opacity: 1;
}

.pw-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--pw-muted);
}

.pw-icon-btn:hover {
  background: rgba(23, 94, 125, 0.1);
  color: var(--pw-primary);
}

.pw-icon-btn svg {
  width: 16px;
  height: 16px;
}

.pw-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--pw-muted);
}

/* Detail pane */
.pw-detail {
  background: var(--pw-bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.pw-detail__empty {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--pw-muted);
  font-size: 0.95rem;
}

.pw-detail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--pw-surface);
  border-bottom: 1px solid var(--pw-border);
}

.pw-detail__head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.pw-detail__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pw-card {
  background: var(--pw-surface);
  border: 1px solid var(--pw-border);
  border-radius: var(--pw-radius);
  padding: 16px 18px;
}

.pw-card__title {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pw-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pw-item-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pw-item-hero__icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #eef4f6;
  display: grid;
  place-items: center;
  color: var(--pw-primary);
}

.pw-item-hero__icon svg {
  width: 26px;
  height: 26px;
}

.pw-item-hero__name {
  font-size: 1.15rem;
  font-weight: 700;
}

.pw-item-hero__folder {
  font-size: 0.82rem;
  color: var(--pw-muted);
}

.pw-view-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--pw-border);
}

.pw-view-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pw-view-row:first-child {
  padding-top: 0;
}

.pw-view-row__label {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--pw-muted);
  margin-bottom: 2px;
}

.pw-view-row__value {
  font-size: 0.95rem;
  word-break: break-word;
  white-space: pre-wrap;
}

.pw-view-row__actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.pw-notes-box {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.45;
  max-height: 220px;
  overflow-y: auto;
}

.pw-meta {
  font-size: 0.78rem;
  color: var(--pw-muted);
  line-height: 1.55;
}

.pw-detail__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--pw-surface);
  border-top: 1px solid var(--pw-border);
}

.pw-btn--edit {
  background: var(--pw-primary);
  color: #fff;
  padding: 10px 28px;
  border-radius: 6px;
  font-weight: 650;
}

.pw-btn--edit:hover {
  background: var(--pw-primary-hover);
}

.pw-btn--danger-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--pw-danger);
  display: grid;
  place-items: center;
}

.pw-btn--danger-icon:hover {
  background: rgba(198, 40, 40, 0.08);
}

.pw-btn--danger-icon svg {
  width: 20px;
  height: 20px;
}

/* Modals */
.pw-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.pw-modal {
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--pw-surface);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.pw-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--pw-border);
}

.pw-modal__head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.pw-modal__body {
  padding: 18px;
}

.pw-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 18px;
}

.pw-btn--secondary {
  background: #eef1f4;
  color: var(--pw-text);
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 600;
}

.pw-btn--secondary:hover {
  background: #e2e6ea;
}

.pw-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a2332;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  z-index: 2000;
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: none;
}

.pw-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.pw-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.9rem;
}

.pw-range {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pw-range input[type="range"] {
  flex: 1;
}

.pw-gen-out {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1rem;
  word-break: break-all;
  background: #f6f8fa;
  border: 1px solid var(--pw-border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
}

.pw-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.pw-type-tabs button {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--pw-border);
  font-size: 0.82rem;
  font-weight: 600;
}

.pw-totp {
  display: flex;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.pw-totp__code {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--pw-primary);
  font-family: ui-monospace, Consolas, monospace;
}

.pw-totp__bar {
  flex: 1;
  height: 4px;
  background: #e5e9ed;
  border-radius: 2px;
  overflow: hidden;
}

.pw-totp__bar > span {
  display: block;
  height: 100%;
  background: var(--pw-accent);
  transition: width 0.4s linear;
}

.pw-hist-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--pw-border);
  font-size: 0.85rem;
}

.pw-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .pw-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .pw-sidebar {
    flex-direction: row;
    overflow-x: auto;
    height: auto;
  }

  .pw-sidebar__scroll {
    display: flex;
    gap: 4px;
    padding: 8px;
  }

  .pw-nav-section {
    display: flex;
    margin: 0;
  }

  .pw-nav-section__title,
  .pw-nav-tools,
  .pw-sidebar__foot,
  .pw-sidebar__brand-text {
    display: none;
  }

  .pw-detail {
    position: fixed;
    inset: 0;
    z-index: 50;
  }

  .pw-detail:not(.is-open) {
    display: none;
  }
}
