:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #262126;
  background: #f8f6f6;
  --accent: #85072d;
  --border: #e7dadd;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #a34c00; outline-offset: 3px; }
.wrap { width: min(70rem, 100% - 2rem); margin-inline: auto; }
.top { background: #fff; border-top: .35rem solid var(--accent); }
.masthead { padding-block: 1.25rem; }
.heading, .actions, nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { color: inherit; display: inline-flex; align-items: center; gap: 1.15rem; text-decoration: none; }
.brand img { display: block; width: clamp(3.5rem, 11vw, 4.875rem); height: auto; flex: none; }
.brand strong { display: block; color: #700626; font-size: clamp(1.15rem, 3.5vw, 1.9rem); line-height: 1.15; letter-spacing: -.028em; }
.brand small { margin-top: .35rem; }
.nav-bar { background: #790729; }
nav { gap: .2rem; }
nav a { color: #fff; padding: .75rem 1rem; border-bottom: .22rem solid transparent; text-decoration: none; }
nav a:hover { background: #941540; }
nav a[aria-current] { border-bottom-color: #fff; background: #941540; font-weight: 650; }
.nav-bar a:focus-visible { outline-color: #fff; outline-offset: -5px; }
main { padding-block: 2rem 3rem; }
.heading { justify-content: space-between; margin-bottom: 1.25rem; }
h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.55rem); letter-spacing: -.045em; }
.panel, .table-box { border: 1px solid var(--border); border-radius: .65rem; background: white; }
.filters, .editor { padding: 1rem; gap: 1rem; }
.filters { display: flex; align-items: end; flex-wrap: wrap; }
.filters label { flex: 1 1 9rem; min-width: 0; }
.filters .search { flex-basis: 15rem; }
.filters > a { align-self: center; }
label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 650; }
input, select, textarea, .button { font: inherit; font-size: 1rem; }
input, select, textarea {
  color: inherit; width: 100%; min-width: 0; border: 1px solid #ad969e;
  border-radius: .35rem; padding: .55rem .65rem; background: white;
}
select {
  appearance: none; padding-right: 2rem;
  background: white linear-gradient(45deg, transparent 50%, #6d424f 50%) calc(100% - 14px) 52% / 5px 5px no-repeat;
  background-image: linear-gradient(45deg, transparent 50%, #6d424f 50%), linear-gradient(135deg, #6d424f 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
}
textarea { resize: vertical; }
.button {
  display: inline-block; cursor: pointer; padding: .55rem .8rem; font-weight: 650;
  border: 1px solid #ad969e; border-radius: .35rem; text-decoration: none;
  background: #fff; color: var(--accent);
}
.button:hover { background: #fcf1f4; }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: #690424; }
.count { color: #65535a; font-size: .9rem; }
.table-box { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .8rem 1rem; vertical-align: middle; }
th { background: #f5edef; font-size: .9rem; white-space: nowrap; }
td { border-top: 1px solid var(--border); overflow-wrap: anywhere; }
tbody tr:hover { background: #fff7f9; }
.record { font-weight: 700; }
.code { font-family: ui-monospace, monospace; }
small { display: block; color: #65535a; font-size: .875rem; margin-top: .15rem; }
.status { display: inline-block; border-radius: .3rem; padding: .2rem .45rem; font-size: .875rem; white-space: nowrap; background: #e7edf2; }
.state-0 { color: #124736; background: #dcefe6; }
.state-2 { color: #614214; background: #fff0cf; }
.editor { max-width: 49rem; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.wide { grid-column: 1 / -1; }
.actions { margin-top: .45rem; }
.notice, .empty { padding: .85rem 1rem; }
.notice { border-radius: .35rem; background: #dcefe6; color: #124736; margin: 0 0 1rem; }
.error { background: #fce3df; color: #7b291b; margin: 0; }
.empty p { margin: .25rem 0; }
@media (max-width: 36rem) {
  .editor { grid-template-columns: 1fr; }
  th, td { padding: .65rem; }
}
.delete-link { color: #8c1634; font-weight: 650; }
.editor p:first-child { margin-top: 0; }
.editor p:last-child { margin-bottom: 0; }
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1; }
.site-footer {
  display: grid;
  justify-items: end;
  gap: .2rem;
  border-top: 1px solid var(--border);
  padding-block: .85rem 1.15rem;
  color: #65535a;
  font-size: .875rem;
}
.detail dt { font-weight: 650; }
.detail dd { margin: .35rem 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.nav-inner, .session-actions { display: flex; align-items: center; flex-wrap: wrap; }
.nav-inner { justify-content: space-between; column-gap: 1rem; }
.session-actions { gap: .65rem; color: white; font-size: .875rem; padding-block: .35rem; }
.session-actions button {
  font: inherit; color: white; background: transparent; border: 1px solid #eab9c7;
  border-radius: .35rem; padding: .35rem .65rem; cursor: pointer;
}
.session-actions button:hover { background: #941540; }
.session-actions button:focus-visible { outline-color: white; }
.login { max-width: 27rem; }

.export-bar, .export-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.export-bar { justify-content: space-between; margin: 1rem 0; }
.export-bar .count { margin: 0; }

.ticket-card { margin-bottom: 1rem; overflow-wrap: anywhere; }
.ticket-card h2 { margin: 0; }
.ticket-text { white-space: pre-wrap; }
.ticket-open { color: #821b23; background: #fce3e5; }
.ticket-closed { color: #124736; background: #dcefe6; }
.ticket-thread { display: grid; gap: .65rem; }
.ticket-message { border-left: 3px solid var(--border); padding: .35rem .7rem; }

@media (max-width: 44rem) {
  .wrap { width: calc(100% - 1.5rem); }
  .masthead { padding-block: .85rem; }
  .brand { gap: .7rem; }
  .nav-inner { gap: 0 .5rem; }
  nav a { display: inline-flex; align-items: center; padding: .5rem .6rem; min-height: 44px; }
  .session-actions { margin-inline-start: auto; }
  .session-actions button, .button, input, select { min-height: 44px; }
  .heading { gap: .65rem; }
  main { padding-block: 1.25rem 2rem; }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .filters { gap: .65rem; }
  .filters .search { flex-basis: 100%; }
  .filters label { flex-basis: 8rem; }
  .export-bar { align-items: flex-start; }
  .table-box:has(.responsive-table) { overflow: visible; border: 0; background: none; }
  .responsive-table, .responsive-table tbody { display: block; }
  .responsive-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .responsive-table tbody tr {
    display: block; margin-bottom: .65rem; border: 1px solid var(--border);
    border-radius: .65rem; background: #fff;
  }
  .responsive-table td {
    display: grid; grid-template-columns: minmax(6rem, 32%) minmax(0, 1fr);
    gap: .65rem; padding: .48rem .7rem; align-items: baseline;
  }
  .responsive-table td::before {
    content: attr(data-label); font-size: .875rem; font-weight: 650; color: #65535a;
  }
  .responsive-table td:first-child { border: 0; padding-block: .65rem; }
  .responsive-table td > small { grid-column: 2; margin: 0; }
  .responsive-table td > .status { justify-self: start; white-space: normal; }
}
