:root {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-secondary: #f1f5f9;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    --brand-primary: #0284c7;
    --brand-dark: #0369a1;
    --brand-light: #e0f2fe;
    
    /* Estados Semafóricos Renovados */
    --color-pendente: #64748b;
    --bg-pendente: #f1f5f9;
    --color-prioridade: #f59e0b;
    --bg-prioridade: #fef3c7;
    --color-producao: #3b82f6;
    --bg-producao: #dbeafe;
    --color-pronto: #10b981;
    --bg-pronto: #d1fae5;
    --color-rota: #8b5cf6;
    --bg-rota: #ede9fe;
    --color-concluido: #059669;
    --bg-concluido: #ecfdf5;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, 0.15);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-main);
    background: var(--bg);
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   TELA DE LOGIN - DESIGN MINIMALISTA SPLIT
   ========================================================================== */
.login-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background: #ffffff;
}

.brand-panel {
    background: radial-gradient(circle at top left, #0c4a6e, #0284c7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    top: -100px;
    left: -100px;
}

.brand-content {
    max-width: 460px;
}

.logo-img-login {
    height: auto;
    width: 200px;
    margin-bottom: 40px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.brand-panel h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.brand-panel p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.15rem;
    line-height: 1.6;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background-color: var(--bg);
}

.login-card {
    background: #ffffff;
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.login-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

.login-subtitle {
    color: var(--text-muted);
    margin: 0 0 32px 0;
    font-size: 0.95rem;
}

.code-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-card label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.login-card input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg);
    transition: var(--transition);
}

.login-card input:focus {
    border-color: var(--brand-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--brand-light);
    outline: none;
}

.login-card button {
    width: 100%;
    height: 52px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.login-card button:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

.form-message {
    margin: 16px 0 0 0;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 20px;
}

/* ==========================================================================
   VISÃO DA ESTEIRA (KANBAN APP)
   ========================================================================== */
.kanban-view {
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px;
}

/* Topbar Premium */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-img-kanban {
    height: 40px;
    width: auto;
}

.eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--brand-primary);
    margin: 0 0 2px 0;
}

.topbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.metric {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 18px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

.metric small {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.metric span {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand-primary);
}

.ghost-button {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.ghost-button:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

/* Área de Filtros */
.filters {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.search-input-wrapper input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg);
    font-size: 0.95rem;
    transition: var(--transition);
}

.search-input-wrapper input:focus {
    border-color: var(--brand-primary);
    background: #ffffff;
    outline: none;
}

/* Chips de Letras Dinâmicas */
.letter-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.letter-chip {
    height: 38px;
    padding: 0 14px;
    background: var(--surface-secondary);
    border: 1px solid transparent;
    color: #475569;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.letter-chip:hover {
    background: #e2e8f0;
}

.letter-chip.active {
    background: var(--brand-primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

/* Estado Interno (Panels) */
.state-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 24px;
}

.state-panel.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

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

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

/* ==========================================================================
   QUADRO KANBAN
   ========================================================================== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(6, 300px);
    gap: 20px;
    align-items: start;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 18px;
    max-width: 100%;
    scrollbar-gutter: stable;
}

.kanban-board::-webkit-scrollbar {
    height: 12px;
}

.kanban-board::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 999px;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
    border: 3px solid #e2e8f0;
}

.kanban-board::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.kanban-column {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    min-height: 75vh;
    transition: var(--transition);
}

.kanban-column h2 {
    margin: 0 0 16px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
}

.kanban-column h2 span {
    font-size: 0.8rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #475569;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Modificadores Semafóricos Sutil nas Colunas */
.col-pendente h2 span { background: #e2e8f0; color: #475569; }
.col-prioridade h2 span { background: var(--bg-prioridade); color: var(--color-prioridade); }
.col-producao h2 span { background: var(--bg-producao); color: var(--color-producao); }
.col-pronto h2 span { background: var(--bg-pronto); color: var(--color-pronto); }
.col-rota h2 span { background: var(--bg-rota); color: var(--color-rota); }
.col-concluido h2 span { background: var(--bg-concluido); color: var(--color-concluido); }

.column-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 150px;
}

/* Estilização Customizada dos Cards de Pedido */
.card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: left;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

/* Identificadores Laterais Transparentes com base no Status */
.col-pendente .card { border-left: 4px solid var(--color-pendente); }
.col-prioridade .card { border-left: 4px solid var(--color-prioridade); }
.col-producao .card { border-left: 4px solid var(--color-producao); }
.col-pronto .card { border-left: 4px solid var(--color-pronto); }
.col-rota .card { border-left: 4px solid var(--color-rota); }
.col-concluido .card { border-left: 4px solid var(--color-concluido); }

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    margin-bottom: 12px;
    padding-right: 44px;
}

.card p {
    margin: 6px 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Indicadores de Tempo Compactos (SLA) */
.sla {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--bg-pronto);
    color: var(--color-concluido);
}
.sla.warn { background: var(--bg-prioridade); color: var(--color-prioridade); }
.sla.late { background: #fee2e2; color: #ef4444; }

.group-badge {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   INTERFACES DE MODAL (GAVETA PREMIUM)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 999;
    transition: var(--transition);
}

.order-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: min(850px, 95vw);
    max-height: 85vh;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalShow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalShow {
    from { opacity: 0; transform: translate(-50%, -46%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-secondary);
}

.status-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--brand-light);
    color: var(--brand-primary);
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 6px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.icon-button {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.icon-button:hover {
    color: var(--text-main);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow-y: auto;
    flex: 1;
}

.modal-section {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 90px);
}

.modal-section h3 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    font-weight: 700;
    color: #334155;
}

.items-section {
    border-right: 1px solid var(--border-color);
}

/* Listas internas do modal */
.item-list, .comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    list-style: none;
}

.item-list li {
    background: var(--bg);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius-md);
}

.item-list li strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 4px;
}

.item-list li p {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.item-status {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    background: #e2e8f0;
    color: #475569;
    display: inline-block;
}

.item-status.done {
    background: var(--bg-pronto);
    color: var(--color-concluido);
}

/* Área de Linha do Tempo de Comentários */
.comment-item {
    background: var(--bg);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    border-radius: var(--radius-md);
}

.comment-item strong {
    font-size: 0.85rem;
    color: var(--text-main);
    display: block;
    margin-bottom: 4px;
}

.comment-item p {
    margin: 0 0 6px 0;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.4;
}

.comment-item small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Formulário de Input de Comentário */
.comment-form {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.textarea-wrapper textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg);
    resize: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.textarea-wrapper textarea:focus {
    background: #ffffff;
    border-color: var(--brand-primary);
    outline: none;
}

.comment-form button {
    height: 40px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.comment-form button:hover {
    background: var(--brand-dark);
}

/* ==========================================================================
   SUPORTE DE RESPONSIVIDADE E DISPOSITIVOS MÓVEIS (MOBILE FIRST BREAKPOINTS)
   ========================================================================== */

@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(280px, 86vw);
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 16px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
        
    .kanban-column {
        scroll-snap-align: start;
        min-height: 60vh;
    }
    
    .login-view {
        grid-template-columns: 1fr;
    }
    
    .brand-panel {
        display: none; /* Otimização de espaço no mobile */
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .filters {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .letter-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .letter-chip {
        flex: 0 0 auto;
    }
    
    .modal-body {
        grid-template-columns: 1fr;
    }
    
    .items-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .order-modal {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
        animation: modalMobileShow 0.25s ease;
    }

    @keyframes modalMobileShow {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    .modal-section {
        max-height: none;
    }
}