:root {
    --wa-teal: #2563eb;
    --wa-teal-dark: #1d4ed8;
    --wa-green: #2563eb;
    --wa-green-soft: #dbeafe;
    --wa-blue: #3b82f6;
    --wa-blue-deep: #1d4ed8;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-hover: #1e40af;
    --secondary: #3b82f6;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --bg-light: #f0f2f5;
    --bg-white: #ffffff;
    --bg-panel: #f0f2f5;
    --border: #e9edef;
    --border-color: #e9edef;
    --text-dark: #111b21;
    --text-gray: #667781;
    --text: #111b21;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --shadow: 0 1px 2px rgba(11, 20, 26, 0.06);
    --shadow-lg: 0 8px 24px rgba(11, 20, 26, 0.12);
}

html, body {
    height: 100%;
}

body {
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: #ffffff;
    color: #111b21;
    line-height: 1.45;
}

body.app-has-shell {
    overflow: hidden;
}

.app-frame {
    display: grid;
    grid-template-columns: 312px minmax(0, 1fr);
    height: 100vh;
    background: #ffffff;
}

.app-rail {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid #e9edef;
    min-width: 0;
}

.app-rail-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 16px;
    background: #ffffff;
    color: #0f172a;
    border-bottom: 1px solid #e8eef5;
}

.app-rail-head img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 50%;
    padding: 4px;
}

.app-rail-brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-rail-brand strong {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #2563eb;
}

.app-rail-brand span {
    font-size: 12px;
    color: #64748b;
}

.app-rail-search {
    padding: 8px 12px 10px;
    background: #ffffff;
    border-bottom: 1px solid #f0f2f5;
}

.app-rail-search input {
    width: 100%;
    border: 0;
    background: #f0f2f5;
    color: #111b21;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    outline: none;
}

.app-rail-search input:focus {
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #2563eb;
}

.app-rail-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: #111b21;
    text-decoration: none;
    border-bottom: 1px solid #f0f2f5;
}

.app-nav-item:hover {
    background: #f5f6f6;
}

.app-nav-item.is-active {
    background: #eaf1ff;
}

.app-nav-item.is-active .app-nav-icon {
    background: #2563eb;
    color: #ffffff;
}

.app-nav-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e8eef7;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-nav-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.app-nav-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-nav-copy strong {
    font-size: 16px;
    font-weight: 500;
}

.app-nav-copy small {
    color: #667781;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-rail-foot {
    padding: 10px 12px 14px;
    border-top: 1px solid #e9edef;
}

.app-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    background: #e8f4fc;
    color: #027eb5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.app-logout:hover {
    background: #d3ecfa;
}

.app-logout svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f4f7fb;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 8px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e8eef5;
}

.app-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #54656f;
    cursor: pointer;
}

.app-menu-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.app-topbar-title h1,
.app-topbar-title .section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111b21;
    text-align: left;
}

.app-topbar-title p {
    margin: 2px 0 0;
    font-size: 13px;
    color: #667781;
}

.main-section,
.app-body {
    flex: 1;
    overflow: auto;
    padding: 18px 20px 28px;
}

.app-body .container,
.main-section .container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0;
}

.app-panel {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-title {
    display: none;
}

.search-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}

.search-input,
.filter-select,
.form-group input,
.form-group select,
.form-group textarea {
    background: #ffffff !important;
    color: #111b21 !important;
    border: 1px solid #d1d7db !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

.search-input {
    min-width: 220px;
    padding: 10px 14px;
    font-size: 14px;
}

.search-input:focus,
.filter-select:focus,
.form-group input:focus,
.form-group select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18) !important;
    outline: none;
}

.btn-primary,
.btn-save,
.btn-login {
    background: #2563eb !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 8px !important;
    font-weight: 600;
    box-shadow: none !important;
    transform: none !important;
}

.btn-primary:hover,
.btn-save:hover,
.btn-login:hover {
    background: #1d4ed8 !important;
    transform: none !important;
}

.btn-primary.btn-blue,
.btn-ghost-blue {
    background: #027eb5 !important;
}

.btn-primary.btn-blue:hover,
.btn-ghost-blue:hover {
    background: #026a99 !important;
}

.table-wrapper {
    background: #ffffff;
    border: 1px solid #e9edef;
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
}

.data-table thead {
    display: table-header-group;
    background: #f0f2f5;
    color: #54656f;
}

.data-table th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid #e9edef;
}

.data-table td {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid #f0f2f5;
    color: #111b21;
}

.data-table tbody tr:hover {
    background: #f5f6f6;
}

#garantiasTable {
    display: block;
    background: #ffffff;
}

.data-table:has(#garantiasTable) thead,
.table-wrapper:has(#garantiasTable) thead {
    display: none;
}

.garantia-card-mobile {
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid #f0f2f5;
    border-radius: 0;
    box-shadow: none;
}

.garantia-card-mobile.is-hidden {
    display: none !important;
}

.garantia-card-header {
    padding: 12px 16px;
    background: #ffffff;
}

.garantia-card-header:hover {
    background: #f5f6f6;
}

.garantia-card-header.expanded {
    background: #eaf1ff;
    border-bottom: 1px solid #d6e4ff;
}

.garantia-card-main {
    gap: 12px;
}

.wa-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.wa-avatar.is-blue {
    background: #027eb5;
}

.garantia-card-numero {
    color: #027eb5;
    font-size: 12px;
    min-width: auto;
}

.garantia-card-cliente {
    font-size: 16px;
    font-weight: 500;
}

.garantia-card-details {
    background: #f0f2f5;
}

.garantia-card-actions {
    flex-direction: row;
    flex-wrap: wrap;
}

.garantia-card-actions .btn-action {
    width: auto;
    flex: 1;
    text-align: center;
    justify-content: center;
}

.badge-success {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-danger {
    background: #fde8e8;
    color: #9b2c2c;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.btn-action {
    background: #ffffff;
    color: #027eb5;
    border: 1px solid #d1d7db;
    border-radius: 6px;
}

.btn-action:hover {
    background: #e8f4fc;
    border-color: #53bdeb;
}

.btn-action.btn-danger {
    color: #c53030;
}

.marcas-filtro {
    gap: 6px;
}

.marca-btn,
[data-theme="dark"] .marca-btn {
    background: #ffffff;
    border: 1px solid #d1d7db;
    color: #54656f;
    border-radius: 16px;
    font-weight: 600;
}

.marca-btn:hover {
    background: #e8f4fc;
    border-color: #53bdeb;
    color: #027eb5;
}

.marca-btn.active,
[data-theme="dark"] .marca-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.phone-card {
    background: #ffffff;
    border: 1px solid #e9edef;
    box-shadow: none;
    border-radius: 8px;
}

.phone-card:hover:not(.no-hover) {
    box-shadow: 0 1px 3px rgba(11, 20, 26, 0.08);
    border-color: #2563eb;
}

.brand-badge {
    color: #027eb5;
    background: #e8f4fc;
    border-color: #c5e6f6;
}

.modal {
    background: rgba(17, 27, 33, 0.45);
    backdrop-filter: none;
}

.modal-content {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    animation: none;
}

.modal-header h2,
.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.header,
.footer {
    display: none !important;
}

.login-modal {
    background: #eef3fb;
}

.login-modal-content {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    padding: 0 28px 28px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    margin: 0 -28px 22px;
    padding: 22px 28px 16px;
    background: #ffffff;
    color: #0f172a;
    border-bottom: 1px solid #e8eef5;
}

.login-header h2 {
    color: #2563eb;
}

.login-header p {
    color: #64748b;
}

.login-header img {
    background: #ffffff;
    border-radius: 50%;
    padding: 6px;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dash-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border-radius: 8px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    box-shadow: var(--shadow);
}

.dash-card:hover {
    border-color: #2563eb;
}

.dash-card.is-blue:hover {
    border-color: #027eb5;
}

.dash-card h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.dash-card p {
    margin: 3px 0 0;
    color: #667781;
    font-size: 13px;
}

.welcome-panel {
    background: #ffffff;
    border-radius: 8px;
    padding: 28px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.welcome-panel h1 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
}

.welcome-panel p {
    margin: 0;
    color: #667781;
}

@media (max-width: 900px) {
    .app-frame {
        grid-template-columns: 1fr;
    }

    .app-rail {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        z-index: 40;
        transform: translateX(-105%);
        box-shadow: var(--shadow-lg);
    }

    body.rail-open .app-rail {
        transform: none;
    }

    .app-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .dash-grid {
        grid-template-columns: 1fr;
    }

    .search-filter {
        flex-direction: column;
        align-items: stretch;
    }
}

.btn-icon.btn-edit,
.btn-icon.btn-delete {
    font-size: 12px;
    font-weight: 600;
    min-width: auto;
    padding: 6px 10px;
}

.btn-icon.btn-edit {
    border: 1px solid #d1d7db;
    background: #ffffff;
    color: #027eb5;
}

.btn-icon.btn-delete {
    border: 1px solid #f5c2c2;
    background: #fff5f5;
    color: #c53030;
}

.app-frame .app-nav-item svg {
    fill: currentColor;
}

.phone-list {
    background: #ffffff;
    border: 1px solid #e8eef5;
    border-radius: 8px;
    overflow: hidden;
}

.phone-list-head,
#telefonesCards .phone-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.6fr) 110px 130px 120px 120px 148px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
}

.phone-list-head {
    background: #f8fafc;
    border-bottom: 1px solid #e8eef5;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #64748b;
    text-transform: uppercase;
}

#telefonesCards.cards-grid {
    display: block;
    gap: 0;
}

#telefonesCards .phone-card,
#telefonesCards .phone-row {
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid #eef2f6;
    border-radius: 0;
    box-shadow: none;
    padding: 7px 12px;
    margin: 0;
}

#telefonesCards .phone-row:last-child {
    border-bottom: 0;
}

#telefonesCards .phone-row:hover {
    background: #f5f8ff;
    border-color: #eef2f6;
    box-shadow: none;
}

.phone-row-name {
    min-width: 0;
}

.phone-row-name strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: none;
}

.phone-row-imei {
    display: block;
    margin-top: 1px;
    font-size: 11px;
    color: #94a3b8;
}

.phone-row-cell {
    font-size: 13px;
    color: #475569;
    text-transform: capitalize;
}

.phone-row-price {
    font-size: 13px;
    font-weight: 600;
    color: #1d4ed8;
}

#telefonesCards .brand-badge {
    justify-self: start;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 4px;
    color: #1d4ed8;
    background: #eff4ff;
    border: 1px solid #dbe4ff;
}

#telefonesCards .phone-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin: 0;
}

#telefonesCards .btn-icon.btn-edit,
#telefonesCards .btn-icon.btn-delete {
    min-height: 28px;
    min-width: 58px;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 5px;
}

.marcas-filtro {
    gap: 6px;
    margin: 8px 0 10px;
    padding: 0;
}

.marca-btn {
    padding: 5px 10px;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 600;
}

@media (max-width: 1100px) {
    .phone-list-head {
        display: none;
    }

    #telefonesCards .phone-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        padding: 8px 12px;
    }

    .phone-row-name {
        flex: 1 1 160px;
    }

    #telefonesCards .phone-actions {
        margin-left: auto;
    }
}


