/* =========================================================
   Gestor de Quadras — tema
   ========================================================= */
:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --surface-3: #eef2f0;
  --border: #e3e9e6;
  --border-strong: #cfd8d3;
  --text: #0f1b16;
  --text-2: #5d6d65;
  --text-3: #8a9891;

  --primary: #0a8a5c;
  --primary-600: #077049;
  --primary-ink: #ffffff;
  --primary-soft: #e2f4ec;
  --primary-glow: rgba(10, 138, 92, .18);

  --warn: #b25e04;
  --warn-soft: #fff1dc;
  --danger: #c0281b;
  --danger-soft: #fde9e7;
  --ok: #0a8a5c;
  --ok-soft: #e2f4ec;
  --info: #2457c5;
  --info-soft: #e7eefc;

  --side-bg: #0b241b;
  --side-text: #b8cbc2;
  --side-text-strong: #ffffff;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(52, 211, 153, .14);
  --side-accent: #34d399;

  --slot-free: #f1f7f4;
  --slot-free-text: #4f6b5e;
  --slot-free-hover: #d6efe3;
  --slot-booked: linear-gradient(135deg, #0a8a5c, #0b7a55);
  --slot-pending: linear-gradient(135deg, #e08a12, #c87406);
  --slot-done: linear-gradient(135deg, #5f7d70, #51695e);
  --slot-noshow: linear-gradient(135deg, #cf3b2c, #b02a1d);
  --slot-block: #8d9a94;

  --shadow-sm: 0 1px 2px rgba(15, 27, 22, .06);
  --shadow: 0 1px 2px rgba(15, 27, 22, .05), 0 6px 20px -6px rgba(15, 27, 22, .10);
  --shadow-lg: 0 24px 60px -12px rgba(15, 27, 22, .35);
  --radius: 14px;
  --radius-sm: 10px;
  --side: 248px;
  --topbar: 56px;
  --bottombar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f0d;
    --surface: #121a16;
    --surface-2: #17211c;
    --surface-3: #1c2822;
    --border: #233029;
    --border-strong: #2f3f37;
    --text: #e7eeea;
    --text-2: #9fb0a8;
    --text-3: #71837a;
    --primary: #2bbd85;
    --primary-600: #22a273;
    --primary-ink: #03140d;
    --primary-soft: #11301f;
    --primary-glow: rgba(43, 189, 133, .22);
    --warn: #f3a640;
    --warn-soft: #36260e;
    --danger: #ff7a6e;
    --danger-soft: #3a1714;
    --ok: #2bbd85;
    --ok-soft: #11301f;
    --info: #8eb0ff;
    --info-soft: #172240;
    --side-bg: #08120e;
    --slot-free: #15211b;
    --slot-free-text: #8fb3a2;
    --slot-free-hover: #1b3a2b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 14.5px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh; min-height: 100dvh;
}
body.no-scroll { overflow: hidden; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 16px; font-weight: 680; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 8px; }
hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.hidden { display: none !important; }
::selection { background: var(--primary-glow); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side {
  background: var(--side-bg); color: var(--side-text); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; min-width: 0; }
.brand > div { min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, #34d399, #0a8a5c 70%); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; letter-spacing: .02em;
  box-shadow: 0 6px 16px -6px rgba(52, 211, 153, .6), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand b { display: block; font-size: 14.5px; color: var(--side-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { font-size: 12px; color: var(--side-text); opacity: .8; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-text); opacity: .55; padding: 14px 12px 6px; font-weight: 650; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--side-text); text-decoration: none; font-weight: 560; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--side-hover); color: var(--side-text-strong); }
.nav a.active { background: var(--side-active); color: var(--side-text-strong); }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent); }
.nav a.active svg { color: var(--side-accent); }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav .count { margin-left: auto; background: #f59e0b; color: #1b1203; border-radius: 99px; font-size: 11px; font-weight: 750; padding: 1px 7px; }
.side-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side-foot .who { flex: 1; min-width: 0; font-size: 12px; }
.side-foot .who b { display: block; color: var(--side-text-strong); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .icon-btn { color: var(--side-text); }
.side-foot .icon-btn:hover { background: var(--side-hover); color: #fff; }

.main { padding: 28px 32px 64px; min-width: 0; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.topbar, .bottom-nav, .side-backdrop { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head .grow { flex: 1; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

.kpi { padding: 16px 18px; position: relative; overflow: hidden; display: block; }
.kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 84px; height: 84px; border-radius: 50%; background: var(--primary-soft); opacity: .7; }
.kpi .lbl { font-size: 12.5px; color: var(--text-2); font-weight: 580; position: relative; z-index: 1; }
.kpi .val { font-size: 25px; font-weight: 760; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; position: relative; z-index: 1; }
.kpi .val.warn { color: var(--warn); }
a.kpi { transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow), 0 0 0 1px var(--primary-glow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); padding: 9px 15px; border-radius: 10px; font: inherit; font-weight: 620;
  cursor: pointer; white-space: nowrap; min-height: 40px; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 14px -4px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.15); }
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn.danger { background: #c0281b; border-color: #c0281b; color: #fff; }
.btn.danger:hover { background: #a82014; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 5px 11px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.btn.link { border: none; background: none; color: var(--primary); padding: 0; min-height: 0; box-shadow: none; font-weight: 600; }
.btn.link:hover { text-decoration: underline; }
.icon-btn { border: none; background: none; color: var(--text-2); cursor: pointer; font-size: 17px; width: 36px; height: 36px; border-radius: 9px; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

label.f { display: block; min-width: 0; }
label.f > span { display: block; font-size: 12.5px; font-weight: 620; color: var(--text-2); margin-bottom: 5px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 9px 12px; width: 100%; min-height: 42px; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a9891' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); margin: 0; }
textarea { min-height: 80px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 520; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields .full { grid-column: 1 / -1; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 640; white-space: nowrap; line-height: 1.3; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--surface-3); color: var(--text-2); }
.badge.muted::before { display: none; }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.t thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.t thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: none; }
.t tbody tr.click { cursor: pointer; transition: background .12s; }
.t tbody tr.click:hover { background: var(--surface-2); }
.t td b { font-weight: 640; }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--surface-3); border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: none; background: none; padding: 8px 16px; font: inherit; font-weight: 620; color: var(--text-2); cursor: pointer; border-radius: 9px; white-space: nowrap; transition: background .15s, color .15s; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }

.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty::before { content: ""; display: block; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke='%238a9891' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M12 5v14'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3C/svg%3E") center no-repeat; }
.empty p { margin-bottom: 12px; }
.alert { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 560; }
.alert.info { background: var(--primary-soft); color: var(--primary); }

.filtros { display: grid; gap: 12px; grid-template-columns: 2fr repeat(5, minmax(0, 1fr)); align-items: end; }
@media (max-width: 1100px) { .filtros { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filtros .busca { grid-column: 1 / -1; } }
@media (max-width: 560px) { .filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ---------- Modal / toast ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(6, 14, 10, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); border: 1px solid var(--border); }
.modal.lg { width: min(880px, 100%); }
.modal header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 10px; }
.modal header h2 { flex: 1; font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes up { from { transform: translateY(100%); } }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: #10201a; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 560; transition: opacity .3s, transform .3s; max-width: 380px; display: flex; gap: 10px; align-items: center; animation: pop .2s; }
.toast::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; background: #34d399; color: #062015; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.toast.erro::before { content: "!"; background: #ff8a7a; color: #2b0703; }
.toast.out { opacity: 0; transform: translateY(8px); }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { padding: 48px; text-align: center; color: var(--text-3); }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(52, 211, 153, .22), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(10, 138, 92, .2), transparent 60%),
    var(--bg);
}
.auth .card { width: min(420px, 100%); padding: 32px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.auth h1 { margin: 6px 0 4px; font-size: 26px; }
.auth form { display: grid; gap: 14px; margin-top: 22px; }
.auth .btn.primary { min-height: 46px; font-size: 15px; }
.auth .brand { padding: 0 0 14px; }
.auth .brand b { color: var(--text); }
.auth .brand span { color: var(--text-2); }

/* ---------- Instalar app ---------- */
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px; margin: 10px 0 4px; border-radius: 12px; background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .25); color: var(--side-text-strong); font-size: 12.5px; }
.install-card .btn { margin-left: auto; }

/* ---------- Agenda ---------- */
.agenda-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.datebar { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 2px; flex: 0 1 auto; min-width: 0; scrollbar-width: none; scroll-snap-type: x proximity; }
.datebar::-webkit-scrollbar { display: none; }
.day {
  border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 7px 0 6px; width: 54px; flex: none;
  text-align: center; cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, background .15s, transform .1s; scroll-snap-align: center;
}
.day:hover { border-color: var(--primary); }
.day small { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 700; letter-spacing: .04em; }
.day b { font-size: 17px; font-weight: 720; }
.day.today { border-color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
.day.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 16px -6px var(--primary-glow); }
.day.active small { color: inherit; opacity: .85; }
.agenda-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.resumo-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; color: var(--text-2); }

.board { display: flex; align-items: flex-start; overflow: auto; max-height: calc(100dvh - 250px); min-height: 360px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); overscroll-behavior: contain; }
.board .axis { flex: none; width: 58px; border-right: 1px solid var(--border); position: sticky; left: 0; background: var(--surface); z-index: 4; }
.board .col { flex: 1 0 180px; border-right: 1px solid var(--border); min-width: 180px; }
.board .col:last-child { border-right: none; }
.col-head, .axis-head { height: 58px; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 3; }
.axis-head { z-index: 5; }
.col-head b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.col-head span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.lane { position: relative; }
.tick { position: absolute; left: 0; right: 0; font-size: 11px; color: var(--text-3); padding: 0 8px; transform: translateY(-8px); font-variant-numeric: tabular-nums; font-weight: 600; }
.hline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); opacity: .7; }
.blk {
  position: absolute; left: 5px; right: 5px; border-radius: 8px; padding: 4px 9px; overflow: hidden;
  cursor: pointer; border: none; text-align: left; font: inherit; font-size: 12px; line-height: 1.3; transition: background .12s, transform .1s, box-shadow .12s;
}
.blk.free { background: var(--slot-free); color: var(--slot-free-text); display: flex; justify-content: space-between; align-items: center; font-weight: 560; }
.blk.free:hover { background: var(--slot-free-hover); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--primary); }
.blk.free:hover span:first-child::before { content: "+ "; font-weight: 800; color: var(--primary); }
.blk.past { background: transparent; color: var(--text-3); opacity: .55; cursor: default; display: flex; justify-content: space-between; align-items: center; }
.blk.noprice { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--surface) 6px, var(--surface) 12px); color: var(--text-3); cursor: default; display: flex; justify-content: space-between; align-items: center; }
.blk.res { background: var(--slot-booked); color: #fff; z-index: 2; box-shadow: 0 4px 12px -4px rgba(10, 80, 55, .45); border-left: 3px solid rgba(255,255,255,.45); }
.blk.res:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -6px rgba(10, 80, 55, .55); }
.blk.res.pendente { background: var(--slot-pending); box-shadow: 0 4px 12px -4px rgba(170, 100, 5, .5); }
.blk.res.concluida { background: var(--slot-done); }
.blk.res.nao_compareceu { background: var(--slot-noshow); }
.blk.res b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; padding-right: 16px; }
.blk.res .ln { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.blk.res .ln.op { opacity: .82; }
.blk.res .paid { position: absolute; top: 4px; right: 7px; font-size: 11px; width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; }
.blk.blq { background: repeating-linear-gradient(-45deg, var(--slot-block), var(--slot-block) 6px, #7a8781 6px, #7a8781 12px); color: #fff; z-index: 2; }
.blk.blq b { display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; }
.now-line { position: absolute; left: 0; right: 0; border-top: 2px solid #ef4444; z-index: 3; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -1px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; }

/* ---------- Cartão da reserva ("ingresso") ---------- */
.ticket {
  display: flex; gap: 0; margin-bottom: 18px; border-radius: 14px; overflow: hidden; color: #fff;
  background: linear-gradient(120deg, #0b241b, #0f3d2c 55%, #0a8a5c);
}
.ticket-main { flex: 1; min-width: 0; padding: 16px 18px; }
.ticket-when { flex: none; padding: 16px 18px; text-align: right; border-left: 2px dashed rgba(255,255,255,.25); display: flex; flex-direction: column; justify-content: center; }
.ticket-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #9fdcc0; font-weight: 700; }
.ticket-quadra { font-size: 24px; font-weight: 780; letter-spacing: -.02em; line-height: 1.15; margin: 2px 0 6px; overflow-wrap: anywhere; }
.ticket-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: #cfeee0; margin-bottom: 8px; }
.ticket-sub .badge { background: rgba(52, 211, 153, .2); color: #a7f3d0; }
.ticket-local { font-size: 13px; color: #cfeee0; }
.ticket-local b { color: #fff; }
.ticket-hora { font-size: 28px; font-weight: 780; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ticket-hora small { display: block; font-size: 13px; font-weight: 600; color: #cfeee0; }
@media (max-width: 560px) {
  .ticket { flex-direction: column; }
  .ticket-when { border-left: none; border-top: 2px dashed rgba(255,255,255,.25); text-align: left; flex-direction: row; align-items: baseline; justify-content: space-between; padding: 12px 18px; }
  .ticket-hora { font-size: 22px; display: flex; gap: 6px; align-items: baseline; }
  .ticket-hora small { display: inline; }
}

/* ---------- Diversos ---------- */
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.kv dt { color: var(--text-2); font-size: 13px; }
.kv dd { margin: 0; font-weight: 580; min-width: 0; overflow-wrap: anywhere; }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #34d399, var(--primary)); border-radius: 99px; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 12px; }
.chart .c { flex: 1; background: linear-gradient(180deg, #34d399, var(--primary)); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; opacity: .9; transition: opacity .15s; }
.chart .c:hover { opacity: 1; }
.chart-x { display: flex; gap: 4px; font-size: 10.5px; color: var(--text-3); margin-top: 4px; }
.chart-x span { flex: 1; text-align: center; overflow: hidden; }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 10; max-height: 240px; overflow-y: auto; padding: 4px; }
.ac-list button { display: block; width: 100%; text-align: left; padding: 9px 11px; border: none; background: none; font: inherit; color: var(--text); cursor: pointer; border-radius: 8px; }
.ac-list button:hover, .ac-list button.hl { background: var(--surface-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary); border-radius: 99px; padding: 3px 4px 3px 14px; font-weight: 640; max-width: 100%; }
.chip .icon-btn { width: 28px; height: 28px; color: inherit; }
.faixa { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.dia-bloco { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.dia-bloco h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.steps { counter-reset: s; display: grid; gap: 10px; }
.steps .st { display: flex; gap: 12px; align-items: center; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.steps .st::before { counter-increment: s; content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-strong); display: grid; place-items: center; font-weight: 750; flex: none; font-size: 13px; }
.steps .st.done::before { content: "✓"; background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.steps .st.done b { text-decoration: line-through; color: var(--text-2); }
.steps .st .grow { flex: 1; }
.hello { background: linear-gradient(120deg, #0b241b, #0f3d2c 60%, #0a8a5c); color: #e9fff5; border: none; padding: 22px 24px; margin-bottom: 16px; position: relative; overflow: hidden; }
.hello::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 240px; height: 240px; border-radius: 50%; border: 28px solid rgba(255,255,255,.06); }
.hello h1 { color: #fff; }
.hello p { color: #b9e6d2; margin: 4px 0 0; }
.hello .btn.primary { background: #34d399; border-color: #34d399; color: #062015; position: relative; z-index: 1; }

/* =========================================================
   Celular e tablet
   ========================================================= */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg);
    padding-top: calc(18px + var(--safe-t)); padding-bottom: calc(14px + var(--safe-b));
  }
  .side.open { transform: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(6, 14, 10, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .side.open + .side-backdrop { opacity: 1; pointer-events: auto; }
  .topbar {
    display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 12px 8px; min-height: calc(var(--topbar) + var(--safe-t));
    background: var(--side-bg); color: #fff; position: sticky; top: 0; z-index: 40;
  }
  .topbar .icon-btn { color: #d5e6de; }
  .topbar .icon-btn:hover { background: rgba(255,255,255,.08); }
  .topbar .brand-mark { width: 30px; height: 30px; font-size: 12px; border-radius: 9px; }
  .topbar b { flex: 1; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .main { padding: 18px 14px calc(var(--bottombar) + 28px + var(--safe-b)); }
  h1 { font-size: 22px; }
  .page-head { align-items: stretch; margin-bottom: 16px; }
  .page-head .grow { min-width: 100%; }
  .page-actions, .page-head > .btn, .page-head > select, .page-head > label { flex: 1 1 auto; }
  .page-actions .btn { flex: 1; }
  .page-head > .btn { flex: 1 1 140px; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding-bottom: var(--safe-b); height: calc(var(--bottombar) + var(--safe-b));
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--text-3);
    font: inherit; font-size: 11px; font-weight: 640; background: none; border: none; cursor: pointer; position: relative;
  }
  .bottom-nav svg { width: 23px; height: 23px; }
  .bottom-nav .active { color: var(--primary); }
  .bottom-nav .active::before { content: ""; position: absolute; top: 0; width: 32px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .bottom-nav .count { position: absolute; top: 6px; left: calc(50% + 6px); background: #f59e0b; color: #1b1203; border-radius: 99px; font-size: 10px; font-weight: 800; padding: 0 5px; min-width: 16px; line-height: 16px; }

  .fields { grid-template-columns: minmax(0, 1fr); }
  input, select, textarea { font-size: 16px; min-height: 46px; } /* evita zoom no iOS */
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }

  /* modais viram "folhas" que sobem de baixo */
  .modal-wrap { place-items: end center; padding: 0; }
  .modal, .modal.lg { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; animation: up .25s cubic-bezier(.2, .8, .2, 1); border-bottom: none; }
  .modal header { padding: 14px 16px; position: relative; }
  .modal header::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); }
  .modal-body { padding: 16px; }
  .modal footer { padding: 12px 16px calc(12px + var(--safe-b)); border-radius: 0; }
  .modal footer .btn { flex: 1 1 auto; }
  #toasts { left: 16px; right: 16px; bottom: calc(var(--bottombar) + 12px + var(--safe-b)); align-items: center; }

  /* tabelas viram cartões */
  .t.cards thead { display: none; }
  .t.cards, .t.cards tbody { display: block; }
  .t.cards tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
  .t.cards tbody tr:last-child { border-bottom: none; }
  .t.cards td { display: block; padding: 0; border: none; text-align: left !important; min-width: 0; overflow-wrap: anywhere; }
  .t.cards td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .t.cards td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }
  .t.cards td:empty { display: none; }
  .t.cards td:last-child:has(.btn) { grid-column: 1 / -1; }

  .kpi { padding: 14px; }
  .kpi .val { font-size: 21px; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 9px 12px; }
  .hello { padding: 18px; }

  .agenda-bar { flex-wrap: nowrap; }
  .agenda-bar > input[type=date], .agenda-bar > #hoje { display: none; }
  .agenda-bar .datebar { flex: 1; }
  .board { max-height: calc(100dvh - var(--topbar) - var(--bottombar) - 210px); min-height: 380px; }
  .board .col { flex-basis: 150px; min-width: 150px; }
  .board .axis { width: 48px; }
  .card-pad { padding: 14px; }
}

@media (max-width: 560px) {
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid { gap: 10px; }
  .auth .card { padding: 24px 20px; }
}

@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .side, .topbar, .bottom-nav, .page-head .btn, .page-actions { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; }
}

/* Foto da quadra (cadastro) */
.foto-quadra { display: flex; gap: 14px; align-items: center; }
.foto-prev { width: 132px; height: 96px; flex: none; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px dashed var(--border-strong); display: grid; place-items: center; color: var(--text-3); font-size: 12px; }
.foto-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-foto { display: inline-block; width: 34px; height: 26px; border-radius: 6px; overflow: hidden; vertical-align: middle; margin-right: 8px; background: var(--surface-3); }
.mini-foto:empty { display: none; }
.mini-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
