:root {
    --bg-main: #F8F9FB;
    --bg-card: #FFFFFF;
    --text-main: #2C2C2C;
    --text-soft: #6B7280;
    --primary: #D71920;
    --primary-orange: #D71920;
    --primary-dark: #B7151B;
    --primary-soft: rgba(215, 25, 32, 0.06);
    --border: #E5E7EB;
    --focus: #D71920;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    min-height: 100dvh;
    min-height: 100svh;
    font-family: "Inter", "Roboto", "Segoe UI", Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #FFFFFF, #F6F7FA);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* ========== HEADER ========== */
header {
    background: #a09494;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
    flex-wrap: wrap;
}

.logo-header {
    max-width: 120px;
    width: 100%;
    height: auto;
    flex-shrink: 0;
}

.btn-header {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: filter 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-header:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn-header:active {
    transform: translateY(0);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.panel {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

/* ========== CARD ========== */
.card-logo {
    text-align: center;
    margin-bottom: 32px;
}

.card-logo img {
    max-width: 180px;
    width: 100%;
    height: auto;
}

.card {
    background: var(--bg-card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 40px;
    border: 1px solid rgba(44, 44, 44, 0.04);
    animation: fadeIn 0.2s ease-out;
}

h1 {
    margin: 0 0 10px;
    font-size: 34px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    line-height: 1.2;
}


.card > p:first-of-type {
    margin: 0 0 18px;
    color: var(--text-soft);
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.5;
}

/* ========== FORM ========== */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

input[type="text"] {
    width: 100%;
    height: 54px;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 0 16px;
    font-size: 16px;
    line-height: 1.4;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #FAFAFA;
    margin-bottom: 8px;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(215, 25, 32, 0.12);
}

input[type="text"]::placeholder {
    color: #cccccc;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-soft);
    margin-bottom: 18px;
    line-height: 1.4;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========== BUTTONS ========== */
.btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    height: 54px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: background 0.2s ease, transform 0.2s ease;
    margin-bottom: 20px;
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn:hover,
.btn:focus-visible {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    display: none;
}

/* ========== ERROR & ALERTS ========== */
.error {
    background: #fff3f3;
    color: #b7151b;
    border: 1px solid #f6c7c9;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-link {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-soft);
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s ease;
    display: inline;
}

.footer-link a:hover {
    opacity: 0.8;
}

/* ========== RESULTS ========== */
.result-area {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.result-subtitle {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.address-list,
.invoice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.address-card {
    border: 1px solid var(--border);
    background: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    text-align: left;
}

.address-card:hover,
.address-card:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.12);
    transform: translateY(-1px);
    outline: none;
}

.address-title {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.address-meta {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.invoice-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
}

.invoice-item input {
    margin-top: 4px;
}

.invoice-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.invoice-title {
    font-weight: 600;
    color: var(--text-main);
}

.invoice-meta {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.invoice-note {
    font-size: 0.75rem;
    color: #b7151b;
}

.invoice-value {
    font-weight: 600;
    color: var(--text-main);
}

.invoice-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invoice-summary {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 1px solid rgba(215, 25, 32, 0.3);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: rgba(215, 25, 32, 0.06);
}

.btn-primary {
    box-shadow: 0 12px 24px rgba(215, 25, 32, 0.25);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    box-shadow: 0 14px 28px rgba(215, 25, 32, 0.3);
}

.btn-inline {
    height: 40px;
    padding: 0 16px;
    width: auto;
}

.btn-small {
    height: 44px;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.payment-box {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-summary {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    background: #fff;
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-soft);
    font-size: 0.85rem;
}

.summary-item strong {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
}

.payment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.payment-label {
    font-weight: 600;
    color: var(--text-main);
}

.payment-pix {
    width: 100%;
    min-height: 120px;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-soft);
    background: #FAFAFA;
    resize: vertical;
}

.payment-qr {
    display: flex;
    justify-content: center;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.payment-qr svg {
    width: 180px;
    height: 180px;
}

.notice {
    background: #fff3f3;
    border: 1px solid #f6c7c9;
    color: #b7151b;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 600;
}

.step-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.step-actions .btn {
    flex: 1;
}

.loading {
    font-size: 0.9rem;
    color: var(--text-soft);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== FOOTER ========== */
footer {
    background: #f5f0eb;
    padding: 16px 12px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
}

.footer-logo {
    max-width: 90px;
    width: 100%;
    height: auto;
}

.footer-info {
    font-size: 0.7rem;
    color: #888888;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.footer-links a {
    color: #666666;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-socials {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.footer-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666666;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.15s ease;
    font-size: 0.9rem;
}

.footer-socials a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

/* ========== SUCCESS PAGE ========== */
.card > p {
    margin: 0 0 14px;
    color: var(--text-soft);
    font-size: 0.85rem;
    line-height: 1.5;
}

.doc-display {
    margin: 14px 0;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--primary);
    font-size: 1rem;
}

.success-icon {
    width: 50px;
    height: 50px;
    background: #e8f5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.8rem;
    line-height: 1;
}

.btn-back {
    display: inline-block;
    margin-top: 14px;
    color: #fff;
    text-decoration: none;
    background: var(--primary);
    border-radius: 10px;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s ease, transform 0.2s ease;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-back:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-back:active {
    transform: translateY(0);
}

/* ========== RESPONSIVE BREAKPOINTS ========== */

/* Extra small devices - 320px (iPhone SE, etc) */
@media (max-width: 375px) {
    body {
        font-size: 13px;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 6px 10px;
    }

    .logo-header {
        max-width: 120px;
        text-align: center;
        margin: 0 auto;
    }

    .btn-header {
        width: 100%;
        text-align: center;
        padding: 6px 10px;
        font-size: 0.65rem;
    }

    .main-content {
        padding: 20px 12px;
    }

    .panel {
        width: 100%;
    }

    .card {
        padding: 24px;
        border-radius: 16px;
    }

    .card-logo {
        margin-bottom: 24px;
    }

    h1 {
        font-size: 28px;
        margin-bottom: 8px;
        font-weight: 700;
    }

    .card > p:first-of-type {
        font-size: 0.9rem;
        margin-bottom: 16px;
        line-height: 1.4;
    }

    label {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }

    input[type="text"] {
        height: 52px;
        font-size: 16px;
        margin-bottom: 6px;
        border-radius: 10px;
    }

    .form-hint {
        font-size: 0.75rem;
        margin-bottom: 14px;
        line-height: 1.3;
    }

    .btn {
        height: 52px;
        font-size: 0.95rem;
        margin-bottom: 16px;
    }

    .btn-small {
        height: 44px;
        font-size: 0.85rem;
    }

    .error {
        padding: 10px 12px;
        font-size: 0.8rem;
        margin-bottom: 14px;
    }

    .footer-link {
        font-size: 0.8rem;
        margin-top: 6px;
    }

    footer {
        padding: 14px 10px;
    }

    .footer-content {
        gap: 8px;
    }

    .footer-logo {
        max-width: 80px;
    }

    .footer-info {
        font-size: 0.65rem;
    }

    .footer-links {
        gap: 8px;
        font-size: 0.7rem;
    }

    .success-icon {
        width: 48px;
        height: 48px;
        font-size: 1.6rem;
        margin-bottom: 10px;
    }

    .doc-display {
        font-size: 0.95rem;
        margin: 12px 0;
    }

    .btn-back {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-height: 40px;
    }
}

/* Small devices - 376px to 480px (iPhone 12, Pixel 5, etc) */
@media (min-width: 376px) and (max-width: 480px) {
    body {
        font-size: 13px;
    }

    header {
        padding: 8px 12px;
        gap: 8px;
    }

    .logo-header {
        max-width: 130px;
    }

    .btn-header {
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    .btn-small {
        height: 46px;
        font-size: 0.88rem;
    }

    .main-content {
        padding: 24px 14px;
    }

    .card {
        padding: 28px;
        border-radius: 16px;
    }

    .card-logo {
        margin-bottom: 24px;
    }

    h1 {
        font-size: 30px;
        margin-bottom: 10px;
    }

    .card > p:first-of-type {
        font-size: 0.95rem;
        margin-bottom: 18px;
    }

    label {
        font-size: 0.88rem;
        margin-bottom: 6px;
    }

    input[type="text"] {
        height: 54px;
        font-size: 16px;
        margin-bottom: 6px;
    }

    .form-hint {
        font-size: 0.78rem;
        margin-bottom: 16px;
    }

    .btn {
        height: 54px;
        font-size: 1rem;
        margin-bottom: 16px;
    }

    .error {
        padding: 12px 12px;
        font-size: 0.85rem;
        margin-bottom: 16px;
    }

    footer {
        padding: 16px 12px;
    }

    .footer-logo {
        max-width: 90px;
    }

    .footer-info {
        font-size: 0.7rem;
    }

    .footer-links {
        font-size: 0.75rem;
        gap: 12px;
    }

    .success-icon {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }

    .doc-display {
        font-size: 1rem;
        margin: 14px 0;
    }

    .btn-back {
        padding: 10px 14px;
        font-size: 0.9rem;
        min-height: 42px;
    }
}

/* Medium devices - 481px to 768px (iPad mini, etc) */
@media (min-width: 481px) and (max-width: 768px) {
    .main-content {
        padding: 32px 18px;
    }

    .card {
        padding: 36px;
    }

    h1 {
        font-size: 32px;
    }

    .footer-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .footer-info {
        flex: 0 1 auto;
    }

    .footer-links {
        flex: 1;
    }
}

/* Large devices - 769px to 1024px (iPad, iPad Pro 11") */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        padding: 36px 24px;
    }

    .card {
        padding: 40px;
        max-width: 520px;
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-around;
    }
}

/* Extra large devices - 1025px and up (Desktop, iPad Pro 12.9") */
@media (min-width: 1025px) {
    .main-content {
        padding: 40px 20px;
    }

    .card {
        padding: 40px;
    }

    .panel {
        width: 520px;
        margin: 0 auto;
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        gap: 30px;
    }

    .footer-info {
        flex: 0 1 auto;
    }

    .footer-links {
        flex: 1;
        justify-content: center;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 4px 12px;
    }

    .main-content {
        padding: 16px 20px;
    }

    .card {
        padding: 20px 24px;
    }

    h1 {
        margin-bottom: 4px;
        font-size: 24px;
    }

    .card > p:first-of-type {
        margin-bottom: 10px;
        font-size: 0.85rem;
    }

    input[type="text"] {
        height: 46px;
        margin-bottom: 6px;
    }

    .form-hint {
        margin-bottom: 10px;
        font-size: 0.7rem;
    }

    .btn {
        height: 46px;
        margin-bottom: 12px;
        font-size: 0.9rem;
    }
}

/* Tablet landscape */
@media (min-width: 1024px) and (orientation: landscape) {
    .main-content {
        padding: 20px 40px;
    }

    .card {
        max-width: 600px;
    }
}

/* High DPI / Retina screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print styles */
@media print {
    header,
    footer,
    .footer-link,
    .btn-header {
        display: none;
    }

    .main-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .btn-back,
    .btn-header,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    .btn,
    .btn-back,
    .btn-header {
        padding: 10px 14px;
    }
}


