/* Estilo responsivo simples, mobile-first. Evitar tables; usar flex/grid */
:root {
    --bg: #ffffff;
    --accent: #1f4e3d;
    --muted: #6b7280;
    --card: #f7f7f9;
    /* layout variables */
    --sidebar-width: 250px;
    --sidebar-gap: 0.75rem;
    --header-gap: 0.75rem;
    --header-height: 56px;
}

* {
    box-sizing: border-box
}

body {
    font-family: Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: #111;
    margin: 0
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem
}

.site-header {
    background: var(--card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

/* Header should start after the fixed sidebar so it doesn't sit behind it */
.site-header {
    /* make header fixed and align with the visible sidebar-inner */
    border: solid 1px #ededed;
    position: fixed;
    top: var(--header-gap);
    left: calc(var(--sidebar-width) + var(--sidebar-gap));
    right: var(--sidebar-gap);
    /* same gap on the right */
    border-radius: 12px;
    z-index: 60;
    margin: 0;
    /* handled by left/right */
    height: var(--header-height);
    display: block;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem
}

.brand {
    font-weight: 700;
    color: var(--accent);
    text-decoration: none
}

.main-nav {
    position: relative
}

.nav-toggle {
    display: none;
    border: 0;
    background: transparent;
    font-size: 1.3rem
}

.sidebar-toggle {
    display: none
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.5rem
}

.nav-list li a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--muted);
    text-decoration: none
}

.nav-list.open {
    display: block
}

/* Layout with sidebar */
.layout {
    display: block;
    min-height: 100vh
}

.sidebar {
    background: transparent;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    z-index: 50
}

.sidebar-inner {
    border: solid 1px #ededed;
    background: var(--card);
    margin: 0.75rem;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    height: 97%
}

.sidebar-brand {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--accent)
}

.brand-title {
    font-weight: 700;
    color: var(--accent);
    padding: 0.5rem 0
}

.sidebar-top {
    padding-bottom: 0.5rem
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0
}

.logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    border: 2px solid #1f4e3d;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700
}

.logo-text {
    font-weight: 700;
    color: #0f172a
}

.menu {
    margin-top: 0.5rem
}

.menu-section {
    padding: 0.5rem 0
}

.menu-heading {
    font-size: 0.75rem;
    color: var(--muted);
    padding: 0 0.5rem;
    margin-bottom: 0.25rem
}

.menu-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none
}

.menu-item a .icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center
}

.menu-item a .fa-solid {
    font-size: 0.95rem;
    width: 20px;
    text-align: center
}

.menu-item.active>a {
    background: var(--accent);
    color: #fff;
}

.menu-item.active>a .icon {
    opacity: 1;
}

/* highlight specific submenu item when active */
.submenu-item.active a {
    background: var(--accent);
    color: #fff;
}

.sidebar-promo {
    margin-top: 1rem;
    padding: 0.5rem
}

.promo-card {
    background: linear-gradient(180deg, #0f2f24, #1f4e3d);
    color: #fff;
    padding: 1rem;
    border-radius: 12px
}

.promo-title {
    font-weight: 700
}

.promo-sub {
    font-size: 0.85rem;
    opacity: 0.9
}

.promo-cta {
    margin-top: 0.5rem;
    background: #fff;
    color: var(--accent);
    border: 0
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none
}

.menu-item a .icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center
}

/* Header compact */
.header-compact .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 0.5rem;
    /* keep small internal padding */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ensure the header-right is positioned relative to the site-header edge */
.site-header {
    padding-right: 3px;
}

.site-header .header-right {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

/* place header-left near the left edge of the header (flush with header border) */
.site-header .header-left {
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
}

/* style the header logout button to match the site accent */
.site-header .header-right .btn {
    background: var(--accent);
    color: #fff;
    border: 0;
}

.avatar {
    background: rgba(31, 78, 61, 0.08);
    color: var(--accent);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-weight: 700
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem
}

.sidebar-nav li a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: 6px
}

.sidebar-nav li a:hover {
    background: #f1f5f9
}

.main-content {
    min-height: 60vh;
    padding-top: 4rem
}

/* Page frame styling to match mock: rounded header and large rounded content area */
.page-frame {
    background: transparent;
    padding: 0
}

.page-frame .page-header {
    background: var(--card);
    border-radius: 18px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    text-align: center;
}

.page-frame .content-panel {
    background: #ffffff;
    /* contrast with .main */
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    min-height: 56vh;
}

/* Main wrapper for dashboard requested by user */
.main {
    /* fill the area between the fixed header and sidebar */
    border: solid 1px #ededed;
    position: fixed;
    top: calc(var(--header-height) + (var(--header-gap) * 2));
    left: calc(var(--sidebar-width) + var(--sidebar-gap));
    right: var(--sidebar-gap);
    bottom: var(--sidebar-gap);
    background: var(--card);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    overflow: auto;
}

@media (max-width:720px) {
    .main {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        margin: 1rem;
        padding: 0.75rem;
    }
}

/* Cards */
.cards {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem
}

.card {
    background: var(--card);
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    flex: 1;
    min-width: 160px
}

/* Footer */
.site-footer {
    padding: 1rem 0;
    text-align: center;
    color: var(--muted);
    font-size: .9rem
}

/* Responsivo */
@media (max-width:720px) {
    .nav-toggle {
        display: inline-block
    }

    .nav-list {
        display: none;
        flex-direction: column;
        background: var(--card);
        position: absolute;
        right: 0;
        top: 100%;
        min-width: 200px;
        padding: 0.5rem;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .08)
    }

    .nav-list li a {
        padding: 0.5rem 1rem
    }

    .site-header .container {
        padding: 0.75rem
    }

    /* On small screens the header should span full width again */
    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        margin: 0;
        width: 100%;
        border-radius: 0 0 10px 10px
    }

    .main-content {
        padding-top: 3.75rem;
        margin-left: 0
    }

    .header-controls {
        gap: 0.5rem
    }

    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        bottom: 0;
        width: 250px;
        z-index: 60;
        transition: left .22s ease
    }

    .sidebar.open {
        left: 0
    }

    .sidebar-inner {
        height: 97%;
        border-radius: 12px;
        margin: 0.5rem;
        padding: 0.5rem
    }

    .sidebar-toggle {
        display: inline-block;
        border: 0;
        background: transparent;
        font-size: 1.2rem
    }

    .layout {
        grid-template-columns: 1fr
    }

    .main-content {
        padding-top: 1rem;
        margin-left: 0
    }

    /* On mobile the page-frame should remove large radii so it fits */
    .page-frame .page-header,
    .page-frame .content-panel {
        border-radius: 10px
    }
}

/* Dashboard specific styles */
.dashboard-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem
}

.dashboard-title h1 {
    margin: 0;
    font-size: 1.6rem
}

.dashboard-title .muted {
    color: var(--muted);
    font-size: .95rem
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem
}

.search {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e6edf3;
    background: #fff;
    min-width: 220px
}

.btn {
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    transition:
        transform .12s ease,
        box-shadow .12s ease,
        filter .12s ease,
        opacity .12s ease
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(31, 78, 61, 0.06);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: 0;
}

.btn-primary:hover {
    filter: brightness(0.95);
    box-shadow: 0 10px 24px rgba(31, 78, 61, 0.14);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(31, 78, 61, 0.10);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem
}

.col-left {
    display: flex;
    flex-direction: column;
    gap: 1rem
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem
}

.metric-card {
    background: linear-gradient(180deg, #fff, #fbfeff);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(11, 22, 39, 0.03)
}

.metric-title {
    font-size: 0.9rem;
    color: var(--muted)
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a
}

.metric-sub {
    font-size: 0.8rem;
    color: var(--muted)
}

.card-large {
    padding: 1rem
}

.chart-placeholder {
    height: 90px;
    background: linear-gradient(90deg, #f1f5f9, #eef7f3);
    border-radius: 8px;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted)
}

.team-projects {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1rem
}

.team-list {
    list-style: none;
    margin: 0;
    padding: 0
}

.team-list li {
    padding: 0.35rem 0;
    border-bottom: 1px dashed #eef2f7
}

.project-list {
    list-style: none;
    margin: 0;
    padding: 0
}

.project-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9
}

.time-tracker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem
}

.tracker-clock {
    font-size: 1.4rem;
    font-weight: 700
}

@media (max-width:900px) {
    .metrics {
        grid-template-columns: repeat(2, 1fr)
    }

    .dashboard-grid {
        grid-template-columns: 1fr 300px
    }
}

@media (max-width:720px) {
    .dashboard-top {
        flex-direction: column;
        align-items: stretch
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr)
    }

    .dashboard-grid {
        grid-template-columns: 1fr
    }

    .team-projects {
        grid-template-columns: 1fr
    }
}

/* Clients list styles */
.clients-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.client-card {
    background: #fff;
    border-radius: 10px;
    padding: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pagination {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    /* allow buttons to wrap to next line on narrow screens */
    overflow-x: auto;
    /* if too many pages, allow horizontal scroll */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

.pagination .btn {
    padding: 0.35rem 0.5rem;
    min-width: 40px;
    text-align: center;
    white-space: nowrap;
}

.pagination .btn.active,
.pagination .btn[aria-current="page"] {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

@media (max-width:480px) {
    .pagination {
        gap: 0.35rem;
    }

    .pagination .btn {
        padding: 0.25rem 0.4rem;
        min-width: 34px;
        font-size: 0.95rem;
    }

    /* slightly reduce gaps in lists on very small screens */
    .clients-list,
    .clients-grid {
        gap: 0.6rem;
    }
}

/* Ensure pagination is centered and buttons don't stretch */
.pagination {
    justify-content: center;
}

.pagination .btn {
    flex: 0 0 auto;
}

/* Collapse long Prev/Next labels on very small screens and show icons */
@media (max-width:420px) {

    .pagination a.btn:first-child,
    .pagination a.btn:last-child {
        position: relative;
        text-indent: -9999px;
        /* hide long text but keep accessible for screen readers if title/aria-label present */
        padding: 0.3rem 0.45rem;
        min-width: 36px;
    }

    .pagination a.btn:first-child::before {
        content: "\00AB";
        /* « */
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--muted);
    }

    .pagination a.btn:last-child::after {
        content: "\00BB";
        /* » */
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--muted);
    }
}

/* allow pagination to be visible when inside rounded content panels */
.page-frame .content-panel {
    overflow: visible;
}

.client-name {
    margin: 0;
    font-size: 1rem
}

.client-meta {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem
}

.client-contact {
    margin-top: 0.5rem;
    font-size: 0.85rem
}

@media (max-width:720px) {
    .clients-list {
        grid-template-columns: 1fr
    }
}

/* Clients grid and card styles */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.client-card {
    background: #fff;
    border-radius: 10px;
    padding: 0.9rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.client-card__head {
    display: flex;
    align-items: center;
    gap: 0.75rem
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--accent), #14503f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700
}

.client-info .client-name {
    margin: 0;
    font-size: 1rem
}

.client-doc {
    font-size: 0.85rem;
    color: var(--muted);
}

.client-body {
    margin-top: 0.6rem;
    color: #111
}

.client-meta {
    color: var(--muted);
    font-size: 0.9rem
}

.client-email a {
    color: var(--muted);
    text-decoration: none
}

.client-card__foot {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end
}

.btn-ghost {
    background: transparent;
    border: 1px solid #e6eef0;
    color: var(--muted)
}

@media (max-width:720px) {
    .clients-grid {
        grid-template-columns: 1fr
    }
}

/* Collapsible submenu styles */
.menu-collapsible .collapse-toggle {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.90rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 8px;
    cursor: pointer;
}

.menu-collapsible .collapse-toggle:focus {
    outline: 2px solid rgba(31, 78, 61, 0.12)
}

.menu-collapsible .collapse-arrow {
    transition: transform .18s ease;
    font-size: 0.9rem
}

.menu-collapsible .submenu {
    display: none;
    padding-left: 0.5rem;
    margin-top: 0.25rem;
    list-style: none
}

.menu-collapsible .submenu.open {
    display: block
}

.menu-collapsible .submenu li a {
    display: block;
    padding: 0.45rem 0.75rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: 6px
}

.menu-collapsible .submenu li:not(.active) a:hover {
    background: #f1f5f9
}

/* stronger rules for active submenu items to prevent hover conflicts */
.menu-item.menu-collapsible .submenu-item.active>a,
.menu-item.menu-collapsible .submenu-item.active>a:hover {
    background: var(--accent);
    color: #fff;
}

.menu-collapsible.open .collapse-arrow {
    transform: rotate(180deg)
}

/* Form and button utilities used in client forms */
.content-panel form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem
}

.content-panel form input,
.content-panel form select,
.content-panel form textarea {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #e6eef0
}

.btn {
    display: inline-block;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--muted);
    text-decoration: none
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: 0
}

/* Search form in page header */
.search-form {
    background: transparent;
    display: flex;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    border: 1px solid #e9f0ef;
    background: #fff;
    outline: none;
    font-size: 0.95rem;
}

.search-form input[type="search"]:focus {
    box-shadow: 0 6px 18px rgba(31, 78, 61, 0.06);
    border-color: var(--accent);
}

.search-form .btn {
    padding: 0.45rem 0.6rem;
}

/* Client view layout */
.client-view .client-view-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    align-items: start;
}

.client-view .client-details dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    row-gap: 0.5rem;
    column-gap: 1rem;
}

.client-view .client-details dt {
    font-weight: 700;
    color: var(--muted);
}

.client-view .client-details dd {
    margin: 0;
    color: var(--text);
}

.client-view .client-aside {
    padding: 1rem;
    border-radius: 12px;
    background: var(--card);
}

.client-view .client-aside__top {
    text-align: center;
    margin-bottom: 0.75rem
}

.avatar-lg {
    width: 88px;
    height: 88px;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--accent), #14503f);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}

.client-aside__name {
    margin-top: 0.5rem;
    font-weight: 700
}

.client-aside__city {
    font-size: 0.9rem
}

.client-aside__contact {
    margin-top: 0.5rem
}

.client-aside__contact .contact-email a {
    color: var(--accent)
}

@media (max-width:720px) {
    .client-view .client-view-grid {
        grid-template-columns: 1fr
    }

    .client-view .client-details dl {
        grid-template-columns: 1fr
    }
}
/* ============================================
   NEW SIDEBAR - Completamente Novo
   ============================================ */

/* Submenu styling */
.menu-item.has-submenu .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}

.menu-item.has-submenu.open .submenu {
    margin-top: 0.5rem;
}

.menu-item.has-submenu .submenu li {
    margin: 0;
}

.menu-item.has-submenu .submenu li a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.menu-item.has-submenu .submenu li a:hover {
    background: rgba(31, 78, 61, 0.08);
    color: var(--accent);
    padding-left: 1rem;
}

.menu-item.has-submenu .submenu li a.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Menu trigger com seta */
.menu-link.submenu-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.menu-link.submenu-trigger .arrow {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.menu-item.has-submenu.open .menu-link.submenu-trigger .arrow {
    transform: rotate(180deg);
}

/* Menu list base */
.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-list .menu-item {
    margin-bottom: 0.25rem;
}
