/* =====================================================================
 * GESTOR AgendaGest — design system próprio (light, clean, estilo ClickUp)
 * Independente do app.css (Tailwind compilado): tudo que o Gestor usa
 * está aqui, prefixado com g-.
 * ===================================================================== */

:root {
    --g-bg: #ffffff;
    --g-bg-soft: #f7f8fa;
    --g-sidebar: #fafbfc;
    --g-border: #eceef2;
    --g-border-strong: #dfe2e8;
    --g-text: #1f2430;
    --g-text-2: #4b5263;
    --g-muted: #8a91a0;
    --g-faint: #b6bcc8;
    --g-hover: #f1f3f6;
    --g-primary: #0F766E;
    --g-primary-600: #115E59;
    --g-primary-soft: #fff4ec;
    --g-accent: #7b68ee;
    --g-accent-soft: #f1efff;
    --g-success: #16a34a;
    --g-success-soft: #ecfdf3;
    --g-danger: #e11d48;
    --g-danger-soft: #fff1f3;
    --g-radius: 12px;
    --g-radius-sm: 8px;
    --g-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    --g-shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .05);
    --g-sidebar-w: 252px;
}

* { box-sizing: border-box; }

html { font-size: 14px; }

body.g-body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    color: var(--g-text);
    background: var(--g-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.g-num { font-variant-numeric: tabular-nums; }

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

.g-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--g-sidebar-w);
    background: var(--g-sidebar); border-right: 1px solid var(--g-border);
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .2s ease;
}

.g-main { flex: 1; min-width: 0; margin-left: var(--g-sidebar-w); display: flex; flex-direction: column; }

.g-topbar {
    position: sticky; top: 0; z-index: 30; height: 56px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 28px; background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--g-border);
}

.g-content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }

.g-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--g-muted); font-weight: 600; }
.g-crumbs b { color: var(--g-text); font-weight: 700; }
.g-crumbs i { font-size: 9px; color: var(--g-faint); }

.g-burger { display: none; width: 34px; height: 34px; border: 1px solid var(--g-border); border-radius: var(--g-radius-sm); background: #fff; cursor: pointer; }

.g-overlay { display: none; }

@media (max-width: 1023px) {
    .g-sidebar { transform: translateX(-100%); box-shadow: var(--g-shadow-lg); }
    .g-shell.is-open .g-sidebar { transform: none; }
    .g-shell.is-open .g-overlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .25); z-index: 35; }
    .g-main { margin-left: 0; }
    .g-burger { display: inline-flex; align-items: center; justify-content: center; }
    .g-topbar { padding: 0 16px; }
    .g-content { padding: 18px 16px 40px; }
}

/* ---------------- Sidebar ---------------- */
.g-ws {
    margin: 12px 10px 6px; padding: 8px; border-radius: 10px;
    display: flex; align-items: center; gap: 10px; cursor: pointer; border: 1px solid transparent;
    background: none; width: calc(100% - 20px); text-align: left;
}
.g-ws:hover { background: var(--g-hover); }
.g-ws-avatar {
    width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #14B8A6, #0F766E); color: #fff; font-weight: 800; font-size: 12px;
}
.g-ws-name { font-weight: 800; font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-ws-sub { font-size: 11px; color: var(--g-muted); font-weight: 600; }

.g-ws-menu {
    position: absolute; top: 58px; left: 10px; right: 10px; z-index: 50;
    background: #fff; border: 1px solid var(--g-border); border-radius: var(--g-radius);
    box-shadow: var(--g-shadow-lg); padding: 6px;
}
.g-ws-menu[hidden] { display: none; }
.g-ws-menu-title { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--g-muted); padding: 8px 8px 4px; }

.g-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.g-nav::-webkit-scrollbar { width: 6px; }
.g-nav::-webkit-scrollbar-thumb { background: var(--g-border-strong); border-radius: 99px; }

.g-nav-label {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
    color: var(--g-muted); padding: 14px 8px 6px;
}

.g-nav-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--g-radius-sm);
    font-size: 13px; font-weight: 600; color: var(--g-text-2); cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.g-nav-item i { width: 16px; text-align: center; color: var(--g-muted); font-size: 13px; }
.g-nav-item:hover { background: var(--g-hover); color: var(--g-text); }
.g-nav-item.is-active { background: var(--g-primary-soft); color: var(--g-primary-600); }
.g-nav-item.is-active i { color: var(--g-primary); }
.g-nav-item .g-count { margin-left: auto; font-size: 11px; color: var(--g-muted); font-weight: 700; }

.g-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; display: inline-block; }

.g-side-foot { border-top: 1px solid var(--g-border); padding: 10px; }

.g-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.g-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; color: #fff; background: var(--g-accent);
}
.g-avatar.lg { width: 44px; height: 44px; font-size: 15px; }

/* ---------------- Tipografia / cabeçalho de página ---------------- */
.g-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.g-h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.g-sub { font-size: 13px; color: var(--g-muted); font-weight: 500; margin: 4px 0 0; }
.g-h2 { font-size: 14px; font-weight: 800; margin: 0; }
.g-hint { font-size: 12px; color: var(--g-muted); font-weight: 500; }

/* ---------------- Botões / controles ---------------- */
.g-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
    border-radius: var(--g-radius-sm); border: 1px solid var(--g-border-strong); background: #fff;
    font-size: 13px; font-weight: 700; color: var(--g-text-2); cursor: pointer; white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.g-btn:hover { background: var(--g-hover); color: var(--g-text); }
.g-btn.primary { background: var(--g-primary); border-color: var(--g-primary); color: #fff; }
.g-btn.primary:hover { background: var(--g-primary-600); }
.g-btn.ghost { border-color: transparent; background: none; }
.g-btn.icon { width: 34px; padding: 0; justify-content: center; }

.g-seg { display: inline-flex; padding: 3px; background: var(--g-bg-soft); border: 1px solid var(--g-border); border-radius: 10px; gap: 2px; }
.g-seg button, .g-seg a {
    display: inline-flex; align-items: center;
    border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 7px;
    font-size: 12.5px; font-weight: 700; color: var(--g-muted); cursor: pointer;
}
.g-seg button:hover, .g-seg a:hover { color: var(--g-text); }
.g-seg button.is-active, .g-seg a.is-active { background: #fff; color: var(--g-text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--g-border); }

.g-input {
    height: 36px; border: 1px solid var(--g-border-strong); border-radius: var(--g-radius-sm);
    padding: 0 12px; font: inherit; font-size: 13px; color: var(--g-text); background: #fff; outline: none; width: 100%;
}
.g-input:focus { border-color: var(--g-primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.g-search { position: relative; }
.g-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--g-faint); font-size: 12px; }
.g-search .g-input { padding-left: 34px; }

select.g-input { padding-right: 28px; cursor: pointer; }

/* ---------------- Filtro de lojas (chips) ---------------- */
.g-store-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.g-chip {
    display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
    border-radius: 999px; border: 1px solid var(--g-border-strong); background: #fff;
    font-size: 12.5px; font-weight: 700; color: var(--g-text-2); cursor: pointer; transition: all .12s;
}
.g-chip:hover { border-color: var(--g-faint); color: var(--g-text); }
.g-chip.is-active { background: var(--g-text); border-color: var(--g-text); color: #fff; }
.g-chip.is-active .g-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.g-chip .g-chip-badge { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: var(--g-bg-soft); color: var(--g-muted); }
.g-chip.is-active .g-chip-badge { background: rgba(255, 255, 255, .16); color: #fff; }

.g-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 0 16px; border-bottom: 1px solid var(--g-border); margin-bottom: 20px;
}

/* ---------------- Cards / KPIs ---------------- */
.g-card { background: #fff; border: 1px solid var(--g-border); border-radius: var(--g-radius); box-shadow: var(--g-shadow); }
.g-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.g-card-body { padding: 16px 18px 18px; }

.g-grid { display: grid; gap: 16px; }
.g-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-row-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-row-half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) { .g-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 1279px) { .g-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1023px) { .g-row-2, .g-row-3, .g-row-half { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 639px) { .g-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.g-kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.g-kpi-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--g-muted); }
.g-kpi-label i { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: var(--g-bg-soft); color: var(--g-text-2); }
.g-kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 10px; line-height: 1.1; }
.g-kpi-foot { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--g-muted); font-weight: 600; }

.g-delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 800; }
.g-delta.up { color: var(--g-success); background: var(--g-success-soft); }
.g-delta.down { color: var(--g-danger); background: var(--g-danger-soft); }
.g-delta.flat { color: var(--g-muted); background: var(--g-bg-soft); }

/* ---------------- Tabela ---------------- */
.g-table-wrap { overflow-x: auto; }
.g-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.g-table th {
    text-align: left; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
    color: var(--g-muted); padding: 10px 14px; border-bottom: 1px solid var(--g-border); white-space: nowrap; background: var(--g-bg-soft);
}
.g-table th.r, .g-table td.r { text-align: right; }
.g-table td { padding: 11px 14px; border-bottom: 1px solid var(--g-border); vertical-align: middle; }
.g-table tbody tr { transition: background .1s; }
.g-table tbody tr.is-click { cursor: pointer; }
.g-table tbody tr:hover { background: #fbfbfd; }
.g-table tbody tr:last-child td { border-bottom: 0; }
.g-table th button.g-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.g-table th button.g-sort.is-active { color: var(--g-text); }

.g-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.g-person-name { font-weight: 700; color: var(--g-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-person-sub { font-size: 11.5px; color: var(--g-muted); font-weight: 500; }

.g-tag {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
    font-size: 11px; font-weight: 700; background: var(--g-bg-soft); color: var(--g-text-2); white-space: nowrap; border: 1px solid var(--g-border);
}
.g-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.g-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 10.5px; font-weight: 800; }
.g-badge.hq { background: var(--g-accent-soft); color: var(--g-accent); }
.g-badge.warn { background: #fff7e6; color: #b45309; }
.g-badge.danger { background: var(--g-danger-soft); color: var(--g-danger); }
.g-badge.ok { background: var(--g-success-soft); color: var(--g-success); }

.g-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--g-border); font-size: 12.5px; color: var(--g-muted); font-weight: 600; }

/* ---------------- Charts ---------------- */
.g-chart { position: relative; width: 100%; }
.g-chart svg { display: block; width: 100%; overflow: visible; }
.g-chart .g-grid-line { stroke: var(--g-border); stroke-width: 1; }
.g-chart .g-axis { fill: var(--g-muted); font-size: 10.5px; font-weight: 600; font-family: inherit; }
.g-tip {
    position: absolute; pointer-events: none; z-index: 5; min-width: 170px;
    background: #111827; color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 12px;
    box-shadow: var(--g-shadow-lg); opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s;
}
.g-tip.is-on { opacity: 1; transform: none; }
.g-tip-title { font-size: 11px; color: #9ca3af; font-weight: 700; margin-bottom: 6px; }
.g-tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 3px; }
.g-tip-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: #d1d5db; }

.g-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; font-weight: 600; color: var(--g-text-2); }
.g-legend span { display: inline-flex; align-items: center; gap: 6px; }

.g-bar-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 0; }
.g-bar-track { height: 8px; border-radius: 99px; background: var(--g-bg-soft); overflow: hidden; }
.g-bar-fill { height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }

.g-donut-wrap { display: flex; align-items: center; gap: 20px; }
.g-donut-wrap svg { width: 132px; height: 132px; flex-shrink: 0; }

.g-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; align-items: end; height: 110px; }
.g-hours div { background: var(--g-accent-soft); border-radius: 4px 4px 2px 2px; min-height: 3px; position: relative; transition: height .4s; }
.g-hours div.is-peak { background: var(--g-accent); }
.g-hours-axis { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; margin-top: 6px; font-size: 10px; color: var(--g-faint); font-weight: 700; text-align: center; }

/* ---------------- Cards de loja ---------------- */
.g-store-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.g-store-head { display: flex; align-items: center; gap: 12px; }
.g-store-icon {
    width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; color: #fff; font-weight: 800; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.g-store-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.g-store-metrics > div { background: var(--g-bg-soft); border-radius: 10px; padding: 10px 12px; }
.g-store-metrics small { display: block; font-size: 11px; color: var(--g-muted); font-weight: 700; }
.g-store-metrics b { display: block; font-size: 15px; font-weight: 800; margin-top: 2px; }

/* ---------------- Drawer ---------------- */
.g-drawer-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .28); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .18s; }
.g-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: #fff; z-index: 61;
    border-left: 1px solid var(--g-border); box-shadow: var(--g-shadow-lg);
    transform: translateX(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column;
}
.g-drawer.is-open { transform: none; }
.g-drawer-back.is-open { opacity: 1; pointer-events: auto; }
.g-drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--g-border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.g-drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }
.g-section-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--g-muted); margin: 22px 0 10px; }
.g-dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
.g-dl dt { color: var(--g-muted); font-weight: 600; }
.g-dl dd { margin: 0; font-weight: 600; word-break: break-word; }

.g-mini-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.g-mini-kpis > div { border: 1px solid var(--g-border); border-radius: 10px; padding: 10px 12px; }
.g-mini-kpis small { display: block; font-size: 11px; color: var(--g-muted); font-weight: 700; }
.g-mini-kpis b { display: block; font-size: 16px; font-weight: 800; margin-top: 2px; }

.g-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--g-border); font-size: 13px; }
.g-list-row:last-child { border-bottom: 0; }

/* ---------------- Estados ---------------- */
.g-empty { text-align: center; padding: 48px 20px; color: var(--g-muted); }
.g-empty i { font-size: 26px; color: var(--g-faint); margin-bottom: 10px; display: block; }
.g-empty b { display: block; color: var(--g-text); font-size: 14px; margin-bottom: 4px; }

.g-skel { background: linear-gradient(90deg, #f1f3f6 25%, #f7f8fa 50%, #f1f3f6 75%); background-size: 200% 100%; animation: g-shimmer 1.2s infinite; border-radius: 6px; }
@keyframes g-shimmer { to { background-position: -200% 0; } }

.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

.g-fade-in { animation: g-fade .25s ease both; }
@keyframes g-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.g-hide-sm { }
@media (max-width: 767px) { .g-hide-sm { display: none !important; } }

/* ---------------- Login ---------------- */
.g-login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #fff; }
.g-login-art {
    background: radial-gradient(1200px 600px at 20% 10%, #fff4ec 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #f1efff 0%, transparent 60%), var(--g-bg-soft);
    border-right: 1px solid var(--g-border); padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.g-login-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.g-login-box { width: 100%; max-width: 380px; }
.g-field { margin-bottom: 14px; }
.g-field label { display: block; font-size: 12px; font-weight: 700; color: var(--g-text-2); margin-bottom: 6px; }
.g-field .g-input { height: 42px; font-size: 14px; }
.g-alert { padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.g-alert.err { background: var(--g-danger-soft); color: var(--g-danger); }
.g-preview-card { background: #fff; border: 1px solid var(--g-border); border-radius: 14px; padding: 16px; box-shadow: var(--g-shadow-lg); }

@media (max-width: 1023px) {
    .g-login { grid-template-columns: minmax(0, 1fr); }
    .g-login-art { display: none; }
}
