:root {
  --blue: #17458f;      /* Rotary royal blue */
  --gold: #f7a81b;      /* Rotary gold */
  --ink: #1d2433;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f5f7fb;
  --card: #ffffff;
  --danger: #b42318;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--blue); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem;
  padding: .75rem 1rem; background: var(--blue); color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.brand small { font-weight: 400; opacity: .8; }
.brand-mark {
  display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem;
  border-radius: 50%; background: var(--gold); color: var(--blue); font-weight: 800;
}
.nav { display: flex; gap: .25rem; }
.nav a { padding: .35rem .7rem; border-radius: 6px; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.15); }
.account { margin-left: auto; font-size: .9rem; display: flex; gap: .75rem; align-items: center; }
.account a { text-decoration: underline; }

.page { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.count { font-size: .9rem; color: var(--muted); font-weight: 400; }
.crumbs { margin: 0 0 .75rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 440px; margin: 3rem auto; }
.login h1 { margin-bottom: .5rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; color: var(--blue); font-weight: 700; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.stack { display: grid; gap: .6rem; margin-top: 1.25rem; }

.button {
  display: inline-block; text-align: center; padding: .6rem 1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.button.primary { background: var(--blue); color: #fff; }
.button.secondary { background: #fff; color: var(--blue); border-color: var(--line); }
.button.small { padding: .35rem .7rem; font-size: .9rem; }

.notice { padding: .7rem .9rem; border-radius: 8px; background: #eef4ff; border: 1px solid #c7d7fe; margin: 0 0 1rem; }
.notice.error { background: #fef3f2; border-color: #fecdca; color: var(--danger); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
input, select {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0;
}
.filters input[type=search] { flex: 1 1 240px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.inactive { opacity: .55; }
table.list a { text-decoration: none; }

.avatar-cell { width: 48px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: block; }
.placeholder { display: grid; place-items: center; background: #dfe7f6; color: var(--blue); font-weight: 700; }
.avatar.placeholder { width: 36px; height: 36px; border-radius: 50%; }

.tag { display: inline-block; font-size: .78rem; padding: .1rem .5rem; border-radius: 999px; background: #eef1f6; color: var(--ink); }
.tag.status-2 { background: #e7f6ec; color: #067647; }
.tag.status-3, .tag.status-4 { background: #f2f4f7; color: var(--muted); }

.profile-head { display: flex; gap: 1.25rem; align-items: center; }
.portrait { width: 110px; height: 110px; border-radius: 12px; object-fit: cover; flex: none; }
.portrait.placeholder { font-size: 2.5rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 -1px; }
.tabs a {
  padding: .55rem .9rem; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0;
  text-decoration: none; color: var(--muted);
}
.tabs a.active { background: var(--card); border-color: var(--line); color: var(--ink); font-weight: 600; }
.tabs + .card { border-top-left-radius: 0; }

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem 1.5rem; margin: 0; }
.field dt { font-size: .8rem; color: var(--muted); }
.field dd { margin: 0; }
.sub + .sub { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.gallery figure { margin: 0; }
.gallery img, .gallery .missing { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: #eef1f6; }
.gallery .missing { display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.gallery figcaption { font-size: .85rem; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem 1rem; align-items: end; }
.form-grid label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }

/* Edit forms */
.edit-form { align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid label.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); align-self: center; }
.form-grid label.check input { width: 1.1rem; height: 1.1rem; }
textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.invalid input, .invalid select, .invalid textarea { border-color: var(--danger); }
.field-error { color: var(--danger); }
.form-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.danger-zone { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1rem; }
.button.danger { background: #fff; color: var(--danger); border-color: #fecdca; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; }
.link-button.danger { color: var(--danger); }
form.inline { display: inline; margin-left: .5rem; }

.head-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; align-self: flex-start; }
.section-actions { display: flex; justify-content: flex-end; margin-bottom: .75rem; }
.edit-link { font-size: .85rem; font-weight: 400; margin-left: .5rem; }
.row-actions { text-align: right; white-space: nowrap; }
.upload { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.upload label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
.photo-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .25rem; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.report-grid .card { margin: 0; display: flex; flex-direction: column; }
.report-grid .card > :last-child { margin-top: auto; align-self: flex-start; }
.report-options { display: flex; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 640px) {
  .account { margin-left: 0; width: 100%; }
  .profile-head { flex-direction: column; align-items: flex-start; }
  .head-actions { margin-left: 0; }
}
