:root {
  color-scheme: light;
  --ink: #18201e;
  --muted: #67716d;
  --paper: #f7f7f2;
  --panel: #ffffff;
  --line: #dfe5dc;
  --mint: #33b783;
  --mint-dark: #12684d;
  --coral: #e56b5d;
  --gold: #d8a427;
  --sky: #4f8fd9;
  --shadow: 0 20px 60px rgba(26, 44, 38, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(51, 183, 131, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(229, 107, 93, 0.13), transparent 34%),
    var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.hidden {
  display: none !important;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
}

.unlock-view {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 440px);
  gap: 28px;
  align-items: stretch;
}

.brand-panel {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 76px);
  color: #f8fff9;
  background:
    linear-gradient(rgba(12, 42, 34, 0.82), rgba(12, 42, 34, 0.74)),
    radial-gradient(circle at 28% 20%, rgba(216, 164, 39, 0.42), transparent 32%),
    linear-gradient(145deg, #0a342b 0%, #14523f 48%, #2f8165 100%);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-mark,
.small-mark,
.empty-icon {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.brand-mark {
  width: 98px;
  height: 98px;
  border-radius: 8px;
  margin-bottom: 34px;
}

.brand-mark svg {
  width: 62px;
  height: 62px;
}

.small-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
  color: var(--mint-dark);
  background: #e9f8f1;
  border-color: #c9eadb;
}

.small-mark svg {
  width: 31px;
  height: 31px;
}

.eyebrow {
  margin: 0 0 8px;
  color: currentColor;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.72;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3.2rem, 8vw, 6.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

h3 {
  font-size: 1.35rem;
}

.intro {
  max-width: 680px;
  margin: 22px 0 0;
  color: rgba(248, 255, 249, 0.86);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.5;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 38px;
}

.trust-strip span {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff9e8;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
}

.unlock-card,
.detail-panel,
.sidebar {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.unlock-card {
  align-self: center;
  padding: 28px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea,
.search-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input,
.field select,
.search-field input {
  height: 46px;
  padding: 0 13px;
}

.field textarea {
  min-height: 116px;
  padding: 12px 13px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(51, 183, 131, 0.16);
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.error {
  min-height: 22px;
  margin: 12px 0 0;
  color: #b72b20;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  min-height: 42px;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.primary-button {
  width: 100%;
  margin-top: 12px;
  padding: 0 18px;
  color: #fff;
  background: var(--mint-dark);
  box-shadow: 0 12px 24px rgba(18, 104, 77, 0.22);
}

.reset-button {
  width: 100%;
  margin-top: 8px;
}

.secondary-button {
  padding: 0 14px;
  color: var(--mint-dark);
  background: #e8f6ef;
}

.danger-button {
  padding: 0 14px;
  color: #a73025;
  background: #feeae7;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: #eef4ef;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button svg,
.secondary-button svg,
.danger-button svg,
.icon-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
}

.vault-view {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.vault-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.brand-line,
.header-actions,
.add-row,
.form-topline,
.form-actions,
.generator-head,
.option-row {
  display: flex;
  align-items: center;
}

.brand-line {
  gap: 12px;
}

.header-actions,
.form-actions {
  gap: 10px;
}

.header-search {
  width: min(240px, 24vw);
  flex: 0 1 240px;
}

.lock-stack {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.lock-countdown {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.1;
}

.vault-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto auto auto auto;
  gap: 14px;
  min-height: 620px;
  padding: 16px;
}

.add-row {
  justify-content: flex-end;
}

.search-field {
  position: relative;
  flex: 1;
}

.search-field svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-field input {
  padding-left: 38px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.stats-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.stats-grid span {
  display: block;
  font-size: 1.55rem;
  font-weight: 950;
}

.stats-grid p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.view-toggle-button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.view-toggle-button.active {
  color: var(--mint-dark);
  background: #e8f6ef;
}

.archive-button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfa;
  font-weight: 900;
}

.archive-button:hover,
.archive-button.active {
  border-color: #c9eadb;
  color: var(--mint-dark);
  background: #eef8f2;
}

.archive-button strong {
  min-width: 34px;
  padding: 5px 8px;
  border-radius: 8px;
  text-align: center;
  background: #e8f6ef;
}

.security-panel {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.security-head,
.custom-fields-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.security-head strong {
  font-size: 1.25rem;
}

.security-meter {
  height: 8px;
  margin: 10px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece7;
}

.security-meter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.security-grid div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.security-grid span {
  display: block;
  font-weight: 950;
}

.security-grid p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.items-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.item-category {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  overflow: hidden;
}

.category-summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 950;
  list-style: none;
}

.category-summary::-webkit-details-marker {
  display: none;
}

.category-summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.item-category[open] .category-summary::before {
  transform: rotate(45deg);
}

.category-summary span {
  flex: 1;
}

.category-summary strong {
  min-width: 30px;
  padding: 4px 8px;
  border-radius: 8px;
  text-align: center;
  color: var(--mint-dark);
  background: #e8f6ef;
}

.category-items {
  display: grid;
  gap: 6px;
  padding: 0 8px 8px;
}

.activity-log {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #fbfcfa;
}

.cloud-panel {
  padding: 14px;
  border-radius: 8px;
  background: #fbfcfa;
  overflow: auto;
}

.cloud-auth,
.cloud-actions {
  display: grid;
  gap: 12px;
}

.activity-row {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.activity-row strong {
  display: block;
  font-size: 0.82rem;
}

.activity-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.item-button {
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  color: var(--ink);
  background: transparent;
}

.item-button:hover,
.item-button.active {
  border-color: #c9eadb;
  background: #eef8f2;
}

.item-button strong {
  display: block;
  font-size: 0.98rem;
}

.item-button span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.85rem;
}

.detail-panel {
  min-height: 620px;
  padding: clamp(18px, 3vw, 30px);
}

.empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  margin-top: 18px;
  color: var(--ink);
}

.empty-state p {
  max-width: 430px;
  line-height: 1.5;
}

.empty-icon {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  color: var(--mint-dark);
  background: #e8f6ef;
}

.empty-icon svg {
  width: 42px;
  height: 42px;
}

.entry-form {
  display: grid;
  gap: 18px;
}

.form-topline,
.generator-head {
  justify-content: space-between;
  gap: 14px;
}

.attachments-panel,
.custom-fields-panel,
.password-history-panel,
.type-fields-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.attachments-panel.drag-over {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(51, 183, 131, 0.16);
}

.attachments-head,
.attachment-item,
.attachment-actions,
.custom-field-row {
  display: flex;
  align-items: center;
}

.attachments-head {
  justify-content: space-between;
  gap: 14px;
}

.attachments-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.custom-fields-list,
.password-history-list,
.type-fields-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.type-fields-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.type-fields-grid .field:has(textarea) {
  grid-column: 1 / -1;
}

.totp-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #c9eadb;
  border-radius: 8px;
  background: #eef8f2;
}

.totp-panel strong {
  display: block;
  margin-top: 3px;
  font-size: 1.8rem;
  letter-spacing: 0.08em;
}

.totp-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.password-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.password-history-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-field-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(160px, 1.2fr) 42px;
  gap: 8px;
}

.custom-field-row input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.custom-field-row input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(51, 183, 131, 0.16);
}

.attachment-item {
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attachment-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.attachment-thumb {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  color: var(--mint-dark);
  background: #e8f6ef;
  font-weight: 950;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-meta {
  min-width: 0;
}

.attachment-meta strong,
.attachment-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.attachment-actions {
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.generator {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.range-field {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 800;
}

.range-field input {
  accent-color: var(--mint-dark);
}

.option-row {
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 800;
}

.option-row input {
  accent-color: var(--mint-dark);
}

.strength-meter {
  height: 9px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece7;
}

.strength-meter span {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
  transition: width 0.18s ease, background 0.18s ease;
}

.save-status {
  min-height: 22px;
  margin: 0;
  color: var(--mint-dark);
  font-weight: 900;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 18px;
  background: rgba(10, 24, 20, 0.82);
}

.log-modal {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 24, 20, 0.82);
}

.log-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1180px, 100%);
  margin: 0 auto 12px;
  color: #fff;
}

.preview-content {
  width: min(1180px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  place-items: center;
  overflow: auto;
  border-radius: 8px;
  background: #101713;
}

.preview-content img {
  max-width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
}

.preview-content iframe {
  width: 100%;
  height: calc(100vh - 110px);
  border: 0;
  background: #fff;
}

@media (max-width: 900px) {
  .unlock-view,
  .vault-layout,
  .form-grid,
  .type-fields-grid,
  .custom-field-row {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 420px;
  }

  .sidebar,
  .detail-panel {
    min-height: auto;
  }

  .header-search {
    width: min(320px, 100%);
    flex: 1 1 220px;
  }
}

@media (max-width: 580px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding: 8px 0;
  }

  .unlock-view,
  .vault-view {
    min-height: calc(100vh - 20px);
  }

  .brand-panel,
  .unlock-card,
  .vault-header,
  .sidebar,
  .detail-panel {
    padding: 14px;
  }

  .vault-view {
    gap: 10px;
  }

  .vault-header {
    gap: 12px;
  }

  .small-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .small-mark svg {
    width: 25px;
    height: 25px;
  }

  h2 {
    font-size: 1.55rem;
  }

  h3 {
    font-size: 1.18rem;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: 0.68rem;
  }

  .vault-header,
  .form-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .form-actions {
    width: 100%;
    gap: 8px;
  }

  .header-search,
  .lock-stack {
    width: 100%;
  }

  .lock-stack {
    justify-items: stretch;
  }

  .lock-countdown {
    text-align: right;
  }

  .header-actions .secondary-button,
  .form-actions button {
    flex: 1;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .header-actions .icon-button {
    width: 48px;
    height: 48px;
  }

  .search-field input,
  .field input,
  .field select {
    height: 44px;
  }

  .field {
    gap: 6px;
    margin-top: 14px;
  }

  .entry-form {
    gap: 14px;
  }

  .attachments-panel,
  .custom-fields-panel,
  .password-history-panel,
  .type-fields-panel {
    padding: 13px;
  }

  .attachments-head,
  .custom-fields-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .attachments-head .secondary-button,
  .custom-fields-head .secondary-button {
    width: 100%;
  }

  .stats-grid div,
  .security-panel,
  .archive-button {
    padding: 11px;
  }

  .empty-state {
    min-height: 320px;
  }

  .totp-panel {
    align-items: stretch;
    flex-direction: column;
  }
}
