:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --ink: #16212c;
  --muted: #647386;
  --line: #d9e2ea;
  --teal: #118477;
  --teal-soft: #e1f3f0;
  --amber: #b7791f;
  --amber-soft: #fff4db;
  --red: #c2413a;
  --red-soft: #fde8e5;
  --green: #147a4f;
  --green-soft: #e2f5eb;
  --shadow: 0 18px 50px rgba(22, 33, 44, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.login-shell {
  width: min(620px, calc(100vw - 32px));
  margin: 48px auto;
}

.login-shell .brand {
  color: var(--ink);
}

.sidebar {
  background: #132530;
  color: #eaf2f5;
  padding: 24px 18px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 750;
  margin-bottom: 28px;
}

.app-brand {
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}

.app-brand-logo {
  display: block;
  width: min(100%, 208px);
  height: auto;
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
}

.app-brand-link {
  color: inherit;
  text-decoration: none;
}

.app-brand-link:hover .app-brand-logo {
  border-color: rgba(17, 132, 119, 0.42);
}

.app-brand-link:focus-visible {
  outline: 3px solid rgba(17, 132, 119, 0.45);
  outline-offset: 5px;
  border-radius: 8px;
}

.app-product-name {
  color: #c7d5dc;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-shell .app-brand {
  align-items: center;
  margin-bottom: 22px;
}

.login-shell .app-brand-logo {
  width: min(100%, 260px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-shell .app-product-name {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 4px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 6px;
  background: transparent;
  color: #b8c9d0;
  text-align: left;
  font-size: 14px;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.main {
  min-width: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.agency {
  display: grid;
  gap: 3px;
}

.agency strong {
  font-size: 16px;
}

.agency span {
  color: var(--muted);
  font-size: 13px;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal) !important;
  padding: 0 8px;
  font-size: 11px !important;
  font-weight: 750;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(42vw, 480px);
}

.search {
  width: min(34vw, 380px);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
}

.workspace-search-form .search {
  flex: 1;
  min-width: 0;
  width: auto;
}

.search-submit {
  white-space: nowrap;
}

.icon-btn,
.primary,
.secondary,
.quiet {
  min-height: 38px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
}

.icon-btn {
  width: 38px;
  background: var(--surface-2);
  color: var(--ink);
}

.notification-button {
  position: relative;
}

.notification-button span {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.primary {
  background: var(--teal);
  color: #fff;
  padding: 0 14px;
}

.issued-ticket-button {
  font-weight: 800;
  border-color: var(--teal);
}

.secondary {
  background: var(--surface-2);
  color: var(--ink);
  padding: 0 12px;
}

.danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f3b9bd;
  padding: 0 12px;
}

.action-link {
  text-decoration: none;
}

.quiet {
  background: transparent;
  color: var(--teal);
  padding: 0 8px;
}

.content {
  padding: 22px 26px 34px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  min-width: 0;
}

.page-head > *,
.agency,
.top-actions,
.workspace-search-form {
  min-width: 0;
}

.page-head h1,
.page-head p,
.agency strong,
.agency span,
.panel-head h2,
.panel-head p {
  overflow-wrap: anywhere;
}

.search-panel {
  margin-bottom: 18px;
}

.notification-panel {
  margin-bottom: 18px;
}

.notification-list {
  display: grid;
  padding: 8px 16px 16px;
}

.notification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 13px;
}

.notification-row:last-child {
  border-bottom: 0;
}

.notification-row strong,
.notification-row span,
.notification-row time {
  display: block;
}

.notification-row span,
.notification-row time {
  color: var(--muted);
}

.notification-row.unread strong {
  color: var(--red);
}

.search-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.search-group {
  display: grid;
  align-content: start;
  gap: 8px;
}

.search-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.search-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
}

.search-row strong,
.search-row span {
  display: block;
}

.search-row span {
  color: var(--muted);
  margin-top: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

.muted {
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.report-panel {
  box-shadow: none;
}

.report-panel-wide {
  grid-column: 1 / -1;
}

.workspace-subscription-panel {
  margin-bottom: 18px;
  box-shadow: none;
}

.subscription-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.subscription-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 14px 14px;
}

.usage-panel {
  box-shadow: none;
  margin-bottom: 18px;
}

.access-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--amber);
  border-radius: 6px;
  background: var(--amber-soft);
  color: #5c3d0f;
}

.access-banner div,
.access-lock {
  display: grid;
  gap: 5px;
}

.access-banner span,
.access-lock span {
  font-size: 13px;
  line-height: 1.45;
}

.access-lock {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: #5c3d0f;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.usage-row {
  display: grid;
  gap: 12px;
  min-height: 112px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px;
  background: var(--surface);
}

.usage-row strong,
.usage-row span {
  display: block;
}

.usage-row strong {
  font-size: 14px;
}

.usage-row span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.usage-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.usage-bar span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.usage-row.warning .usage-bar span {
  background: var(--amber);
}

.usage-row.limit .usage-bar span {
  background: var(--red);
}

.check-row {
  display: grid;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 13px;
}

.check-row strong,
.check-row span {
  display: block;
}

.check-row {
  grid-template-columns: 26px minmax(0, 1fr);
}

.check-dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

.check-row.done .check-dot {
  background: var(--green-soft);
  color: var(--green);
}

.check-row.blocked .check-dot {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-bars,
.staff-list,
.mini-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.status-bar-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.status-bar-row strong,
.status-bar-row span {
  display: block;
}

.status-bar-row span,
.staff-row span,
.staff-row small,
.mini-row span,
.mini-row time,
.empty-note {
  color: var(--muted);
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.staff-row,
.mini-row {
  display: grid;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.staff-row {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.9fr);
}

.staff-row strong,
.staff-row span,
.staff-row small,
.mini-row strong,
.mini-row span,
.mini-row time {
  display: block;
}

.staff-metrics {
  text-align: right;
}

.staff-list.compact {
  padding: 0;
}

.staff-admin {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.settings-form {
  padding: 16px;
}

.support-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.retention-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.backup-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.system-list {
  display: grid;
  padding: 8px 16px 16px;
}

.system-list.compact {
  padding: 0;
}

.system-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 13px;
}

.system-row:last-child {
  border-bottom: 0;
}

.system-row strong,
.system-row span {
  display: block;
}

.system-row > div > span {
  color: var(--muted);
  margin-top: 3px;
}

.system-row.failed strong {
  color: var(--danger);
}

.system-row.warning strong {
  color: #7a4b0b;
}

.system-row.blocked strong {
  color: var(--red);
}

.system-row.local strong {
  color: #7a4b0b;
}

.readiness-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 16px 4px;
}

.readiness-summary > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 11px 12px;
}

.readiness-summary strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.retention-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.retention-stats > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 11px 12px;
}

.retention-stats strong {
  color: var(--ink);
  font-size: 18px;
}

.ticket-list {
  display: grid;
  gap: 10px;
}

.closed-ticket-archive {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 14px;
}

.closed-ticket-archive > summary {
  cursor: pointer;
  font-weight: 700;
}

.closed-ticket-archive[open] > summary {
  margin-bottom: 12px;
}

.document-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.audit-list {
  display: grid;
  padding: 8px 16px 16px;
}

.ticket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 13px;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
}

.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 13px;
}

.audit-row:last-child {
  border-bottom: 0;
}

.ticket-row strong,
.ticket-row span,
.document-row strong,
.document-row span,
.audit-row strong,
.audit-row span,
.audit-row time {
  display: block;
}

.document-row > div > span {
  color: var(--muted);
  margin-top: 3px;
}

.travel-record-row {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr) auto;
}

.record-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.audit-row > div > span,
.audit-meta {
  color: var(--muted);
}

.audit-meta {
  text-align: right;
  font-size: 12px;
}

.invite-form {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.status-strip,
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.user-actions {
  justify-content: flex-end;
  align-items: center;
  margin-top: 0;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
}

.staff-metrics span {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.mini-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.mini-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.empty-note {
  margin: 0;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
  gap: 18px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.single-column {
  display: grid;
  gap: 18px;
  width: 100%;
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head > *,
.extract-row > *,
.extraction-head > *,
.record-summary > *,
.upload-form > *,
.message-box > * {
  min-width: 0;
}

.panel-head h2 {
  font-size: 16px;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.panel-head p,
.extract-row p,
.extraction-head span,
.empty-note,
.note-row,
.delivery-row,
.message-box,
.setup-note {
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.queue-filter {
  display: none;
}

.tab {
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 650;
}

.tab.active {
  background: var(--teal-soft);
  color: var(--teal);
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-wrap table {
  min-width: 640px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fafbfd;
}

tr.selected {
  background: #f1fbf9;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.Pending,
.DueToday {
  background: var(--teal-soft);
  color: var(--teal);
}

.Completed {
  background: var(--green-soft);
  color: var(--green);
}

.Overdue {
  background: var(--amber-soft);
  color: var(--amber);
}

.ReservationPendingTicket {
  background: var(--amber-soft);
  color: var(--amber);
}

.Critical {
  background: var(--red-soft);
  color: var(--red);
}

.next-actions-table table {
  min-width: 560px;
}

.next-actions-table th:first-child,
.next-actions-table td:first-child {
  width: 56px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.next-action-row td {
  vertical-align: middle;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.link-button {
  display: inline;
  border: 0;
  background: transparent;
  color: var(--teal);
  padding: 0;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.link-button:hover {
  text-decoration: underline;
}

.compact-action {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.record-summary,
.upload-form,
.message-box {
  padding: 16px;
}

.passenger-profile {
  overflow: hidden;
}

.profile-grid,
.library-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 18px;
  padding: 16px;
}

.profile-section {
  display: grid;
  align-content: start;
  gap: 14px;
}

.profile-section h3,
.profile-message-box h3 {
  margin: 0;
  font-size: 15px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-card-list,
.library-categories,
.message-type-list {
  display: grid;
  gap: 8px;
}

.task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px;
  font-size: 13px;
}

.task-card.selected {
  border-color: rgba(17, 132, 119, 0.55);
  background: var(--teal-soft);
}

.task-card strong,
.task-card span {
  display: block;
}

.task-card > div > span {
  color: var(--muted);
  margin-top: 3px;
}

.profile-message-box {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.message-library {
  border-top: 1px solid var(--line);
}

.library-categories button,
.message-type-list button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.library-categories button {
  display: grid;
  gap: 3px;
  padding: 12px;
}

.library-categories button span {
  color: var(--muted);
  font-size: 12px;
}

.library-categories button.active,
.message-type-list button.active {
  border-color: rgba(17, 132, 119, 0.55);
  background: var(--teal-soft);
  color: var(--teal);
}

.message-type-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.message-type-list button {
  min-height: 38px;
  padding: 9px 10px;
  font-size: 13px;
}

.record-row-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.document-unavailable {
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.usage-periods {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.records-clarification {
  display: grid;
  gap: 4px;
  margin: 16px 16px 0;
  border: 1px solid rgba(17, 132, 119, 0.18);
  border-radius: 6px;
  background: var(--teal-soft);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}

.records-clarification strong {
  color: var(--ink);
}

.records-clarification span {
  color: var(--muted);
}

.usage-month {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.usage-month.archived {
  background: #fbfcfd;
}

.usage-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.usage-month-head strong,
.usage-month-head span {
  display: block;
}

.usage-month-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.upcoming-periods {
  padding-top: 0;
}

.completion-periods {
  padding-top: 0;
}

.audit-periods {
  padding-top: 0;
}

.completion-list {
  padding: 12px 14px 14px;
}

.completion-actions {
  padding-top: 12px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px 0;
}

.pagination-page {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.pagination-page.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.record-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
}

.record-notes {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.notes-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.notes-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.note-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 9px 10px;
  font-size: 13px;
}

.note-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.record-note-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.message {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  line-height: 1.5;
  color: var(--ink);
}

.task-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.task-detail-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.audit-line {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.contact-log {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.delivery-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.delivery-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  font-size: 13px;
}

.delivery-row strong,
.delivery-row span,
.delivery-row time {
  display: block;
}

.delivery-row span {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

fieldset.form-grid {
  border: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
}

.form-grid label,
.full {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.compact-checks {
  gap: 10px;
}

.compact-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-checks input {
  width: auto;
}

.full {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  font-size: 13px;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.field-help {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.upload-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.setup-note {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.setup-note strong {
  color: var(--ink);
}

.manual-journey-confirmation {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: #5c3d0f;
}

.manual-journey-confirmation > label {
  margin-top: 6px;
  color: #5c3d0f;
}

.verification-edit-banner {
  border-color: #b8d8d2;
  background: #eef8f6;
}

.verification-edit-banner strong {
  color: var(--teal-dark);
}

.verification-evidence {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.verification-evidence-head {
  display: grid;
  gap: 3px;
}

.verification-evidence-head strong {
  color: var(--ink);
  font-size: 14px;
}

.verification-evidence-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.session-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.session-tools p {
  margin-top: 4px;
}

.auth-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.auth-message {
  border: 1px solid #b8d8d2;
  border-radius: 6px;
  background: #eef8f6;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  padding: 10px 12px;
}

.auth-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-status p {
  margin-top: 4px;
}

.extract-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.extraction-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 12px;
}

.extraction-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.extraction-head strong,
.extraction-head span {
  display: block;
}

.extraction-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
}

.extraction-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
}

.parser-warnings {
  margin-top: 12px;
  border: 1px solid var(--amber);
  border-radius: 6px;
  background: var(--amber-soft);
  color: #5c3d0f;
  padding: 10px 12px;
  font-size: 13px;
}

.parser-warnings strong,
.parser-warnings p {
  margin: 0;
}

.parser-warnings p {
  margin-top: 4px;
}

.legs-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.legs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.legs-head strong {
  font-size: 13px;
}

.legs-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.legs-list {
  display: grid;
}

.leg-review {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.leg-review label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.leg-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.leg-row:last-child {
  border-bottom: 0;
}

.leg-row strong,
.leg-row span {
  display: block;
}

.leg-row span,
.leg-row time {
  color: var(--muted);
}

.leg-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

details {
  margin-top: 12px;
}

summary {
  color: var(--teal);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

pre {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #132530;
  color: #fff;
  border-radius: 6px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .report-grid,
  .usage-grid,
  .search-results {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) and (orientation: landscape), (max-height: 560px) and (orientation: landscape) {
  .shell {
    display: block;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    min-height: 0;
    padding: 14px 16px;
  }

  .app-brand {
    align-items: flex-start;
    margin-bottom: 14px;
  }

  .app-brand-logo {
    width: min(220px, 62vw);
    padding: 7px 9px;
  }

  .app-product-name {
    font-size: 11px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 8px;
    max-width: 100%;
    max-height: 132px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 2px 6px;
    -webkit-overflow-scrolling: touch;
  }

  .nav button {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    justify-content: flex-start;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    width: 100%;
    max-width: 100%;
    gap: 10px;
  }

  .workspace-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    min-width: 0;
  }

  .workspace-search-form .search-submit {
    min-height: 44px;
    padding-inline: 16px;
  }

  .top-actions .primary {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    white-space: normal;
  }

  .content {
    padding: 18px 16px 28px;
  }

  .page-head,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .page-head h1 {
    font-size: clamp(30px, 6vw, 40px);
  }

  .panel-head > * {
    max-width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    position: relative;
  }

  .shell {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100vw;
  }

  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    padding: 20px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav button {
    min-width: 0;
    justify-content: flex-start;
  }

  .topbar,
  .page-head,
  .panel-head,
  .top-actions,
  .session-tools,
  .auth-status {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .content,
  .page-head,
  .workspace,
  .single-column,
  .panel,
  .side-stack,
  .record-summary,
  .upload-form,
  .message-box,
  .extraction-box,
  .legs-box {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .content > * {
    max-width: 100%;
    min-width: 0;
  }

  .panel-head > *,
  .extract-row > *,
  .extraction-head > *,
  .leg-review > *,
  .form-grid > * {
    max-width: 100%;
    min-width: 0;
  }

  .workspace-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    min-width: 0;
  }

  .workspace-search-form .search-submit {
    width: auto;
    min-height: 44px;
    padding-inline: 16px;
  }

  .search {
    width: 100%;
  }

  .top-actions,
  .session-tools,
  .auth-status,
  .extract-row,
  .extraction-head,
  .upload-actions {
    gap: 10px;
  }

  .extract-row,
  .extraction-head {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-actions {
    justify-content: stretch;
  }

  .upload-actions .primary,
  .extract-row .secondary,
  .top-actions .primary,
  .message-actions .secondary {
    width: 100%;
  }

  .message-actions {
    justify-content: stretch;
  }

  .travel-record-row,
  .record-list-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: none;
  }

  .queue-filter {
    display: grid;
    gap: 6px;
    padding: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0;
  }

  .queue-filter select {
    min-height: 42px;
    color: var(--teal);
    font-size: 15px;
    font-weight: 750;
    text-transform: none;
  }

  .table-wrap {
    margin-inline: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  .table-wrap table {
    min-width: 0;
  }

  [data-section="tasks"] .table-wrap {
    overflow-x: hidden;
  }

  [data-section="tasks"] table,
  [data-section="tasks"] thead,
  [data-section="tasks"] tbody,
  [data-section="tasks"] tr,
  [data-section="tasks"] td {
    display: block;
    width: 100%;
  }

  [data-section="tasks"] thead {
    display: none;
  }

  [data-section="tasks"] tbody {
    padding: 0 12px 12px;
  }

  [data-section="tasks"] tr {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    margin-top: 10px;
    overflow: hidden;
  }

  [data-section="tasks"] td {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    overflow-wrap: anywhere;
  }

  [data-section="tasks"] td:last-child {
    border-bottom: 0;
  }

  [data-section="tasks"] td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  [data-section="tasks"] td[colspan] {
    display: block;
  }

  [data-section="tasks"] td[colspan]::before {
    content: "";
    display: none;
  }

  [data-section="tasks"] .row-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .metrics,
  .subscription-summary,
  .retention-stats,
  .readiness-summary,
  .status-bar-row,
  .staff-row,
  .ticket-row,
  .delivery-row,
  .profile-grid,
  .library-grid,
  .task-card,
  .notification-row,
  .mini-row,
  .form-grid,
  .extraction-grid,
  .record-grid {
    grid-template-columns: 1fr;
  }

  [data-form="supabase-agency-registration"] .registration-country {
    order: 1;
  }

  [data-form="supabase-agency-registration"] .registration-mobile {
    order: 2;
  }

  [data-form="supabase-agency-registration"] .registration-city {
    order: 3;
  }

  .message-type-list {
    grid-template-columns: 1fr;
  }

  .section-title-row,
  .message-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .record-row-actions {
    justify-items: stretch;
  }

  .leg-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .leg-review {
    grid-template-columns: 1fr;
  }

  .leg-row time {
    grid-column: 2;
  }

  .content {
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .sidebar,
  .topbar,
  .content {
    padding-left: 14px;
    padding-right: 14px;
  }
}

.quick-actions-toggle {
  display: none;
}

@media (max-width: 760px), (max-width: 980px) and (orientation: landscape), (max-height: 560px) and (orientation: landscape) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 16px;
  }

  .topbar .agency {
    min-width: 0;
  }

  .topbar .agency strong,
  .topbar .agency span {
    overflow-wrap: anywhere;
  }

  .quick-actions-toggle {
    display: inline-flex;
    justify-self: end;
    align-self: start;
    min-width: 46px;
    min-height: 46px;
    padding: 0 12px;
    gap: 8px;
    white-space: nowrap;
  }

  .quick-actions-toggle span {
    display: inline;
  }

  .topbar .top-actions {
    grid-column: 1 / -1;
    display: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .topbar .top-actions.is-open {
    display: grid;
  }

  .topbar .workspace-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    min-width: 0;
    gap: 10px;
  }

  .topbar .workspace-search-form .search {
    width: 100%;
    min-width: 0;
  }

  .topbar .notification-button {
    width: 46px;
    min-height: 46px;
    justify-self: start;
  }

  .topbar .primary {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .quick-actions-toggle span {
    display: none;
  }
}

@media (max-width: 980px) and (orientation: landscape), (max-height: 560px) and (orientation: landscape) {
  .sidebar {
    overflow: hidden;
  }

  .sidebar .nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding: 2px 2px 10px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar .nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: 150px;
  }
}
