:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d6dbe1;
  --accent: #116a7b;
  --danger: #a4262c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
}

.brand {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

nav {
  align-items: center;
  display: flex;
  gap: 0.8rem;
}

.page {
  margin: 0 auto;
  max-width: 1100px;
  padding: 1.5rem;
}

.page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.flash {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.notice {
  background: #edf8f2;
}

.alert {
  background: #fff2f1;
}

.panel,
.picture-card,
.list-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.panel {
  margin: 1.5rem 0;
  padding: 1rem;
}

.list-grid,
.gallery-grid {
  display: grid;
  gap: 1rem;
}

.list-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.list-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem;
  text-decoration: none;
}

.list-item span,
.hint {
  color: var(--muted);
}

.picture-card {
  overflow: hidden;
  padding: 0.75rem;
}

.picture-card img,
.picture-detail img {
  background: white;
  display: block;
  height: auto;
  max-width: 100%;
}

.picture-card img {
  aspect-ratio: 1 / 1;
  object-fit: contain;
  width: 100%;
}

.picture-detail {
  text-align: center;
}

.edit-thumb {
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}

.stacked-form,
.form-row {
  display: grid;
  gap: 0.75rem;
  max-width: 520px;
}

.form-row {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  max-width: none;
}

input,
textarea,
select,
button,
.button,
input[type="submit"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 0.55rem 0.7rem;
}

button,
.button,
input[type="submit"] {
  background: var(--accent);
  color: white;
  cursor: pointer;
  text-decoration: none;
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 0;
}

.danger {
  background: var(--danger);
}

table {
  background: var(--panel);
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
}

.tree {
  line-height: 1.8;
}

.missing-image {
  align-items: center;
  background: #e8ebef;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 120px;
}

@media (max-width: 720px) {
  .topbar,
  .page-header,
  .form-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }
}
