:root {
  --ink: var(--midas-ink);
  --muted: var(--midas-muted);
  --green: var(--midas-link);
  --line: var(--midas-line);
  --surface: #fff;
  --tint: var(--midas-warm);
  font-family: var(--midas-font);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--midas-canvas); color: var(--ink); line-height: 1.5; }
[hidden] { display: none !important; }
.admin-shell { min-height: 100dvh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 26px 16px; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px; }
.brand img { border-radius: 9px; flex: none; }
.brand strong { display: block; font-size: 1.15rem; }
.brand span { display: block; font-size: .83rem; color: var(--muted); }
.sidebar-nav { display: grid; gap: 5px; margin-top: 42px; }
.sidebar-nav button { background: transparent; text-align: left; }
.sidebar-nav button:hover { background: var(--midas-canvas); }
.sidebar-nav button[aria-current="page"] { background: var(--tint); border-inline-start: 4px solid var(--midas-accent); }
.workspace { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 32px; min-height: 65px; background: white; border-bottom: 1px solid var(--line); }
.topbar strong { color: var(--muted); }
.workspace-content { width: min(100%, 1440px); padding: 30px 32px 52px; margin-inline: auto; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: clamp(1.55rem, 2.2vw, 2rem); letter-spacing: -.025em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 8px 0 16px; }
.muted { color: var(--muted); }
.toolbar, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar { justify-content: space-between; }
.page-heading { margin-bottom: 20px; }
.panel {
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  box-shadow: 0 2px 6px #1f1f2008;
}
.account-form { max-width: 460px; padding: clamp(20px, 4vw, 36px); margin: clamp(16px, 7vh, 85px) auto 0; }
.admin-shell:not(.signed-in) .topbar { display: none; }
.account-form form { margin-top: 22px; }
.account-form form > button { margin-top: 8px; }
label { display: grid; gap: 5px; font-size: .93rem; font-weight: 650; margin: 14px 0; }
button, input, select { font: inherit; }
button, input:not([type=checkbox]), select { min-height: 42px; padding: 8px 13px; border-radius: 6px; }
input:not([type=checkbox]), select { min-width: 0; width: 100%; border: 1px solid #918c85; background: white; color: var(--ink); }
button { cursor: pointer; background: var(--midas-accent); color: var(--ink); border: 1px solid transparent; font-weight: 700; }
button:hover:not(:disabled) { filter: brightness(.94); }
button.secondary { background: white; color: var(--ink); border-color: #a8a29a; }
button.danger { background: white; color: #982727; border-color: #e4c1c1; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--green); width: 19px; height: 19px; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#message, .form-message { white-space: pre-line; color: #713128; font-weight: 650; }
#message { padding: 10px 14px; border-radius: 8px; background: #fff4e7; }
#message:empty, .form-message:empty { display: none; }
.member-tools { padding: 16px 20px; }
.search-label { margin: 0; flex: 1 1 245px; max-width: 390px; }
.table-scroll { overflow-x: auto; }
#members-table { width: 100%; border-collapse: collapse; }
#members-table th, #members-table td { text-align: left; padding: 11px 16px; }
#members-table th { color: var(--muted); background: var(--midas-canvas); font-size: .86rem; }
#members-table td { border-top: 1px solid var(--line); }
#members-table tbody tr:hover { background: var(--tint); }
#members-table th:first-child, #members-table td:first-child { width: 50px; text-align: center; }
#members-table td:nth-child(2) { font-weight: 700; overflow-wrap: anywhere; }
#members-table td:nth-child(3) { font-variant-numeric: tabular-nums; }
#members-table th:last-child, #members-table td:last-child { text-align: right; }
.member-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.empty-state { padding: 20px; text-align: center; color: var(--muted); }
.retry { display: block; margin: 0 auto 16px; }
dialog { width: min(calc(100% - 24px), 760px); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: 0 20px 60px #1f1f2044; }
dialog::backdrop { background: #1f1f2080; }
.registration-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 24px; margin-top: 20px; }
#registration-csv { border-left: 1px solid var(--line); padding-left: 24px; }
.records-header { margin-top: 14px; }
.count-pill { background: var(--tint); color: var(--green); border-radius: 20px; padding: 5px 12px; margin: 0; font-size: .88rem; font-weight: 700; }
.records-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(285px, 1fr); align-items: start; gap: 18px; }
.calendar-panel, .activity-panel { padding: 19px; }
.month-nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; text-align: center; gap: 8px; }
.month-nav button { min-width: 42px; padding-inline: 8px; font-size: 1.2rem; }
.month-nav h3 { white-space: nowrap; }
.month-nav #choose-month { font-size: 1rem; }
#month-picker { width: min(calc(100% - 24px), 320px); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.weekdays { color: var(--muted); text-align: center; font-size: .87rem; padding-top: 12px; }
.calendar-day { display: grid; place-content: center; text-align: center; min-height: 54px; padding: 2px; border-radius: 7px; }
span.calendar-day { background: var(--midas-canvas); color: var(--muted); }
button.calendar-day { background: var(--tint); color: var(--green); border-color: #d6a86f; }
button.calendar-day[aria-pressed=true] { background: var(--midas-accent); color: var(--ink); border-color: var(--green); }
.day-count { display: block; font-size: .75rem; line-height: 1.2; }
.calendar-footer { margin-top: 12px; }
.calendar-note { font-size: .88rem; color: var(--muted); margin: 0; }
#record-list { padding: 0; margin: 8px 0 0; list-style: none; }
#record-list li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.record-time { display: block; color: var(--muted); font-size: .86rem; }
.summary-action { margin-top: 15px; padding: 12px; background: var(--midas-canvas); border-radius: 10px; }
.summary-action label { margin-top: 0; }
@media screen {
  #report #report-preview-content { max-width: 820px; margin: 0 auto; padding: clamp(16px, 4vw, 40px); }
}
@media (max-width: 940px) {
  .admin-shell { grid-template-columns: 172px minmax(0, 1fr); }
  .workspace-content, .topbar { padding-inline: 20px; }
  .records-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .sidebar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .sidebar-nav { display: flex; flex-wrap: wrap; margin: 0; }
  .workspace-content { padding: 16px 12px 28px; }
  .topbar { min-height: 52px; padding: 5px 12px; }
  .calendar-panel, .activity-panel, dialog { padding: 13px; }
  #registration-csv { border-left: 0; padding-left: 0; }
  .member-tools { padding: 12px; }
  #members-table th, #members-table td { padding: 7px; }
  #members-table th:first-child, #members-table td:first-child { width: 33px; }
  #members-table td:nth-child(3) { overflow-wrap: anywhere; }
  .member-actions { flex-direction: column; align-items: flex-end; }
  .member-actions button { padding-inline: 7px; white-space: nowrap; }
  .calendar-day { min-height: 46px; }
}
