h1:focus {
    outline: none;
}

:root {
    color-scheme: light;
    /* Aliases for the shared tokens (_content/Sabre.Shared.Web/css/theme-tokens.css, linked before this
       file), so the page rules below keep their names and a tenant theme reaches the mobile app. The chrome
       tokens (--sabre-chrome-*) come from the same file. */
    --surface: var(--gnt-surface-2);
    --panel: var(--gnt-surface-color);
    --ink: var(--gnt-text-color);
    --muted: var(--gnt-muted-color);
    --line: var(--gnt-border-soft);
    --blue: var(--gnt-primary-color);
    --green: var(--gnt-success-color);
    --amber: var(--gnt-warning-color);
    --teal: var(--gnt-info-color);
    --red: var(--gnt-danger-color);
    --violet: var(--gnt-chart-5);
}

* {
    box-sizing: border-box;
}

html,
body {
    background: var(--surface);
    color: var(--ink);
    font-family: "OpenSansRegular", "Segoe UI", Arial, sans-serif;
    margin: 0;
    min-height: 100%;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.mobile-shell {
    min-height: 100vh;
    position: relative;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--green) 12%, transparent), transparent 190px),
        var(--surface);
}

.mobile-shell-sword {
    height: auto;
    left: max(12px, env(safe-area-inset-left));
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    width: min(132px, calc(100vw - 24px));
    z-index: 12;
}

.mobile-app-layout {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

.mobile-app-topbar {
    align-items: center;
    background: var(--sabre-chrome-bg);
    color: var(--sabre-chrome-fg);
    border-bottom: 1px solid var(--sabre-chrome-border);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 64px;
    padding: max(10px, env(safe-area-inset-top)) 14px 10px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-app-brand {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--sabre-chrome-fg);
    display: flex;
    gap: 10px;
    min-width: 0;
    padding: 0;
    text-align: left;
}

.mobile-app-brand span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mobile-app-brand strong,
.mobile-app-brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-app-brand small {
    color: var(--sabre-chrome-fg-muted);
    font-size: 0.75rem;
}

.brand-mark--compact {
    border-radius: 6px;
    flex: 0 0 auto;
    font-size: 1rem;
    height: 34px;
    width: 112px;
}

.mobile-app-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.mobile-app-selectors {
    align-items: end;
    display: grid;
    flex: 1 1 auto;
    gap: 8px;
    grid-template-columns: minmax(140px, 1.3fr) minmax(110px, 0.8fr);
    max-width: 520px;
    min-width: 0;
}

.mobile-app-selectors label {
    color: var(--sabre-chrome-fg-muted);
    display: flex;
    flex-direction: column;
    font-size: 0.68rem;
    font-weight: 800;
    gap: 3px;
    letter-spacing: 0;
    min-width: 0;
    text-transform: uppercase;
}

.mobile-app-selectors select {
    appearance: none;
    background:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%),
        var(--panel);
    background-position:
        calc(100% - 16px) 16px,
        calc(100% - 10px) 16px,
        100% 0;
    background-repeat: no-repeat;
    background-size: 6px 6px, 6px 6px, 2.3rem 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    height: 38px;
    min-width: 0;
    overflow: hidden;
    padding: 7px 36px 7px 10px;
    text-overflow: ellipsis;
    width: 100%;
}

.mobile-app-selectors select:focus {
    border-color: var(--green);
    outline: 3px solid color-mix(in srgb, var(--green) 16%, transparent);
}

.mobile-app-status {
    background: var(--gnt-warning-tint);
    border-bottom: 1px solid var(--gnt-warning-border);
    color: var(--gnt-warning-text);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 8px 14px;
}

.mobile-app-content {
    min-width: 0;
}

.mobile-app-tabbar {
    background: var(--sabre-chrome-bg);
    border-top: 1px solid var(--sabre-chrome-border);
    bottom: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    position: sticky;
    z-index: 10;
}

.mobile-app-tabbar button {
    background: color-mix(in srgb, var(--sabre-chrome-fg) 10%, transparent);
    border: 1px solid var(--sabre-chrome-border);
    border-radius: 6px;
    color: var(--sabre-chrome-fg);
    font-size: 0.78rem;
    font-weight: 800;
    min-height: 42px;
    min-width: 0;
    padding: 0 6px;
}

.mobile-app-tabbar button:active {
    background: color-mix(in srgb, var(--sabre-chrome-fg) 20%, transparent);
}

.auth-page,
.app-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 auto;
    max-width: 760px;
    min-height: 100vh;
    padding: 28px 18px calc(24px + env(safe-area-inset-bottom));
}

.mobile-app-layout .app-page {
    min-height: auto;
    padding-bottom: 18px;
}

.app-page--environment-signin {
    align-items: center;
    background: var(--panel);
    justify-content: center;
    max-width: none;
    padding: 24px;
}

.auth-page {
    justify-content: center;
}

.auth-page--signin {
    align-items: center;
    background: var(--panel);
    gap: 0;
    max-width: none;
    padding: 24px;
}

.auth-welcome {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: center;
}

.auth-warrior {
    height: 118px;
    width: 118px;
}

.auth-welcome h1 {
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.2;
}

.brand-lockup,
.app-header {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.brand-lockup {
    justify-content: flex-start;
}

.brand-mark {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    font-size: 1.5rem;
    font-weight: 800;
    height: 52px;
    justify-content: center;
    width: 52px;
}

img.brand-mark {
    display: block;
    object-fit: contain;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(2rem, 2.4rem, 2.4rem);
    letter-spacing: 0;
    line-height: 1.05;
    margin: 0;
}

.auth-form,
.detail-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--gnt-shadow-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
}

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-form--signin {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    gap: 10px;
    padding: 0;
}

.auth-form label,
.search-box {
    color: var(--muted);
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    font-weight: 700;
    gap: 7px;
}

.auth-form input,
.search-box input {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    min-height: 46px;
    padding: 10px 12px;
}

.auth-form input:focus,
.search-box input:focus {
    border-color: var(--green);
    outline: 3px solid color-mix(in srgb, var(--green) 16%, transparent);
}

.primary-action,
.text-button,
.icon-button,
.capture-bar button {
    border: 0;
    border-radius: 6px;
    font-weight: 800;
    min-height: 44px;
    padding: 0 14px;
}

.primary-action {
    background: var(--green);
    color: var(--gnt-text-inverse);
    width: 100%;
}

.primary-action:disabled {
    background: var(--gnt-text-faint);
}

.login-action {
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 400;
    min-height: 32px;
    padding: 4px 10px;
    width: auto;
}

.primary-action.login-action {
    background: var(--gnt-primary-color);
    color: var(--gnt-text-inverse);
}

.primary-action.login-action:disabled {
    background: var(--gnt-primary-border);
    color: var(--gnt-text-inverse);
}

.secondary-action.login-action {
    background: var(--panel);
    border: 1px solid var(--gnt-primary-color);
    color: var(--gnt-primary-color);
}

.secondary-action.login-action:disabled {
    border-color: var(--gnt-primary-border);
    color: var(--gnt-primary-border);
}

.text-button {
    background: var(--gnt-hover-bg);
    color: var(--ink);
}

.icon-button {
    background: var(--gnt-text-strong);
    color: var(--gnt-text-inverse);
    font-size: 0.72rem;
    min-width: 52px;
}

.form-error {
    background: var(--gnt-danger-tint);
    border: 1px solid var(--gnt-danger-border);
    border-radius: 6px;
    color: var(--gnt-danger-text);
    margin: 0;
    padding: 10px 12px;
}

.loading-message {
    color: var(--muted);
    margin: 0;
}

.environment-signin {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: min(420px, 100%);
    text-align: center;
    width: 100%;
}

.environment-signin__warrior {
    height: 118px;
    margin-bottom: 18px;
    object-fit: contain;
    width: 118px;
}

.environment-signin h1 {
    color: var(--gnt-text-strong);
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1.2;
    margin: 0 0 8px;
}

.environment-signin p {
    color: var(--gnt-text-strong);
    margin: 0 0 22px;
}

.environment-selector {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.environment-selector select {
    appearance: none;
    background:
        linear-gradient(45deg, transparent 50%, var(--gnt-text-secondary) 50%),
        linear-gradient(135deg, var(--gnt-text-secondary) 50%, transparent 50%),
        var(--panel);
    background-position:
        calc(100% - 18px) 15px,
        calc(100% - 12px) 15px,
        calc(100% - 2.1rem) 0;
    background-repeat: no-repeat;
    background-size: 6px 6px, 6px 6px, 1px 100%;
    border: 1px solid var(--gnt-border-color);
    border-radius: 4px;
    color: var(--gnt-text-color);
    height: 32px;
    padding: 4px 44px 4px 8px;
    width: min(300px, 100%);
}

.environment-selector select:focus {
    border-color: var(--gnt-primary-border);
    outline: 3px solid color-mix(in srgb, var(--gnt-focus-color) 25%, transparent);
}

.environment-signin__button {
    min-height: 33px;
    padding: 5px 10px;
}

.environment-signin__signout {
    background: transparent;
    border: 0;
    color: var(--gnt-muted-color);
    font-size: 0.85rem;
    margin-top: 16px;
    padding: 4px 8px;
}

.environment-list,
.record-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.environment-card,
.record-row,
.module-tile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    text-align: left;
}

.environment-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 16px;
}

.environment-card strong {
    font-size: 1.1rem;
}

.environment-status,
.record-status {
    align-self: flex-start;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 8px;
}

.environment-status.production {
    background: var(--gnt-success-tint);
    color: var(--green);
}

.environment-status.non-production {
    background: var(--gnt-warning-tint);
    color: var(--amber);
}

.card-footer,
.record-row small,
.tile-description,
.tile-meta {
    color: var(--muted);
}

.context-strip {
    display: flex;
    gap: 8px;
    margin: 0 -18px;
    overflow-x: auto;
    padding: 0 18px 4px;
}

.context-pill {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    flex: 0 0 auto;
    font-weight: 800;
    min-height: 40px;
    padding: 0 14px;
}

.context-pill.selected {
    background: var(--gnt-text-strong);
    border-color: var(--gnt-text-strong);
    color: var(--gnt-text-inverse);
}

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

.module-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 178px;
    padding: 14px;
    position: relative;
}

.module-tile::before {
    border-radius: 8px 8px 0 0;
    content: "";
    height: 4px;
    left: -1px;
    position: absolute;
    right: -1px;
    top: -1px;
}

.module-tile.blue::before {
    background: var(--blue);
}

.module-tile.green::before {
    background: var(--green);
}

.module-tile.amber::before {
    background: var(--amber);
}

.module-tile.teal::before {
    background: var(--teal);
}

.module-tile.red::before {
    background: var(--red);
}

.module-tile.violet::before {
    background: var(--violet);
}

.tile-kicker {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.tile-title {
    font-size: 1.18rem;
    font-weight: 900;
    line-height: 1.15;
}

.tile-description {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.35;
}

.tile-meta {
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    gap: 2px;
}

.tile-meta strong {
    color: var(--red);
}

.capture-bar {
    background: color-mix(in srgb, var(--gnt-surface-color) 92%, transparent);
    border: 1px solid var(--line);
    border-radius: 8px;
    bottom: max(14px, env(safe-area-inset-bottom));
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
    padding: 8px;
    position: sticky;
}

.capture-bar button {
    background: var(--gnt-text-strong);
    color: var(--gnt-text-inverse);
    min-width: 0;
}

.search-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.record-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 72px;
    padding: 14px;
}

.record-row span:first-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.record-row strong,
.record-row small {
    overflow-wrap: anywhere;
}

.record-status {
    background: var(--gnt-hover-bg);
    color: var(--green);
    white-space: nowrap;
}

.field-row {
    align-items: flex-start;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding-top: 12px;
}

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

.field-row strong {
    text-align: right;
}

.detail-actions {
    position: static;
}

@media (max-width: 420px) {
    .mobile-app-topbar {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .mobile-app-brand {
        flex: 1 1 calc(100% - 60px);
    }

    .mobile-app-selectors {
        flex-basis: 100%;
        max-width: none;
        order: 3;
    }

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

    h1 {
        font-size: 2rem;
    }
}

.status-bar-safe-area {
    display: none;
}

@supports (-webkit-touch-callout: none) {
    .status-bar-safe-area {
        display: flex;
        position: sticky;
        top: 0;
        height: env(safe-area-inset-top);
        background-color: var(--gnt-surface-2);
        width: 100%;
        z-index: 1;
    }

    .flex-column, .navbar-brand {
        padding-left: env(safe-area-inset-left);
    }
}

/* Form layouts on the phone (form-templates design note FT-P2). */
.layout-tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.layout-tab {
    flex: 0 0 auto;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
}

.layout-tab.is-active {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--gnt-text-inverse);
}

.layout-page-heading {
    margin: 1rem 0 0.25rem;
    font-size: 1.05rem;
}

.layout-section {
    margin-top: 0.75rem;
}

.layout-section-title,
.layout-group-title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
}

.layout-group {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--line);
}

.layout-text {
    margin: 0.35rem 0;
    white-space: pre-wrap;
}

.layout-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 0.5rem 0;
}

/* ---------------------------------------------------------------------------------------------
   Responsive layout. The rules above are the phone (one column, full-width bars). From here the same
   pages widen for a tablet and a laptop/desktop browser: the content column grows, tiles and record
   lists use more columns, and the bottom action bar stops stretching edge to edge. Nothing here depends
   on detecting the device; it follows the window, so a resized browser or a rotated tablet re-lays out.
   Same tokens as above, so a tenant theme still applies. */

/* Mobile browsers' collapsing address bar makes 100vh taller than the visible page; dvh is the visible height. */
@supports (height: 100dvh) {
    .mobile-shell,
    .mobile-app-layout,
    .auth-page,
    .app-page {
        min-height: 100dvh;
    }

    .mobile-app-layout .app-page {
        min-height: auto;
    }
}

/* Landscape phone: the bars use a lot of a short screen, so let them go slim. */
@media (max-height: 480px) and (orientation: landscape) {
    .mobile-app-topbar {
        min-height: 48px;
        padding-bottom: 6px;
        padding-top: max(6px, env(safe-area-inset-top));
    }

    .mobile-app-tabbar button {
        min-height: 34px;
    }

    .mobile-app-tabbar {
        padding-bottom: max(4px, env(safe-area-inset-bottom));
        padding-top: 4px;
    }
}

/* Tablet and up. */
@media (min-width: 700px) {
    /* Only the pages inside the app shell widen; the sign-in pages stay centred panels. */
    .mobile-app-layout .app-page {
        max-width: 980px;
        padding-left: 28px;
        padding-right: 28px;
    }

    .module-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }

    .environment-list,
    .record-list {
        display: grid;
        gap: 14px;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .mobile-app-topbar {
        padding-left: 24px;
        padding-right: 24px;
    }

    /* The five actions are thumb-sized targets on a phone; on a wide screen they sit together in the middle. */
    .mobile-app-tabbar {
        grid-template-columns: repeat(5, minmax(0, 150px));
        justify-content: center;
    }

    .capture-bar {
        margin-left: auto;
        margin-right: auto;
        max-width: 520px;
        width: 100%;
    }
}

/* Laptop and desktop. */
@media (min-width: 1100px) {
    .mobile-app-layout .app-page {
        max-width: 1280px;
    }

    .mobile-app-selectors {
        max-width: 640px;
    }
}

/* A mouse or trackpad can hover; a finger can't, so only a pointer device gets the hover cue. */
@media (hover: hover) and (pointer: fine) {
    .module-tile:not(:disabled):hover,
    .record-row:hover,
    .environment-card:hover {
        border-color: var(--blue);
        box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 12%, transparent);
    }

    .module-tile:not(:disabled),
    .record-row {
        transition: border-color 0.12s ease, box-shadow 0.12s ease;
    }
}
