:root {
  --bg: #fff7fb;
  --panel: rgba(255, 255, 255, .82);
  --panel-solid: #fffafd;
  --line: rgba(172, 75, 120, .15);
  --text: #4d293b;
  --muted: #936a7e;
  --green: #eb6fa4;
  --green-dark: #fde3ee;
  --danger: #d94f73;
  --shadow: 0 24px 70px rgba(139, 58, 96, .14);
}

html { color-scheme: light; }
body {
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 190, 218, .55) 0, transparent 32%),
    radial-gradient(circle at 92% 88%, rgba(218, 192, 255, .38) 0, transparent 28%),
    var(--bg);
}
.ambient { opacity: .28; }
.ambient-a { background: #ff8fbd; }
.ambient-b { background: #c9a1ff; }
.topbar { background: rgba(255, 250, 253, .7); }
.brand-mark {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}
.brand small { color: #b47792; }
.hero-copy > p { color: #7d596a; }
.security-points span { color: #875f72; background: rgba(255,255,255,.48); }
.panel { background: var(--panel); }
.tabs, input, textarea, select { background: #fff3f8; }
.tab.active, .filter.active { background: #f9dce9; color: var(--text); }
.button { background: #fff0f6; }
.button.primary { background: linear-gradient(135deg, #f17cac, #df5f98); color: #fff; box-shadow: 0 8px 24px rgba(218, 78, 139, .2); }
.button.google { background: #fff; color: #4d293b; }
.button.danger { background: #fff0f3; }
.divider span { background: #fffafd; }
label { color: #8c6175; }
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px rgba(235,111,164,.12); }
.screen-icon {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 15px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(210, 86, 143, .15));
}
.entry-item:hover, .entry-item.active { background: #fff0f6; }
.entry-icon { background: #fde1ed; overflow: hidden; }
.entry-icon img { width: 28px; height: 28px; object-fit: contain; }
.filter { display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.filter-icon { width: 17px; height: 17px; object-fit: contain; }
.input-action button { background: #fce8f1; color: #8c6175; }
.empty-icon {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 16px 24px rgba(210, 86, 143, .14));
}
.empty-state h2 { color: var(--text); }
.toast { color: #4d293b; box-shadow: 0 12px 38px rgba(139,58,96,.18); }
.status-dot { background: #ef77a9; box-shadow: 0 0 10px #ef77a9; }
details code, code { color: #c34c80; }

.vault-layout { grid-template-columns: 340px 1fr; }
.editor {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: rgba(82, 38, 60, .28);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.editor form {
  width: min(680px, 100%);
  max-height: min(760px, 92vh);
  overflow-y: auto;
  margin: 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fffafd;
  box-shadow: 0 30px 90px rgba(112, 43, 77, .24);
}
.editor-top { align-items: center; margin-bottom: 18px; }
.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #fde7f0;
  color: #a94f78;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.editor-actions {
  position: sticky;
  bottom: -26px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  margin: 22px -26px -26px;
  padding: 16px 26px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 253, .96);
  backdrop-filter: blur(12px);
}
.editor-actions .button { min-width: 88px; }

@media (max-width: 480px) {
  .brand-mark { width: 38px; height: 38px; }
  .screen-icon { width: 76px; height: 76px; }
  .editor { place-items: end center; padding: 0; }
  .editor form { width: 100%; max-height: 92vh; padding: 20px 18px; border-radius: 24px 24px 0 0; }
  .editor-actions { bottom: -20px; grid-template-columns: auto 1fr auto auto; margin: 20px -18px -20px; padding: 14px 18px 18px; }
  .editor-actions .button { min-width: 72px; padding-inline: 12px; }
}

@media (max-width: 820px) {
  .topbar { height: 72px; max-width: 100vw; padding: 0 14px; }
  .brand { min-width: 0; font-size: 16px; }
  .brand-mark { width: 36px; height: 36px; flex: 0 0 auto; }
  .session-actions { gap: 5px; }
  .session-actions .button { padding: 8px 10px; }
  .user-chip { display: none; }
  .screen { min-height: calc(100svh - 72px); }
  .vault-layout {
    display: flex;
    grid-template-columns: none;
    width: 100%;
    max-width: 100vw;
    height: calc(100svh - 72px);
    gap: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
  .sidebar {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
    padding: 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transition: margin-left .28s ease;
  }
  .vault-layout.detail-open .sidebar { margin-left: -100%; }
  .empty-state { display: none !important; }
  .editor {
    position: relative;
    inset: auto;
    z-index: 1;
    display: block;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fffafd;
    backdrop-filter: none;
    overflow: hidden;
  }
  .editor form {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
  }
  .editor-top { position: sticky; top: -18px; z-index: 3; margin: -18px -18px 16px; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); background: rgba(255,250,253,.96); backdrop-filter: blur(12px); }
  .modal-close { order: -1; width: 42px; height: 42px; font-size: 24px; }
  .editor-top select { margin-left: auto; }
  .editor-actions {
    bottom: -18px;
    grid-template-columns: auto 1fr auto auto;
    margin: 20px -18px -18px;
    padding: 14px 18px max(18px, env(safe-area-inset-bottom));
  }
  .editor-actions .button { min-width: 72px; padding-inline: 12px; }
}

.image-field { display: grid; gap: 10px; }
.field-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.field-label span { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.image-picker { display: inline-flex !important; width: fit-content; cursor: pointer; }
.image-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.image-picker span { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 17px; border: 1px dashed #e9adc2; border-radius: 13px; color: #9b4768; background: #fff8fb; font-weight: 700; }
.image-preview { display: grid; grid-template-columns: minmax(0, 180px) 1fr; gap: 14px; align-items: center; padding: 12px; border: 1px solid #f0cfdb; border-radius: 16px; background: #fff9fc; }
.image-preview img { display: block; width: 100%; max-height: 150px; object-fit: contain; border-radius: 10px; background: #fff; }
.image-preview > div { display: grid; justify-items: start; gap: 10px; min-width: 0; }
.image-preview span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
@media (max-width: 480px) { .image-preview { grid-template-columns: 110px 1fr; } .field-label span { display: block; margin: 3px 0 0; } }
.master-dialog { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(77,28,51,.34); backdrop-filter: blur(8px); }
.master-dialog.hidden { display: none; }
.master-dialog-card { width: min(500px, 100%); padding: 28px; }
.master-dialog-card h2 { margin: 7px 0; }
.master-dialog-card > p { color: var(--muted); line-height: 1.65; }
.master-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.sharing-field { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid #f0cfdb; border-radius: 15px; background: #fff9fc; }
.sharing-field > div { display: grid; gap: 3px; }.sharing-field span { color: var(--muted); font-size: 12px; }
.social-card { max-height: min(720px, calc(100svh - 40px)); overflow-y: auto; }
.social-head { display: flex; align-items: center; justify-content: space-between; }.social-head h2 { margin: 5px 0; }
.friend-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 18px 0; }.friend-add input { margin: 0; }
.friends-list { display: grid; gap: 9px; }.friend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #f1d5df; border-radius: 13px; background: #fffafd; }.friend-row strong,.friend-row small { display: block; overflow-wrap: anywhere; }.friend-row small { color: var(--muted); margin-top: 3px; }.friend-actions { display: flex; gap: 6px; flex: 0 0 auto; }
@media(max-width:520px){.friend-row{align-items:stretch;flex-direction:column}.friend-actions .button{flex:1}.friend-add{grid-template-columns:1fr}.sharing-field{align-items:stretch;flex-direction:column}}
