* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f5f6f8;
  color: #222;
}

.container {
  width: min(720px, 92%);
  margin: 36px auto 60px;
}

header {
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 5px;
}

h2 {
  margin-top: 0;
}

.subtitle {
  margin: 0;
  color: #777;
}

.help {
  color: #666;
  line-height: 1.5;
}

.card,
.password-card,
.modal-card {
  background: white;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 3px 15px rgba(0, 0, 0, .07);
}

label {
  display: block;
  margin-top: 15px;
  margin-bottom: 6px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 9px;
  font-size: 16px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  background: #2563eb;
  color: white;
  font-size: 15px;
  cursor: pointer;
}

button:hover {
  opacity: .92;
}

.card > button {
  width: 100%;
  margin-top: 20px;
}

button.secondary {
  background: #e8ebf0;
  color: #333;
}

button.danger {
  background: #c62828;
}

button.compact {
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.message {
  color: #c62828;
  min-height: 20px;
}

.status {
  color: #555;
  min-height: 22px;
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.toolbar input {
  flex: 1;
}

.vault-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 5px;
}

.password-card {
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.password-card h3 {
  margin: 0;
  word-break: break-word;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.row-label {
  width: 74px;
  flex-shrink: 0;
  color: #777;
  font-size: 13px;
}

.value {
  flex: 1;
  word-break: break-all;
}

.password-value {
  font-family: Consolas, "Courier New", monospace;
}

.small-button {
  padding: 7px 10px;
  background: #eef1f5;
  color: #333;
}

.website-link {
  color: #2563eb;
  text-decoration: none;
  word-break: break-all;
}

.notes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eee;
  color: #555;
  white-space: pre-wrap;
  word-break: break-word;
}

.meta {
  margin-top: 12px;
  color: #999;
  font-size: 12px;
}

.add-button {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  width: min(500px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.confirm-card {
  width: min(420px, 100%);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.password-input-row {
  display: flex;
  gap: 8px;
}

.password-input-row input {
  flex: 1;
}

@media (max-width: 600px) {
  .container {
    margin-top: 22px;
    width: 94%;
  }

  h1 {
    font-size: 25px;
  }

  .toolbar {
    flex-direction: column;
  }

  .vault-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .card-header {
    flex-direction: column;
  }

  .card-actions {
    width: 100%;
  }

  .card-actions button {
    flex: 1;
  }

  .row {
    flex-wrap: wrap;
  }

  .row-label {
    width: 100%;
  }

  .value {
    min-width: 0;
  }
}