/* ============================================================
   KIWICAR — Fiber-optic styles v2 (4-stage publication)
   ============================================================ */

:root {
    --kiwi: #7CB342;
    --kiwi-dark: #558B2F;
    --kiwi-light: #C5E1A5;
    --kiwi-bg: #F1F8E9;
    --kiwi-yellow: #CDDC39;
    --fiber-glow: #B2FF59;
    --rec-yellow: #FFD600;
    --rec-red: #E53935;
}

/* === Container === */
#step0.fiber-mode {
    position: relative;
    min-height: calc(100vh - 80px);
    padding: 0;
    background: linear-gradient(180deg, #fafafa 0%, #f0f4ec 100%);
}
.fiber-mode .voice-section { display: none; }  /* hide legacy */

/* === Shell layout === */
.fiber-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 80px;
    position: relative;
}

/* === Header (breadcrumbs + reset button) === */
.fiber-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* === Progress bar (4 stages) === */
.fiber-progress {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 4px;
}
.fp-step {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9e9e9e;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.3s;
}
.fp-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #9e9e9e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.3s, color 0.3s;
}
.fp-label { white-space: nowrap; }
.fp-step.active { color: #558B2F; font-weight: 600; }
.fp-step.active .fp-num { background: var(--kiwi); color: #fff; }
.fp-step.done { color: var(--kiwi); }
.fp-step.done .fp-num { background: var(--kiwi-light); color: var(--kiwi-dark); }
.fp-line {
    flex: 0 0 32px;
    height: 2px;
    background: #e0e0e0;
    transition: background 0.3s;
}
.fp-line.done { background: var(--kiwi); }

/* Reset button in header */
.fiber-reset-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 14px;
    color: #757575;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.fiber-reset-btn:hover {
    border-color: var(--rec-red);
    color: var(--rec-red);
    background: #fff5f5;
}

/* === Stage wrap === */
.fiber-stage-wrap {
    position: relative;
    min-height: 420px;
}
.fiber-stage { animation: fs-fadein 0.35s ease; }
@keyframes fs-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Stage header (title + hint) === */
.fs-header {
    text-align: center;
    margin-bottom: 24px;
}
.fs-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 600;
    color: #424242;
    margin: 0 0 8px;
}
.fs-hint {
    font-size: 14px;
    color: #757575;
    margin: 0;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* === Mic placeholder (Step A skeleton — voice not yet wired) === */
.fs-mic-placeholder {
    text-align: center;
    margin: 32px auto 24px;
}
.fs-mic-disabled {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #c5e1a5, #aed581 60%, #9ccc65);
    box-shadow: 0 0 0 4px transparent,
                0 0 0 20px rgba(0,0,0,0.04),
                0 8px 24px rgba(85,139,47,0.18);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    cursor: not-allowed;
}
.fs-mic-disabled .mic-icon {
    width: 56px;
    height: 56px;
    color: #fff;
    fill: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.fs-mic-hint {
    margin-top: 12px;
    font-size: 12px;
    color: #9e9e9e;
    font-style: italic;
}

/* === Fields container === */
.fs-fields {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 720px;
    margin: 0 auto;
}
@media (max-width: 600px) {
    .fs-fields { grid-template-columns: 1fr; padding: 16px; }
}

/* Description (stage 3) — full width single column */
#fiberStage3 .fs-fields { grid-template-columns: 1fr; }

/* Voronka (stage 1) — single column for sequential narrowing */
#fiberStage1 .fs-fields { grid-template-columns: 1fr; max-width: 520px; }

/* Field cell */
.fs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fs-field-label {
    font-size: 12px;
    font-weight: 600;
    color: #616161;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Inputs */
.fs-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #212121;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.fs-input:focus {
    outline: none;
    border-color: var(--kiwi);
    box-shadow: 0 0 0 3px rgba(124,179,66,0.18);
}
textarea.fs-input { resize: vertical; min-height: 120px; }

/* Checkbox */
.fs-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #424242;
    cursor: pointer;
    user-select: none;
}
.fs-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--kiwi);
    cursor: pointer;
}

/* === Navigation buttons === */
.fiber-nav {
    margin: 32px auto 0;
    max-width: 720px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.fb-btn {
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s, background 0.15s, color 0.15s;
}
.fb-btn:hover { transform: translateY(-1px); }
.fb-btn.primary { background: var(--kiwi); color: #fff; }
.fb-btn.primary:hover { background: var(--kiwi-dark); }
.fb-btn.warn { background: var(--kiwi-yellow); color: #424242; }
.fb-btn.warn:hover { background: #afb42b; color: #fff; }
.fb-btn.ghost { background: transparent; color: #757575; border: 1px solid #e0e0e0; }
.fb-btn.ghost:hover { background: #f5f5f5; color: #424242; }

/* === Confirm modal === */
.fiber-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}
.fiber-confirm-overlay.open { display: flex; animation: fs-fadein 0.2s ease; }
.fiber-confirm-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    text-align: center;
}
.fc-icon { font-size: 48px; margin-bottom: 12px; }
.fc-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    margin: 0 0 12px;
    color: #424242;
}
.fc-body {
    font-size: 14px;
    color: #616161;
    line-height: 1.5;
    margin: 0 0 24px;
}
.fc-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .fiber-shell { padding: 16px 12px 60px; }
    .fp-label { display: none; }
    .fp-line { flex: 0 0 16px; }
    .fs-title { font-size: 22px; }
    .fb-btn { padding: 10px 16px; font-size: 13px; }
    .fiber-reset-btn span { display: none; }
}

/* ============================================================
   Legacy classes preserved (older code paths still reference them)
   ============================================================ */
.mic-orb {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #aed581, #7CB342 60%, #558B2F);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mic-orb .mic-icon { width: 56px; height: 56px; color: #fff; fill: #fff; }

/* === Voronka result card (stage 1 success) === */
.voronka-result {
    margin: 20px auto 0;
    max-width: 520px;
    animation: fs-fadein 0.4s ease;
}
.vr-card {
    background: linear-gradient(180deg, #f1f8e9 0%, #fff 60%);
    border: 2px solid var(--kiwi);
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: 0 6px 20px rgba(124,179,66,0.18);
    text-align: center;
}
.vr-label {
    color: var(--kiwi-dark);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.vr-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 12px;
}
.vr-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.vr-spec {
    background: #fff;
    border: 1px solid var(--kiwi-light);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--kiwi-dark);
    font-weight: 500;
}

/* Disabled next button while voronka not resolved */
.fb-btn.disabled, .fb-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* === Year + Month pair === */
.vk-year-month .vk-year-month-row {
    display: flex;
    gap: 10px;
}
.vk-year-sel { flex: 0 0 45%; }
.vk-month-sel { flex: 1; }
@media (max-width: 600px) {
    .vk-year-month .vk-year-month-row { flex-direction: column; gap: 6px; }
    .vk-year-sel, .vk-month-sel { flex: 1; width: 100%; }
}

/* === Manual mode link === */
.voronka-manual-link-wrap {
    text-align: center;
    margin-top: 18px;
}
.voronka-manual-link {
    background: none;
    border: none;
    color: #1976d2;
    text-decoration: underline;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    padding: 6px 10px;
}
.voronka-manual-link:hover { color: #0d47a1; text-decoration: none; }
.voronka-manual-notice {
    margin-top: 12px;
    font-size: 13px;
    color: #757575;
    font-style: italic;
    background: #fff8e1;
    border-left: 3px solid #ffc107;
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    max-width: 480px;
    margin: 12px auto 0;
}

/* ============================================================
   Microphone v2 (Step C.1) — interactive with progress ring
   ============================================================ */

.fs-mic-wrap {
    text-align: center;
    margin: 28px auto 32px;
    position: relative;
}

.fs-mic-btn {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.15s;
}
.fs-mic-btn:hover { transform: scale(1.04); }
.fs-mic-btn:active { transform: scale(0.97); }

/* SVG ring (background + foreground) */
.fs-mic-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);  /* start at 12 o'clock */
    pointer-events: none;
}
.fs-mic-ring-bg {
    fill: none;
    stroke: rgba(0,0,0,0.06);
    stroke-width: 6;
}
.fs-mic-ring-fg {
    fill: none;
    stroke: var(--kiwi);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 289;
    stroke-dashoffset: 289;
    transition: stroke 0.3s;
}

/* Inner orb */
.fs-mic-orb {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #aed581, #7CB342 60%, #558B2F);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(85,139,47,0.25);
    transition: background 0.3s, box-shadow 0.3s;
    pointer-events: none;
}
.fs-mic-icon {
    width: 56px;
    height: 56px;
    color: #fff;
    fill: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

/* Timer */
.fs-mic-timer {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #424242;
    background: rgba(255,255,255,0.95);
    padding: 2px 10px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    pointer-events: none;
    white-space: nowrap;
    min-height: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}
.fs-mic-btn[data-state="recording"] .fs-mic-timer,
.fs-mic-btn[data-state="recording-warn"] .fs-mic-timer,
.fs-mic-btn[data-state="recording-critical"] .fs-mic-timer,
.fs-mic-btn[data-state="recognizing"] .fs-mic-timer {
    opacity: 1;
}

/* === State: recording (green 0-40s) === */
.fs-mic-btn[data-state="recording"] .fs-mic-ring-fg { stroke: var(--kiwi); }
.fs-mic-btn[data-state="recording"] .fs-mic-orb {
    background: radial-gradient(circle at 35% 30%, #b9e398, #7CB342 50%, #4d7e2a);
    animation: mic-pulse-green 2s ease-in-out infinite;
}
@keyframes mic-pulse-green {
    0%, 100% { box-shadow: 0 6px 18px rgba(85,139,47,0.3), 0 0 0 0 rgba(124,179,66,0.4); }
    50% { box-shadow: 0 6px 18px rgba(85,139,47,0.3), 0 0 0 14px rgba(124,179,66,0); }
}

/* === State: warn (yellow 40-50s) === */
.fs-mic-btn[data-state="recording-warn"] .fs-mic-ring-fg { stroke: #FBC02D; }
.fs-mic-btn[data-state="recording-warn"] .fs-mic-orb {
    background: radial-gradient(circle at 35% 30%, #fff176, #FBC02D 50%, #c79100);
    animation: mic-pulse-yellow 1s ease-in-out infinite;
}
@keyframes mic-pulse-yellow {
    0%, 100% { box-shadow: 0 6px 18px rgba(251,192,45,0.35), 0 0 0 0 rgba(251,192,45,0.5); }
    50% { box-shadow: 0 6px 18px rgba(251,192,45,0.35), 0 0 0 12px rgba(251,192,45,0); }
}

/* === State: critical (red 50-60s, pulsing) === */
.fs-mic-btn[data-state="recording-critical"] .fs-mic-ring-fg { stroke: #E53935; }
.fs-mic-btn[data-state="recording-critical"] .fs-mic-orb {
    background: radial-gradient(circle at 35% 30%, #ff8a80, #E53935 50%, #b71c1c);
    animation: mic-pulse-red 0.5s ease-in-out infinite;
}
@keyframes mic-pulse-red {
    0%, 100% { box-shadow: 0 6px 18px rgba(229,57,53,0.45), 0 0 0 0 rgba(229,57,53,0.6); }
    50% { box-shadow: 0 6px 18px rgba(229,57,53,0.45), 0 0 0 16px rgba(229,57,53,0); }
}

/* === State: recognizing (yellow stable) === */
.fs-mic-btn[data-state="recognizing"] {
    cursor: wait;
    pointer-events: none;
}
.fs-mic-btn[data-state="recognizing"] .fs-mic-ring-fg { stroke: #FBC02D; stroke-dashoffset: 0; }
.fs-mic-btn[data-state="recognizing"] .fs-mic-orb {
    background: radial-gradient(circle at 35% 30%, #ffe082, #FBC02D 50%, #c79100);
    animation: mic-recognizing 1.5s ease-in-out infinite;
}
@keyframes mic-recognizing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.95); }
}

/* === Captions under mic === */
.fs-mic-captions {
    margin-top: 26px;
    text-align: center;
}
.fs-mic-caption-main {
    font-size: 13px;
    color: #757575;
    font-weight: 500;
}
.fs-mic-caption-sub {
    font-size: 11px;
    color: #9e9e9e;
    margin-top: 3px;
    font-style: italic;
}

/* === Transcript preview bubble === */
.fs-transcript-bubble {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    margin-top: 40px;
    background: rgba(33,33,33,0.92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13px;
    max-width: 400px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.4s, transform 0.4s;
    z-index: 5;
    pointer-events: none;
}
.fs-transcript-bubble.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === AI-filled field highlight (Step C.3.2) === */
@keyframes ai-flash {
    0% { box-shadow: 0 0 0 0 rgba(124,179,66,0.65); background: #f1f8e9; }
    100% { box-shadow: 0 0 0 12px rgba(124,179,66,0); background: #fff; }
}
.ai-filled-flash {
    animation: ai-flash 1.2s ease-out;
}

/* === Pulse for empty fields after voice input === */
@keyframes vk-pulse-bg {
    0%, 100% { background: #fff; box-shadow: 0 0 0 0 rgba(124,179,66,0); }
    50% { background: #f1f8e9; box-shadow: 0 0 0 4px rgba(124,179,66,0.25); }
}
.vk-pulse .fs-input,
.vk-pulse select,
.vk-pulse .vk-year-month-row {
    animation: vk-pulse-bg 1.5s ease-in-out infinite;
    border-color: var(--kiwi) !important;
}
.vk-pulse .fs-field-label {
    color: var(--kiwi-dark);
    font-weight: 700;
}

/* Mic button pulses softly when there's an empty field below */
@keyframes mic-empty-hint {
    0%, 100% { box-shadow: 0 6px 18px rgba(85,139,47,0.25), 0 0 0 0 rgba(124,179,66,0.5); }
    50% { box-shadow: 0 6px 18px rgba(85,139,47,0.25), 0 0 0 10px rgba(124,179,66,0); }
}
.fs-mic-btn[data-state="idle"].fs-mic-btn-pulse-empty .fs-mic-orb {
    animation: mic-empty-hint 1.5s ease-in-out infinite;
}

/* ============================================================
   STAGE 2 — Grouped checklist with stacking (Step C.4)
   ============================================================ */

/* Overall progress bar */
.overall-progress {
    margin: 0 auto 16px;
    max-width: 1100px;
    padding: 0 16px;
}
.op-bar {
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.op-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--kiwi-light), var(--kiwi), var(--kiwi-dark));
    width: 0%;
    transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
}
.op-text {
    margin-top: 4px;
    font-size: 11px;
    color: #9e9e9e;
    text-align: right;
}
.op-text #opPct {
    font-weight: 700;
    color: var(--kiwi-dark);
}
.op-hint {
    font-style: italic;
}

/* Groups container */
.fs-groups {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Group block */
.fs-group {
    border-radius: 14px;
    padding: 14px 18px 16px;
    border: 1px solid #e0e0e0;
    background: #fff;
    transition: background 250ms, border-color 250ms, opacity 250ms;
}
.fs-group.full {
    background: #f9fcf6;
    border-color: var(--kiwi-light);
}
.fs-group.partial {
    background: #fff;
    border-color: #e8e8e8;
}
.fs-group.empty {
    background: #fafafa;
    border-color: #ececec;
    opacity: 0.85;
}

.fs-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.fs-group-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #616161;
}
.fs-group.full .fs-group-title { color: var(--kiwi-dark); }
.fs-group.empty .fs-group-title { color: #9e9e9e; font-weight: 600; }
.fs-group-counter {
    font-size: 12px;
    color: #9e9e9e;
    font-weight: 500;
}
.fs-group.full .fs-group-counter { color: var(--kiwi); font-weight: 700; }

/* Group rows */
.fs-group-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Row */
.fs-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px 8px 4px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background 150ms;
    will-change: transform;
}
.fs-row:hover { background: rgba(124,179,66,0.06); }
.fs-row.filled .fs-row-label,
.fs-row.filled .fs-row-value {
    color: #212121;
    font-weight: 500;
}
.fs-row:not(.filled) .fs-row-label {
    color: #9e9e9e;
    font-weight: 400;
}

/* Checkbox visual (not clickable) */
.fs-row-check {
    width: 20px;
    height: 20px;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 200ms, border-color 200ms;
}
.fs-row.filled .fs-row-check {
    background: var(--kiwi);
    border-color: var(--kiwi);
    color: #fff;
}
.fs-check-icon {
    width: 14px;
    height: 14px;
    color: #fff;
}

/* Row content */
.fs-row-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    min-width: 0;
}
.fs-row-label {
    /* base text style is inherited */
}
.fs-row-value {
    color: var(--kiwi-dark);
    font-weight: 600;
}
.fs-row-placeholder {
    color: #c5c5c5;
    margin-left: 4px;
}
.fs-row-warn {
    color: #f57c00;
    font-size: 13px;
    margin-left: 6px;
    cursor: help;
}

/* Clear button (×) */
.fs-row-clear {
    background: none;
    border: none;
    color: #c5c5c5;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    border-radius: 4px;
    transition: color 150ms, background 150ms;
    font-weight: 300;
    font-family: inherit;
}
.fs-row-clear:hover {
    color: #ff7043;
    background: rgba(255, 112, 67, 0.08);
}

/* Inline editor */
.fs-row-editor {
    margin-left: 4px;
    padding: 4px 8px;
    border: 1.5px solid var(--kiwi);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(124,179,66,0.15);
}

/* Conflict modal */
.fs-conflict-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}
.fs-conflict-overlay.open {
    display: flex;
    animation: fs-fadein 0.2s ease;
}
.fs-conflict-modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    text-align: center;
}
.fs-conflict-field {
    font-size: 13px;
    color: #757575;
    margin: 4px 0 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fs-conflict-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.fs-conflict-options .fb-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
}

@media (max-width: 600px) {
    .fs-groups { padding: 0 8px; }
    .fs-group { padding: 12px 14px; }
}

/* === Clickable progress bar steps (Step C.5) === */
.fp-step {
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 8px;
    font-family: inherit;
    transition: background 150ms, transform 150ms;
}
.fp-step[data-clickable="1"] {
    cursor: pointer;
}
.fp-step[data-clickable="1"]:hover {
    background: rgba(124, 179, 66, 0.08);
    transform: translateY(-1px);
}
.fp-step[data-clickable="0"] {
    cursor: not-allowed;
    opacity: 0.6;
}

/* === Photos block on Stage 3 (Step C.5) === */
.fp-photos-block {
    max-width: 720px;
    margin: 24px auto 0;
    padding: 18px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
}
.fp-photos-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    margin: 0 0 4px;
    color: #212121;
}
.fp-photos-sub {
    margin: 0 0 14px;
    font-size: 13px;
    color: #757575;
}
.fp-angles-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #757575;
    margin: 0 0 8px;
    font-weight: 700;
}
.fp-angles-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}
.fp-angle {
    text-align: center;
    padding: 6px 4px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 6px;
    font-size: 10px;
    color: #757575;
    line-height: 1.2;
}
.fp-angle-icon {
    font-size: 18px;
    margin-bottom: 2px;
}
@media (max-width: 700px) {
    .fp-angles-grid { grid-template-columns: repeat(3, 1fr); }
    .fp-angle { font-size: 11px; }
    .fp-angle-icon { font-size: 22px; }
}

.fp-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
@media (max-width: 600px) {
    .fp-photo-grid { grid-template-columns: repeat(2, 1fr); }
}
.fp-photo-slot {
    aspect-ratio: 4 / 3;
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 32px;
    color: #9e9e9e;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    background: #fff;
}
.fp-photo-slot:hover {
    border-color: var(--kiwi);
    color: var(--kiwi);
}
.fp-photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}
.fp-photo-slot.dragging {
    opacity: 0.4;
    border-color: var(--kiwi);
}
.fp-photo-slot.drag-over {
    border-color: var(--kiwi);
    border-style: solid;
    background: rgba(124,179,66,0.1);
}
.fp-remove-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 150ms;
}
.fp-remove-photo:hover { background: #e53935; }
.fp-portada-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: var(--kiwi);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fp-photo-add {
    background: #fcfcfc;
}
.fp-photo-info {
    font-size: 13px;
    color: #9e9e9e;
    text-align: center;
}
.fp-photo-info span { font-weight: 600; color: #424242; }


/* === Stage 4 layout overrides (uses base .fs-fields grid 2cols max-width:720px) === */
/* direccion (with map) spans full width */
#fiberStage4 .fs-fields > .fs-field[data-fid="direccion"] { grid-column: 1 / -1; }
/* tipo (last) — full row, narrower select */
#fiberStage4 .fs-fields > .fs-field[data-fid="tipo"] { grid-column: 1 / -1; }
#fiberStage4 .fs-fields > .fs-field[data-fid="tipo"] .fs-input { max-width: 280px; }
/* Map container — full width, contained inside .fs-fields padding */
#pickerMapStage4Wrap { width: 100%; box-sizing: border-box; }
#pickerMapStage4 { width: 100% !important; box-sizing: border-box; }
/* Autocomplete dropdown — position below input properly */
.fs-field { position: relative; }
.fs-ac-dropdown { box-sizing: border-box; }
.fs-ac-item { box-sizing: border-box; }
/* Make sure inputs do not overflow container */
.fs-input { box-sizing: border-box; max-width: 100%; }

/* === Reset icon (circular arrow) next to stage title === */
.fs-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}
.fs-reset-icon {
    background: transparent;
    border: 1.5px solid #d1d5db;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.fs-reset-icon:hover {
    border-color: #6b7280;
    color: #4b5563;
    background: #f9fafb;
    transform: rotate(-30deg);
}
.fs-reset-icon:active { transform: rotate(-90deg); }
.fs-reset-icon svg { display: block; }

/* === Autocomplete dropdown styling === */
.fs-ac-item:hover { background: #f3f4f6; }
.fs-ac-item:last-child { border-bottom: none !important; }


/* === Phone composite field === */
.fs-phone-group { width: 100%; box-sizing: border-box; }
.fs-phone-group .fs-input { box-sizing: border-box; }
.fs-phone-flag { line-height: 1; padding: 8px; transition: all 0.2s ease; }
.fs-phone-flag img { width: 22px; height: 22px; display: block; }
.fs-phone-prefix { font-variant-numeric: tabular-nums; }


/* === Progress bar: ensure all 4 steps stay within container === */
.fiber-progress { flex-wrap: nowrap; overflow: hidden; }
.fp-step { min-width: 0; flex-shrink: 1; }
.fp-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fp-line { flex: 1 1 8px; min-width: 8px; max-width: 32px; }

/* On narrower viewports hide labels to fit all 4 crumbs */
@media (max-width: 900px) {
    .fp-label { display: none; }
}

/* === Phone composite (with + separator) === */
.fs-phone-plus { user-select: none; }
