:root {
  --paper:       #edefe9;
  --panel:       #f7f8f4;
  --ink:         #232821;
  --muted:       #6a7168;
  --rule:        #d3d7cc;
  --accent:      #2f6f6b;
  --accent-wash: #dee9e4;
  --danger:      #9c4a3c;

  --measure: 46rem;
  --sans: ui-sans-serif, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #1a1e1b;
    --panel:       #222723;
    --ink:         #e2e7dd;
    --muted:       #99a295;
    --rule:        #343a35;
    --accent:      #86beb2;
    --accent-wash: #27312d;
    --danger:      #d98b7c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.sheet {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

a { color: var(--accent); }

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

code {
  font-family: var(--mono);
  font-size: 0.875em;
}

/* ---------- Päis ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--ink);
}

.masthead__name {
  font-size: 1.5rem;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.masthead__nav {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.9375rem;
}

.masthead__nav form { margin: 0; }

.tagline {
  margin: 1.25rem 0 2.5rem;
  color: var(--muted);
  max-width: 34rem;
}

/* ---------- Linkide register ---------- */

.register {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.register__label {
  margin: 0.55rem 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
}

.register__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry {
  display: block;
  padding: 0.55rem 0.75rem;
  margin-left: -0.75rem;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.entry:hover,
.entry:focus-visible {
  background: var(--accent-wash);
}

.entry--restricted { border-left-color: var(--accent); }

.entry__title {
  display: block;
  font-weight: 560;
}

.entry__note {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

@media (max-width: 34rem) {
  .sheet { padding-top: 2rem; }
  .register { grid-template-columns: 1fr; gap: 0.5rem; }
  .register__label { margin-top: 0; }
}

/* ---------- Teated ja tühi olek ---------- */

.notices {
  margin: 1.5rem 0 0;
  padding: 0.75rem 1rem;
  list-style: none;
  background: var(--accent-wash);
  border-left: 2px solid var(--accent);
  font-size: 0.9375rem;
}

.blank {
  margin: 2.5rem 0;
  color: var(--muted);
}

/* ---------- Sisselogimine ---------- */

.gate { max-width: 20rem; margin: 3rem 0; }

.gate__heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.gate__error {
  padding: 0.6rem 0.85rem;
  border-left: 2px solid var(--danger);
  color: var(--danger);
  font-size: 0.9375rem;
}

/* ---------- Vormid ---------- */

.stack {
  display: grid;
  gap: 0.85rem;
  margin: 1.25rem 0 0;
  align-items: start;
}

.stack--inset {
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.stack label { display: grid; gap: 0.25rem; }

.stack label > span {
  font-size: 0.875rem;
  color: var(--muted);
}

.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem !important;
}

.checkbox > span { color: var(--ink) !important; }

input[type="text"], input:not([type]), input[type="password"], textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

textarea {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: vertical;
}

.button {
  justify-self: start;
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-weight: 560;
  color: var(--paper);
  background: var(--accent);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.button:hover { filter: brightness(1.08); }

.linkish {
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linkish--danger { color: var(--danger); }

.inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline input { max-width: 12rem; }

/* ---------- Haldusliides ---------- */

.page-heading {
  font-size: 1.5rem;
  font-weight: 640;
  letter-spacing: -0.02em;
  margin: 2rem 0 0;
}

.panel {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.panel__heading {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.panel__note {
  color: var(--muted);
  font-size: 0.875rem;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.grid td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-top: 1px solid var(--rule);
  vertical-align: top;
}

.grid tr:first-child td { border-top: 0; }

.grid__group {
  width: 7rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.grid__url {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.grid__action { text-align: right; white-space: nowrap; }

.tag {
  margin-left: 0.4rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-wash);
  border-radius: 2px;
}

/* ---------- Jalus ---------- */

.colophon {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
}
