:root {
    color-scheme: light;
    --bg: #f8faf7;
    --ink: #17231c;
    --muted: #5b665f;
    --accent: #0b6e69;
    --line: #cfd8d1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

main {
    width: min(44rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 4rem 0;
}

h1 {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 6vw, 4rem);
    line-height: 1;
}

p {
    color: var(--muted);
    font-size: 1.125rem;
}

a {
    color: var(--accent);
    text-decoration-thickness: 0.12em;
    text-underline-offset: 0.2em;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.65rem 0.75rem;
    background: #fff;
    color: var(--ink);
}

label span {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.admin-shell {
    width: min(64rem, calc(100% - 2rem));
}

.admin-header,
.form-grid,
.detail-list {
    display: grid;
    gap: 1rem;
}

.admin-header {
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-form {
    display: grid;
    gap: 1rem;
    max-width: 44rem;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-rides-table {
    min-width: 52rem;
}

.admin-ride-actions-cell {
    min-width: 15rem;
}

.admin-ride-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.admin-ride-actions form {
    margin: 0;
}

.button-compact {
    min-height: 2.25rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
}

.admin-rides-table th {
    font-size: 0.75rem;
}

.admin-rides-table td {
    font-size: 0.85rem;
}

.admin-ride-rename {
    position: relative;
}

.admin-ride-rename > summary {
    list-style: none;
}

.admin-ride-rename > summary::-webkit-details-marker {
    display: none;
}

.admin-ride-rename[open] > form {
    display: grid;
    gap: 0.6rem;
    width: min(20rem, calc(100vw - 3rem));
    margin-top: 0.4rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
    background: #fff;
}

.admin-ride-action-error {
    margin-top: 0.5rem;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border: 0;
    border-radius: 6px;
    padding: 0.65rem 0.9rem;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button-secondary {
    border: 1px solid var(--accent);
    background: #fff;
    color: var(--accent);
}

.button-danger {
    border: 1px solid #a11f1f;
    background: #a11f1f;
    color: #fff;
}

.button-danger:hover,
.button-danger:focus-visible {
    background: #7f1717;
}

.ride-link-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: -0.5rem 0 2rem;
}

.eyebrow,
.form-error {
    margin: 0;
    font-size: 0.875rem;
}

.eyebrow {
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
}

.form-error {
    color: #a11f1f;
}

.form-error-summary {
    margin-bottom: 1rem;
}

.notice-success {
    border: 1px solid #9ac7a9;
    border-radius: 6px;
    padding: 0.75rem;
    background: #eef8f1;
    color: #245a35;
}

.admin-preview-notice {
    display: grid;
    gap: 0.65rem;
    border: 1px solid #d5a51d;
    border-radius: 8px;
    padding: 0.85rem;
    background: #fff8dc;
    color: #5d4700;
}

.admin-preview-notice p {
    margin: 0;
}

.one-time-link {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.one-time-link p {
    margin: 0;
    color: inherit;
}

.compact-form {
    margin-bottom: 1.5rem;
}

.status-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    background: #fff;
    font-weight: 700;
}

.detail-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 1rem 0 2rem;
}

.detail-list div {
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.75rem;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0.25rem 0 0;
}

.status-list {
    display: grid;
    gap: 0.75rem;
    padding: 0;
    list-style: none;
}

.status-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
}

.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;
}

.rider-shell {
    display: grid;
    gap: 1.25rem;
    width: min(42rem, calc(100% - 2rem));
    padding: 2rem 0 3rem;
}

.rider-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.rider-header h1 {
    margin-top: 0.25rem;
}

.ride-status {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    background: #fff;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 800;
}

.ride-status--live {
    border-color: #147b4a;
    background: #e7f7ed;
    color: #0d5b35;
}

.ride-status--ended {
    background: #eef0ee;
    color: var(--muted);
}

.ride-start,
.ride-description,
.rider-card p,
.rider-guidance p,
.listen-card p {
    margin: 0;
}

.listen-card,
.rider-card,
.rider-guidance {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: clamp(1rem, 4vw, 1.5rem);
    background: #fff;
}

.listen-card {
    display: grid;
    gap: 1rem;
    border-color: #87aaa5;
    box-shadow: 0 8px 24px rgb(23 35 28 / 8%);
}

.listen-card h2,
.rider-card h2,
.rider-guidance h2 {
    margin: 0;
    line-height: 1.2;
}

.listen-button {
    width: 100%;
    min-height: 4rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
}

.listen-button:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink);
    font-weight: 700;
}

.connection-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #6b746e;
}

.connection-status[data-connection-state="connecting"] .connection-dot,
.connection-status[data-connection-state="reconnecting"] .connection-dot {
    background: #9a6500;
}

.connection-status[data-connection-state="listening"] .connection-dot,
.connection-status[data-connection-state="publishing"] .connection-dot {
    background: #147b4a;
}

.connection-status[data-connection-state="disconnected"] .connection-dot {
    background: #a11f1f;
}

.listen-note {
    color: var(--muted);
    font-size: 0.95rem;
}

.ride-audio-player {
    width: 100%;
    min-height: 3rem;
}

.latest-alert {
    border-left: 0.35rem solid var(--accent);
}

.latest-alert[data-alert-type="emergency"] {
    border-left-color: #b42318;
    background: #fff4f2;
}

.latest-alert[data-alert-category="danger"] {
    border-left-color: #b42318;
    background: #fff4f2;
}

.latest-alert[data-alert-category="caution"] {
    border-left-color: #9a6500;
    background: #fff9df;
}

.latest-alert[data-alert-category="information"] {
    border-left-color: #147b4a;
    background: #effaf4;
}

.emergency-alert-banner {
    position: sticky;
    top: 0.5rem;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    align-items: center;
    margin: 0.75rem 0 1rem;
    border: 2px solid #8f1711;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    color: #fff;
    background: #b42318;
    box-shadow: 0 0.45rem 1.2rem rgb(70 13 10 / 28%);
}

.emergency-alert-banner[hidden] {
    display: none;
}

.emergency-alert-banner .eyebrow,
.emergency-alert-banner h2,
.emergency-alert-banner p {
    margin: 0;
    color: inherit;
}

.emergency-alert-banner h2 {
    font-size: clamp(1.35rem, 6vw, 1.85rem);
    line-height: 1;
}

.emergency-alert-banner [data-emergency-alert-message] {
    margin-top: 0.25rem;
    font-weight: 700;
}

.emergency-alert-icon {
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
}

.active-alert-overlay {
    position: fixed;
    right: 0.75rem;
    bottom: calc(5.75rem + env(safe-area-inset-bottom));
    left: 0.75rem;
    z-index: 35;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    width: min(38rem, calc(100% - 1.5rem));
    margin: 0 auto;
    border: 2px solid #147b4a;
    border-radius: 14px;
    padding: 0.8rem;
    color: #0c5935;
    background: #effaf4;
    box-shadow: 0 0.55rem 1.5rem rgb(23 35 28 / 28%);
}

.active-alert-overlay[hidden] {
    display: none;
}

.active-alert-overlay[data-alert-category="danger"] {
    border-color: #b42318;
    color: #7a1710;
    background: #fff4f2;
}

.active-alert-overlay[data-alert-category="caution"] {
    border-color: #9a6500;
    color: #5d3d00;
    background: #fff9df;
}

.active-alert-overlay[data-alert-category="information"] {
    border-color: #147b4a;
    color: #0c5935;
    background: #effaf4;
}

.active-alert-overlay[data-alert-type="emergency"] {
    border-color: #8f1711;
    color: #fff;
    background: #b42318;
}

.active-alert-overlay-copy,
.active-alert-overlay .eyebrow,
.active-alert-overlay-message,
.active-alert-overlay-detail {
    min-width: 0;
    margin: 0;
    color: inherit;
}

.active-alert-overlay-message {
    margin-top: 0.1rem;
    font-size: 1.1rem;
    font-weight: 850;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.active-alert-overlay-detail {
    margin-top: 0.15rem;
    font-size: 0.82rem;
}

.active-alert-overlay-icon {
    width: 2rem;
    height: 2rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.active-alert-overlay-dismiss {
    display: inline-grid;
    place-items: center;
    align-self: start;
    width: 2.75rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0;
    color: inherit;
    background: transparent;
    font-size: 1.65rem;
    line-height: 1;
    cursor: pointer;
}

.active-alert-overlay-dismiss:hover {
    background: rgb(255 255 255 / 55%);
}

.active-alert-overlay[data-alert-type="emergency"] .active-alert-overlay-dismiss:hover {
    background: rgb(255 255 255 / 18%);
}

.active-alert-overlay-dismiss:focus-visible {
    outline: 3px solid #f2a900;
    outline-offset: 2px;
}

.ride-crew {
    display: grid;
    gap: 0.75rem;
}

.ride-crew-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ride-crew-list li {
    display: grid;
    gap: 0.2rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.85rem;
    background: #f7faf8;
}

.ride-crew-name {
    overflow-wrap: anywhere;
    font-weight: 800;
}

.ride-crew-role {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.ride-crew-contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.45rem;
}

.ride-crew-contact-actions .crew-contact-action {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.9rem;
}

.join-card {
    display: grid;
    gap: 0.75rem;
}

.join-card h2 {
    margin: 0;
}

.rider-session-form,
.rider-session-actions {
    display: grid;
    gap: 0.75rem;
}

.rider-session-form {
    margin-top: 0.25rem;
}

.rider-session-actions {
    margin-top: 0.5rem;
}

.rider-session-actions form {
    margin: 0;
}

.rider-session-button {
    min-height: 3rem;
}

.field-help {
    color: var(--muted);
    font-size: 0.9rem;
}

.ride-messages {
    display: grid;
    gap: 1rem;
}

.ride-messages-heading,
.ride-message-actions,
.ride-message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ride-messages-heading h2,
.ride-messages-heading p,
.ride-message-list,
.ride-message p,
.ride-message-form,
.ride-message-actions p,
.chat-paused {
    margin: 0;
}

.chat-settings-detail {
    margin-top: -0.5rem;
    font-size: 0.78rem;
}

.message-transport,
.ride-message-kind {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    background: #eef3ef;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.ride-message-list {
    display: grid;
    gap: 0.75rem;
    max-height: 24rem;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.ride-message,
.ride-message-empty {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.85rem;
    background: #f7faf8;
}

.ride-message--broadcast {
    border-left: 0.35rem solid #744210;
    background: #fff8e8;
}

.ride-message--broadcast .ride-message-kind {
    border-color: #b88b47;
    background: #fff0c9;
}

.ride-message-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.ride-message-meta time {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.8rem;
}

.ride-message-form {
    display: grid;
    gap: 0.75rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.ride-message-form textarea {
    resize: vertical;
}

.ride-message-actions .button,
.chat-settings-button {
    flex: 0 0 auto;
    min-height: 3rem;
}

.chat-paused {
    border: 1px solid #d3b36c;
    border-radius: 8px;
    padding: 0.75rem;
    background: #fff8e8;
    color: #694612;
    font-weight: 700;
}

.danger-zone {
    margin-top: 3rem;
    border-top: 2px solid #d8a2a2;
    padding-top: 1.5rem;
}

.danger-zone h2 {
    color: #8b1717;
}

.confirmation-dialog {
    width: min(30rem, calc(100% - 2rem));
    border: 1px solid #d8a2a2;
    border-radius: 12px;
    padding: 1.5rem;
    color: var(--ink);
}

.confirmation-dialog::backdrop {
    background: rgb(23 35 28 / 58%);
}

.confirmation-dialog form {
    display: grid;
    gap: 1rem;
}

.confirmation-dialog h2,
.confirmation-dialog p {
    margin: 0;
}

.confirmation-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

.leader-management-list,
.leader-shell {
    display: grid;
    gap: 1rem;
}

.leader-management-list {
    margin: 1rem 0 2rem;
}

.leader-management-card,
.leader-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
}

.leader-management-card > header,
.leader-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.leader-management-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.crew-login-action {
    padding: 0.4rem 0.65rem;
    font-size: 0.9rem;
}

.leader-management-card h3,
.leader-card h2 {
    margin: 0;
}

.leader-edit-form,
.leader-management-actions {
    display: grid;
    gap: 0.75rem;
}

.leader-edit-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1rem;
}

.leader-edit-form .button {
    align-self: end;
}

.leader-management-actions {
    grid-template-columns: repeat(2, max-content);
    margin-top: 1rem;
}

.leader-management-actions form {
    margin: 0;
}

.crew-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.crew-bulk-actions .field-help {
    flex: 1 1 20rem;
    margin: 0;
}

.crew-contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.55rem;
}

.crew-contact-action {
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.75rem;
}

.crew-contact-icon {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
}

.leader-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.leader-meta dt {
    color: var(--muted);
    font-weight: 700;
}

.leader-meta dd {
    margin: 0.2rem 0 0;
}

.leader-shell {
    width: min(58rem, calc(100% - 2rem));
    padding: 2rem 0 3rem;
}

.leader-shell :focus-visible {
    outline: 3px solid #f2a900;
    outline-offset: 3px;
}

.leader-identity {
    margin: 0.5rem 0 0;
}

.leader-access-card,
.leader-connection-card,
.leader-alert-card,
.leader-metric-card {
    display: grid;
    gap: 1rem;
}

.leader-connection-card {
    gap: 0.65rem;
}

.leader-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.leader-section-heading h2,
.leader-alert-card h2,
.leader-metric-card h2,
.leader-metric-card p {
    margin: 0;
}

.leader-connection-status {
    flex: 0 0 auto;
    margin: 0;
}

.leader-connect-button {
    width: 100%;
    min-height: 3.5rem;
    font-size: 1.1rem;
}

.leader-shell .button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.leader-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.leader-connection-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(6.75rem, 0.32fr);
    align-items: stretch;
    gap: 0.65rem;
}

.leader-audio-buttons {
    display: grid;
    gap: 0.5rem;
}

.leader-microphone-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-height: 3.25rem;
}

.leader-microphone-toggle strong {
    color: var(--muted);
}

.leader-microphone-toggle[aria-checked="true"] {
    border-color: var(--accent);
    background: #e3f4ef;
}

.leader-microphone-toggle[aria-checked="true"] strong {
    color: var(--accent);
}

.leader-live-riders {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.15rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.5rem;
    background: #f7faf8;
    text-align: center;
}

.leader-live-riders p,
.leader-broadcast-summary {
    margin: 0;
}

.leader-live-riders .leader-metric {
    font-size: clamp(2.25rem, 8vw, 3.5rem);
}

.leader-live-riders-detail {
    font-size: 0.75rem;
    line-height: 1.15;
}

.active-ride-panel .leader-live-riders .eyebrow,
.active-ride-panel .leader-broadcast-summary .eyebrow {
    display: inline;
    font-size: 0.7rem;
}

.leader-broadcast-summary {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.leader-broadcast-summary strong {
    color: var(--ink);
}

.leader-button-row,
.leader-alert-grid {
    display: grid;
    gap: 0.75rem;
}

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

.leader-button-row .button,
.leader-alert-button {
    width: 100%;
    min-height: 3rem;
}

.alert-icon-definitions {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.leader-alert-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.leader-alert-button {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.35rem;
    min-height: 7.25rem;
    border-width: 2px;
    padding: 0.8rem 0.55rem;
    text-align: center;
    line-height: 1.15;
}

.leader-alert-icon {
    width: 2.15rem;
    height: 2.15rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.leader-alert-label {
    font-weight: 850;
}

.leader-alert-severity {
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.leader-alert-button--danger {
    border-color: #b42318;
    color: #7a1710;
    background: #fff4f2;
}

.leader-alert-button--caution {
    border-color: #9a6500;
    color: #5d3d00;
    background: #fff9df;
}

.leader-alert-button--information {
    border-color: #147b4a;
    color: #0c5935;
    background: #effaf4;
}

.leader-alert-button--danger:hover,
.leader-alert-button--danger:focus-visible {
    background: #ffe0dc;
}

.leader-alert-button--caution:hover,
.leader-alert-button--caution:focus-visible {
    background: #ffefad;
}

.leader-alert-button--information:hover,
.leader-alert-button--information:focus-visible {
    background: #d9f2e4;
}

.leader-metric {
    font-size: clamp(2.5rem, 8vw, 4rem);
    line-height: 1;
}

.leader-contact-list {
    display: grid;
    gap: 0.75rem;
    padding: 0;
    list-style: none;
}

.leader-contact-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.leader-contacts-card {
    display: grid;
    gap: 0.45rem;
}

.leader-contacts-description {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.leader-contacts-card .leader-contact-list {
    gap: 0.5rem;
    margin: 0;
}

.leader-contacts-card .leader-contact-list li {
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.leader-contacts-card .crew-contact-actions {
    flex-wrap: nowrap;
    gap: 0.35rem;
    margin: 0;
}

.leader-contacts-card .crew-contact-action {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0;
}

.joined-name {
    color: var(--accent);
}

.playlist-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.playlist-link {
    min-height: 2.75rem;
}

.rider-guidance {
    background: #eef8f1;
}

.active-ride-mode {
    width: min(58rem, calc(100% - 1rem));
    padding: 0.5rem 0 calc(5.5rem + env(safe-area-inset-bottom));
    font-size: 12px;
    line-height: 1.3;
}

.active-ride-mode .rider-header,
.active-ride-mode .leader-header {
    align-items: start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.ride-lifecycle-notice {
    margin: 0 0 0.5rem;
    border: 1px solid #d6b66b;
    border-radius: 10px;
    padding: 8px 10px;
    color: #4c3700;
    background: #fff7db;
    font-size: 12px;
    font-weight: 750;
}

.active-ride-mode h1 {
    max-width: 18ch;
    margin-bottom: 0;
    font-size: clamp(1.4rem, 5vw, 1.75rem);
    line-height: 1.05;
}

.rider-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
}

.active-rider-identity {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    max-width: 11rem;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.3rem 0.55rem;
    color: var(--ink);
    background: #fff;
    font-weight: 800;
    text-decoration: none;
}

.active-rider-identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-rider-identity svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.active-ride-panels {
    min-height: calc(100dvh - 8rem - env(safe-area-inset-bottom));
}

.active-ride-panel {
    display: grid;
    align-content: start;
    gap: 0.5rem;
    min-height: calc(100dvh - 8rem - env(safe-area-inset-bottom));
    outline: none;
}

.active-ride-panel[hidden] {
    display: none;
}

.active-ride-panel > .rider-card,
.active-ride-panel > .leader-card,
.active-ride-panel > .listen-card,
.active-ride-panel > .rider-guidance,
.active-ride-panel > .ride-info {
    margin: 0;
}

.active-ride-panel > .rider-card,
.active-ride-panel > .leader-card,
.active-ride-panel > .listen-card,
.active-ride-panel > .rider-guidance {
    gap: 0.5rem;
    border-radius: 10px;
    padding: 10px 12px;
}

.active-ride-panel h2,
.active-ride-panel h3 {
    font-size: 16px;
    line-height: 1.15;
}

.active-ride-panel .eyebrow {
    display: none;
}

.active-ride-panel .latest-alert {
    gap: 3px;
    border-left-width: 3px;
    padding-block: 9px;
}

.active-ride-panel .latest-alert [data-alert-detail],
.active-ride-panel .latest-broadcast time,
.active-ride-panel .field-help,
.active-ride-panel .ride-message-meta {
    font-size: 11px;
}

.active-ride-panel .message-transport {
    display: none;
}

.active-ride-panel button,
.active-ride-panel a.button,
.active-ride-panel summary {
    min-height: 44px;
}

.active-ride-panel .ride-message-list {
    max-height: min(44dvh, 28rem);
    gap: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.active-ride-panel .ride-message,
.active-ride-panel .ride-message-empty,
.active-ride-panel .ride-crew-list li {
    border-radius: 8px;
    padding: 8px;
}

.active-ride-panel .ride-message-meta,
.active-ride-panel .ride-message-form,
.active-ride-panel .ride-message-actions,
.active-ride-panel .rider-session-form,
.active-ride-panel .rider-session-actions {
    gap: 6px;
}

.active-ride-panel .listen-button {
    min-height: 44px;
    font-size: 14px;
}

.active-ride-panel .leader-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin: 6px 0;
}

.active-ride-panel .leader-meta > div {
    border-radius: 8px;
    padding: 6px 8px;
    background: #f1f6f3;
}

.active-ride-panel .leader-meta dt {
    font-size: 10px;
}

.active-ride-panel .leader-meta dd {
    margin-top: 1px;
    font-size: 11px;
    font-weight: 750;
}

.active-ride-panel .leader-contact-list,
.active-ride-panel .ride-crew-list {
    grid-template-columns: 1fr;
    gap: 6px;
}

.active-ride-panel .leader-contact-list li,
.active-ride-panel .ride-crew-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 5px 7px;
}

.crew-role-group {
    display: grid;
    gap: 4px;
}

.crew-role-group + .crew-role-group {
    margin-top: 4px;
}

.crew-role-heading {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.active-ride-panel .ride-crew-contact-actions {
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0;
}

.active-ride-panel .crew-contact-action {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
}

.active-ride-panel .leader-metric {
    font-size: 28px;
}

.active-ride-panel .post-ride-summary {
    border-color: #86c8ad;
    background: linear-gradient(135deg, #e8fff5 0%, #f8fffb 100%);
}

.active-ride-panel .post-ride-summary h2 {
    font-size: 20px;
}

.post-ride-time,
.post-ride-last-item {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.ended-action-card button:disabled,
.ended-action-card textarea:disabled,
.ended-message-form button:disabled,
.ended-message-form textarea:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.ended-disabled-field,
.ended-message-form label {
    display: grid;
    gap: 4px;
    font-weight: 750;
}

.ended-disabled-field textarea,
.ended-message-form textarea {
    resize: none;
}

.active-ride-panel .post-ride-next {
    border-color: #a7b7f2;
    background: #f2f5ff;
}

.active-ride-nav {
    position: fixed;
    right: 0.5rem;
    bottom: calc(0.35rem + env(safe-area-inset-bottom));
    left: 0.5rem;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
    width: min(44rem, calc(100% - 1rem));
    margin: 0 auto;
    border: 1px solid #31433a;
    border-radius: 16px;
    padding: 0.3rem;
    background: #17231c;
    box-shadow: 0 0.65rem 1.8rem rgb(23 35 28 / 32%);
}

.active-ride-nav[hidden] {
    display: none;
}

.active-ride-nav button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    padding: 0.4rem 0.2rem;
    color: #eef8f1;
    background: transparent;
    font-size: 12px;
    font-weight: 800;
}

.active-ride-badge {
    display: inline-grid;
    min-width: 17px;
    height: 17px;
    place-items: center;
    border-radius: 999px;
    padding-inline: 4px;
    color: #fff;
    background: #b42318;
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
}

.active-ride-badge[hidden] {
    display: none;
}

.active-ride-nav button[aria-selected="true"] {
    color: #10211a;
    background: #9fe8d3;
}

.active-ride-nav button:focus-visible,
.active-rider-identity:focus-visible,
.active-rider-identity-editor summary:focus-visible {
    outline: 3px solid #f2a900;
    outline-offset: 2px;
}

.active-rider-identity-editor > summary {
    cursor: pointer;
    min-height: 44px;
    font-weight: 800;
}

.active-ride-mode .ride-info {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 12px;
    background: #fff;
}

.active-ride-mode .ride-info > summary {
    cursor: pointer;
    min-height: 44px;
    font-weight: 800;
}

.active-ride-mode .ride-info[open] > summary {
    margin-bottom: 0.4rem;
}

.active-ride-mode .join-card[data-rider-joined="true"] {
    padding-block: 8px;
}

.active-ride-mode .livestream-music {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 6px 10px;
}

.active-ride-mode .livestream-music .eyebrow {
    display: none;
}

.active-ride-mode .livestream-music h2 {
    margin: 0;
    font-size: 13px;
}

.active-ride-mode .livestream-music .playlist-links {
    display: flex;
    width: auto;
    margin: 0;
}

.active-ride-mode .playlist-link {
    width: auto;
    min-height: 44px;
    padding: 5px 8px;
    font-size: 11px;
}

.playlist-service-icon {
    margin-right: 3px;
    font-size: 14px;
}

.active-ride-mode .leader-identity {
    margin-top: 2px;
    font-size: 11px;
}

.active-ride-mode .ride-status {
    padding: 4px 10px;
    font-size: 12px;
}

.active-ride-mode .leader-alert-card {
    gap: 6px;
}

.active-ride-mode .leader-alert-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.active-ride-mode .leader-alert-button {
    gap: 2px;
    min-height: 80px;
    border-width: 1px;
    padding: 6px 4px;
}

.active-ride-mode .leader-alert-icon {
    width: 24px;
    height: 24px;
}

.active-ride-mode .leader-alert-label {
    font-size: 12px;
}

.active-ride-mode .leader-alert-severity {
    font-size: 10px;
}

.active-ride-mode .leader-alert-card [data-alert-send-status] {
    margin: 0;
}

.playlist-label-active {
    display: none;
}

.active-ride-mode .playlist-label-default {
    display: none;
}

.active-ride-mode .playlist-label-active {
    display: inline;
}

.latest-broadcast time {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

@media (max-width: 640px) {
    .admin-table-wrap {
        overflow: visible;
    }

    .admin-rides-table,
    .admin-rides-table tbody,
    .admin-rides-table tr,
    .admin-rides-table td {
        display: block;
        min-width: 0;
        width: 100%;
    }

    .admin-rides-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .admin-rides-table tr {
        margin-bottom: 0.75rem;
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: 0.45rem;
        background: #fff;
    }

    .admin-rides-table td {
        display: grid;
        grid-template-columns: 5rem minmax(0, 1fr);
        gap: 0.4rem;
        border: 0;
        padding: 0.25rem;
    }

    .admin-rides-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.68rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .admin-rides-table .admin-ride-actions-cell {
        display: block;
        padding-top: 0.75rem;
        border-top: 1px solid var(--line);
    }

    .admin-rides-table .admin-ride-actions-cell::before {
        display: block;
        margin-bottom: 0.5rem;
    }

    .admin-ride-rename[open] > form {
        width: 100%;
    }

    .admin-header,
    .form-grid,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .rider-shell {
        width: min(100% - 1rem, 42rem);
        padding-top: 1rem;
    }

    .rider-header {
        display: grid;
    }

    .active-ride-mode .rider-header {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .active-ride-mode .leader-header {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .leader-management-card > header,
    .leader-header,
    .leader-management-header-actions,
    .leader-section-heading,
    .leader-contact-list li {
        display: grid;
    }

    .leader-edit-form,
    .leader-management-actions,
    .leader-meta,
    .ride-crew-list {
        grid-template-columns: 1fr;
    }

    .active-ride-panel .leader-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .leader-management-actions .button,
    .leader-management-actions form,
    .leader-management-header-actions .button,
    .leader-edit-form .button,
    .crew-bulk-actions .button {
        width: 100%;
    }

    .leader-dashboard-grid,
    .leader-button-row {
        grid-template-columns: 1fr;
    }

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

    .ride-status {
        justify-self: start;
    }

    .playlist-links,
    .playlist-link,
    .rider-session-button {
        width: 100%;
    }

    .active-ride-mode .playlist-links,
    .active-ride-mode .playlist-link {
        width: auto;
    }

    .active-ride-mode .leader-alert-button {
        min-height: 80px;
    }

    .confirmation-dialog-actions,
    .confirmation-dialog-actions .button {
        width: 100%;
    }

    .ride-messages-heading,
    .ride-message-actions {
        display: grid;
    }

    .ride-message-actions .button,
    .chat-settings-button {
        width: 100%;
    }

    .ride-message-meta time {
        width: 100%;
        margin-left: 0;
    }
}
