/* Dashboard-local surfaces keep the existing blue background and navbar. */
.page-dashboard {
    --dashboard-ink: #081321;
    --dashboard-muted: #526584;
    --dashboard-border: #d7e1eb;
    --dashboard-surface: #f8fafd;
    --dashboard-shadow: 0 5px 12px rgba(28, 57, 87, .07), 0 1px 2px rgba(28, 57, 87, .03);
    --dashboard-section-gap: 20px;
}
.page-dashboard [hidden] { display: none !important; }
.dashboard-page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 20px 48px; }
.page-dashboard .dashboard-page .dashboard-card {
    --surface-radius: 22px;
    --dashboard-section-gap: 20px;
    padding: 36px;
    border-color: #e2edf5;
    background: #eff5f9;
    color: var(--dashboard-ink);
    box-shadow: 0 7px 16px rgba(24, 70, 105, .12), inset 0 1px 0 #fff;
}
.page-dashboard .dashboard-card::before { content: none; }
.page-dashboard .dashboard-header { max-width: none; margin-bottom: 20px; padding-inline: 6px; }
.dashboard-eyebrow { margin: 0 0 6px; color: #30577d; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.dashboard-card h1 { margin: 0 0 6px; color: var(--dashboard-ink); font-size: 36px; line-height: 1.16; font-weight: 800; letter-spacing: -.035em; }
#welcomeText { margin: 0; color: var(--dashboard-muted); font-size: 14px; font-weight: 600; line-height: 1.5; }
.page-dashboard .dashboard-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 34px; }
.page-dashboard [data-premium-hidden="true"] .dashboard-overview { grid-template-columns: minmax(0, 1fr); }
.dashboard-summary-card,
.selected-photo-overview,
.photo-list-card,
.stat-card,
.confidence-meter-card,
.photo-rating-section,
.photo-management,
.photo-item,
.selected-empty {
    min-width: 0;
    border: 1px solid var(--dashboard-border);
    border-radius: 20px;
    background: var(--dashboard-surface);
    box-shadow: var(--dashboard-shadow), inset 0 1px 0 #fff;
}
.dashboard-summary-card { display: flex; flex-direction: column; align-items: flex-start; min-height: 124px; padding: 18px 20px; }
.dashboard-summary-label { color: var(--dashboard-muted); font-size: 11px; font-weight: 800; letter-spacing: .075em; line-height: 1.3; text-transform: uppercase; }
.dashboard-summary-value { display: block; margin: 10px 0 14px; font-size: 32px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.035em; overflow-wrap: anywhere; }
.dashboard-summary-value--status { font-size: 29px; }
.dashboard-summary-value--status[data-state="active"] { color: #147039; }
.dashboard-summary-value--status[data-state="inactive"] { color: var(--dashboard-muted); }
.dashboard-summary-link { display: inline-flex; align-items: center; gap: 7px; margin-top: auto; color: #103866; font-size: 13px; font-weight: 750; line-height: 1.35; text-decoration: none; }
.dashboard-summary-link:hover { color: #007bb9; text-decoration: underline; text-underline-offset: 3px; }
.dashboard-notices { display: grid; gap: 10px; margin-bottom: 20px; }
.dashboard-notice { margin: 0; padding: 14px 17px; border: 1px solid var(--dashboard-border); border-radius: 14px; background: #e8eff7; color: #30577d; font-size: 14px; font-weight: 650; line-height: 1.5; }
.dashboard-notice--positive { border-color: #bcdcc8; background: #e4f3e9; color: #265c36; }

/* Separate cards in the left column; the photo selector spans their height. */
.page-dashboard .dashboard-layout { display: grid; grid-template-columns: minmax(0, 2.08fr) minmax(260px, 1fr); gap: 20px; align-items: stretch; }
.selected-photo-card { min-width: 0; container: dashboard-photo / inline-size; }
.page-dashboard #selectedPhotoContent { display: grid; gap: var(--dashboard-section-gap); }
.selected-empty { padding: 24px; }
.selected-photo-overview { display: grid; grid-template-columns: minmax(0, .87fr) minmax(0, 1fr); align-items: center; gap: 20px; padding: 20px; }
.selected-photo-image { display: block; width: 100%; height: auto; max-height: 430px; object-fit: contain; margin: 0; border: 1px solid #e2e6eb; border-radius: 14px; background: #eef1f4; }
.page-dashboard .dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-width: 0; }
.stat-card { padding: 18px; }
.stat-card:last-child { grid-column: 1 / -1; }
.stat-card span { display: block; margin-bottom: 12px; color: var(--dashboard-muted); font-size: 11px; font-weight: 800; letter-spacing: .075em; line-height: 1.35; text-transform: uppercase; overflow-wrap: anywhere; }
.stat-card strong { display: block; color: var(--dashboard-ink); font-size: 29px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.page-dashboard :is(.confidence-meter-card, .photo-rating-section, .photo-management) { margin: 0; padding: 20px; }
.confidence-meter-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.confidence-meter-heading h2,
.photo-section-heading h2,
.photo-orders summary h2,
.photo-list-header h2 { margin: 0; color: var(--dashboard-ink); font-size: 20px; font-weight: 750; line-height: 1.25; letter-spacing: -.035em; }
.confidence-meter-heading p { margin: 4px 0 0; color: var(--dashboard-muted); font-size: 13px; font-weight: 550; line-height: 1.45; }
#confidenceMeterValue,
.photo-rating-state { flex-shrink: 0; padding: 5px 12px; border-radius: 999px; background: #e4eafa; color: #244d79; font-size: 13px; font-weight: 750; line-height: 1.2; }
.confidence-meter { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.confidence-segment { min-width: 0; color: var(--dashboard-muted); }
.confidence-segment-bar { display: block; height: 12px; border-radius: 999px; background: #dce0e6; box-shadow: inset 0 1px 3px rgba(40, 55, 77, .2); }
.confidence-segment-label { display: block; margin-top: 8px; font-size: 11px; font-weight: 650; line-height: 1.2; text-align: center; }
.confidence-segment.is-lit .confidence-segment-bar { background: #758299; }
.confidence-segment.is-current { color: #193e6c; font-weight: 800; }
.confidence-segment.is-current .confidence-segment-bar { background: #3d6289; box-shadow: inset 0 1px 2px rgba(18, 51, 83, .2), 0 2px 5px rgba(28, 57, 87, .16); }
.photo-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Use the existing activation control as the source of the badge's state. */
.photo-rating-state { background: #edf0f4; color: var(--dashboard-muted); }
.photo-rating-section:has(.face-activation-btn[aria-pressed="true"]) .photo-rating-state { background: #dff1e7; color: #086039; }
.face-safety-status { margin: 14px 0 0; color: var(--dashboard-muted); font-size: 14px; font-weight: 650; line-height: 1.5; }
.face-safety-status.is-removed { color: #8a1f1f; }
#faceActions,
#photoManagementActions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
#photoActionHint { margin: 12px 0 0; font-size: 13px; line-height: 1.5; }
#photoActionStatus { margin: 12px 0 0; font-size: 14px; line-height: 1.5; }
#photoActionStatus:empty { display: none; }
#photoActionStatus.is-error,
#photoDialogStatus { color: #8a1f1f; }
.empty-text,
.selected-empty { color: var(--dashboard-muted); font-size: 14px; font-weight: 550; line-height: 1.5; }
.photo-orders summary { cursor: pointer; color: var(--dashboard-ink); font-weight: 750; }
.photo-orders summary h2 { display: inline; margin-left: 5px; }
.photo-orders-content { margin-top: 16px; }
.photo-order { padding: 16px 0; border-bottom: 1px solid var(--dashboard-border); overflow-wrap: anywhere; }
.photo-order:last-child { border-bottom: 0; }
.photo-order p { margin-block: 10px; font-size: 14px; line-height: 1.5; }
.photo-order progress { display: block; width: 100%; height: 12px; margin-bottom: 14px; accent-color: #35648b; }
.photo-order .photo-order-result { margin-bottom: 0; }

/* Secondary controls echo the existing rounded navbar buttons. */
.face-action-btn,
.dashboard-btn,
.small-upload-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 18px; border: 1px solid #e3e9ef; border-radius: 999px; background: linear-gradient(180deg, #fff, #f3f6fa); box-shadow: 0 4px 9px rgba(28, 57, 87, .08), inset 0 1px 0 #fff; color: var(--dashboard-ink); font: inherit; font-size: 13px; font-weight: 750; line-height: 1.3; text-align: center; text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease; }
.face-action-btn:hover,
.dashboard-btn:hover,
.small-upload-btn:hover { background: #eaf1f7; border-color: #c2d2e0; }
.face-action-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.face-action-btn.face-activation-btn[aria-pressed="true"] { border-color: #a4b9ce; background: #e9eff4; box-shadow: inset 0 1px 3px rgba(28, 57, 87, .13); transform: translateY(1px); }
.face-action-btn.danger { color: #9e161c; border-color: #dcaeb4; background: #f4e9ec; box-shadow: inset 0 1px 0 #fff; }
.face-action-btn.danger:hover { background: #f1dce0; border-color: #cd8a93; }
.face-action-btn.primary { background: #244d6c; border-color: #244d6c; color: #fff; }
.face-action-btn.primary:hover { background: #193c58; }
.face-action-btn.primary.danger { background: #8a1f1f; border-color: #8a1f1f; color: #fff; }
.page-dashboard :is(a, button, summary):focus-visible { outline: 3px solid #1688c8; outline-offset: 3px; }
.page-dashboard .dashboard-actions { display: flex; flex-direction: row; align-items: stretch; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.dashboard-btn { flex: 1 1 150px; min-height: 50px; padding: 14px 18px; font-size: 15px; }
#openScoreCard { background: linear-gradient(180deg, #0c9cdb, #007fbe); border-color: #007fbe; color: #fff; box-shadow: 0 5px 12px rgba(21, 101, 148, .18), inset 0 1px 0 rgba(255, 255, 255, .3); }
#openScoreCard:hover { background: #0078b4; }
.photo-list-card { padding: 18px; }
.page-dashboard .photo-list-header { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.photo-list-header h2 { font-size: 21px; }
.small-upload-btn { min-height: 36px; padding: 8px 15px; flex-shrink: 0; }
.photo-list { display: flex; flex-direction: column; gap: 12px; }
.photo-item { display: flex; align-items: center; width: 100%; padding: 11px; gap: 13px; border-color: #e4e9f0; border-radius: 18px; color: var(--dashboard-ink); text-align: left; font: inherit; cursor: pointer; }
.photo-item:hover { background: #eef4fa; }
.photo-item.active { border-color: #cad9e7; background: #fff; }
.photo-item-thumb-wrap { position: relative; flex-shrink: 0; width: 56px; height: 56px; }
.photo-item img { display: block; width: 100%; height: 100%; border: 1px solid #e2e6eb; border-radius: 11px; object-fit: cover; background: #e6ecf2; }
.photo-item-info { display: flex; flex-direction: column; min-width: 0; gap: 4px; overflow-wrap: anywhere; }
.photo-item-info strong { font-size: 14px; font-weight: 750; }
.photo-item-info span { color: var(--dashboard-muted); font-size: 13px; font-weight: 550; line-height: 1.4; }
.photo-status-badge { position: absolute; left: 2px; right: 2px; bottom: 2px; padding: 2px; border-radius: 5px; color: #fff; font-size: 9px; font-weight: 750; line-height: 1.2; text-align: center; pointer-events: none; }
.photo-status-badge.is-checking { background: rgba(40, 40, 40, .8); }
.photo-status-badge.is-removed { background: rgba(140, 28, 28, .9); }
.photo-item.is-removed img { opacity: .55; filter: grayscale(.35); }
.page-dashboard .dashboard-progress { margin-top: 24px; border-color: var(--dashboard-border); background: var(--dashboard-surface); box-shadow: var(--dashboard-shadow); }
@media (min-width: 851px) {
    .page-dashboard[data-ad-layout="responsive"] .responsive-ads-shell { --desktop-content-width: min(1200px, 92vw); }
}
@media (max-width: 850px) {
    .page-dashboard .dashboard-layout { grid-template-columns: minmax(0, 1fr); }
    .photo-list-card { min-height: 0; }
    .photo-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
}
/* Stack the statistics when the actual photo column cannot fit two readable
   cards. The portrait remains beside them at every screen size. */
@container dashboard-photo (max-width: 520px) {
    .page-dashboard .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .stat-card { padding: 12px 14px; border-radius: 14px; }
    .stat-card span { margin-bottom: 6px; font-size: 10px; letter-spacing: .035em; }
    .stat-card strong { font-size: 24px; }
}
@media (max-width: 600px) {
    .page-dashboard { --dashboard-section-gap: 16px; }
    .page-dashboard[data-ad-layout="responsive"] .dashboard-page { padding: 0; }
    .page-dashboard .dashboard-page .dashboard-card { --surface-radius: 22px; --dashboard-section-gap: 16px; padding: 16px 12px; }
    .page-dashboard .dashboard-header { padding: 0; margin-bottom: 16px; }
    .dashboard-eyebrow { font-size: 10px; }
    .dashboard-card h1 { font-size: 30px; }
    #welcomeText { font-size: 13px; }
    .page-dashboard .dashboard-overview { gap: 6px; margin-bottom: 20px; }
    .dashboard-summary-card { min-height: 128px; padding: 12px 8px; border-radius: 14px; }
    .dashboard-summary-label { min-height: 3.6em; font-size: clamp(8px, 2vw, 10px); letter-spacing: .035em; }
    .dashboard-summary-value { margin: 8px 0 12px; font-size: clamp(23px, 6vw, 30px); }
    .dashboard-summary-value--status { font-size: clamp(18px, 4.6vw, 24px); }
    .dashboard-summary-link { gap: 3px; font-size: 10px; }
    .dashboard-notice { padding: 12px; font-size: 12px; }
    .page-dashboard .dashboard-layout { gap: 16px; }
    .selected-photo-overview { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); gap: 12px; padding: 12px; border-radius: 16px; }
    /* Preserve the existing mobile portrait crop and reserve space as it loads. */
    .selected-photo-image { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 11px; max-height: none; }
    .page-dashboard .dashboard-grid { gap: 8px; }
    .stat-card { padding: 12px 8px; border-radius: 12px; }
    .stat-card span { margin-bottom: 6px; font-size: 10px; letter-spacing: .025em; }
    .stat-card strong { font-size: clamp(20px, 5vw, 26px); }
    .page-dashboard :is(.confidence-meter-card, .photo-rating-section, .photo-management) { padding: 16px 12px; border-radius: 16px; }
    .confidence-meter-heading { gap: 8px; margin-bottom: 16px; }
    .confidence-meter-heading h2, .photo-section-heading h2, .photo-orders summary h2 { font-size: 18px; }
    .confidence-meter-heading p { font-size: 12px; }
    #confidenceMeterValue, .photo-rating-state { padding: 5px 9px; font-size: 11px; }
    .confidence-meter { gap: 4px; }
    .confidence-segment-bar { height: 10px; }
    .confidence-segment-label { font-size: 9px; }
    #faceActions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .face-action-btn { min-width: 0; min-height: 42px; padding: 10px 12px; font-size: 12px; }
    #photoActionHint { font-size: 12px; }
    .page-dashboard .dashboard-actions { gap: 10px; margin-top: 4px; }
    .dashboard-btn { flex-basis: 100%; min-height: 46px; font-size: 14px; }
    .photo-list-card { padding: 14px; border-radius: 16px; }
    .photo-list { display: flex; flex-direction: row; overflow-x: auto; gap: 10px; padding: 2px 2px 8px; scrollbar-width: thin; }
    .photo-item { flex: 0 0 190px; padding: 10px; gap: 10px; border-radius: 14px; }
    .photo-item-thumb-wrap { width: 48px; height: 48px; }
    .photo-item-info strong { font-size: 13px; }
    .photo-item-info span { font-size: 12px; }
    .page-dashboard .dashboard-progress { margin-top: 16px; }
}
.photo-action-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100dvh - 40px);
    box-sizing: border-box;
    overflow: auto;
    padding: 28px;
    border: 1px solid #d7e0e7;
    border-radius: 24px;
    background: #f5f8fa;
    color: #222;
    font-family: inherit;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
}
.photo-action-dialog::backdrop { background: rgba(15, 25, 35, .55); }
.photo-action-dialog h2 { margin: 0 0 16px; font-size: 24px; }
#photoDialogImage { width: 80px; height: 80px; border-radius: 14px; object-fit: cover; }
#photoDialogDescription { font-size: 14px; line-height: 1.65; }
#photoDialogCost { font-weight: 800; line-height: 1.6; }
#photoDialogFields { display: grid; gap: 14px; }
#photoDialogFields label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
#photoDialogFields input,
#photoDialogFields select { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #b4c3cf; border-radius: 10px; background: #fff; font: inherit; }
.photo-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
@media (max-width: 650px) {
    .photo-action-dialog { padding: 22px; }
    .photo-dialog-actions .face-action-btn { justify-content: center; width: 100%; }
}
