/* FERNANDER - Premium Vanilla CSS */

/* --- CSS Variables & Tokens --- */
:root {
    /* Colors - Schmitz Embalagens Visual Identity Palette */
    --brand-primary: #E51C24;        /* Bold Vibrant Red */
    --brand-primary-hover: #C7121A;  /* Deep Crimson Hover */
    --brand-dark: #1A1A1A;           /* Industrial Charcoal / Black */
    --brand-grey: #52525B;           /* Slate Metallic Grey (7.8:1 contrast on white) */
    --brand-grey-light: #F4F5F7;     /* Light Cool Grey Surface */
    
    --bg-color: #F4F5F7;
    --surface-color: #FFFFFF;
    
    --text-main: #1A1A1A;
    --text-muted: #52525B;
    --text-light: #FFFFFF;
    
    --border-color: #E2E4E8;
    --danger: #B91C1C;               /* Accessible Red for badges & alerts (6.2:1) */
    --danger-bg: #FEF2F2;            /* Light Red tint background */
    --success: #047857;              /* Accessible Forest Green (5.2:1) */
    --success-bg: #ECFDF5;           /* Light Green tint background */

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 1rem;
    --sp-4: 1.5rem;
    --sp-5: 2rem;
    
    /* Misc */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-float: 0 12px 32px rgba(0,0,0,0.12);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Resets --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden; /* App-like feel, content scrolls inside main */
    display: flex;
    flex-direction: column;
}

/* --- Views & Routing --- */
.view {
    display: none;
    height: 100%;
    width: 100%;
}
.view.active {
    display: flex;
    flex-direction: column;
}

/* --- Typography --- */
h1, h2, h3 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
p { color: var(--text-muted); }

/* --- Inputs & Buttons --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    margin-bottom: var(--sp-3);
    width: 100%;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(229, 28, 36, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    font-family: inherit;
    font-weight: 600;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--brand-primary);
    color: var(--text-light);
}
.btn-primary:hover {
    background-color: var(--brand-primary-hover);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--bg-color);
}

.btn-large {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    width: 100%;
}
.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--sp-1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.btn-icon:hover {
    background: var(--bg-color);
    color: var(--text-main);
}

/* --- Login Screen --- */
.login-container {
    margin: auto;
    width: 100%;
    max-width: 400px;
    padding: var(--sp-5);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.login-header {
    text-align: center;
    margin-bottom: var(--sp-5);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.login-logo {
    height: 64px;
    width: auto;
    margin-bottom: var(--sp-3);
    object-fit: contain;
}
.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: var(--sp-1);
    letter-spacing: 0.05em;
}

/* --- App Layout --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    gap: var(--sp-2);
}
.header-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}
.header-logo {
    height: 34px;
    width: auto;
    object-fit: contain;
}
.header-brand-name {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
    color: var(--brand-dark);
}
.app-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--brand-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    flex: 1;
    min-width: 0;
}
#btn-logout {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .app-header {
        padding: var(--sp-2) var(--sp-3);
    }
    .header-brand-name {
        font-size: 1rem;
    }
    .app-header h2 {
        font-size: 1rem;
    }
    .header-logo {
        height: 30px;
    }
}

.app-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding-bottom: 80px; /* Space for bottom nav and draft indicator */
}

/* --- Tab Content --- */
.tab-content {
    display: none;
    padding: var(--sp-4);
    max-width: 800px;
    margin: 0 auto;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* --- Search Bar --- */
.search-bar {
    position: relative;
    margin-bottom: var(--sp-4);
}
.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-bar input {
    padding-left: 2.75rem;
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
    border-color: transparent;
}

/* --- Empty States --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--sp-5) 0;
    color: var(--text-muted);
    gap: var(--sp-3);
}

/* --- Customer Details --- */
.customer-header-info {
    margin-bottom: var(--sp-4);
}
.customer-header-info h3 {
    font-size: 1.5rem;
}

.table-wrapper {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-color);
}
.data-table th:first-child, .data-table td:first-child {
    padding-left: 1.5rem;
}
.data-table th:last-child, .data-table td:last-child {
    padding-right: 1.5rem;
}
.data-table tr:last-child td {
    border-bottom: none;
}
.badge-status {
    padding: 0.25rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--border-color);
}
.badge-unpaid {
    background: var(--danger-bg);
    color: var(--danger);
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: var(--sp-2) 0;
    padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom)); /* iOS safe area */
    z-index: 20;
}
.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}
.nav-item.active {
    color: var(--brand-primary);
}

/* --- Draft Indicator (Floating) --- */
.draft-indicator {
    position: fixed;
    bottom: 80px; /* Above bottom nav */
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 600px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-float);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 15;
}
.draft-info {
    display: flex;
    flex-direction: column;
}
.draft-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.draft-items {
    font-size: 0.875rem;
    color: var(--text-muted);
}
.draft-total {
    font-weight: 700;
    font-size: 1.125rem;
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: flex-end; /* Mobile bottom sheet feel */
    justify-content: center;
}
.modal.active {
    display: flex;
    animation: fadeBg 0.3s ease;
}
.modal-content {
    background: var(--bg-color);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-4);
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-body {
    padding: var(--sp-4);
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: var(--sp-4);
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
}
.cart-footer {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.cart-summary-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.25rem;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@keyframes fadeBg {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Desktop Tweaks --- */
@media (min-width: 768px) {
    .modal {
        align-items: center;
    }
    .modal-content {
        border-radius: var(--radius-lg);
    }
    .bottom-nav {
        /* On desktop, this could be a side rail, but for now we keep it bottom and centered */
        max-width: 600px;
        margin: 0 auto;
        border-left: 1px solid var(--border-color);
        border-right: 1px solid var(--border-color);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .app-content {
        padding-bottom: 100px;
    }
}

/* Basic List Items for Catalog/Cart */
.list-item {
    background: var(--surface-color);
    padding: var(--sp-3);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--sp-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.item-info h4 { margin-bottom: 4px; }
.item-price { font-weight: 600; color: var(--brand-primary); }
.item-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* --- Simulador de Vendas Specific --- */
.cart-table-wrapper {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    margin-bottom: var(--sp-4);
}
.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.cart-table th, .cart-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.cart-table th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-color);
    white-space: nowrap;
}
.cart-table input[type="number"] {
    width: 60px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}
.search-dropdown.active {
    display: block;
}
.search-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.search-item:hover {
    background: var(--bg-color);
}
.search-item-info {
    display: flex;
    flex-direction: column;
}
.search-item-code {
    font-weight: 600;
    color: var(--brand-primary);
    font-size: 0.75rem;
}
.search-item-name {
    font-weight: 500;
}
.search-item-price {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Hide old list view */
.catalog-list { display: none; }
/* --- Mobile-Focused Cart Cards --- */
.cart-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.cart-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--sp-3);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.cart-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.card-code {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--brand-primary);
}
.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
}
.cart-card-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: var(--sp-2);
}
.card-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.card-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}
.card-subtotal {
    font-size: 0.875rem;
    color: var(--text-muted);
}
.btn-discount {
    margin-top: var(--sp-1);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.qty-control {
    display: flex;
    flex-direction: column;
    width: 80px;
}
.qty-input {
    width: 100%;
    text-align: center;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.qty-actions {
    display: flex;
    width: 100%;
}
.btn-qty {
    flex: 1;
    border: none;
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    padding: 0.25rem 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-minus {
    background-color: var(--brand-grey);
    border-radius: 0 0 0 var(--radius-md);
}
.btn-plus {
    background-color: var(--success);
    border-radius: 0 0 var(--radius-md) 0;
}
.btn-minus:active { background-color: var(--brand-dark); }
.btn-plus:active { background-color: hsl(150, 70%, 30%); }

/* Empty state styling */
.empty-cart-msg {
    text-align: center;
    padding: var(--sp-5);
    color: var(--text-muted);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
}
/* --- Enhanced Mobile Card --- */
.cart-card {
    position: relative;
    padding: var(--sp-3);
}
.card-top {
    display: flex;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
}
.card-img {
    width: 60px;
    height: 60px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.card-code { color: var(--brand-primary); font-weight: 700; }
.card-brand { font-weight: 600; text-transform: uppercase; }
.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    padding-right: 24px; /* Space for delete button */
}

.btn-delete {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--danger);
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: var(--surface-color);
    color: var(--text-main);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid var(--brand-grey);
    font-weight: 500;
    font-size: 0.95rem;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 300px;
    word-break: break-word;
}

.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-success { border-left-color: var(--success); }

.toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 480px) {
    .toast-container {
        top: 20px;
        left: 20px;
        right: 20px;
        align-items: center;
    }
    .toast { max-width: 100%; width: 100%; }
}

.btn-delete:hover { background: hsla(350, 80%, 55%, 0.1); }

/* Grid for pricing details */
.card-pricing {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-2);
    background: var(--bg-color);
    padding: var(--sp-2);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-3);
}
.price-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.price-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.price-val { font-size: 0.85rem; font-weight: 600; }
.price-input {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    -moz-appearance: textfield;
}
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.card-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.margin-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--border-color);
    color: var(--text-main);
}
.margin-danger { background: var(--danger-bg); color: var(--danger); }
.margin-success { background: var(--success-bg); color: var(--success); }

.card-subtotal {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--brand-primary);
}

/* Update Qty control to fit */
.qty-control { width: 100px; }
/* Fixes for overlapping and editable subtotal */
.card-meta {
    padding-right: 32px; /* Prevent overlap with absolute delete button */
}
.card-subtotal-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-subtotal-prefix {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--brand-primary);
}
.card-subtotal-input {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--brand-primary);
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--brand-primary);
    outline: none;
    width: 90px;
    padding: 0;
    -moz-appearance: textfield;
}
.card-subtotal-input::-webkit-outer-spin-button,
.card-subtotal-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.card-subtotal-input:focus {
    border-bottom-style: solid;
}

/* --- Duplicata Cards (Clientes Tab) --- */
.duplicatas-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-top: var(--sp-2);
}
.dup-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--sp-3);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.dup-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--sp-2);
}
.dup-doc {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-primary);
}
.dup-status {
    display: flex;
    gap: 8px;
    align-items: center;
}
.dup-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}
.dup-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dup-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}
.dup-value {
    font-size: 0.875rem;
    font-weight: 600;
}
.dup-value-highlight {
    font-size: 1rem;
    font-weight: 700;
}
.badge-bol-done {
    background: var(--danger-bg);
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Milestone 3: Header Actions & Data Sync UI --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex-shrink: 0;
}

#btn-sync-data {
    color: var(--brand-grey);
    transition: var(--transition);
}

#btn-sync-data:hover {
    color: var(--brand-primary);
    background: var(--bg-color);
}

#btn-sync-data.syncing svg,
.sync-icon-spin {
    animation: spin 1.2s linear infinite;
    color: var(--brand-primary);
}

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

/* --- Sync Progress Modal --- */
#sync-progress-modal {
    z-index: 1000;
}

.sync-modal-card {
    max-width: 480px;
    margin: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    overflow: hidden;
}

.sync-modal-header {
    background: var(--surface-color);
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border-color);
}

.sync-header-title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.sync-header-title h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--brand-dark);
    margin: 0;
}

.sync-modal-body {
    padding: var(--sp-4);
    background: var(--surface-color);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.sync-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-2);
}

.sync-status-detail {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-counter-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--brand-primary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.sync-progress-container {
    width: 100%;
    height: 12px;
    background-color: var(--brand-grey-light);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.sync-progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--brand-primary);
    background-image: linear-gradient(
        90deg,
        var(--brand-primary) 0%,
        var(--brand-primary-hover) 100%
    );
    border-radius: 999px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sync-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

@media (max-width: 480px) {
    .sync-modal-card {
        width: calc(100% - 2rem);
        margin: 1rem;
    }
}

