/* ==================== THEME VARIABLES ==================== */
:root {
    --content-safe-top:    calc(var(--tg-safe-area-inset-top, 0px)    + var(--tg-content-safe-area-inset-top, 0px));
    --content-safe-bottom: calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px));
    --content-safe-left:   calc(var(--tg-safe-area-inset-left, 0px)   + var(--tg-content-safe-area-inset-left, 0px));
    --content-safe-right:  calc(var(--tg-safe-area-inset-right, 0px)  + var(--tg-content-safe-area-inset-right, 0px));

    --brand-primary:        #0088cc;
    --brand-primary-hover:  #0077b5;
    --brand-primary-alpha:  rgba(0, 136, 204, 0.08);
    --brand-success:        #31b545;
    --brand-success-alpha:  rgba(49, 181, 69, 0.1);
    --brand-warning:        #f2994a;
    --brand-error:          #e53935;
    --brand-text:           #222222;
    --brand-text-secondary: #707579;
    --brand-bg:             #f4f4f5;
    --brand-surface:        #ffffff;
    --brand-border:         #dcdfe2;
    --brand-shadow:         rgba(0, 0, 0, 0.08);
}

body.dark-theme {
    --brand-primary:        #40a7e3;
    --brand-primary-hover:  #2996d1;
    --brand-primary-alpha:  rgba(64, 167, 227, 0.15);
    --brand-success-alpha:  rgba(49, 181, 69, 0.15);
    --brand-bg:             #1c2733;
    --brand-surface:        #242f3d;
    --brand-text:           #ffffff;
    --brand-text-secondary: #aaaaaa;
    --brand-border:         #303d4d;
    --brand-shadow:         rgba(0, 0, 0, 0.3);
}

/* ==================== BASE ==================== */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    background: var(--brand-bg);
    color: var(--brand-text);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    touch-action: pan-y;
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding-top:    calc(20px + var(--content-safe-top));
    padding-bottom: calc(36px + var(--content-safe-bottom));
    padding-left:   calc(20px + var(--content-safe-left));
    padding-right:  calc(20px + var(--content-safe-right));
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 14px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes slideDown {
    from { opacity: 1; transform: translate(-50%, 0); }
    to   { opacity: 0; transform: translate(-50%, 10px); }
}

@keyframes popIn {
    0%   { opacity: 0; transform: scale(0.85); }
    60%  { transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

#screenMain,
#screenForm,
#screenConfirm,
#screenSuccess {
    animation: fadeSlideIn 0.22s ease-out;
}

/* ==================== HEADINGS ==================== */
.screen-heading {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-text);
    margin-bottom: 24px;
}

/* ==================== MAIN WINDOW ==================== */
.main-heading {
    font-size: 26px;
    font-weight: 800;
    color: var(--brand-text);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.main-subheading {
    font-size: 15px;
    color: var(--brand-text-secondary);
    margin-bottom: 28px;
}

.form-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-card {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 18px 16px;
    background: var(--brand-surface);
    border: 2px solid var(--brand-border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: inherit;
}

.form-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px var(--brand-shadow);
}

.form-card:active {
    transform: translateY(0);
    box-shadow: none;
}

.form-card-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-bg);
    border-radius: 14px;
    flex-shrink: 0;
}

.form-card-text {
    flex: 1;
    min-width: 0;
}

.form-card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-text);
    margin-bottom: 3px;
}

.form-card-desc {
    font-size: 13px;
    color: var(--brand-text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-card-arrow {
    width: 20px;
    height: 20px;
    color: var(--brand-text-secondary);
    flex-shrink: 0;
}

.form-card-arrow svg {
    width: 100%;
    height: 100%;
}

/* ==================== FORM ELEMENTS ==================== */
.form-group {
    margin-bottom: 24px;
}
.form-group:last-of-type {
    margin-bottom: 0;
}

.label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--brand-text);
}

.label-text { flex: 1; }

.required {
    color: var(--brand-error);
    font-size: 17px;
    font-weight: 700;
}

.hint {
    display: block;
    font-size: 13px;
    color: var(--brand-text-secondary);
    margin-top: 7px;
    line-height: 1.4;
}

/* ── Text inputs ── */
.input,
.textarea {
    width: 100%;
    padding: 13px 15px;
    font-size: 16px;
    border: 2px solid var(--brand-border);
    border-radius: 12px;
    background: var(--brand-surface);
    color: var(--brand-text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    font-weight: 500;
}

.input:focus,
.textarea:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-primary-alpha);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--brand-text-secondary);
    opacity: 0.6;
}

.textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.5;
}

/* Required indicator on left border */
.input[required],
.textarea[required] {
    border-left-width: 4px;
    border-left-color: var(--brand-error);
}

/*
 * VALID STATE FIX
 * The [required] attribute selector sets border-left-color to error.
 * We beat it by setting inline style with !important in validation.js
 * AND by having a higher-specificity CSS class below as a fallback.
 */
.input.is-valid,
.textarea.is-valid {
    border-color: var(--brand-success) !important;
    border-left-color: var(--brand-success) !important;
    box-shadow: 0 0 0 3px var(--brand-success-alpha);
}

.input.is-invalid,
.textarea.is-invalid {
    border-color: var(--brand-error) !important;
    border-left-color: var(--brand-error) !important;
}

.char-counter {
    font-size: 12px;
    text-align: right;
    margin-top: 5px;
    color: var(--brand-text-secondary);
}

/* ── Fixed date pill ── */
.fixed-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--brand-success-alpha);
    border: 2px solid var(--brand-success);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-success);
}

/* ==================== RADIO ==================== */
.radio-group {
    display: flex;
    gap: 12px;
}

.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 13px 16px;
    background: var(--brand-surface);
    border: 2px solid var(--brand-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.radio-label:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--brand-shadow);
}

input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-custom {
    width: 20px; height: 20px;
    border: 2px solid var(--brand-border);
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

input[type="radio"]:checked + .radio-custom {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
}

input[type="radio"]:checked + .radio-custom::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 7px; height: 7px;
    background: white;
    border-radius: 50%;
}

input[type="radio"]:checked ~ .radio-text {
    color: var(--brand-primary);
    font-weight: 700;
}

.radio-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-text);
}

/* ==================== CHECKBOX ==================== */
.contact-types-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-type-item {
    display: block;
    cursor: pointer;
    position: relative;
}

.contact-type-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.contact-type-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    background: var(--brand-surface);
    border: 2px solid var(--brand-border);
    border-radius: 12px;
    transition: all 0.2s;
}

.contact-type-item:hover .contact-type-content {
    border-color: var(--brand-primary);
    transform: translateX(3px);
}

.contact-type-item input:checked + .contact-type-content {
    background: var(--brand-primary-alpha);
    border-color: var(--brand-primary);
}

.contact-type-icon {
    font-size: 24px;
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-bg);
    border-radius: 10px;
    flex-shrink: 0;
}

.contact-type-text { flex: 1; }

.contact-type-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-text);
}

.contact-type-check {
    width: 24px; height: 24px;
    border: 2px solid var(--brand-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.contact-type-check svg {
    width: 13px; height: 13px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}

.contact-type-item input:checked + .contact-type-content .contact-type-check {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.contact-type-item input:checked + .contact-type-content .contact-type-check svg {
    opacity: 1;
    transform: scale(1);
}

/* ==================== DATE TRIGGER ==================== */
.date-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 15px;
    background: var(--brand-surface);
    border: 2px solid var(--brand-border);
    border-left: 4px solid var(--brand-error);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: left;
}

.date-trigger:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px var(--brand-shadow);
}

.date-trigger.has-date {
    color: var(--brand-text);
    background: var(--brand-success-alpha);
    border-color: var(--brand-success) !important;
    border-left-color: var(--brand-success) !important;
}

.date-trigger-icon {
    width: 18px; height: 18px;
    color: var(--brand-text-secondary);
    flex-shrink: 0;
}

.date-trigger.has-date .date-trigger-icon {
    color: var(--brand-success);
}

/* ==================== DATE PICKER MODAL ==================== */
.date-picker-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: fadeSlideIn 0.18s ease-out;
}

.date-picker-content {
    background: var(--brand-surface);
    border-radius: 20px;
    padding: 22px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.date-picker-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-text);
}

.date-nav-btn {
    width: 36px; height: 36px;
    border: none;
    background: var(--brand-bg);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-text);
    transition: all 0.18s;
}

.date-nav-btn:hover:not(:disabled) {
    background: var(--brand-primary);
    color: white;
}

.date-nav-btn:disabled,
.date-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.date-nav-btn svg { width: 16px; height: 16px; }

.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}

.date-picker-weekdays div {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-text-secondary);
}

.date-picker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.date-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    background: var(--brand-bg);
    color: var(--brand-text);
    transition: all 0.15s;
}

.date-day:hover:not(.disabled) {
    background: var(--brand-primary);
    color: white;
    transform: scale(1.08);
}

.date-day.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    background: transparent;
}

.date-day.selected {
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 2px 8px var(--brand-primary-alpha);
}

.date-day-empty { aspect-ratio: 1; }

/* ==================== BUTTONS ==================== */
.btn-primary {
    display: block;
    width: 100%;
    padding: 15px 20px;
    margin-top: 28px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--brand-primary-alpha);
}

.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
    display: block;
    flex: 1;
    padding: 15px 20px;
    background: var(--brand-surface);
    color: var(--brand-primary);
    border: 2px solid var(--brand-primary);
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}

.btn-secondary:hover {
    background: var(--brand-primary-alpha);
    transform: translateY(-2px);
}

/* ==================== CONFIRM ACTIONS ==================== */
.confirm-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.confirm-actions .btn-primary {
    flex: 1.4;
    margin-top: 0;
}

/* ==================== CONFIRMATION CARD ==================== */
.confirm-card {
    background: var(--brand-surface);
    border: 2px solid var(--brand-border);
    border-radius: 16px;
    overflow: hidden;
}

.confirm-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--brand-border);
}

.confirm-row:last-child { border-bottom: none; }

.confirm-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.confirm-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--brand-text);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ==================== SUCCESS / PROCESSING SCREEN ==================== */
#screenSuccess .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}

#successContent {
    width: 100%;
}

/* Animated processing icon */
.success-icon {
    width: 88px; height: 88px;
    margin: 0 auto 24px;
    background: var(--brand-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
}

/* Pulsing ring around icon */
.success-icon::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid var(--brand-primary);
    opacity: 0.3;
    animation: ring-pulse 2s ease-in-out infinite;
}

@keyframes ring-pulse {
    0%, 100% { transform: scale(1);    opacity: 0.3; }
    50%       { transform: scale(1.12); opacity: 0;   }
}

.success-icon svg {
    width: 44px; height: 44px;
    color: white;
}

.success-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--brand-text);
    margin-bottom: 10px;
}

.success-message {
    font-size: 15px;
    color: var(--brand-text-secondary);
    line-height: 1.6;
    max-width: 280px;
    margin: 0 auto;
}

/* Order ID block */

/* ==================== SNACKBAR ==================== */
.tg-snackbar {
    position: fixed;
    bottom: calc(24px + var(--content-safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-surface);
    color: var(--brand-text);
    padding: 13px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 10000;
    width: 90%;
    max-width: 380px;
    border-left: 5px solid var(--brand-primary);
    border-right: 1px solid var(--brand-border);
    border-top: 1px solid var(--brand-border);
    border-bottom: 1px solid var(--brand-border);
}

.tg-snackbar.success { border-left-color: var(--brand-success); }
.tg-snackbar.error   { border-left-color: var(--brand-error); }
.tg-snackbar.warning { border-left-color: var(--brand-warning); }

.tg-snackbar-content { display: flex; align-items: center; gap: 10px; }
.tg-snackbar-icon    { font-size: 18px; flex-shrink: 0; }
.tg-snackbar-message { font-size: 14px; font-weight: 600; line-height: 1.4; }

.tg-snackbar:not(.hiding) { animation: slideUp 0.22s cubic-bezier(0.4, 0, 0.2, 1); }
.tg-snackbar.hiding       { animation: slideDown 0.18s ease-in forwards; }

/* ==================== SUBMIT LOADING STATE ==================== */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    margin: auto;
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ==================== SUBMIT ERROR ==================== */
.submit-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 14px 16px;
    background: rgba(229, 57, 53, 0.08);
    border: 1.5px solid var(--brand-error);
    border-radius: 12px;
    animation: fadeSlideIn 0.2s ease-out;
}

.submit-error-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.submit-error-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: var(--brand-text);
}

.submit-error-retry {
    flex-shrink: 0;
    padding: 6px 14px;
    background: var(--brand-error);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.submit-error-retry:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

/* ==================== ORDER ID BLOCK ==================== */
.order-id-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    padding: 16px 20px;
    background: var(--brand-primary-alpha);
    border: 2px solid var(--brand-primary);
    border-radius: 14px;
}

.order-id-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.order-id-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--brand-primary);
    font-family: "Courier New", monospace;
    letter-spacing: 1px;
}

/* ==================== PROCESSING STEPS ==================== */
.processing-steps {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
    text-align: left;
    max-width: 260px;
    margin-left: auto;
    margin-right: auto;
}

.processing-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    position: relative;
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-text-secondary);
}

/* Vertical connector line between steps */
.processing-step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 9px;
    top: 28px;
    width: 2px;
    height: calc(100% - 8px);
    background: var(--brand-border);
}

.step-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--brand-border);
    background: var(--brand-surface);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

/* Active step */
.processing-step.active {
    color: var(--brand-primary);
}

.processing-step.active .step-dot {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-primary-alpha);
}

/* White checkmark inside active dot */
.processing-step.active .step-dot::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px; height: 8px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

/* Connector line coloured for completed steps */
.processing-step.active:not(:last-child)::after,
.processing-step.done:not(:last-child)::after {
    background: var(--brand-primary);
}

.processing-step.done {
    color: var(--brand-success);
}

/* ==================== MEDIA UPLOAD ==================== */
.media-upload-wrap { display: flex; flex-direction: column; gap: 10px; }

.media-add-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    background: var(--brand-surface);
    border: 2px dashed var(--brand-border);
    border-radius: 14px;
    color: var(--brand-text);
    font-size: 15px; font-weight: 600;
    cursor: pointer; width: 100%;
    transition: border-color 0.2s;
}
.media-add-btn:active { opacity: 0.7; }

.media-count-badge {
    margin-left: auto;
    background: var(--brand-primary);
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 12px; font-weight: 700;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.media-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
}

.media-thumb-img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}

.media-thumb-video {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #1a1a2e; gap: 4px;
}

.media-thumb-name {
    color: #aaa; font-size: 10px;
    overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; max-width: 80px;
}

.media-thumb-remove {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.65);
    color: white; border: none;
    font-size: 11px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}

/* ==================== FILE UPLOAD ==================== */
.file-upload-wrap { display: flex; flex-direction: column; gap: 8px; }

.file-upload-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    background: var(--brand-surface);
    border: 2px dashed var(--brand-border);
    border-radius: 14px;
    color: var(--brand-text);
    font-size: 15px; font-weight: 600;
    cursor: pointer; width: 100%;
}
.file-upload-btn.has-file { border-color: var(--brand-success); border-style: solid; }
.file-upload-btn:active { opacity: 0.7; }

.file-preview-img {
    width: 100%; border-radius: 12px;
    max-height: 200px; object-fit: contain;
    border: 1px solid var(--brand-border);
}

.processing-step.done .step-dot {
    border-color: var(--brand-success);
    background: var(--brand-success);
}

.processing-step.done .step-dot::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px; height: 8px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}
body.dark-theme .contact-type-icon {
    background: rgba(255,255,255,0.05);
}

body.dark-theme .form-card-icon {
    background: rgba(255,255,255,0.05);
}

/* ==================== AUTH OVERLAY ==================== */
#authOverlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-bg);
    transition: opacity 0.35s ease;
}

#authOverlay.hiding {
    opacity: 0;
    pointer-events: none;
}

.auth-overlay-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 40px 32px;
    background: var(--brand-surface);
    border: 2px solid var(--brand-border);
    border-radius: 20px;
    box-shadow: 0 12px 40px var(--brand-shadow);
    min-width: 220px;
    text-align: center;
    animation: fadeSlideIn 0.22s ease-out;
}

.auth-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--brand-border);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

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

.auth-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-text-secondary);
}

/* Error state */
.auth-error-box {
    gap: 14px;
}

.auth-error-icon {
    font-size: 48px;
    line-height: 1;
}

.auth-error-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--brand-text);
    margin: 0;
}

.auth-error-message {
    font-size: 14px;
    color: var(--brand-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 400px) {
    .container {
        padding-left:  calc(14px + var(--content-safe-left));
        padding-right: calc(14px + var(--content-safe-right));
    }
    .screen-heading  { font-size: 19px; }
    .main-heading    { font-size: 22px; }
    .radio-group     { flex-direction: column; }
    .confirm-actions { flex-direction: column-reverse; }
    .confirm-actions .btn-primary { flex: none; }
}