:root {
    --sidebar-width: 260px;
    --topbar-height: 72px;
    --page-bg: #f4f6fb;
    --card-border: #eef0f4;
    --text-muted: #8a94a6;
    --text-body: #1f2937;
    --accent: rgb(55 210 162 / 0.7);
    --sidebar-bg: #346556;
    --sidebar-text: #b7c1d4;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(255, 255, 255, 0.1);
    --sidebar-section-label: #8b96ab;
}

body {
    background-color: var(--page-bg);
    color: var(--text-body);
}

.card-stat {
    border-left: 4px solid #73dfbe;
}

/* Shell layout */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    padding: 1.75rem;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.4rem 1.4rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.5rem;
}

.logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.sidebar-scroll {
    padding: 0.5rem 1rem 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    margin: 0.25rem 0 1rem;
}

.sidebar-search-form i {
    color: var(--sidebar-section-label);
    font-size: 0.9rem;
}

.sidebar-search-form input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    color: #fff;
    font-size: 0.85rem;
}

.sidebar-search-form input::placeholder {
    color: var(--sidebar-section-label);
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--sidebar-section-label);
    text-transform: uppercase;
    padding: 1rem 0.75rem 0.5rem;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.2rem;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 1.2rem;
    text-align: center;
}

.sidebar-link:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}

.sidebar-link.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.sidebar-link-toggle {
    cursor: pointer;
}

.sidebar-link-toggle[aria-expanded="true"] {
    color: var(--sidebar-text-hover);
    font-weight: 600;
}

.sidebar-caret {
    margin-left: auto;
    font-size: 0.75rem !important;
    width: auto !important;
    transition: transform 0.2s ease-in-out;
}

.sidebar-link-toggle[aria-expanded="true"] .sidebar-caret {
    transform: rotate(90deg);
}

.sidebar-submenu {
    list-style: none;
    margin: 0.2rem 0 0.3rem 1.55rem;
    padding: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-sublink {
    padding: 0.5rem 0.85rem 0.5rem 1.1rem;
    margin-bottom: 0;
    border-radius: 0;
    border-left: 2px solid transparent;
    margin-left: -1px;
}

.sidebar-sublink:hover {
    background: transparent;
    color: var(--sidebar-text-hover);
}

.sidebar-sublink.active {
    background: transparent;
    color: rgb(55 210 162 / 0.7);
    border-left-color: var(--accent);
    font-weight: 600;
}

/* Topbar */
.app-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-greeting {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-body);
    white-space: nowrap;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bg-primary {
    background-color: #0d9488;
}

.btn-outline-primary {
    color: #0d9488;
    border-color: #0d9488;
}

.btn-primary{
    background-color: #0d9488;
    border-color: #0d9488;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: #fff;
    color: #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--page-bg);
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: none;
    border: 0;
    padding: 0.2rem 0.4rem;
}

.avatar-circle {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.avatar-circle::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-body);
}

/* Stat cards */
.stat-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    height: 100%;
}

.stat-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
}

.stat-icon.bg-blue { background: #73dfbe; }
.stat-icon.bg-purple { background: #7c3aed; }
.stat-icon.bg-teal { background: #14b8a6; }
.stat-icon.bg-orange { background: #f97316; }
.stat-icon.bg-rose { background: #e11d48; }

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-body);
}

/* Content cards */
.content-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.4rem;
}

.content-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-body);
    margin-bottom: 0;
}

/* Tabelas: nunca quebram texto em varias linhas - rolam na horizontal em vez disso */
.table-responsive table {
    font-size: 0.85rem;
}

.table-responsive table th,
.table-responsive table td {
    white-space: nowrap;
}

/* Form sections */
.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}

.form-section-title .icon-box {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.required-mark {
    color: #e11d48;
    margin-left: 0.2rem;
}

.btn-cep-search {
    background: #0d9488;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 0 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.btn-cep-search:hover {
    background: #0f766e;
    color: #fff;
}

.btn-cep-search:disabled {
    opacity: 0.7;
}

.chart-box {
    position: relative;
    height: 280px;
    width: 100%;
}

.autocomplete-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    margin-top: 0.25rem;
    max-height: 260px;
    overflow-y: auto;
}

.autocomplete-list.show {
    display: block;
}

.autocomplete-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.85rem;
    border: 0;
    background: none;
    font-size: 0.87rem;
    color: var(--text-body);
}

.autocomplete-item:hover {
    background: #f1f4fd;
    color: var(--accent);
}

/* Sidebar mobile behaviour */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform 0.2s ease-in-out;
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1030;
    }
}
