/* ═══════════════════════════════════════════════════════════════════
   AGENDA STITCH EXACT DESIGN SYSTEM
   Baseado 1:1 no code.html fornecido
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --bg: #f4f6fb;
    --surface: #fff;
    --line: #e6eaf2;
    --ink: #0f1729;
    --muted: #667085;
    --soft: #98a2b3;
    --primary: #0b6cff;
    --primary-soft: #e9f1ff;
    --navy: #0a1730;
    --navy-2: #13244a;
    --danger: #e5484d;
    --danger-soft: #fdecec;
    --green: #12a26a;
    --green-soft: #e3f7ee;
    --violet: #7a5af8;
    --violet-soft: #f0ecff;
    --warning: #f59e0b;
    --warning-soft: #fff7ed;
    --sidebar: 252px;
}

svg.i {
    width: 1.15em;
    height: 1.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

/* ─── Topbar Buttons ─── */
.pdx-topbar__actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s, background .15s, border-color .15s;
}
.pdx-topbar__actions .btn:hover { border-color: #cfd6e4; background: #fafbfd; }
.pdx-topbar__actions .btn:active { transform: scale(.98); }
.pdx-topbar__actions .btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(11, 108, 255, .6);
}
.pdx-topbar__actions .btn.primary:hover {
    background: #0a5fe3;
    color: #fff;
}

/* ─── Section Header (Sub-header) ─── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ink);
    margin: 0;
}
.section-header p {
    margin-top: 3px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: .88rem;
}
.section-header .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 999px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 6px 16px -6px rgba(11, 108, 255, .6);
    transition: transform .12s, background .15s, border-color .15s;
}
.section-header .btn:hover {
    background: #0a5fe3;
    border-color: #0a5fe3;
    color: #fff;
}
.section-header .btn:active { transform: scale(.98); }

/* ─── KPI Cards Row ─── */
.kpis-agenda {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow .15s;
}
.kpi-card:hover {
    box-shadow: 0 4px 16px rgba(15, 23, 41, .04);
}
.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.kpi-icon.blue { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.amber { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.green { background: var(--green-soft); color: var(--green); }
.kpi-icon.red { background: var(--danger-soft); color: var(--danger); }

.kpi-data {
    display: flex;
    flex-direction: column;
}
.kpi-data .num {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.1;
    color: var(--ink);
}
.kpi-data .label {
    font-size: .82rem;
    font-weight: 500;
    color: var(--muted);
    margin-top: 2px;
}

/* ─── Search and Filters Bar ─── */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}
.filter-group-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
}
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 200px;
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .02);
}
.search-box svg {
    color: var(--soft);
    margin-right: 10px;
    width: 1.1em;
    height: 1.1em;
}
.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: .88rem;
    width: 100%;
    color: var(--ink);
    padding: 7px 0;
}
.search-box input::placeholder {
    color: var(--soft);
}

.time-tabs {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px;
    flex-shrink: 0;
}
.tab-btn {
    border: none;
    background: transparent;
    padding: 7px 16px;
    font-size: .84rem;
    font-weight: 500;
    color: var(--muted);
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.tab-btn:hover {
    color: var(--ink);
}
.tab-btn.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.filter-group-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.select-filter-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.select-filter {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 34px 9px 18px;
    font-size: .84rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    outline: none;
    transition: border-color .15s;
    appearance: none;
    -webkit-appearance: none;
    white-space: nowrap;
}
.select-filter:hover {
    border-color: #cfd6e4;
}
.select-arrow {
    position: absolute;
    right: 14px;
    pointer-events: none;
    width: 0.9em;
    height: 0.9em;
    color: var(--soft);
}

/* ─── Table of Appointments Card ─── */
.table-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 41, .02);
}
.table-header {
    display: grid;
    grid-template-columns: 100px 1.8fr 2fr 1.3fr 130px 48px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    font-size: .75rem;
    font-weight: 700;
    color: var(--soft);
    letter-spacing: .04em;
    text-transform: uppercase;
}
.table-body {
    display: flex;
    flex-direction: column;
}
.table-row {
    display: grid;
    grid-template-columns: 100px 1.8fr 2fr 1.3fr 130px 48px;
    padding: 20px 24px;
    align-items: center;
    border-bottom: 1px solid #f2f4f8;
    transition: background .12s;
    cursor: pointer;
}
.table-row:last-child {
    border-bottom: none;
}
.table-row:hover {
    background: #fafbfd;
}

/* Date cell */
.date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    background: var(--primary-soft);
    border-radius: 14px;
    color: var(--primary);
    text-align: center;
}
.date-badge .day {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}
.date-badge .month {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 2px;
}
.date-badge .time {
    font-size: .65rem;
    font-weight: 600;
    margin-top: 1px;
    opacity: .9;
}

/* Client cell */
.client-cell {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 12px;
}
.client-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: .92rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.client-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.client-name {
    font-size: .94rem;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.client-desc {
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Address cell */
.address-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: var(--muted);
    padding-right: 12px;
}
.address-cell svg {
    color: var(--soft);
    width: 1.05em;
    height: 1.05em;
}
.address-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contact cell */
.contact-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}
.contact-cell svg {
    color: var(--primary);
    width: 1.05em;
    height: 1.05em;
}

/* Status badge (status-pill) */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-pill.concluido { background: var(--green-soft); color: var(--green); }
.status-pill.pendente { background: var(--warning-soft); color: var(--warning); }
.status-pill.cancelado { background: var(--danger-soft); color: var(--danger); }
.status-pill svg { width: .95em; height: .95em; }

/* Row action */
.row-more {
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--soft);
    cursor: pointer;
    transition: all .15s;
}
.row-more:hover {
    background: #edf2f9;
    color: var(--ink);
}
.row-more svg {
    width: 1.1em;
    height: 1.1em;
}

/* ─── Pagination ─── */
.ag-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 16px 24px;
    border-top: 1px solid #f2f4f8;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 600;
}
.ag-pagination__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.ag-page-btn {
    min-height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.ag-page-btn:not(:disabled):hover {
    border-color: #cfd6e4;
    background: #fafbfd;
}
.ag-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ─── Empty & Loading States ─── */
.ag-loading {
    display: flex;
    justify-content: center;
    padding: 4rem 0;
}
.ag-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4.5rem 2rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
}
.ag-empty__icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--primary-soft);
    display: grid;
    place-items: center;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
}
.ag-empty__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.35rem;
}
.ag-empty__desc {
    font-size: .88rem;
    color: var(--muted);
    max-width: 380px;
    margin-bottom: 1.5rem;
}

/* ─── Mobile Cards ─── */
.ag-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ag-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 41, .02);
}
.ag-card__top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.ag-card__details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ag-desc {
    font-size: .8rem;
    color: var(--muted);
    margin-top: 4px;
}
.ag-card__footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f2f4f8;
}

/* ═══ Responsive ═══ */
@media (max-width: 1180px) {
    .kpis-agenda { grid-template-columns: repeat(2, 1fr); }
    .table-header { display: none; }
    .table-row { grid-template-columns: 1fr; gap: 12px; padding: 18px; }
    .client-cell { padding-right: 0; }
}
@media (max-width: 760px) {
    .kpis-agenda { grid-template-columns: 1fr; }
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group-left {
        flex-direction: column;
        align-items: stretch;
    }
    .time-tabs {
        overflow-x: auto;
        justify-content: flex-start;
    }
    .filter-group-right {
        display: flex;
        width: 100%;
    }
    .select-filter-wrap {
        flex: 1;
    }
    .select-filter {
        width: 100%;
    }
}
