:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f6fb;
  color: #1f2933;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
}

main {
  width: min(960px, 100vw);
  padding: 24px;
}

h1 {
  text-align: center;
  margin-bottom: 24px;
}

.panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  margin-bottom: 24px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 0.9rem;
  gap: 4px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  padding: 8px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
}

input:read-only,
textarea:read-only {
  background: #f7fafc;
  color: #2d3748;
}

button {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

button[data-action] {
  background: #6b7280;
}

button[data-action]:hover {
  background: #4b5563;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#password-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

#password-table th,
#password-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px;
  text-align: left;
}

#password-table tbody tr:last-child td {
  border-bottom: none;
}

#password-table a {
  color: #2563eb;
  text-decoration: none;
}

#password-table a:hover {
  text-decoration: underline;
}

.entry-title {
  font-weight: 600;
  display: block;
}

.entry-username {
  font-size: 0.85rem;
  color: #6b7280;
  display: block;
  margin-top: 2px;
}

.actions-cell {
  white-space: nowrap;
}

.icon-button {
  background: none !important;
  border: none !important;
  font-size: 1.3rem;
  padding: 4px 8px;
  cursor: pointer;
  color: inherit;
  border-radius: 0;
}

.icon-button:hover {
  background: none !important;
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hidden {
  display: none;
}

#messages {
  min-height: 24px;
  margin-bottom: 16px;
}

#messages.error {
  color: #dc2626;
}

#messages.success {
  color: #16a34a;
}

.hint {
  font-size: 0.85rem;
  color: #4b5563;
}

.form-actions {
  display: flex;
  gap: 12px;
}

.url-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.url-row input {
  flex: 1;
}

.url-row button {
  flex-shrink: 0;
  background: #dc2626;
}

.url-row button:hover {
  background: #b91c1c;
}

#password-section {
  margin-bottom: 12px;
}

#urls-section {
  margin-bottom: 12px;
}

#urls-section > label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: block;
}

#notes-section {
  margin-bottom: 12px;
}

#add-url-button {
  background: #059669;
}

#add-url-button:hover {
  background: #047857;
}

@media (max-width: 640px) {
  main {
    padding: 12px;
  }

  .toolbar .actions {
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
  }
}
