/* OneBreadCrumb Auth — design tokens from the NextGen Tailwind config
   (libs/tailwind/tailwind.config.js). Kept as plain CSS so the Auth host
   doesn't pull in a frontend build pipeline. */

@font-face {
    font-family: 'Geist';
    src: url('/fonts/Geist-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Geist';
    src: url('/fonts/Geist-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Geist';
    src: url('/fonts/Geist-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Geist';
    src: url('/fonts/Geist-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;

    /* Brand-guideline named tokens — the source of truth for colour decisions.
       Per the guidelines: copy is always Forest or Hardhat; Cone is the hero
       accent (not Hi-Vis); secondary palette (Khaki / Tarpaulin / Clay / Hi-Vis)
       is used for accents and surfaces, never for body text. */
    --forest:       #1B2B1D;
    --hardhat:      #FFFFFF;
    --cone:         #FF7230;
    --cone-deep:    #E55B1F;   /* derived — primary button hover */
    --cone-darker:  #C44A18;   /* derived — primary button active */
    --khaki:        #4E6129;
    --tarpaulin:    #C9D09A;
    --tarpaulin-50: #F1F3E6;   /* derived — subtle on-brand surface tint */
    --clay:         #FFB273;
    --hi-vis:       #F4F55B;

    /* Neutral ramp (Forest-derived green-grey) — UI scaffolding only,
       never used for primary copy. */
    --neutral-0:    var(--hardhat);
    --neutral-50:   #FAFBFA;
    --neutral-100:  #F6F6F6;
    --neutral-200:  #EFF0EF;
    --neutral-300:  #E4E6E4;
    --neutral-400:  #D1D5D2;
    --neutral-500:  #98A099;
    --neutral-600:  #768077;
    --neutral-700:  #5F6B61;
    --neutral-800:  #49554A;
    --neutral-900:  #324034;
    --neutral-950:  var(--forest);

    /* Semantic — danger stays red (no brand colour defined for errors);
       warning uses Hi-Vis per the guideline's high-attention role. */
    --red-100:  #FEE5E2;
    --red-700:  #CA3521;
    --red-800:  #AE2A19;
    --blue-700: #0C66E4;       /* links only */
    --blue-800: #1153BC;

    --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --shadow-raised:  0 0 1px 0 rgba(0, 0, 0, 0.6), 0 3px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-overlay: 0 0 1px 0 rgba(0, 0, 0, 0.6), 0 8px 12px 0 rgba(0, 0, 0, 0.08);

    /* Forest with alpha — visible against every surface incl. Cone CTAs. */
    --focus-ring: 0 0 0 2px rgba(27, 43, 29, 0.55);
}

*, *::before, *::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

html {
    background: var(--tarpaulin-50);
}

html, body {
    margin: 0;
    padding: 0;
    color: var(--forest);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.45;
    min-height: 100%;
}

body {
    background: transparent;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url('/images/background.jpg') center / cover no-repeat;
    filter: blur(3px) brightness(0.6);
    transform: scale(1.05);
    z-index: -1;
    pointer-events: none;
}

a {
    color: var(--blue-700);
    text-decoration: none;
}
a:hover {
    color: var(--blue-800);
    text-decoration: underline;
}

/* ----- App shell ----- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-header {
    height: 72px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--neutral-0);
    border-bottom: 1px solid var(--neutral-200);
}
.auth-header .logo {
    height: 24px;
    width: auto;
    display: block;
}
.auth-header .topnav {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    font-weight: 500;
}
.auth-header .topnav a {
    color: var(--neutral-800);
}
.auth-header .topnav a:hover {
    color: var(--neutral-950);
    text-decoration: none;
}
.auth-header .topnav form {
    margin: 0;
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: safe center;
    justify-content: center;
    padding: 32px 16px;
}

/* ----- Card ----- */

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--neutral-0);
    box-shadow: var(--shadow-raised);
    padding: 32px;
    border-radius: 10px;
}

.auth-card-logo {
    height: 32px;
    width: auto;
    margin-bottom: 24px;
    display: block;
}

.auth-title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--neutral-950);
    margin: 0 0 8px;
}

.auth-subtitle {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--neutral-700);
    margin: 0 0 24px;
}
.auth-subtitle strong {
    color: var(--neutral-950);
    font-weight: 600;
}

/* ----- Form fields ----- */

.field {
    display: block;
    margin-bottom: 16px;
}
.field-label,
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--neutral-800);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="email"],
select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--neutral-300);
    background: var(--neutral-0);
    color: var(--neutral-950);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 0;
}

select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%231B2B1D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

input:focus,
select:focus {
    border-color: var(--cone);
    box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled {
    background: var(--neutral-100);
    color: var(--neutral-600);
    cursor: not-allowed;
}

.field-row {
    display: flex;
    gap: 8px;
}
.field-row > .field-country {
    flex: 0 0 140px;
}
.field-row > .field-grow {
    flex: 1 1 auto;
}

/* OTP — single numeric input styled to feel like grouped digit cells.
   Used as the no-JS fallback; the script replaces it with .otp-group. */
.otp-input {
    text-align: center;
    letter-spacing: 0.55em;
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' on;
    padding-left: 0.55em;
    height: 56px;
}

.otp-group {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.otp-box {
    flex: 1 1 0;
    min-width: 0;
    max-width: 56px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--neutral-950);
    background: var(--neutral-0);
    border: 1px solid var(--neutral-300);
    border-radius: 8px;
    padding: 0;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.otp-box:focus,
.otp-box:focus-visible {
    outline: none;
    border-color: var(--cone);
    box-shadow: var(--focus-ring);
}

.otp-box:disabled {
    background: var(--neutral-200);
    color: var(--neutral-700);
}

/* ----- Buttons ----- */

button,
.btn {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 0 20px;
    height: 44px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--neutral-950);
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
    border-radius: 0;
    white-space: nowrap;
}

button:focus-visible,
.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

button.primary,
.btn-primary {
    background: var(--cone);
    color: var(--hardhat);
}
button.primary:hover,
.btn-primary:hover {
    background: var(--cone-deep);
}
button.primary:active,
.btn-primary:active {
    background: var(--cone-darker);
}

button.primary.loading {
    position: relative;
    cursor: progress;
}
button.primary.loading .btn-label {
    padding-left: 22px;
}
button.primary.loading::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

button.secondary,
.btn-secondary {
    background: var(--neutral-0);
    color: var(--neutral-950);
    border-color: var(--neutral-300);
}
button.secondary:hover,
.btn-secondary:hover {
    background: var(--neutral-100);
    border-color: var(--neutral-400);
}

button.linklike,
.btn-link {
    background: none;
    color: var(--blue-700);
    padding: 0;
    height: auto;
    border: 0;
    font-size: 14px;
    font-weight: 500;
}
button.linklike:hover,
.btn-link:hover {
    color: var(--blue-800);
    text-decoration: underline;
}

button:disabled,
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
}
.actions .btn,
.actions button {
    width: 100%;
}
.actions-row {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}
.actions-row > * {
    flex: 1;
}

/* ----- Messaging ----- */

.error,
.alert-error {
    display: block;
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--red-800);
    background: var(--red-100);
    border-left: 3px solid var(--red-700);
}

.alert-warning {
    display: block;
    margin: 12px 0;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--forest);
    background: var(--hi-vis);
    border-left: 3px solid var(--khaki);
}

.alert-info {
    display: block;
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--blue-800);
    background: var(--neutral-200);
    border-left: 3px solid var(--blue-700);
}

.other-ways {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--neutral-200);
}

.other-ways-title {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--neutral-700);
}

.other-ways-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.other-ways-list li {
    margin: 4px 0;
}

.other-ways-list form {
    margin: 0;
}

.link-button {
    background: none;
    border: 0;
    padding: 4px 0;
    font: inherit;
    font-size: 14px;
    color: var(--blue-700);
    cursor: pointer;
    text-align: left;
}

.link-button:hover:not([disabled]) {
    color: var(--blue-800);
    text-decoration: underline;
}

.link-button[disabled] {
    color: var(--neutral-700);
    cursor: not-allowed;
}

.cooldown {
    margin-left: 6px;
    font-size: 13px;
    color: var(--neutral-700);
}

.muted {
    color: var(--neutral-700);
    font-size: 14px;
}
.muted strong {
    color: var(--neutral-950);
    font-weight: 600;
}

.hint {
    color: var(--neutral-700);
    font-size: 13px;
    margin: -8px 0 16px;
}

small {
    color: var(--neutral-700);
    font-size: 12px;
}

/* ----- Misc layout ----- */

.backlink {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--neutral-700);
    margin-bottom: 16px;
}
.backlink:hover {
    color: var(--neutral-950);
    text-decoration: none;
}

.inline-form {
    display: inline;
    margin: 0;
}

.divider {
    height: 1px;
    background: var(--neutral-200);
    margin: 20px 0;
}

/* SSO alternate link below the primary CTA on the sign-in page */
.sso-alt {
    text-align: center;
    margin: 20px 0 0;
    font-size: 13px;
    color: var(--neutral-700);
}

/* ----- Consent — scope list ----- */

.scope-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 16px;
    border-top: 1px solid var(--neutral-200);
}
.scope-list li {
    padding: 10px 0 10px 28px;
    border-bottom: 1px solid var(--neutral-200);
    position: relative;
    font-size: 14px;
    color: var(--neutral-950);
}
.scope-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 14px;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3e%3cpath d='M2.5 7.5L5.5 10.5L11.5 4' stroke='%231F845A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
}

.consent-meta {
    font-size: 13px;
    color: var(--neutral-700);
    margin: 0 0 12px;
}
.consent-meta strong {
    color: var(--neutral-950);
}

/* ----- Index page (signed-in landing) ----- */

.profile-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 6px 16px;
    margin: 0 0 20px;
    font-size: 14px;
}
.profile-grid dt {
    color: var(--neutral-700);
    font-weight: 500;
}
.profile-grid dd {
    margin: 0;
    color: var(--neutral-950);
    font-weight: 500;
}

.companies h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--neutral-950);
    margin: 20px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.company-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    border-top: 1px solid var(--neutral-200);
    max-height: 300px;
    overflow-y: auto;
}
.company-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--neutral-200);
    color: var(--neutral-950);
    font-weight: 500;
}
.companies p.muted {
    margin: 0 0 16px;
}

.card-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--neutral-300);
    padding: 14px 16px;
    margin-top: 16px;
    color: var(--neutral-950);
    transition: background-color 120ms ease, border-color 120ms ease;
}
.card-link:hover {
    background: var(--tarpaulin-50);
    border-color: var(--tarpaulin);
    text-decoration: none;
}
.card-link strong {
    display: block;
    color: var(--neutral-950);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}
.card-link .muted {
    color: var(--neutral-700);
    font-size: 13px;
}
.card-link::after {
    content: "";
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3e%3cpath d='M6 4L10 8L6 12' stroke='%231B2B1D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
}

/* ----- Sessions table ----- */
.sessions-card {
    max-width: 960px;
}

.sessions-table-wrap {
    overflow-x: auto;
    margin: 16px -8px 0;
    padding: 0 8px;
}

.sessions-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}
.sessions-table col.col-app     { width: 18%; }
.sessions-table col.col-access  { width: 32%; }
.sessions-table col.col-when    { width: 15%; }
.sessions-table col.col-status  { width: 10%; }
.sessions-table col.col-actions { width: 10%; }

/* Tiny breathing room between the scope-tag list and the device line below it. */
.sessions-table .access-where {
    margin-top: 6px;
}

.sessions-table th,
.sessions-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--neutral-200);
    vertical-align: top;       /* anchor row content under the header label */
    word-break: break-word;
}
.sessions-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--neutral-700);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--neutral-50);
    border-bottom: 1px solid var(--neutral-300);
}
.sessions-table tbody tr:last-child td {
    border-bottom: none;
}

/* Stacked cell layout — primary line + supporting metadata. */
.sessions-table .cell-primary {
    color: var(--forest);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' on;
}
.sessions-table .cell-sub {
    color: var(--neutral-700);
    font-size: 12px;
    margin-top: 2px;
}
.sessions-table .cell-sub[title] {
    cursor: help;
}

/* Scope list rendered as compact chips so a long scope set wraps cleanly instead
   of collapsing into one comma-separated line. */
.sessions-table .scope-tags {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.sessions-table .scope-tags li {
    background: var(--tarpaulin-50);
    color: var(--khaki);
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.sessions-table .col-actions-cell {
    text-align: right;
}

/* Accessible-but-hidden label for the action column header. */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.btn-danger-subtle {
    background: var(--red-100);
    color: var(--red-800);
    border-color: var(--red-100);
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}
.btn-danger-subtle:hover {
    background: #fbd1cb;
    border-color: #fbd1cb;
}

/* Status indicator — Khaki copy on Tarpaulin tint, used for "Active" sessions
   and similar success-leaning states. Stays Forest-on-Hardhat for inactive. */
.status-pill {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    background: var(--neutral-200);
    color: var(--forest);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.status-pill.is-active {
    background: var(--tarpaulin-50);
    color: var(--khaki);
}

/* ----- Responsive ----- */

@media (max-width: 480px) {
    .auth-header {
        padding: 0 16px;
        height: 60px;
    }
    .auth-main {
        padding: 24px 12px 40px;
    }
    .auth-card {
        padding: 24px 20px;
        box-shadow: none;
        border-top: 1px solid var(--neutral-200);
    }
    .field-row > .field-country {
        flex-basis: 120px;
    }
}
