:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c1f26;
  --muted: #667085;
  --border: #d9dde4;
  --accent: #2f5fe0;
  --accent-text: #ffffff;
  --danger: #c0392b;
  --shared: #0e7a5a;
  --shared-bg: #e1f5ee;
  --private-bg: #eceef2;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b;
    --surface: #1e2128;
    --text: #e8eaef;
    --muted: #98a1b3;
    --border: #333844;
    --accent: #6d92ff;
    --accent-text: #0d1220;
    --danger: #ff7b6b;
    --shared: #5fd3ab;
    --shared-bg: #173a30;
    --private-bg: #2a2e38;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

h1,
h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

textarea {
  resize: vertical;
}

button {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  border-color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.danger {
  color: var(--danger);
  border-color: var(--danger);
}

label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

label > input,
label > select,
label > textarea,
label > .row {
  margin-top: 5px;
  color: var(--text);
}

.row {
  display: flex;
  gap: 8px;
}

.spacer {
  flex: 1;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

.error {
  margin: 0 0 14px;
  color: var(--danger);
  font-size: 0.92rem;
}

/* logowanie */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 360px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.card button {
  width: 100%;
}

/* aplikacja */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.toolbar {
  display: flex;
  gap: 10px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.chip {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.entries {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.entry-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.entry-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.badge {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--private-bg);
  color: var(--muted);
  font-size: 0.76rem;
}

.badge.shared {
  background: var(--shared-bg);
  color: var(--shared);
}

.entry-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.entry-line a {
  color: var(--accent);
}

.entry-notes {
  white-space: pre-wrap;
}

.secret {
  margin-top: 8px;
  padding: 7px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: all;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.entry-actions button {
  padding: 5px 11px;
  font-size: 0.88rem;
}

/* okno dialogowe */

dialog {
  width: min(480px, calc(100vw - 24px));
  padding: 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
}

fieldset {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

label.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  color: var(--text);
  font-size: 1rem;
}

label.radio input {
  width: auto;
  margin: 0;
}

.actions {
  display: flex;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: 10px;
  font-size: 0.92rem;
}

@media (max-width: 480px) {
  .toolbar {
    flex-direction: column;
  }
}
