/* Town Records — rebuilt for compact database aesthetic */

.town-records .page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 18px 48px;
}

.town-records .town-hero {
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 18px;
  text-align: center;
}

.town-records .kicker {
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .82rem;
  opacity: .75;
  margin: 0 0 10px;
}

.town-records .town-title {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 2.8vw, 2.6rem);
  line-height: 1.1;
}

.town-records .hero-description {
  margin: 0 auto 18px;
  opacity: .80;
  max-width: 72ch;
  line-height: 1.6;
}

/* Portal container */
.town-records .portal {
  margin-top: 14px;
  background: #1e1e1e;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  font-family: 'Courier New', Courier, monospace;
}

/* Filter bar */
.town-records .portal-top {
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
}

.town-records .filters {
  display: grid;
  grid-template-columns: 1.6fr .7fr .7fr .7fr .7fr;
  gap: 10px;
  align-items: end;
}

.town-records .filters label {
  display: block;
  font-size: .72rem;
  opacity: .60;
  margin-bottom: 5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: Arial, sans-serif;
}

.town-records input[type="search"],
.town-records select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.30);
  color: inherit;
  outline: none;
  font-size: .88rem;
  font-family: Arial, sans-serif;
}

.town-records input[type="search"]:focus,
.town-records select:focus {
  border-color: rgba(201,168,76,.5);
}

.town-records input[type="search"]::placeholder {
  color: rgba(255,255,255,.35);
}

.town-records .portal-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: Arial, sans-serif;
}

.town-records .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
  font-size: .78rem;
  white-space: nowrap;
  opacity: .85;
}

.town-records .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,210,120,.95);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* Column header row */
.town-records .row-head {
  display: grid;
  grid-template-columns: 110px 40px 1fr 160px 110px 80px;
  gap: 0;
  padding: 8px 16px;
  background: rgba(0,0,0,.35);
  border-bottom: 1px solid rgba(255,255,255,.10);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
  font-family: Arial, sans-serif;
  cursor: default;
  user-select: none;
}

.town-records .row-head .col-sortable {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.town-records .row-head .col-sortable:hover {
  opacity: 1;
  color: rgba(201,168,76,.9);
}

.town-records .col-sort-indicator {
  font-size: .65rem;
  opacity: .7;
}

/* Data rows */
.town-records .record-row {
  border-bottom: 1px solid rgba(255,255,255,.07);
  cursor: pointer;
  transition: background .15s;
}

.town-records .record-row:last-child {
  border-bottom: 0;
}

.town-records .record-row:hover > .record-main {
  background: rgba(255,255,255,.04);
}

.town-records .record-row.expanded > .record-main {
  background: rgba(201,168,76,.06);
  border-left: 3px solid rgba(201,168,76,.6);
}

.town-records .record-row.restricted-row > .record-main {
  border-left: 3px solid rgba(255,170,80,.18);
}

.town-records .record-row.redacted-row > .record-main {
  border-left: 3px solid rgba(255,100,100,.18);
}

.town-records .record-row.expanded.restricted-row > .record-main,
.town-records .record-row.expanded.redacted-row > .record-main {
  border-left: 3px solid rgba(201,168,76,.6);
}

/* Main single-line row */
.town-records .record-main {
  display: grid;
  grid-template-columns: 110px 40px 1fr 160px 110px 80px;
  gap: 0;
  padding: 10px 16px;
  align-items: center;
  min-height: 44px;
}

.town-records .rec-date {
  font-size: .80rem;
  opacity: .65;
  white-space: nowrap;
}

.town-records .rec-new {
  display: flex;
  align-items: center;
  justify-content: center;
}

.town-records .new-badge {
  background: rgba(255,210,120,.95);
  color: rgba(0,0,0,.85);
  font-size: .62rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  letter-spacing: .04em;
}

.town-records .rec-title {
  font-size: .90rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
  color: rgba(255,255,255,.92);
}

.town-records .rec-category {
  font-size: .78rem;
  opacity: .65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Arial, sans-serif;
}

.town-records .rec-class {
  justify-self: center;
}

.town-records .class-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-family: Arial, sans-serif;
  font-weight: bold;
  border: 1px solid transparent;
}

.town-records .class-badge.public {
  background: rgba(40,100,60,.35);
  border-color: rgba(80,200,120,.25);
  color: rgba(150,255,180,.90);
}

.town-records .class-badge.restricted {
  background: rgba(120,80,20,.35);
  border-color: rgba(255,180,80,.25);
  color: rgba(255,200,120,.90);
}

.town-records .class-badge.redacted {
  background: rgba(100,20,20,.35);
  border-color: rgba(255,100,100,.25);
  color: rgba(255,150,150,.90);
}

.town-records .rec-expand {
  text-align: right;
  font-size: .80rem;
  opacity: .40;
  font-family: Arial, sans-serif;
  transition: opacity .15s, transform .2s;
}

.town-records .record-row:hover .rec-expand {
  opacity: .70;
}

.town-records .record-row.expanded .rec-expand {
  opacity: .90;
  color: rgba(201,168,76,.9);
}

.town-records .chevron {
  display: inline-block;
  transition: transform .2s;
  font-style: normal;
}

.town-records .record-row.expanded .chevron {
  transform: rotate(180deg);
}

/* Expanded detail panel */
.town-records .record-detail {
  display: none;
  padding: 0 16px 16px 16px;
  background: rgba(0,0,0,.20);
  border-top: 1px solid rgba(255,255,255,.06);
}

.town-records .record-row.expanded .record-detail {
  display: block;
}

.town-records .detail-inner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding-top: 14px;
}

.town-records .detail-text {
  flex: 1;
}

.town-records .detail-meta {
  font-size: .78rem;
  opacity: .55;
  font-family: Arial, sans-serif;
  margin-bottom: 8px;
  letter-spacing: .04em;
}

.town-records .detail-summary {
  font-size: .88rem;
  line-height: 1.6;
  opacity: .85;
}

.town-records .detail-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.town-records .btn-view {
  display: inline-block;
  padding: 10px 20px;
  background: rgba(201,168,76,.15);
  border: 1px solid rgba(201,168,76,.45);
  color: rgba(201,168,76,.95);
  border-radius: 6px;
  font-family: Arial, sans-serif;
  font-size: .82rem;
  font-weight: bold;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.town-records .btn-view:hover {
  background: rgba(201,168,76,.28);
  border-color: rgba(201,168,76,.70);
  color: rgba(201,168,76,1);
}

.town-records .btn-view.disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

.town-records .detail-id {
  font-size: .70rem;
  opacity: .40;
  font-family: 'Courier New', monospace;
  text-align: right;
}

/* No results */
.town-records .no-results {
  padding: 32px 16px;
  text-align: center;
  opacity: .50;
  font-family: Arial, sans-serif;
  font-size: .90rem;
}

/* Footer note */
.town-records .portal-note {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .78rem;
  opacity: .55;
  font-family: Arial, sans-serif;
  text-align: center;
  background: rgba(0,0,0,.15);
}

/* Responsive */
@media (max-width: 860px) {
  .town-records .filters {
    grid-template-columns: 1fr 1fr;
  }

  .town-records .row-head {
    display: none;
  }

  .town-records .record-main {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 8px;
    padding: 12px 14px;
  }

  .town-records .rec-date {
    grid-column: 1;
    grid-row: 2;
    font-size: .75rem;
  }

  .town-records .rec-new {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-end;
  }

  .town-records .rec-title {
    grid-column: 1 / 3;
    grid-row: 1;
    white-space: normal;
    font-size: .92rem;
    font-weight: bold;
    padding-right: 0;
  }

  .town-records .rec-category {
    display: none;
  }

  .town-records .rec-class {
    grid-column: 2;
    grid-row: 3;
    justify-self: end;
  }

  .town-records .rec-expand {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .town-records .detail-inner {
    flex-direction: column;
  }

  .town-records .detail-actions {
    align-items: stretch;
    width: 100%;
  }

  .town-records .btn-view {
    text-align: center;
    padding: 14px 20px;
    font-size: .88rem;
  }
}

@media (max-width: 540px) {
  .town-records .filters {
    grid-template-columns: 1fr;
  }
}
