:root {
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  color: #101a17;
  background: #f8fafc;
  --green: #075f4f;
  --green-dark: #04483d;
  --green-soft: #e8f5f1;
  --line: #dfe7e4;
  --muted: #64736e;
  --surface: #ffffff;
  --soft: #f4f7f6;
  --shadow: 0 14px 35px rgba(12, 42, 34, .07);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f8fafc; }
button, input, select { font: inherit; }
button { color: inherit; }
.lucide { width: 16px; height: 16px; stroke-width: 1.9; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-header { position: sticky; top: 0; z-index: 30; min-height: 76px; padding: 13px max(24px, calc((100vw - 1480px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.header-inner { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--green); border-radius: 12px; box-shadow: 0 8px 20px rgba(7,95,79,.2); }
.brand-mark .lucide { width: 22px; height: 22px; }
.app-header h1 { margin: 0; font-size: 18px; font-weight: 750; letter-spacing: -.035em; }
.app-header p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.listener-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.listener-status::before { width: 7px; height: 7px; border-radius: 50%; background: #98a49f; content: ""; }
.listener-status.connected { color: #056044; background: #e5f6ef; }
.listener-status.connected::before { background: #14a574; box-shadow: 0 0 0 3px rgba(20,165,116,.12); }
.listener-status.warning { color: #8a4b0f; background: #fff2dc; }
.listener-status.warning::before { background: #df8b22; }
.icon-button, .header-actions button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.icon-button:hover, .header-actions button:hover { border-color: #aebdb8; background: var(--soft); }
.icon-button:active, .header-actions button:active { transform: translateY(1px); }
.icon-button:disabled { opacity: .45; cursor: default; }

main { max-width: 1536px; margin: 0 auto; padding: 28px 28px 56px; transition: margin-right .22s ease, max-width .22s ease, padding-right .22s ease; }
body.details-open main { max-width: none; margin-right: 50vw; padding-right: 14px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-heading h2 { margin: 0; font-size: clamp(24px, 2.5vw, 34px); font-weight: 700; letter-spacing: -.045em; }
.page-heading p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.filters { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, .7fr)); gap: 12px; margin-bottom: 16px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 20px rgba(12,42,34,.035); }
.filters label { display: grid; gap: 6px; color: #53625d; font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.input-wrap { position: relative; }
.input-wrap .lucide { position: absolute; top: 50%; left: 12px; color: #84918d; transform: translateY(-50%); pointer-events: none; }
.filters input, .filters select { width: 100%; min-height: 42px; padding: 9px 12px; color: #15211d; background: #fbfcfc; border: 1px solid #dce4e1; border-radius: 10px; outline: none; }
.filters input { padding-left: 38px; }
.filters input:focus, .filters select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7,95,79,.09); background: #fff; }
body.details-open .filters { grid-template-columns: 1fr 1fr; }
body.details-open .search-field { grid-column: span 2; }

.table-shell { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.table-summary { min-height: 54px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.table-summary strong { font-size: 13px; }
.table-summary span { color: var(--muted); font-size: 10px; }
.table-scroll { overflow: auto; }
table { width: 100%; min-width: 1180px; border-collapse: collapse; table-layout: auto; }
th { padding: 11px 12px; color: #64736e; background: #f6f8f7; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { height: 64px; padding: 11px 12px; border-bottom: 1px solid #edf1ef; font-size: 11px; vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .14s ease; }
tbody tr:hover, tbody tr:focus-within { background: #f3faf7; }
tbody tr.selected { background: #e9f5f1; box-shadow: inset 3px 0 var(--green); }
tbody tr:last-child td { border-bottom: 0; }
.route-cell strong { display: flex; align-items: center; gap: 6px; max-width: 320px; font-size: 12px; line-height: 1.4; }
.route-cell strong .lucide { width: 13px; flex: 0 0 auto; color: var(--green); }
.route-cell > span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.status-pill, .type-pill, .source-pill, .data-chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 800; letter-spacing: .025em; white-space: nowrap; }
.status-pill.open { color: #056044; background: #e2f5ed; }
.status-pill.booked { color: #73510a; background: #fff0c9; }
.status-pill.cancelled, .status-pill.expired { color: #963f33; background: #fdeae7; }
.status-pill.unknown { color: #59635f; background: #ecefed; }
.type-pill { color: #315a8d; background: #eaf1fb; }
.source-pill { color: #604b91; background: #eee9fa; }
.data-chip { padding: 4px 7px; color: #3e4e48; background: #f0f4f2; font-weight: 650; }
.data-chip .lucide, .source-pill .lucide { width: 12px; height: 12px; }
.muted { color: var(--muted); }
.time-ago { display: inline-flex; align-items: center; gap: 5px; color: #35453f; font-weight: 650; white-space: nowrap; }
.time-ago .lucide { width: 13px; color: #7a8883; }
.open-cell { color: var(--green); text-align: right; }
.open-cell .lucide { width: 18px; height: 18px; }
.empty { padding: 64px 20px; color: var(--muted); font-size: 12px; text-align: center; }
.empty .lucide { display: block; width: 28px; height: 28px; margin: 0 auto 10px; color: #9aacA6; }

.pagination { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); background: #fbfcfc; }
.page-size { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.page-size select { min-height: 34px; padding: 5px 28px 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.page-controls { display: flex; align-items: center; gap: 8px; }
.page-controls span { min-width: 76px; color: #42514c; font-size: 10px; font-weight: 700; text-align: center; }
.page-controls button { width: 34px; min-height: 34px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.page-controls button:disabled { opacity: .4; cursor: default; }

.drawer-layer { position: fixed; top: 76px; right: 0; bottom: 0; width: 50vw; z-index: 20; border-left: 1px solid var(--line); background: #fff; box-shadow: -16px 0 40px rgba(12,42,34,.08); }
.drawer-backdrop { display: none; }
.drawer { width: 100%; height: 100%; display: flex; flex-direction: column; background: #fff; animation: slide-in .2s ease-out; }
@keyframes slide-in { from { transform: translateX(22px); opacity: .55; } to { transform: translateX(0); opacity: 1; } }
.drawer-header { min-height: 82px; padding: 17px 20px; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.drawer-header span { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.drawer-header h2 { margin: 5px 0 0; font-size: 18px; line-height: 1.35; letter-spacing: -.025em; }
.drawer-close { align-self: start; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.drawer-content { padding: 20px; overflow: auto; }
.drawer-status { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.detail-section { margin-bottom: 22px; }
.detail-section h3 { margin: 0 0 9px; color: #60706a; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); gap: 1px; }
.detail { min-height: 70px; padding: 12px; background: #fff; }
.detail.wide { grid-column: span 2; }
.detail span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.detail strong { display: block; margin-top: 6px; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drawer-actions a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 9px; color: #fff; background: var(--green); font-size: 10px; font-weight: 750; text-decoration: none; }
.drawer-actions a:hover { background: var(--green-dark); }
.drawer-actions a.secondary { color: var(--green); background: var(--green-soft); }
.drawer-actions a.secondary:hover { background: #dcefe9; }
.drawer-actions .lucide { width: 14px; }
.source-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.source-list li { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 11px; }
.source-list li:last-child { border-bottom: 0; }
.source-list span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
details.dev { border: 1px solid var(--line); border-radius: 12px; background: #fbfcfc; }
details.dev summary { padding: 12px; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.dev-content { display: grid; gap: 12px; padding: 0 12px 12px; }
.dev-content h4 { margin: 0 0 5px; font-size: 9px; text-transform: uppercase; }
pre { margin: 0; max-height: 320px; overflow: auto; padding: 11px; border-radius: 8px; color: #33403b; background: #f1f5f3; font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 960px) {
  .app-header, main { padding-left: 16px; padding-right: 16px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: span 2; }
  body.details-open main { margin-right: 0; padding-right: 16px; }
  .drawer-layer { top: 76px; width: min(640px, 100vw); }
  .drawer-backdrop { position: fixed; inset: 0; display: block; background: rgba(13,27,22,.24); }
  .drawer { position: relative; z-index: 1; }
}
@media (max-width: 620px) {
  .app-header { min-height: 68px; }
  .brand-mark { width: 38px; height: 38px; }
  .app-header p, #last-updated, #listener-status { display: none; }
  main { padding-top: 20px; }
  .filters { grid-template-columns: 1fr; }
  .search-field, body.details-open .search-field { grid-column: span 1; }
  .table-summary { align-items: flex-start; flex-direction: column; gap: 3px; padding-top: 12px; padding-bottom: 12px; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .page-controls { width: 100%; justify-content: space-between; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail.wide { grid-column: span 1; }
  .drawer-layer { top: 68px; }
}
