
:root {

  color-scheme: light;

  --navy: #0b2545; --teal: #0a9489; --accent: #0fb6a8;

  --bg: #f4f8f9; --surface: #fff; --surface-soft: #edf5f6;

  --text: #183248; --muted: #617487; --line: #dae5e9;

  --danger: #b93644; --warning: #a7600c; --success: #16765b;

  --shadow: 0 10px 32px rgba(11,37,69,.06);

}

body.theme-dark {

  color-scheme: dark;

  --bg: #0c1824; --surface: #142534; --surface-soft: #1b3340;

  --text: #edf6f5; --muted: #a8bec7; --line: #29434e;

  --danger: #ff8590; --warning: #f2bd78; --success: #72d8b0;

  --shadow: 0 12px 36px rgba(0,0,0,.18);

}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, sans-serif; }

button, input, select, textarea { font: inherit; }

button { cursor: pointer; }

button:disabled { cursor: wait; opacity: .65; }

input, select, textarea { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 42px; padding: 9px 12px; outline: none; }

textarea { resize: vertical; }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 { line-height: 1.25; }

h1 { font-size: 1.75rem; } h2 { font-size: 1.1rem; }

.hidden, .icon-sprite { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.muted, .eyebrow { color: var(--muted); }

.eyebrow { font-size: .68rem; font-weight: 800; letter-spacing: .1em; }

.btn, .icon-button, .nav-item { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; transition: background .18s, color .18s, transform .18s, box-shadow .18s; }

.btn { padding: 10px 16px; min-height: 42px; border-radius: 8px; font-weight: 700; white-space: nowrap; }

.btn:hover:not(:disabled) { transform: translateY(-1px); }

.btn.primary { background: var(--teal); color: #fff; }

.btn.primary:hover:not(:disabled) { background: #08766e; box-shadow: 0 7px 16px rgba(10,148,137,.2); }

.btn.secondary { background: var(--surface-soft); color: var(--text); }

.btn.danger { color: var(--danger); background: var(--surface-soft); }

.btn.small { min-height: 34px; padding: 6px 10px; font-size: .81rem; }

.btn.full { width: 100%; }

.icon-button { width: 42px; height: 42px; border-radius: 8px; background: transparent; color: var(--muted); font-size: 24px; }

.icon-button:hover { background: var(--surface-soft); color: var(--text); }



.login-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }

.login-theme { position: fixed; right: 20px; top: 20px; }

.login-box { width: min(100%, 390px); background: var(--surface); padding: 36px; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }

.login-logo { width: 68px; height: 68px; margin-bottom: 18px; }

.login-box h1 { margin-bottom: 5px; }

.login-box p { color: var(--muted); margin-bottom: 25px; }

.login-box label, .form-row label { display: block; margin: 0 0 6px; font-size: .82rem; font-weight: 700; }

.login-box input { display: block; width: 100%; margin-bottom: 17px; }

.form-error { min-height: 22px; color: var(--danger); font-size: .86rem; }



.app { min-height: 100vh; display: flex; }

.sidebar { width: 238px; flex: none; position: sticky; top: 0; height: 100vh; padding: 22px 14px; display: flex; flex-direction: column; background: var(--navy); color: #e3f3f2; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 29px; font-weight: 800; font-size: 1.05rem; white-space: nowrap; }

.brand img, .mobile-brand img { width: 38px; height: 38px; border-radius: 8px; }

.side-nav { display: grid; gap: 4px; }

.side-footer { margin-top: auto; display: grid; gap: 4px; }

.sidebar .nav-item { width: 100%; justify-content: flex-start; padding: 11px 13px; border-radius: 8px; color: #bed1d9; background: transparent; font-weight: 600; text-align: left; }

.sidebar .nav-item:hover, .sidebar .nav-item.active { color: #fff; background: rgba(15,182,168,.24); }

.sidebar .nav-item.active { box-shadow: inset 3px 0 var(--accent); }

.workspace { min-width: 0; flex: 1; }

.topbar { height: 70px; padding: 0 clamp(18px,3vw,42px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--surface); }

.page-title { font-weight: 800; }

.top-actions { display: flex; gap: 4px; }

.mobile-brand, .mobile-theme { display: none; }

.main { max-width: 1480px; margin: auto; padding: 30px clamp(18px,3vw,42px) 60px; }

.view { animation: enter .22s ease both; }

@keyframes enter { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }

.section-heading h1, .section-heading h2 { margin: 3px 0 0; }

.section-heading.compact { margin: 32px 0 14px; }

.cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }

.card { min-width: 0; background: var(--surface); padding: 20px; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }

.card .label { color: var(--muted); font-size: .82rem; font-weight: 600; }

.card .value { font-size: clamp(1.25rem,2vw,1.65rem); font-weight: 800; margin-top: 8px; overflow-wrap: anywhere; }

.card .value.green { color: var(--success); } .card .value.amber { color: var(--warning); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,1fr); gap: 18px; margin-top: 18px; }

.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }

.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 17px; }

.panel-heading h2 { margin: 0; } .panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }

.chart { min-height: 225px; }

.chart-legend { display: flex; gap: 17px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-bottom: 15px; }

.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.chart-legend i { width: 9px; height: 9px; border-radius: 2px; background: var(--teal); }

.chart-legend .pending i { background: #dfaa66; }

.chart-bars { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); align-items: end; gap: 8px; height: 175px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }

.chart-month { height: 100%; position: relative; display: flex; align-items: end; justify-content: center; gap: 3px; }

.chart-bar { width: min(35%,26px); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--teal); }

.chart-bar.pending { background: #dfaa66; }

.chart-month label { position: absolute; bottom: -23px; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

.search-field { position: relative; flex: 1; min-width: 200px; }

.search-field .icon { position: absolute; left: 12px; top: 12px; color: var(--muted); }

.search-field input { width: 100%; padding-left: 38px; }

.toolbar select { min-width: 160px; }

#dashboard-search-results { max-height: 310px; overflow: auto; }

.client-cards { display: grid; gap: 8px; margin-top: 12px; }

.client-card { display: flex; align-items: center; gap: 11px; padding: 10px; background: var(--surface-soft); border-radius: 8px; min-width: 0; }

.client-card-info { min-width: 0; } .client-card-name { font-weight: 750; }

.client-card-sub { color: var(--muted); font-size: .79rem; overflow-wrap: anywhere; }

.client-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-soft); }

.client-thumb.small { width: 38px; height: 38px; }

.client-thumb-placeholder { display: grid; place-items: center; border: 1px solid var(--line); color: var(--teal); font-weight: 800; }

.client-row-name { display: flex; align-items: center; gap: 10px; min-width: 160px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }

table { width: 100%; border-collapse: collapse; min-width: 700px; }

th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; font-size: .86rem; vertical-align: middle; }

th { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; background: var(--surface-soft); }

tr:last-child td { border-bottom: 0; }

tbody tr:hover { background: var(--surface-soft); }

.row-actions { display: flex; gap: 6px; }

.badge, .payment-chip { display: inline-flex; max-width: 100%; padding: 4px 9px; border-radius: 8px; font-size: .76rem; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }

.badge.ativo, .badge.pago, .payment-chip.pago { color: var(--success); background: rgba(22,118,91,.12); }

.badge.pendente, .payment-chip.pendente { color: var(--warning); background: rgba(223,170,102,.18); }

.badge.atrasado, .badge.suspenso, .payment-chip.atrasado { color: var(--danger); background: rgba(185,54,68,.12); }

.badge.cancelado, .badge.inativo { color: var(--muted); background: var(--surface-soft); }

.empty-state { display: grid; justify-items: center; gap: 7px; text-align: center; padding: 34px 18px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; }

.empty-state img { width: 44px; opacity: .8; }

.empty-state strong { color: var(--text); }

.skeleton { height: 18px; border-radius: 6px; background: linear-gradient(90deg,var(--surface-soft) 25%,var(--line) 50%,var(--surface-soft) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }

.skeleton-row { height: 60px; margin-bottom: 7px; }

@keyframes shimmer { to { background-position: -200% 0; } }



.modal-overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 15px; background: rgba(5,20,34,.65); }

.modal { width: min(100%,560px); max-height: min(90vh,850px); overflow-y: auto; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 22px 65px rgba(0,0,0,.2); animation: enter .2s ease both; }

.modal h2 { font-size: 1.25rem; margin-bottom: 20px; }

.modal p { color: var(--muted); }

.form-row { margin-bottom: 14px; }

.form-row input, .form-row select, .form-row textarea { width: 100%; }

.two-col { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }

.photo-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.photo-picker input[type=file] { flex: 1; min-width: 160px; max-width: 100%; }

.photo-preview, .photo-placeholder { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-soft); }

.photo-placeholder { display: grid; place-items: center; color: var(--muted); font-size: .75rem; text-align: center; }

.remove-photo-check { display: flex; align-items: center; gap: 6px; width: 100%; font-size: .82rem; }

.remove-photo-check input { min-height: 0; }

.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

.toast-stack { position: fixed; z-index: 60; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(350px,calc(100vw - 36px)); }

.toast { padding: 13px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--teal); box-shadow: var(--shadow); animation: enter .2s ease both; }

.toast.error { border-left-color: var(--danger); }

.offline-banner { position: fixed; z-index: 40; top: 0; left: 50%; transform: translateX(-50%); padding: 9px 18px; border-radius: 0 0 8px 8px; background: var(--navy); color: #fff; text-align: center; font-size: .83rem; }

.install-banner { position: fixed; z-index: 40; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 13px; width: max-content; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font-weight: 700; }

.bottom-nav { display: none; }



@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2,minmax(0,1fr)); } .dashboard-grid { grid-template-columns: 1fr; } }

@media (max-width: 720px) {

  .sidebar { display: none; } .topbar { height: 60px; padding: 0 16px; }

  .topbar .page-title { display: none; }

  .mobile-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }

  .mobile-brand img { width: 32px; height: 32px; } .mobile-theme { display: inline-flex; }

  .main { padding: 21px 16px calc(92px + env(safe-area-inset-bottom)); }

  .bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3,1fr); padding: 7px 7px calc(7px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }

  .bottom-nav .nav-item { flex-direction: column; gap: 2px; padding: 6px 1px; min-width: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .7rem; font-weight: 700; }

  .bottom-nav .nav-item.active { color: var(--teal); background: var(--surface-soft); }

  .bottom-nav .nav-item .icon { width: 21px; height: 21px; }

  .toast-stack { bottom: calc(78px + env(safe-area-inset-bottom)); }

  .install-banner { bottom: calc(78px + env(safe-area-inset-bottom)); font-size: .78rem; }

}

@media (max-width: 480px) {

  .cards { gap: 8px; } .card { padding: 14px; }

  .card .value { font-size: 1.2rem; }

  .section-heading { align-items: flex-start; }

  .two-col { grid-template-columns: 1fr; }

  .modal { padding: 18px; }

}

@media (prefers-reduced-motion: reduce) {

  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }

}

