/* ============================================================
   Passo 365 — Centro de Inteligência da Escola
   Reaproveita os tokens de cor/tipografia de ../style.css
   (Passo a Passo Escolar) para manter a mesma identidade visual
   do restante do produto. Layout é desktop-first (uso interno da
   equipe), inspirado no shell administrativo já existente em
   ../admin/admin.css.
   ============================================================ */

:root {
  --blue-900: #1E40AF;
  --blue-700: #1D4ED8;
  --blue-600: #2563EB;
  --blue-100: #DBEAFE;
  --blue-50: #EFF6FF;
  --amber-500: #F5B301;
  --amber-900: #92600A;
  --amber-100: #FEF3C7;
  --green-600: #16A34A;
  --green-50: #F0FDF4;
  --slate-900: #0F172A;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --border: #EEF1F4;
  --bg-card: #FFFFFF;
  --bg-input: #F8FAFC;
  --bg-page: #F1F3F6;
  --danger: #DC2626;
  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'Cascadia Code', Consolas, ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg-page); font-family: var(--font); color: var(--slate-900); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-900); }
:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }

/* ---------------- Shell ----------------
   A partir do design "Layout modernizado" (claude.ai/design, projeto
   628cb7fe-f043-4899-aa20-a52fbff6a9c4 · Dashboard.dc.html). */
.p365 { display: flex; min-height: 100vh; }

.p365-side { position: relative; width: 264px; flex: none; background: oklch(0.19 0.02 265); color: oklch(0.9 0.005 260); display: flex; flex-direction: column; padding: 24px 16px; gap: 28px; transition: width .15s ease, padding .15s ease; }
.p365-side__brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; border-bottom: 1px solid oklch(0.3 0.02 265); }
.p365-side__brand .mark { width: 38px; height: 38px; border-radius: 10px; background: oklch(0.55 0.18 260); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; flex: none; }
.p365-side__brand img { height: 30px; width: auto; }
.p365-side__brand b { font-size: 15px; font-weight: 700; color: #fff; display: block; line-height: 1.3; letter-spacing: -.01em; }
.p365-side__brand span { display: block; font-size: 11.5px; font-weight: 500; color: oklch(0.65 0.01 260); }
.p365-nav { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 22px; }
.p365-nav__grp { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: oklch(0.5 0.01 260); padding: 0 12px; margin-bottom: 4px; white-space: nowrap; }
.p365-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: oklch(0.78 0.01 260); background: transparent; margin-bottom: 2px; white-space: nowrap; overflow: hidden; }
.p365-nav a:hover { background: oklch(0.26 0.02 265); color: #fff; }
.p365-nav a.on { background: oklch(0.55 0.18 260); color: #fff; }
.p365-nav a .ic { width: 18px; text-align: center; flex: none; font-size: 15px; opacity: .95; }
.p365-nav a .soon { margin-left: auto; font-size: 9.5px; font-weight: 700; color: oklch(0.65 0.01 260); background: oklch(0.26 0.02 265); border: 1px solid oklch(0.32 0.02 265); padding: 1px 6px; border-radius: 999px; }
.p365-side__foot { padding-top: 16px; border-top: 1px solid oklch(0.3 0.02 265); font-size: 11.5px; color: oklch(0.55 0.01 260); white-space: nowrap; overflow: hidden; }

/* Botão de recolher — círculo grudado na borda direita da sidebar,
   sobrepondo o conteúdo principal (mesmo truque de VSCode/editores). */
.p365-side__toggle { position: absolute; top: 27px; right: -12px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid oklch(0.32 0.02 265); background: oklch(0.22 0.02 265); color: oklch(0.78 0.01 260); font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 6; padding: 0; }
.p365-side__toggle:hover { background: oklch(0.3 0.02 265); color: #fff; }

.p365--nav-collapsed .p365-side { width: 68px; padding-left: 10px; padding-right: 10px; }
.p365--nav-collapsed .p365-side__toggle { transform: rotate(180deg); }
.p365--nav-collapsed .p365-side__brand { justify-content: center; padding-left: 0; padding-right: 0; }
.p365--nav-collapsed .p365-side__brand-text,
.p365--nav-collapsed .p365-nav__grp,
.p365--nav-collapsed .p365-nav a .label,
.p365--nav-collapsed .p365-nav a .soon,
.p365--nav-collapsed .p365-side__foot { display: none; }
.p365--nav-collapsed .p365-nav a { justify-content: center; padding: 9px 0; }

.p365-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p365-top { height: 66px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 36px; border-bottom: 1px solid oklch(0.91 0.005 260); background: #fff; position: sticky; top: 0; z-index: 5; }
.p365-top h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.p365-top__meta { font-size: 12.5px; color: oklch(0.55 0.01 260); background: oklch(0.95 0.006 260); padding: 6px 12px; border-radius: 20px; font-weight: 500; }
.p365-content { flex: 1; overflow: auto; padding: 36px; max-width: 1240px; }

@media (max-width: 880px) {
  .p365-side { width: 210px; }
  .p365-content { padding: 20px; }
}

/* ---------------- Status badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-live { background: var(--green-50); color: var(--green-600); }
.badge-paused { background: var(--amber-100); color: var(--amber-900); }
.badge-soon { background: var(--bg-input); color: var(--slate-500); }
.badge-off { background: var(--slate-100); color: var(--slate-500); }

/* ---------------- Cards / grid ---------------- */
.p365-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 26px; }
.p365-card { background: #fff; border: 1px solid oklch(0.91 0.005 260); border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.p365-card h3 { margin: 0 0 4px; font-size: 14.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p365-card p { margin: 0; font-size: 12.5px; color: oklch(0.55 0.01 260); line-height: 1.5; }
.p365-card .val { font-size: 32px; font-weight: 800; letter-spacing: -.02em; color: oklch(0.2 0.01 260); }
.p365-card .lbl { font-size: 11px; font-weight: 700; color: oklch(0.5 0.01 260); text-transform: uppercase; letter-spacing: .06em; }

/* ---------------- Automation cards (Dashboard/Automações/Top 10) ---------------- */
.p365-auto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 26px; }
.p365-auto-card { background: #fff; border: 1px solid oklch(0.91 0.005 260); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-height: 230px; }
.p365-auto-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.p365-auto-card__icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex: none; }
.p365-auto-card__pill { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.p365-auto-card__body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.p365-auto-card__title { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; color: oklch(0.2 0.01 260); }
.p365-auto-card__desc { font-size: 12.5px; color: oklch(0.5 0.01 260); line-height: 1.5; }
.p365-auto-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.p365-auto-card__tags span { font-size: 11px; font-weight: 500; color: oklch(0.5 0.01 260); background: oklch(0.95 0.006 260); border: 1px solid oklch(0.91 0.005 260); padding: 4px 9px; border-radius: 6px; }
.p365-auto-card__btn { align-self: flex-start; border: none; background: oklch(0.55 0.18 260); color: #fff; font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 8px; cursor: pointer; }
.p365-auto-card__btn:hover { background: oklch(0.48 0.19 260); color: #fff; }

.p365-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.6px; font-weight: 700; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--slate-700); cursor: pointer; }
.p365-btn:hover { background: var(--bg-input); color: var(--slate-900); }
.p365-btn--primary { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.p365-btn--primary:hover { background: var(--blue-900); color: #fff; }

/* ---------------- Section header ---------------- */
.p365-head { margin-bottom: 20px; }
.p365-head h2 { font-size: 21px; margin: 0 0 4px; }
.p365-head p { margin: 0; font-size: 13px; color: var(--slate-500); max-width: 60ch; }

.p365-config-row { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 860px) { .p365-config-row { grid-template-columns: 1fr; } }

.p365-config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; align-items: start; }
.cfg-panel__desc { font-size: 12.4px; color: var(--slate-500); line-height: 1.5; margin: 0 0 14px; }
.cfg-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cfg-panel__head h4 { margin: 0; }
.cfg-tpl-form { display: flex; flex-direction: column; gap: 6px; }
.cfg-tpl-form + .cfg-tpl-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--slate-100); }
.cfg-tpl-form textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 12.8px; box-sizing: border-box; resize: vertical; min-height: 76px; background: var(--bg-input); }
.cfg-tpl-form .k { font-size: 12px; font-weight: 700; color: var(--slate-700); }
.cfg-hint { font-size: 11.2px; color: var(--slate-400); margin: 0; }

.p365-tag-pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }

/* ---------------- Table ---------------- */
.p365-table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; overflow-x: auto; }
.p365-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.p365-table th { text-align: left; font-size: 10.8px; font-weight: 700; color: var(--slate-500); text-transform: uppercase; letter-spacing: .04em; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--bg-input); white-space: nowrap; }
.p365-table td { padding: 11px 16px; border-bottom: 1px solid var(--slate-100); color: var(--slate-700); vertical-align: middle; }
.p365-table tr:last-child td { border-bottom: none; }
.p365-table td.name { font-weight: 700; color: var(--slate-900); }

/* ---------------- Empty / soon state ---------------- */
.p365-soon { background: #fff; border: 1px dashed var(--slate-300); border-radius: 16px; padding: 44px 24px; text-align: center; }
.p365-soon .ic { font-size: 26px; margin-bottom: 10px; }
.p365-soon h3 { margin: 0 0 6px; font-size: 15.5px; }
.p365-soon p { margin: 0 auto; font-size: 13px; color: var(--slate-500); max-width: 42ch; }
.p365-soon .badge { margin-top: 14px; }

/* ---------------- Detail page ---------------- */
.p365-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12.6px; font-weight: 700; color: var(--slate-500); margin-bottom: 14px; }
.p365-back:hover { color: var(--slate-900); }
.p365-detail-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .p365-detail-grid { grid-template-columns: 1fr; } }
.p365-panel { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; margin-bottom: 14px; }
.p365-panel h4 { margin: 0 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-400); }
.p365-kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--slate-100); font-size: 13px; }
.p365-kv:last-child { border-bottom: none; }
.p365-kv .k { color: var(--slate-500); }
.p365-kv .v { font-weight: 700; color: var(--slate-900); text-align: right; }

/* ---------------- Top bar · usuário logado ---------------- */
.p365-top__right { display: flex; align-items: center; gap: 10px; }
.p365-user__name { font-size: 13px; font-weight: 700; color: var(--slate-900); }
.p365-user__cargo { font-size: 11.5px; color: var(--slate-500); background: var(--bg-input); padding: 3px 9px; border-radius: 20px; font-weight: 500; }

/* ---------------- Login / criar administrador ---------------- */
.p365-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: oklch(0.19 0.02 265); padding: 24px; }
.p365-auth__card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 32px 30px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.p365-auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.p365-auth__brand .mark { width: 34px; height: 34px; border-radius: 9px; background: oklch(0.55 0.18 260); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.p365-auth__brand b { font-size: 15px; font-weight: 700; color: var(--slate-900); }
.p365-auth__card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.p365-auth__sub { margin: 0 0 20px; font-size: 12.6px; color: var(--slate-500); line-height: 1.5; }
.p365-auth__error { background: #FEF2F2; color: var(--danger); font-size: 12.6px; font-weight: 600; padding: 10px 12px; border-radius: 9px; margin-bottom: 16px; }
.p365-auth__card form { display: flex; flex-direction: column; gap: 14px; }
.p365-auth__card label { font-size: 12.5px; font-weight: 700; color: var(--slate-600); display: flex; flex-direction: column; gap: 6px; }
.p365-auth__card input { font: inherit; font-size: 13.5px; font-weight: 500; padding: 10px 12px; border: 1px solid var(--slate-200); border-radius: 9px; background: var(--bg-input); color: var(--slate-900); }
.p365-auth__card input:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 1px; }
.p365-auth__card button { margin-top: 4px; justify-content: center; padding: 11px 14px; }
