:root {
  color-scheme: light;
  --fg: #1f2933;
  --muted: #5b6770;
  --line: #d6dde3;
  --accent: #0b5d8c;
  --bg: #fbfcfd;
  --warn: #8a4b00;
  --mark: #fff1a8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}

header {
  background: #123a52;
  color: #fff;
  padding: 0.6rem 1.25rem;
}

header nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
header a { color: #fff; text-decoration: none; font-weight: 600; }
header a:hover { text-decoration: underline; }
.badge {
  background: #f5c542; color: #3a2c00; border-radius: 999px;
  padding: 0.1rem 0.65rem; font-size: 0.8rem; font-weight: 700;
}

main { max-width: 72rem; margin: 0 auto; padding: 1.25rem; }
footer {
  max-width: 72rem; margin: 0 auto; padding: 1.25rem;
  color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line);
}

h1 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.2rem; margin-top: 1.75rem; }
a { color: var(--accent); }

form.search { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
form.search input[type="search"] { flex: 1 1 22rem; }
input, select, button, textarea {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: #fff;
  color: inherit;
}
button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
button:hover { background: #08486c; }

ul.hits { list-style: none; padding: 0; margin: 0; }
ul.hits li {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
}
.hit-head { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.hit-head .date { color: var(--muted); font-variant-numeric: tabular-nums; }
.hit-head .kind {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  background: #e7eef3; color: #33495a; border-radius: 0.25rem; padding: 0 0.4rem;
}
.hit-head .title { font-weight: 600; }
.snippet { color: var(--muted); margin-top: 0.25rem; }
mark { background: var(--mark); color: inherit; padding: 0 0.1rem; }

.pagination { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.hint { color: var(--muted); }
.warning { color: var(--warn); font-weight: 600; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }

.segments, .resolutions, .messages, .pending { display: grid; gap: 1rem; padding: 0; list-style: none; }
.card {
  border: 1px solid var(--line); border-radius: 0.5rem;
  padding: 0.9rem 1rem; background: #fff;
}
.card h2, .card h3 { margin-top: 0; }
.meta { color: var(--muted); font-size: 0.9rem; }
.important { color: #8a2b06; font-weight: 700; }
.routine { color: var(--muted); font-size: 0.85rem; }
.page-text { white-space: pre-wrap; }
.thumbnails { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.75rem; }
.thumbnails figure { margin: 0; text-align: center; }
.thumbnails img { width: 100%; border: 1px solid var(--line); border-radius: 0.25rem; }
.segment-form { display: grid; gap: 0.5rem; }
.segment-row {
  display: grid; gap: 0.35rem; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.75rem; background: #fff;
}
.segment-row label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); }
.readonly-note { background: #fff4d6; border: 1px solid #e6c45a; padding: 0.5rem 0.75rem; border-radius: 0.35rem; }

.notice { background: #fff7e6; border-left: 3px solid var(--warn, #b45309); padding: .5rem .75rem; color: var(--warn, #b45309); }
.meta { font-size: .8rem; color: var(--muted, #6b7280); margin-left: .5rem; }
.ask { border: 1px solid var(--border, #e5e7eb); border-radius: .5rem; padding: 1rem; margin-top: 1rem; }

.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator { opacity: 1; transition: opacity 200ms ease-in; }
.htmx-request.htmx-indicator { opacity: 1; transition: opacity 200ms ease-in; }

.login { max-width: 22rem; margin: 4rem auto; }
.login form { display: grid; gap: .8rem; }
.login label { display: grid; gap: .3rem; }
form.inline-form { display: inline; }
nav form.inline-form button { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.who { font-size: 0.85rem; opacity: 0.9; }
