/* ===== SAM Dimension Brand Colors ===== */
:root {
    /* Primary */
    --sam-black: #000000;
    --sam-white: #FFFFFF;

    /* Grey Scale */
    --grey-800: #333333;
    --grey-600: #666666;
    --grey-400: #999999;
    --grey-200: #CCCCCC;
    --grey-100: #EFEFEF;

    /* SAM Blue */
    --sam-blue: #2044FF;
    --sam-blue-1200: #0020C9;
    --sam-blue-800: #4D69FF;
    --sam-blue-600: #799FFF;
    --sam-blue-400: #A6B4FF;
    --sam-blue-200: #D2D4FF;

    /* SAM Green */
    --sam-green: #3EA533;
    --sam-green-800: #65B75C;

    /* SAM Red */
    --sam-red: #D61C22;
    --sam-red-800: #DE4946;

    /* SAM Yellow */
    --sam-yellow: #FFCC00;

    /* SAM Orange */
    --sam-orange: #FF8A00;

    /* SAM Violet */
    --sam-violet: #9D2ED9;

    /* SAM Magenta */
    --sam-magenta: #F956B8;

    /* SAM Brown */
    --sam-brown: #785742;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--grey-100);
    color: var(--grey-800);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--sam-blue);
    text-decoration: none;
}

a:hover {
    color: var(--sam-blue-1200);
    text-decoration: underline;
}

/* ===== Login Page ===== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--grey-100) 0%, var(--grey-200) 100%);
}

.login-card {
    background: var(--sam-white);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-logo img,
.login-logo svg {
    height: 48px;
    width: auto;
}

.login-title {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--grey-800);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    font-size: 0.875rem;
    color: var(--grey-600);
    margin-bottom: 2rem;
}

/* ===== Form Styles ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--grey-800);
    margin-bottom: 0.375rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border: 1.5px solid var(--grey-200);
    border-radius: 8px;
    background: var(--sam-white);
    color: var(--grey-800);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--sam-blue);
    box-shadow: 0 0 0 3px var(--sam-blue-200);
}

.form-group input::placeholder {
    color: var(--grey-400);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    width: 100%;
    background-color: var(--sam-black);
    color: var(--sam-white);
}

.btn-primary:hover {
    background-color: var(--grey-800);
}

/* ===== Alerts / Messages ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert-error {
    background-color: #FDF2F2;
    color: var(--sam-red);
    border: 1px solid var(--sam-red-800);
}

.alert-success {
    background-color: #F0FDF0;
    color: var(--sam-green);
    border: 1px solid var(--sam-green-800);
}

/* ===== Messages (Django messages framework) ===== */
.messages {
    list-style: none;
    margin-bottom: 1.25rem;
}

.messages li {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.messages .success {
    background-color: #F0FDF0;
    color: var(--sam-green);
}

.messages .error {
    background-color: #FDF2F2;
    color: var(--sam-red);
}

/* ===== Navbar ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sam-white);
    padding: 0.75rem 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-logo {
    height: 32px;
    width: auto;
}

.navbar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--grey-800);
}

/*
 * Navbar title is a link to home. Global `a:hover` adds underline; override
 * that here so the title stays visually identical to plain text.
 */
a.navbar-title,
a.navbar-title:visited,
a.navbar-title:hover,
a.navbar-title:focus,
a.navbar-title:focus-visible,
a.navbar-title:active {
    text-decoration: none;
    color: var(--grey-800);
}

a.navbar-title:hover,
a.navbar-title:focus-visible {
    color: var(--grey-900);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--grey-600);
}

.btn-logout {
    padding: 0.4rem 1rem;
    font-size: 0.8125rem;
    background-color: var(--grey-100);
    color: var(--grey-800);
    border-radius: 6px;
    text-decoration: none;
}

.btn-logout:hover {
    background-color: var(--grey-200);
    text-decoration: none;
}

/* ===== Page Layout ===== */
.page-wrapper {
    min-height: 100vh;
    background-color: var(--grey-100);
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.content--fluid {
    max-width: none;
}

.content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--grey-800);
    margin-bottom: 1rem;
}

.placeholder-text {
    color: var(--grey-600);
    font-size: 0.9375rem;
}

/* ===== Flight Card Grid ===== */
.flight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.flight-card {
    background: var(--sam-white);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.flight-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.flight-card-body {
    padding: 1.25rem 1.25rem 0.75rem;
}

.flight-card-open-link {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--grey-200);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--grey-600);
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    z-index: 1;
}

.flight-card-open-link:hover {
    background: var(--sam-blue);
    border-color: var(--sam-blue);
    color: var(--sam-white);
}

.flight-card-open-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.14);
}

.flight-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--grey-800);
    margin-bottom: 0.25rem;
}

.flight-card-product {
    font-size: 0.8125rem;
    color: var(--grey-600);
    margin-bottom: 0.125rem;
}

.flight-card-meta {
    font-size: 0.8125rem;
    color: var(--grey-400);
    margin-bottom: 0.75rem;
}

.flight-card-thumbnail {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--grey-100);
}

.flight-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flight-card-thumbnail--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--grey-400);
    font-size: 0.875rem;
}

/* ===== Flight Card Footer ===== */
.flight-card-footer {
    padding: 0.75rem 1.25rem 1.25rem;
    margin-top: auto;
}

.flight-card-details {
    margin-bottom: 0.75rem;
}

.flight-card-description {
    font-size: 0.8125rem;
    color: var(--grey-400);
    line-height: 1.4;
}

.btn-start {
    display: block;
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    background-color: var(--sam-green);
    color: var(--sam-white);
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-start:hover {
    background-color: var(--sam-green-800);
    text-decoration: none;
    color: var(--sam-white);
}

.btn-continue {
    background-color: var(--sam-red);
    width: 100%;
    padding: 0.45rem 1rem;
    min-height: 0;
    margin-top: 0.625rem;
}

.btn-continue:hover {
    background-color: var(--sam-red-800);
}

.flight-card-release-form {
    margin-top: 0.5rem;
}

.flight-card-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    align-items: stretch;
    margin-top: 0.5rem;
}

.flight-card-actions-row__col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.flight-card-actions-row__btn {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.flight-card-actions-row .btn-continue {
    margin-top: 0;
}

.flight-card-actions-row .flight-card-release-form--row {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Same footprint for Resume (continue) and Release in the two-column row */
.flight-card-actions-row .flight-card-actions-row__btn.btn-continue,
.flight-card-actions-row .flight-card-release-form--row .btn-release {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 8px;
    min-height: 2.75rem;
    box-sizing: border-box;
    border: 1px solid transparent;
}

.flight-card-actions-row .flight-card-release-form--row .btn-release {
    flex: 1;
    border-color: var(--grey-200);
}

.btn-release {
    background-color: var(--grey-100);
    color: var(--grey-800);
    border: 1px solid var(--grey-200);
    border-radius: 6px;
    padding: 0.4rem 1rem;
    font-size: 0.8125rem;
    cursor: pointer;
    width: 100%;
}

.btn-release:hover {
    background-color: var(--grey-200);
}

.flight-card-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.flight-card-since {
    font-size: 0.75rem;
    color: var(--grey-600);
    margin-top: 0.25rem;
}

/* Three-step pipeline on in-review flight cards (task list) — compact gray scale */
.flight-card-progress {
    margin: 0.5rem 0 0.35rem;
    width: 100%;
}

.flight-card-progress .review-section-progress {
    margin-bottom: 0;
}

.flight-card-progress .review-section-progress__list {
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.12rem;
    min-width: 0;
}

.flight-card-progress .review-section-progress__segment {
    flex: 1 1 0;
    min-width: 0.2rem;
    max-width: 1.25rem;
    height: 2px;
    margin: 0;
}

.flight-card-progress .review-section-progress__step-item {
    flex: 0 0 auto;
}

.flight-card-progress .review-section-progress__step {
    font-size: 0.58rem;
    padding: 0.06rem 0.12rem;
    gap: 0.18rem;
    border-radius: 4px;
    color: #111;
}

.flight-card-progress .review-section-progress__disc {
    width: 1.15rem;
    height: 1.15rem;
    min-width: 1.15rem;
    min-height: 1.15rem;
    font-size: 0.56rem;
    font-weight: 800;
    border-width: 1.5px;
    color: #000;
}

.flight-card-progress .review-section-progress__check {
    font-size: 0.58rem;
}

.flight-card-progress .review-section-progress__label {
    color: #111;
    font-weight: 600;
}

.flight-card-progress .review-section-progress__step--complete .review-section-progress__label {
    color: #111;
}

.flight-card-progress
    .review-section-progress__step--current:not(.review-section-progress__step--complete)
    .review-section-progress__disc {
    border-color: var(--grey-600);
    color: #000;
}

.flight-card-progress
    .review-section-progress__step--current:not(.review-section-progress__step--complete)
    .review-section-progress__label {
    color: #000;
}

.flight-card-created {
    font-size: 0.75rem;
    color: var(--grey-600);
    margin-top: 0.375rem;
}

.flight-card-created__label {
    font-weight: 600;
    color: var(--grey-800);
    margin-right: 0.25rem;
}

.status-icon {
    font-size: 1rem;
}

.flight-card-status--done {
    color: var(--sam-green);
}

.flight-card-status--rejected {
    color: var(--sam-red);
}

.flight-card-outcome-form {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--grey-100);
}

.flight-card-outcome-form__label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--grey-500);
}

.flight-card-outcome-form__controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.flight-card-outcome-form__select {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--grey-200);
    border-radius: 8px;
    background: var(--sam-white);
    color: var(--grey-800);
    font-size: 0.875rem;
}

.flight-card-outcome-form__select:focus {
    outline: none;
    border-color: var(--sam-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.flight-card-outcome-form__submit {
    flex-shrink: 0;
    padding: 0.55rem 0.9rem;
    border: none;
    border-radius: 8px;
    background: var(--sam-blue);
    color: var(--sam-white);
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
}

.flight-card-outcome-form__submit:hover {
    background: #00b8e6;
}

.flight-card-status--in-review {
    color: var(--grey-600);
    margin-bottom: 0.5rem;
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--grey-200);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--sam-red);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ===== Review Page Layout ===== */
.review-page {
    width: 100%;
    padding: 1.5rem 2rem 4rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--grey-400);
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color 0.15s;
}

.back-link svg {
    flex-shrink: 0;
}

.back-link:hover {
    color: var(--sam-blue);
    text-decoration: none;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    line-height: 1;
    white-space: nowrap;
}

.badge--success {
    background-color: #DEF7EC;
    color: #03543F;
}

.badge--warning {
    background-color: #FDF6B2;
    color: #723B13;
}

.badge--muted {
    background-color: var(--grey-100);
    color: var(--grey-400);
}

/* ===== Metadata Strip ===== */
.meta-strip {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.meta-strip__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--grey-800);
    margin: 0;
    line-height: 1.3;
}

.meta-strip__sep {
    color: var(--grey-200);
    font-weight: 400;
}

.meta-strip__tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--grey-600);
    background: var(--sam-white);
    border: 1px solid var(--grey-200);
    border-radius: 6px;
    padding: 0.25rem 0.625rem;
}

.meta-tag svg {
    flex-shrink: 0;
    color: var(--grey-400);
}

.meta-tag--high {
    background: #FEF2F2;
    border-color: #FECACA;
    color: var(--sam-red);
}

.meta-tag--high svg {
    color: var(--sam-red);
}

.meta-tag--medium {
    background: #FFF8E1;
    border-color: #FFE082;
    color: #B45309;
}

.meta-tag--medium svg {
    color: #B45309;
}

/* ===== Review section progress (Map / Tiles / Instances) — compact gray scale ===== */
.review-section-progress {
    margin-bottom: 0.75rem;
}

.review-section-progress__list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 0.15rem 0;
    min-width: 0;
}

.review-section-progress__segment {
    flex: 1 1 0;
    min-width: 0.25rem;
    max-width: 2rem;
    height: 2px;
    border-radius: 1px;
    background: var(--grey-200);
    list-style: none;
    margin: 0 0.06rem;
    align-self: center;
}

.review-section-progress__segment--filled {
    background: var(--grey-600);
}

.review-section-progress__step-item {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

.review-section-progress__step {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.22rem;
    text-decoration: none;
    color: #111;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.review-section-progress__step:hover {
    color: #000;
    background: var(--grey-100);
}

.review-section-progress__disc {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    min-width: 1.35rem;
    min-height: 1.35rem;
    border-radius: 50%;
    border: 2px solid var(--grey-400);
    background: transparent;
    font-size: 0.65rem;
    font-weight: 800;
    color: #000;
    line-height: 1;
    box-sizing: border-box;
}

.review-section-progress__label {
    color: #111;
    font-weight: 600;
}

.review-section-progress__check {
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
}

.review-section-progress__step--complete .review-section-progress__disc {
    border-color: var(--grey-700);
    background: var(--grey-700);
    color: #fff;
}

.review-section-progress__step--complete .review-section-progress__label {
    color: #111;
}

/* Active incomplete step: hollow ring; step index in black */
.review-section-progress__step--current:not(.review-section-progress__step--complete)
    .review-section-progress__disc {
    border-color: var(--grey-600);
    background: transparent;
    color: #000;
    box-shadow: none;
}

.review-section-progress__step--current:not(.review-section-progress__step--complete)
    .review-section-progress__label {
    color: #000;
}

.review-section-progress__step--current.review-section-progress__step--complete
    .review-section-progress__disc {
    border-color: var(--grey-700);
    background: var(--grey-700);
    box-shadow: none;
}

.meta-strip__right {
    flex-shrink: 0;
    padding-top: 0.25rem;
}

.meta-description {
    font-size: 0.8125rem;
    color: var(--grey-400);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ===== Metadata Cards ===== */
.metadata-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metadata-card {
    background: var(--sam-white);
    border: 1px solid var(--grey-200);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.metadata-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--grey-300);
}

.metadata-card__header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--grey-500);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.metadata-card__content {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--grey-800);
    line-height: 1.4;
    word-break: break-word;
}

/* ===== Status Badge ===== */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge--pending {
    background: #FDF6B2;
    color: #723B13;
}

.status-badge--in_review {
    background: #DBEAFE;
    color: #1E40AF;
}

.status-badge--approved {
    background: #DEF7EC;
    color: #03543F;
}

.status-badge--rejected {
    background: #FEE2E2;
    color: #991B1B;
}

/* ===== Priority Badge ===== */
.priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
}

.priority-badge--1 {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: var(--sam-red);
    box-shadow: 0 2px 4px rgba(214, 28, 34, 0.2);
}

.priority-badge--2 {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFE082 100%);
    color: #B45309;
    box-shadow: 0 2px 4px rgba(255, 138, 0, 0.2);
}

.priority-badge--3,
.priority-badge--4,
.priority-badge--5 {
    background: var(--grey-200);
    color: var(--grey-600);
}

/* ===== Rating Badge ===== */
.rating-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
}

.rating-badge--1 {
    background: #FEE2E2;
    color: #991B1B;
}

.rating-badge--2 {
    background: #FEF3C7;
    color: #92400E;
}

.rating-badge--3 {
    background: #D1FAE5;
    color: #065F46;
}

.rating-badge--4 {
    background: #DBEAFE;
    color: #1E40AF;
}

/* ===== Map & Review Wrapper (Centered) ===== */
.map-review-wrapper {
    --map-viewer-max-height: clamp(260px, calc(100dvh - 430px), 440px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 1.25rem;
    width: 100%;
}

/* ===== Map Viewer ===== */
.map-viewer {
    background: var(--sam-white);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.04);
    overflow: hidden;
    margin-bottom: 0;
    border: 1px solid var(--grey-100);
    width: 100%;
}

.map-viewer__img {
    display: block;
    width: 100%;
    max-height: var(--map-viewer-max-height);
    height: auto;
    object-fit: contain;
    object-position: center;
    background: linear-gradient(135deg, #F7F8FA 0%, #EDF2F7 100%);
    margin: 0 auto;
}

.map-viewer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: var(--map-viewer-max-height);
    padding: 2rem;
    color: var(--grey-400);
    text-align: center;
}

.map-viewer__empty p {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== Review Controls (below map) ===== */
.review-controls {
    background: var(--sam-white);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.04);
    padding: 1rem 1.25rem;
    margin: 0;
    border-top: 1px solid var(--grey-100);
    width: 100%;
}

.review-controls__row {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 768px) {
    .metadata-cards {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }

    .metadata-card {
        padding: 0.875rem 1rem;
    }

    .map-review-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .review-controls__row {
        grid-template-columns: 1fr;
    }

    .metadata-cards {
        grid-template-columns: 1fr;
    }
}

.review-controls__actions {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--grey-100);
}

.review-controls__save-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
}

.review-layout {
    display: grid;
    grid-template-columns: minmax(220px, 13%) minmax(0, 87%);
    gap: 1.5rem;
    align-items: start;
    width: 100%;
}

.review-layout__content {
    min-width: 0;
}

/* Cap height so many frames/tiles do not stretch the page; min-height:0 lets grid honor max-height */
.review-sidebar-nav {
    position: sticky;
    top: 1rem;
    align-self: start;
    min-height: 0;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.review-sidebar-nav__inner {
    background: var(--sam-white);
    border: 1px solid var(--grey-100);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.04);
    padding: 1.25rem;
}

.review-sidebar-nav__title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--grey-600);
}

.review-sidebar-nav__group + .review-sidebar-nav__group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--grey-100);
}

.review-sidebar-nav__section {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--grey-800);
    text-decoration: none;
}

.review-sidebar-nav__section--active {
    color: var(--sam-blue);
}

.review-sidebar-nav__subsections {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0 0 0 0.75rem;
}

.review-sidebar-nav__subsections li + li {
    margin-top: 0.5rem;
}

.review-sidebar-nav__subsection {
    display: block;
    color: var(--grey-600);
    text-decoration: none;
    font-size: 0.9rem;
}

.review-sidebar-nav__subsection::before {
    content: "- ";
    color: var(--grey-400);
}

.review-sidebar-nav__subsection--active {
    color: var(--sam-blue);
    font-weight: 600;
}

.review-sidebar-nav__frame-block {
    margin: 0;
}

/* Section 2: collapsible per image (expanded by default); tiles nested below */
.review-sidebar-nav__frame-group {
    margin: 0;
    border: none;
}

.review-sidebar-nav__frame-group-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    user-select: none;
}

.review-sidebar-nav__frame-group-summary::-webkit-details-marker {
    display: none;
}

.review-sidebar-nav__frame-group-summary::marker {
    content: "";
    display: none;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    text-transform: none;
    text-indent: 0 !important;
    text-align: start !important;
    text-align-last: auto !important;
}

.review-sidebar-nav__frame-group-summary::before {
    content: "";
    flex: 0 0 auto;
    order: 0;
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid var(--grey-400);
    transition: transform 0.15s ease;
    margin-right: 0.3rem;
}

.review-sidebar-nav__frame-group[open] > .review-sidebar-nav__frame-group-summary::before {
    transform: rotate(90deg);
}

/* ▸ Image 1 — no leading hyphen from .review-sidebar-nav__subsection::before */
.review-sidebar-nav__frame-group-summary .review-sidebar-nav__subsection::before {
    content: none;
}

.review-sidebar-nav__frame-group-summary .review-sidebar-nav__subsection {
    flex: 1 1 auto;
    order: 1;
    min-width: 0;
    display: block;
}

.review-sidebar-nav__frame-group-tiles {
    list-style: none;
    margin: 0.35rem 0 0.15rem 0;
    padding: 0 0 0 1.35rem;
}

.review-sidebar-nav__frame-group-tiles li + li {
    margin-top: 0.35rem;
}

.review-sidebar-nav__subsection--tile {
    font-size: 0.85rem;
    padding-left: 0.35rem;
}

.review-sidebar-nav__subsection--tile::before {
    content: "";
}

/* Section 2: tiles with a saved TileResult */
.review-sidebar-nav__subsection--tile.review-sidebar-nav__subsection--reviewed:not(.review-sidebar-nav__subsection--active) {
    color: #000000;
    font-weight: 600;
}

.review-sidebar-nav__section:hover,
.review-sidebar-nav__subsection:hover {
    color: var(--sam-blue);
    text-decoration: none;
}

@media (max-width: 960px) {
    .review-layout {
        grid-template-columns: 1fr;
    }

    .instance-review-layout {
        flex-direction: column;
    }

    #section-3-found,
    #section-3-missing {
        flex: none;
        width: 100%;
    }

    .instance-review-answer-card {
        width: 100%;
        max-width: 100%;
    }

    .review-sidebar-nav {
        position: static;
    }

    .section-image-meta--stacked {
        grid-template-columns: 1fr;
    }

    .section-image-meta__stats {
        align-items: flex-start;
    }

    .section-image-meta__stat {
        text-align: left;
    }
}

/* ===== Section Cards ===== */
.section-card {
    background: var(--sam-white);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.04);
    padding: 1.5rem 2rem;
    margin-bottom: 1rem;
}

#section-3-instances {
    padding: 1rem 1.5rem;
}

#section-3-found,
#section-3-missing {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
}

#section-3-found.section-card,
#section-3-missing.section-card {
    margin-bottom: 0;
}

#section-3-found .frame-nav-actions,
#section-3-missing .frame-nav-actions {
    margin-top: 1.25rem;
    justify-content: space-between;
    width: 100%;
}

.section-card--locked {
    opacity: 0.55;
    pointer-events: none;
}

.section-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0;
}

.section-card__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--sam-blue);
    color: var(--sam-white);
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.section-card__number--muted {
    background: var(--grey-200);
    color: var(--grey-600);
}

.section-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--grey-800);
    margin: 0;
    flex-grow: 1;
}

.section-card__description {
    margin: 1rem 0 0;
    color: var(--grey-600);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.section-image-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.section-image-meta--stacked {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem 1rem;
    align-items: start;
    margin-top: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--grey-100);
}

.section-image-meta__primary {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--grey-700);
    line-height: 1.35;
    overflow: hidden;
}

/* Thora flight/subflight id under the frame filename (Section 2 / 3) */
.section-image-meta__subflight {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--grey-500);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-image-meta__stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--grey-700);
    line-height: 1.35;
}

.section-image-meta__stat {
    text-align: right;
}

.section-2-detections-toggle {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sam-white);
    background: var(--sam-green);
    border: 1px solid var(--sam-green);
    border-radius: 6px;
    cursor: pointer;
}

.section-2-detections-toggle:hover {
    background: var(--sam-green-800);
    border-color: var(--sam-green-800);
    color: var(--sam-white);
}

.frame-nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
    flex-wrap: wrap;
}

.frame-nav-actions--bottom {
    width: 100%;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.frame-nav-link {
    color: #1f4cff;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
}

.frame-nav-link:hover {
    color: #1539c9;
    text-decoration: none;
}

.frame-nav-link--next {
    margin-left: auto;
}

.frame-nav-link--disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}

.image-review-wrapper {
    margin-top: 1rem;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
}

.image-review-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1rem;
}

.image-review-main {
    min-width: 0;
}

.image-review-sidebar {
    display: flex;
}

.image-canvas {
    position: relative;
    display: inline-block;
    width: auto;
    max-width: 100%;
    border: 1px solid var(--grey-200);
    border-radius: 14px;
    overflow: hidden;
    background: var(--grey-100);
}

.image-canvas__img {
    display: block;
    width: auto;
    max-width: 100%;
    /* max-height: 500px; */
    height: auto;
}

.image-canvas__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.tile-link {
    cursor: pointer;
}

.tile-link--disabled {
    cursor: default;
}

.tile-box {
    transition: fill 0.15s ease, stroke 0.15s ease;
}

.tile-box--existing {
    /* transparent keeps pointer events active on the full cell area */
    fill: transparent;
    stroke: rgba(245, 250, 255, 0.98);
}

.tile-box--empty {
    fill: transparent;
    stroke: rgba(255, 255, 255, 0.45);
    stroke-dasharray: 18 10;
}

.tile-box--available {
    fill: transparent;
    stroke: rgba(62, 165, 51, 0.96);
    stroke-dasharray: 18 10;
}

.tile-box--locked {
    fill: transparent;
    stroke: rgba(255, 255, 255, 0.24);
}

.tile-box--empty:hover,
.tile-link:hover .tile-box--empty,
.tile-link:hover .tile-box--available {
    fill: rgba(255, 255, 255, 0.08);
    stroke: rgba(255, 255, 255, 0.7);
}

.tile-box--existing:hover,
.tile-link:hover .tile-box--existing,
.tile-box--selected {
    fill: rgba(0, 212, 255, 0.08);
    stroke: rgba(0, 212, 255, 0.98);
    stroke-dasharray: none;
}

/* Reviewed tiles: stroke-only indicator, no fill to keep image visible */
.tile-box--reviewed {
    fill: transparent;
    stroke: rgba(218, 105, 0, 0.96);
    stroke-dasharray: none;
}

.tile-link:hover .tile-box--reviewed:not(.tile-box--selected) {
    fill: rgba(255, 155, 0, 0.08);
    stroke: rgba(200, 95, 0, 1);
}

/* Active selection on an already-reviewed tile: subtle fill + cyan ring */
.tile-box--reviewed.tile-box--selected,
.tile-link:hover .tile-box--reviewed.tile-box--selected {
    fill: rgba(0, 212, 255, 0.08);
    stroke: rgba(0, 212, 255, 0.98);
    stroke-dasharray: none;
}

.tile-box {
    stroke-width: 4;
}

.tile-label {
    font-size: 36px;
    font-weight: 700;
    fill: rgba(228, 10, 220, 0.92);
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.95);
    stroke-width: 7px;
    stroke-linejoin: round;
}

.tile-label--existing {
    fill: rgba(228, 10, 220, 0.92);
}

.tile-label--empty {
    fill: rgba(228, 10, 220, 0.92);
}

.tile-label--available {
    fill: rgba(228, 10, 220, 0.92);
}

.tile-label--locked {
    fill: rgba(228, 10, 220, 0.92);
}

.tile-link:hover .tile-label,
.tile-label--selected {
    fill: rgba(0, 0, 0, 0.92);
}

.tile-label--reviewed {
    fill: rgba(55, 30, 0, 0.9);
    stroke: rgba(255, 255, 255, 0.95);
}

.tile-label--reviewed.tile-label--selected,
.tile-link:hover .tile-label--reviewed {
    fill: rgba(0, 0, 0, 0.92);
}

.detection-box {
    fill: none;
    stroke: var(--detection-stroke, #EC407A);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    pointer-events: none;
}

/* Overview grid (full-frame map): solid, slightly thicker border */
[data-frame-detection-layer] .detection-box {
    stroke-width: 2.5;
    stroke-dasharray: none;
}

.detection-box.detection-box--hidden,
[data-instance-detection-overlay].detection-box--hidden,
[data-frame-detection-layer].detection-box--hidden {
    visibility: hidden;
}

.detection-label {
    fill: var(--detection-label-fill, #EC407A);
    font-size: 20px;
    font-weight: 700;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.95);
    stroke-width: 6px;
    stroke-linejoin: round;
    pointer-events: none;
    /* Labels are hidden by default; toggled visible via JS */
    visibility: hidden;
}

.detection-label--visible {
    visibility: visible;
}

.tile-review-card {
    width: 100%;
    border: 1px solid var(--grey-300);
    border-radius: 24px;
    padding: 1.25rem 1rem;
    background: var(--sam-white);
}

.tile-review-card__eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--grey-400);
}

.tile-review-card__title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--grey-800);
}

.tile-review-card__meta {
    margin: 0.75rem 0 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--grey-600);
}

.tile-review-card__note {
    margin: 0.875rem 0 0;
    padding: 0.625rem 0.75rem;
    border-left: 3px solid var(--sam-blue);
    border-radius: 10px;
    background: rgba(32, 68, 255, 0.06);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--sam-blue-1200);
}

.tile-review-card__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border: 1px solid #00D4FF;
    border-radius: 14px;
    text-decoration: none;
    color: var(--grey-800);
    font-weight: 600;
    text-align: center;
}

.tile-review-modal[hidden] {
    display: none !important;
}

.tile-review-modal {
    position: absolute;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* reduced padding so dialog can use more of the frame area */
    padding: 0.5rem;
}

.tile-review-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.32);
    border-radius: 14px;
}

.tile-review-modal__dialog {
    position: relative;
    z-index: 1;
    /* +20%: 1120px → 1344px; width fills frame minus small gutter */
    width: calc(100% - 1rem);
    max-width: 1344px;
    max-height: calc(100% - 1rem);
    overflow: auto;
    padding: 1.25rem;
    border-radius: 24px;
    background: var(--sam-white);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

.tile-review-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 999px;
    background: var(--grey-100);
    color: var(--grey-700);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.tile-review-modal__close:hover {
    background: var(--grey-200);
}

.tile-review-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.5rem;
}

/* Section-3: header and filename above the instance review row */
.instance-review-header {
    margin-bottom: 0.25rem;
}

.instance-review-meta {
    margin-bottom: 0.75rem;
}

/* Section-3: image card + answer card — full width row (not centred) */
#section-3-instance-workspace {
    scroll-margin-top: 5.5rem;
}

.instance-review-layout {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    width: 100%;
}

.instance-review-answer-card {
    flex-shrink: 0;
    width: 240px;
    text-align: center;
    padding-top: 0rem;
}

.tile-review-sidebar-card {
    border: none;
    padding: 0;
}

.tile-review-sidebar-card__meta {
    text-align: center;
}

.instance-review-answer-card .tile-review-comment {
    width: 100%;
    box-sizing: border-box;
}

/* Section-3 instance review panel: controls | image */
#section-3-instances .tile-review-panel,
#section-3-found .tile-review-panel,
#section-3-missing .tile-review-panel,
.tile-review-panel--instance {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 1.5rem;
}

/* Fill the section card: image row grows above Previous/Next */
#section-3-found .tile-review-panel,
#section-3-missing .tile-review-panel {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    margin-top: 0.35rem;
    grid-template-rows: minmax(0, 1fr);
}

#section-3-found .tile-review-panel__controls,
#section-3-missing .tile-review-panel__controls {
    align-self: start;
}

#section-3-instances .tile-review-panel__controls,
#section-3-found .tile-review-panel__controls,
#section-3-missing .tile-review-panel__controls,
.tile-review-panel--instance .tile-review-panel__controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
}

#section-3-instances .tile-review-panel__main,
.tile-review-panel--instance .tile-review-panel__main {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    min-width: 0;
    min-height: 0;
    width: 100%;
}

#section-3-found .tile-review-panel__main,
#section-3-missing .tile-review-panel__main {
    height: 100%;
    align-self: stretch;
}

#section-3-found .tile-image-container,
#section-3-missing .tile-image-container {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    align-items: stretch;
}

.tile-review-panel--instance .tile-zoom-frame,
#section-3-found .tile-zoom-frame,
#section-3-missing .tile-zoom-frame {
    box-sizing: border-box;
    align-self: stretch;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: min(
        100%,
        calc(82vh * var(--instance-crop-w, 1000) / var(--instance-crop-h, 1000))
    );
    max-height: min(82vh, 88dvh);
    height: auto;
}

.tile-review-panel--modal {
    margin-top: 0.75rem;
    grid-template-columns: minmax(0, 80%) minmax(220px, 20%);
}

.tile-review-panel__main {
    min-width: 0;
}

.tile-image-container {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* #section-3-instances .tile-image-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
} */


.tile-review-panel__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tile-review-panel__tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--grey-500);
    border-radius: 8px;
    font-weight: 600;
    color: var(--grey-800);
}

.tile-review-panel__title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--grey-700);
}

/* Section 2 tile inspection modal — product / task context + tile number */
.tile-review-panel__header--modal-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.tile-review-panel__modal-meta {
    width: 100%;
}

.tile-review-panel__modal-meta-line {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--grey-700);
}

.tile-review-panel__modal-meta-line--wrap .tile-review-panel__modal-meta-value {
    display: block;
    margin-top: 0.15rem;
}

.tile-review-panel__modal-meta-label {
    font-weight: 600;
    color: var(--grey-600);
    margin-right: 0.35rem;
}

.tile-review-panel__title--modal {
    margin-top: 0.35rem;
    font-size: 1.35rem;
}

.tile-zoom-frame {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* .tile-zoom-frame {
    position: relative;
    width: 100%;
    aspect-ratio: var(--tile-frame-aspect-ratio);
    overflow: hidden;
    border: 1px solid var(--grey-300);
    border-radius: 36px;
    background: var(--sam-white);
    contain: layout style paint;
} */

#section-3-instances .tile-zoom-frame {
    width: 100%;
}

.tile-zoom-frame {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: var(--tile-frame-aspect-ratio);
}

.tile-zoom-frame.image-pannable {
    cursor: grab;
    user-select: none;
}

.tile-zoom-frame.image-pannable.image-panning {
    cursor: grabbing;
}

.tile-zoom-frame.image-pannable * {
    pointer-events: none;
}

.tile-zoom-frame.image-pannable .tile-zoom-frame__svg {
    pointer-events: auto;
}

.tile-zoom-frame__svg {
    display: block;
    width: 100%;
    height: 100%;

    /* position: absolute;
    top: 0;
    left: 0;
    clip-path: inset(0 round 36px);
    -webkit-clip-path: inset(0 round 36px); */
}



.tile-review-panel__sidebar {
    display: flex;
}

.tile-review-sidebar-card {
    width: 100%;
    border: 1px solid var(--grey-500);
    border-radius: 24px;
    padding: 0.75rem;
    padding-bottom: 0.5rem;
    background: var(--sam-white);
    font-size: 0.85rem;
}

.tile-review-sidebar-card__title {
    margin: 0 0 1rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--grey-800);
}


.tile-review-sidebar-card__meta {
    margin: 0.5rem 0;
    color: var(--grey-700);
    font-size: 0.85rem;
    line-height: 1.4;
}

.tile-review-sidebar-card__meta-label {
    font-weight: 600;
    color: var(--grey-800);
    margin-right: 0.25rem;
}

.tile-action-btn {
    width: 50%;
    margin-bottom: 0.75rem;
    margin-left: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.tile-action-btn--good {
    width: 100%;
    background: #27F200;
}

.tile-action-btn--fp {
    width: 100%;
    background: #FFF000;
}

.tile-action-btn--fn {
    width: 100%;
    background: #FFAE00;
}

.tile-action-btn--mixed {
    width: 100%;
    background: #FF1C1C;
    color: var(--sam-white);
}

/* Saved decision matches this submit option (Section 2 modal) */
.tile-action-btn--selected {
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.55);
    border-color: rgba(13, 71, 161, 0.85);
}

/* Section-3 instance Yes / No buttons — independent from tile-action-btn */
.instance-decision-btn {
    display: block;
    width: 50%;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.instance-decision-btn--yes {
    width: 50%;
    background: #27F200;
    color: #000;
    margin-left: auto;
    margin-right: auto;
}

.instance-decision-btn--no {
    width: 50%;
    background: #FFAE00;
    color: #000;
    margin-left: auto;
    margin-right: auto;
}

.instance-decision-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tile-review-comment {
    width: 100%;
    max-height: 100px;
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--grey-300);
    border-radius: 10px;
    font: inherit;
    /* resize: vertical; */
}

/* ===== Form Fields ===== */
.field__label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--grey-600);
    margin-bottom: 0.4rem;
}

.field__select-wrap {
    position: relative;
}

.field__select {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1.5px solid var(--grey-200);
    border-radius: 10px;
    background-color: var(--sam-white);
    color: var(--grey-800);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
}

.field__select:focus {
    outline: none;
    border-color: var(--sam-blue);
    box-shadow: 0 0 0 3px var(--sam-blue-200);
}

.field__textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1.5px solid var(--grey-200);
    border-radius: 10px;
    background-color: var(--sam-white);
    color: var(--grey-800);
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field__textarea:focus {
    outline: none;
    border-color: var(--sam-blue);
    box-shadow: 0 0 0 3px var(--sam-blue-200);
}

.field__textarea::placeholder {
    color: var(--grey-400);
}

/* ===== Green Save Button ===== */
.btn-green {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: inherit;
    background: linear-gradient(135deg, var(--sam-green) 0%, #2E9626 100%);
    color: var(--sam-white);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(62, 165, 51, 0.25);
    transition: transform 0.1s, box-shadow 0.15s;
}

.btn-green:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(62, 165, 51, 0.35);
}

.btn-green:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(62, 165, 51, 0.2);
}

.save-hint {
    font-size: 0.75rem;
    color: var(--grey-400);
    font-style: italic;
    line-height: 1.45;
    max-width: 20rem;
}

.proceed-link {
    align-self: center;
    margin-left: auto;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--sam-blue);
    text-decoration: none;
    transition: color 0.15s ease;
}

.proceed-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .review-controls__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .image-review-layout,
    .tile-review-panel {
        grid-template-columns: 1fr;
    }

    .image-review-wrapper {
        width: 100%;
    }

    .proceed-link {
        align-self: flex-start;
        margin-left: 0;
    }

    .tile-review-modal {
        padding: 0.35rem;
    }

    .tile-review-modal__dialog {
        width: calc(100% - 0.7rem);
        max-height: calc(100% - 0.7rem);
        padding: 1rem;
        border-radius: 18px;
    }
}

/* ===== Image Controls ===== */
.image-controls {
    position: relative;
    display: flex;
    align-items: flex-start;
}

.image-toolbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.image-toolbar button {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
}

.image-toolbar button:hover {
    background: #eee;
}

.image-controls-panel {
    position: absolute;
    left: 46px;
    top: 0;
}

.image-control-panel {
    display: none;
    background: white;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    min-width: 180px;
}

.image-control-panel.active {
    display: block;
}

.image-control-panel input[type=range] {
    width: 100%;
}

.tile-image-container {
    position: relative;
}

/* controls overlay */

.tile-image-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5000;
}

/* slider panels */

.image-controls-panel,
.tile-image-controls__panel {
    z-index: 6000;
}

/* zoom frame must stay below */

.tile-zoom-frame {
    z-index: 1;
    cursor: default;
}

.image-control-panel {
    display: none;
}

.image-control-panel.active {
    display: block;
}

.tile-zoom-frame.zoomed {
    cursor: grab;
}

/* ===== User Management (admin) ===== */
.users-page {
    padding-top: 1.5rem;
}

.users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.users-header h2 {
    margin: 0;
}

.users-header__new-btn {
    width: auto;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
}

.users-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.users-stat {
    background: var(--sam-white);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.users-stat__value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--grey-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.users-stat__label {
    font-size: 0.8125rem;
    color: var(--grey-600);
}

.users-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    background: var(--sam-white);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.users-filter__search {
    flex: 1 1 240px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1.5px solid var(--grey-200);
    border-radius: 8px;
    background: var(--sam-white);
    color: var(--grey-800);
}

.users-filter__search:focus {
    outline: none;
    border-color: var(--sam-blue);
    box-shadow: 0 0 0 3px var(--sam-blue-200);
}

.users-filter__role {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1.5px solid var(--grey-200);
    border-radius: 8px;
    background: var(--sam-white);
    color: var(--grey-800);
}

.users-filter__submit {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    background-color: var(--sam-black);
    color: var(--sam-white);
}

.users-filter__submit:hover {
    background-color: var(--grey-800);
}

.users-filter__clear {
    font-size: 0.8125rem;
    color: var(--grey-600);
}

.users-table-wrapper {
    background: var(--sam-white);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.users-table thead th {
    text-align: left;
    padding: 0.75rem 0.875rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--grey-600);
    background: var(--grey-100);
    border-bottom: 1px solid var(--grey-200);
    white-space: nowrap;
}

.users-table tbody td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--grey-100);
    vertical-align: top;
    color: var(--grey-800);
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.users-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.users-table__actions {
    white-space: nowrap;
    text-align: right;
}

.users-cell-user {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 180px;
}

.users-cell-user__text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.users-cell-user__name {
    font-weight: 600;
    color: var(--grey-800);
    text-decoration: none;
}

.users-cell-user__name:hover {
    color: var(--sam-blue);
    text-decoration: underline;
}

.users-cell-user__fullname {
    font-size: 0.8125rem;
    color: var(--grey-600);
}

.users-cell-user__email {
    font-size: 0.75rem;
    color: var(--grey-400);
}

.users-cell-active {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 140px;
}

.users-cell-active__flight {
    font-weight: 600;
    font-size: 0.8125rem;
}

.users-cell-active__since {
    font-size: 0.75rem;
    color: var(--grey-600);
}

.users-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    flex: 0 0 auto;
    margin-top: 0.4rem;
}

.users-dot--online {
    background-color: var(--sam-green);
    box-shadow: 0 0 0 3px rgba(62, 165, 51, 0.18);
}

.users-dot--offline {
    background-color: var(--grey-200);
}

.users-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.4;
    background: var(--grey-100);
    color: var(--grey-800);
    margin-right: 0.25rem;
}

.users-badge--admin {
    background: var(--sam-blue-200);
    color: var(--sam-blue-1200);
}

.users-badge--reviewer {
    background: var(--grey-100);
    color: var(--grey-800);
}

.users-badge--super {
    background: var(--sam-yellow);
    color: var(--grey-800);
}

.users-badge--active {
    background: #E6F7E4;
    color: var(--sam-green);
}

.users-badge--inactive {
    background: #FDF2F2;
    color: var(--sam-red);
}

.users-muted {
    color: var(--grey-400);
}

.users-action {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--grey-200);
    background: var(--sam-white);
    color: var(--grey-800);
    cursor: pointer;
    text-decoration: none;
    margin-left: 0.25rem;
}

.users-action:hover {
    background: var(--grey-100);
    text-decoration: none;
}

.users-action--danger {
    color: var(--sam-red);
    border-color: var(--sam-red-800);
}

.users-action--danger:hover {
    background: #FDF2F2;
}

.users-action--success {
    color: var(--sam-green);
    border-color: var(--sam-green-800);
}

.users-action--success:hover {
    background: #F0FDF0;
}

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

/* ----- Form / edit page ----- */
.users-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .users-form-layout {
        grid-template-columns: 1fr;
    }
}

.users-card {
    background: var(--sam-white);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

.users-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--grey-800);
}

.users-form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--grey-600);
    margin-top: 0.25rem;
}

.users-form-error {
    color: var(--sam-red);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.users-form-submit {
    width: auto;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
}

/* Style raw form widgets the same way as login form inputs */
.users-card .form-group input[type="text"],
.users-card .form-group input[type="email"],
.users-card .form-group input[type="password"],
.users-card .form-group select {
    width: 100%;
    padding: 0.6rem 0.875rem;
    font-size: 0.9375rem;
    border: 1.5px solid var(--grey-200);
    border-radius: 8px;
    background: var(--sam-white);
    color: var(--grey-800);
}

.users-card .form-group input:focus,
.users-card .form-group select:focus {
    outline: none;
    border-color: var(--sam-blue);
    box-shadow: 0 0 0 3px var(--sam-blue-200);
}

.users-card .form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.users-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.users-sidebar__list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--grey-100);
}

.users-sidebar__list li:last-child {
    border-bottom: none;
}

.users-sidebar__label {
    color: var(--grey-600);
}

.users-sidebar__value {
    color: var(--grey-800);
    font-weight: 500;
    text-align: right;
}

/* ---------------------------------------------------------------------------
   Changelog page
   --------------------------------------------------------------------------- */

.changelog-intro {
    color: var(--grey-600);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.changelog-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 760px;
}

.changelog-entry {
    background: var(--sam-white);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.changelog-entry__header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--grey-200);
    background: var(--grey-100);
}

.changelog-entry__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--grey-800);
    margin: 0;
}

.changelog-entry__body {
    padding: 1.125rem 1.25rem;
    font-size: 0.9375rem;
    color: var(--grey-800);
    line-height: 1.6;
}

.changelog-entry__body p {
    margin: 0 0 0.75rem;
}

.changelog-entry__body p:last-child {
    margin-bottom: 0;
}

.changelog-entry__body ul,
.changelog-entry__body ol {
    margin: 0 0 0.75rem 1.25rem;
    padding: 0;
}

.changelog-entry__body li {
    margin-bottom: 0.35rem;
}

.changelog-entry__body li:last-child {
    margin-bottom: 0;
}

.changelog-entry__body .changelog-note {
    background: var(--sam-blue-200);
    border-left: 3px solid var(--sam-blue);
    border-radius: 4px;
    padding: 0.6rem 0.875rem;
    margin: 0.75rem 0;
    font-size: 0.875rem;
    color: var(--grey-800);
}
