/* ===========================================================
   AGS DESIGN SYSTEM — tokens de marca (fixos, não mudam por tema)
   =========================================================== */
:root {
  --ags-graphite-900: #14181f;
  --ags-graphite-800: #1c222c;
  --ags-graphite-700: #2a3240;
  --ags-blue-900: #0b2e4f;
  --ags-blue-700: #14507f;
  --ags-cyan-500: #22b8cf;
  --ags-cyan-400: #4fd1e3;
  --ags-danger: #e2543a;
  --ags-warning: #e8a33d;
  --ags-success: #29a37a;
  --ags-radius: 10px;
  --ags-radius-sm: 7px;
  --ags-font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;

  /* ---- tokens semânticos: TEMA CLARO (default) ----
     Item 7: nada de branco puro em grande superfície. */
  --surface-app: #eef1f6;
  --surface-card: #fbfcfd;
  --surface-sidebar-from: var(--ags-graphite-900);
  --surface-sidebar-to: var(--ags-graphite-800);
  --surface-topbar: #fbfcfd;
  --surface-input: #ffffff;
  --surface-hover: #eef1f6;
  --surface-overlay: rgba(20, 24, 31, 0.55);

  --border-color: #dde3ea;
  --border-strong: #c3cbd4;

  --text-primary: #171b22;
  --text-secondary: #5b6675;
  --text-muted: #8894a3;
  --text-on-dark: #f4f6f8;
  --text-on-dark-muted: #97a2b0;

  --accent: var(--ags-blue-700);
  --accent-strong: var(--ags-blue-900);
  --accent-cyan: var(--ags-cyan-500);

  --shadow-card: 0 1px 3px rgba(20, 24, 31, 0.07), 0 1px 2px rgba(20, 24, 31, 0.05);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.28);
}

/* ---- TEMA ESCURO ----
   Item 8: sem preto puro; superfícies em camadas; cards se
   diferenciam do fundo; tabelas continuam legíveis. */
:root[data-theme="dark"] {
  --surface-app: #12161d;
  --surface-card: #1b212b;
  --surface-sidebar-from: #0c1015;
  --surface-sidebar-to: #141a22;
  --surface-topbar: #1b212b;
  --surface-input: #232b37;
  --surface-hover: #232b37;
  --surface-overlay: rgba(6, 8, 11, 0.72);

  --border-color: #2b3340;
  --border-strong: #3a4453;

  --text-primary: #e9edf2;
  --text-secondary: #aab4c1;
  --text-muted: #7c8794;
  --text-on-dark: #f4f6f8;
  --text-on-dark-muted: #8b96a5;

  --accent: var(--ags-cyan-400);
  --accent-strong: var(--ags-cyan-500);
  --accent-cyan: var(--ags-cyan-400);

  --shadow-card: 0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--ags-font);
  background: var(--surface-app);
  color: var(--text-primary);
  font-size: 14px;
  transition: background-color .15s ease, color .15s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ---------- Layout autenticado ---------- */
/* Sidebar FIXA e independente do scroll da página (mesmo padrão do FT ERP:
   templates/core/base.html + .sidebar{position:fixed} em app.css) -- antes
   .ags-sidebar era só um item flex dentro de .ags-app, então rolava junto
   com o conteúdo da página e o rodapé ("Sobre") sumia de vista ao descer
   uma página longa (bug reportado ao vivo 2026-09-16, duas vezes). */
.ags-app { min-height: 100vh; min-height: 100dvh; }

.ags-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, var(--surface-sidebar-from), var(--surface-sidebar-to));
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 40;
}

/* Botão hambúrguer — só existe/aparece em telas estreitas (ver media query).
   Estilo próprio (não reaproveita .ags-icon-btn) para evitar conflito de
   cascata entre a regra "display:none" default e a regra "display:flex"
   incondicional de .ags-icon-btn. */
.ags-hamburger-btn {
  display: none;
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--surface-card); color: var(--text-primary);
  align-items: center; justify-content: center; cursor: pointer; font-size: 17px;
  flex-shrink: 0;
}

/* Backdrop do menu off-canvas em mobile — inerte/invisível em telas largas */
.ags-sidebar-backdrop { display: none; }

.ags-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
}
.ags-sidebar__brand img { width: 34px; height: 34px; object-fit: contain; }
.ags-sidebar__brand-text { line-height: 1.2; }
.ags-sidebar__brand-text strong { display: block; font-size: 14px; color: #fff; }
.ags-sidebar__brand-text span { font-size: 11px; color: var(--text-on-dark-muted); }

.ags-nav { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.ags-nav-group { padding: 10px 20px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-on-dark-muted); margin-top: 8px; }
.ags-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: #c3cbd4;
  font-size: 13.5px;
  border-left: 3px solid transparent;
}
.ags-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.ags-nav a.active {
  background: rgba(34, 184, 207, 0.14);
  border-left-color: var(--ags-cyan-500);
  color: #fff;
  font-weight: 600;
}
.ags-nav i { width: 16px; text-align: center; font-size: 14px; }

.ags-sidebar__footer {
  padding: 12px 12px 0;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.ags-sidebar__footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #c3cbd4;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.ags-sidebar__footer-btn:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.ags-sidebar__footer-btn i { width: 16px; text-align: center; font-size: 14px; }

/* Modal de contato de suporte, aberto a partir do botão fixo da sidebar --
   réplica fiel de .support-ticket-modal/.support-ticket-modal-card do FT PACS
   (app/web/static/final446.css), adaptada pros tokens de cor da AGS. */
.ags-support-modal { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; }
/* [hidden] e a classe tem a MESMA especificidade CSS (0,1,0) -- sem esta
   regra explicita, .ags-support-modal{display:flex} vence a cascata por
   vir depois no arquivo e o modal fica SEMPRE visivel, mesmo com o
   atributo hidden presente no HTML (bug relatado 2026-09-16: modal abria
   sozinho assim que a pagina carregava, antes de qualquer clique no botao
   Suporte -- FT PACS ja tinha essa regra em support-ticket-modal[hidden],
   ficou faltando aqui). */
.ags-support-modal[hidden] { display: none; }
.ags-support-modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.ags-support-modal__card {
  position: relative;
  width: min(440px, 92vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface-card);
  color: var(--text-primary);
  border-radius: var(--ags-radius);
  box-shadow: var(--shadow-modal, 0 20px 60px rgba(0,0,0,.35));
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ags-support-modal__card h3 { margin: 0; font-size: 18px; }
.ags-support-modal__card label { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-top: 4px; }
.ags-support-modal__card input, .ags-support-modal__card select, .ags-support-modal__card textarea {
  width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border-color);
  background: var(--surface-card); color: var(--text-primary); font: inherit;
}
.ags-support-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.ags-support-ticket-feedback { min-height: 18px; font-size: 13px; }
.ags-support-ticket-feedback.ok { color: var(--ags-success); }
.ags-support-ticket-feedback.error { color: var(--ags-danger); }
.ags-support-ticket-history { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.ags-support-ticket-history h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); }
.ags-support-ticket-history-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow: auto; }
.ags-support-ticket-history-empty { color: var(--text-secondary); font-size: 12px; margin: 0; }
.ags-support-ticket-history-item { background: var(--surface-card); border: 1px solid var(--border-color); border-left: 3px solid var(--text-secondary); border-radius: 10px; padding: 9px 11px; font-size: 12px; }
.ags-support-ticket-history-item.status-open, .ags-support-ticket-history-item.status-in_progress { border-left-color: #3b82f6; }
.ags-support-ticket-history-item.status-waiting_client { border-left-color: #d4af37; }
.ags-support-ticket-history-item.status-resolved, .ags-support-ticket-history-item.status-closed { border-left-color: var(--ags-success); }
.ags-support-ticket-history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ags-support-ticket-history-head b { font-size: 12px; color: var(--text-primary); }
.ags-support-ticket-history-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); white-space: nowrap; }
.ags-support-ticket-history-meta { color: var(--text-secondary); margin-top: 3px; }
.ags-support-ticket-history-comment { margin-top: 5px; color: var(--text-primary); font-style: italic; opacity: .85; }

/* Página /sobre — réplica fiel do padrão FT PACS (about-hero/about-grid/
   about-card/about-facts/about-contact-grid/about-list/about-process-grid/
   about-flow em app/web/static/style.css), com os tokens de cor da AGS. */
.ags-about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(220px, .95fr);
  gap: 22px;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(34,184,207,.14), rgba(41,163,122,.09)), var(--surface-card);
}
.ags-about-hero__copy { display: grid; gap: 14px; }
.ags-about-hero__copy h1 { font-size: 30px; line-height: 1.05; margin: 0; color: var(--text-primary); }
.ags-about-hero__copy p { font-size: 14.5px; max-width: 760px; margin: 0; color: var(--text-secondary); }
.ags-about-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.ags-about-badges span { padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 12px; background: rgba(120,130,150,.1); font-size: 11px; font-weight: 700; color: var(--text-primary); }
.ags-about-hero__media { border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; background: #07111d; }
.ags-about-hero__media img { display: block; width: 100%; height: 280px; object-fit: cover; }

.ags-about-eyebrow { display: inline-flex; width: max-content; max-width: 100%; padding: 6px 10px; border: 1px solid rgba(34,184,207,.35); border-radius: 999px; background: rgba(34,184,207,.12); color: var(--ags-cyan-500); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.ags-about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.ags-about-card { display: grid; gap: 12px; align-content: start; }
.ags-about-card h2 { margin: 0; font-size: 18px; color: var(--text-primary); }
.ags-about-card p { margin: 0; color: var(--text-secondary); font-size: 13.5px; }
.ags-about-card--strong { background: linear-gradient(135deg, rgba(34,184,207,.16), rgba(41,163,122,.08)), var(--surface-card); }

.ags-about-facts { display: grid; gap: 8px; margin: 0; }
.ags-about-facts div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--border-color); }
.ags-about-facts dt { color: var(--text-secondary); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.ags-about-facts dd { margin: 0; font-weight: 600; color: var(--text-primary); }

.ags-about-contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ags-about-contact-grid a { display: grid; gap: 4px; text-decoration: none; padding: 12px; border: 1px solid var(--border-color); border-radius: 12px; background: rgba(120,130,150,.08); color: var(--text-primary); }
.ags-about-contact-grid a:hover { background: var(--surface-hover); text-decoration: none; }
.ags-about-contact-grid a i { font-size: 15px; color: var(--ags-cyan-500); }
.ags-about-contact-grid span { color: var(--text-secondary); font-size: 12px; }

.ags-about-list { display: grid; gap: 8px; margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 13.5px; }
.ags-about-list li { padding-left: 4px; }

.ags-about-process-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ags-about-process-grid span { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--border-color); border-radius: 12px; background: rgba(120,130,150,.08); }
.ags-about-process-grid strong { color: var(--text-primary); font-size: 13px; }
.ags-about-process-grid small { color: var(--text-secondary); font-size: 11px; }

.ags-about-flow { display: grid; gap: 16px; margin-top: 14px; }
.ags-about-flow h2 { margin: 0; font-size: 18px; color: var(--text-primary); }
.ags-about-flow ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.ags-about-flow li { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--border-color); border-radius: 14px; background: rgba(120,130,150,.08); }
.ags-about-flow li strong { color: var(--text-primary); }
.ags-about-flow span { color: var(--text-secondary); font-size: 12px; }

@media (max-width: 900px) {
  .ags-about-hero { grid-template-columns: 1fr; }
  .ags-about-hero__media img { height: 220px; }
  .ags-about-grid { grid-template-columns: 1fr; }
  .ags-about-flow ol { grid-template-columns: repeat(2, 1fr); }
  .ags-about-contact-grid, .ags-about-process-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .ags-about-flow ol { grid-template-columns: 1fr; }
}

/* Espaço reservado pra sidebar fixa (mesma largura de .ags-sidebar acima
   e no breakpoint de 1024px abaixo) -- .ags-app deixou de ser flex, entao
   quem empurra o conteúdo pra direita agora é essa margem, não mais o
   fluxo flex normal. */
.ags-main { margin-left: 248px; display: flex; flex-direction: column; min-width: 0; }

.ags-topbar {
  height: 60px;
  background: var(--surface-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}
.ags-topbar__search { flex: 1; max-width: 420px; position: relative; }
.ags-topbar__search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.ags-topbar__search input {
  border: 1px solid var(--border-color);
  border-radius: var(--ags-radius);
  padding: 8px 12px 8px 32px;
  width: 100%;
  background: var(--surface-app);
  color: var(--text-primary);
}
.ags-topbar__actions { display: flex; align-items: center; gap: 10px; }
.ags-icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--surface-card); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px;
}
.ags-icon-btn:hover { background: var(--surface-hover); }

.ags-user-menu { position: relative; }
.ags-user-menu__trigger {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--text-primary);
  border: 1px solid transparent;
}
.ags-user-menu__trigger:hover { background: var(--surface-hover); }
.ags-user-menu__avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
.ags-user-menu__dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
  background: var(--surface-card); border: 1px solid var(--border-color); border-radius: var(--ags-radius);
  box-shadow: var(--shadow-modal); padding: 6px; z-index: 60;
}
.ags-user-menu__dropdown a, .ags-user-menu__dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 7px; font-size: 13px; color: var(--text-primary);
  border: none; background: none; cursor: pointer;
}
.ags-user-menu__dropdown a:hover, .ags-user-menu__dropdown button:hover { background: var(--surface-hover); text-decoration: none; }
.ags-user-menu__divider { height: 1px; background: var(--border-color); margin: 6px 2px; }

.ags-content { padding: 24px; flex: 1; }

/* ---------- Breadcrumbs ---------- */
.ags-breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; flex-wrap: wrap; }
.ags-breadcrumbs a { color: var(--text-muted); }
.ags-breadcrumbs a:hover { color: var(--accent); }
.ags-breadcrumbs .sep { opacity: .6; }
.ags-breadcrumbs .current { color: var(--text-primary); font-weight: 600; }

/* ---------- Cards / KPIs ---------- */
.ags-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* Layouts de 2 colunas lado a lado (detalhes, dashboard) — respeitam a
   proporção pedida no desktop mas colapsam para 1 coluna em mobile
   (ver media query <=768px). Usar em vez de style="grid-template-columns"
   inline, que teria especificidade maior que a media query e nunca
   colapsaria no celular. */
.ags-grid--split { grid-template-columns: 1fr 1fr; }
.ags-grid--split-wide { grid-template-columns: 1.4fr 1fr; }

.ags-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--ags-radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}
.ags-card h3 { margin: 0 0 16px; font-size: 15px; color: var(--text-primary); }

.ags-kpi { transition: transform .1s ease; }
a.ags-kpi-link { display: block; }
a.ags-kpi-link:hover .ags-card { transform: translateY(-1px); border-color: var(--border-strong); text-decoration: none; }
.ags-kpi__label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 6px; }
.ags-kpi__value { font-size: 26px; font-weight: 700; color: var(--text-primary); }
.ags-kpi--positive .ags-kpi__value { color: var(--accent); }
.ags-kpi--alert .ags-kpi__value { color: var(--ags-danger); }
.ags-kpi__hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Badges ---------- */
.ags-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.ags-badge--active, .ags-badge--paid, .ags-badge--online { background: rgba(41,163,122,0.14); color: var(--ags-success); }
.ags-badge--warning, .ags-badge--pending, .ags-badge--expiring { background: rgba(232,163,61,0.16); color: #b3791f; }
.ags-badge--danger, .ags-badge--overdue, .ags-badge--blocked, .ags-badge--offline { background: rgba(226,84,58,0.14); color: var(--ags-danger); }
.ags-badge--muted { background: var(--surface-hover); color: var(--text-secondary); }

/* ---------- Tabelas ---------- */
.ags-table-wrap { overflow-x: auto; border-radius: var(--ags-radius); box-shadow: var(--shadow-card); }
.ags-table { width: 100%; border-collapse: collapse; background: var(--surface-card); border-radius: var(--ags-radius); overflow: hidden; box-shadow: var(--shadow-card); }
.ags-table-wrap .ags-table { box-shadow: none; border-radius: 0; }
.ags-table th, .ags-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 13.5px; white-space: nowrap; }
.ags-table td { white-space: normal; }
.ags-table th { background: var(--surface-app); color: var(--text-secondary); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.ags-table tr:last-child td { border-bottom: none; }
.ags-table tbody tr:hover td { background: var(--surface-hover); }

/* ---------- Empty state ---------- */
.ags-empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.ags-empty__icon { font-size: 30px; margin-bottom: 10px; color: var(--text-muted); }

/* ---------- Central de Ajuda (item 21-24) ---------- */
.ags-help-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.ags-help-nav { display: flex; flex-direction: column; gap: 2px; background: var(--surface-card); border: 1px solid var(--border-color); border-radius: var(--ags-radius); padding: 8px; }
.ags-help-nav__item {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px;
  color: var(--text-secondary); font-size: 13px; text-decoration: none;
}
.ags-help-nav__item:hover { background: var(--surface-hover); }
.ags-help-nav__item.active { background: var(--ags-blue-700); color: #fff; font-weight: 600; }
.ags-help-content h3 { margin-top: 0; }
.ags-help-content p { color: var(--text-secondary); line-height: 1.6; }
.ags-help-glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ags-help-glossary__item strong { display: block; color: var(--text-primary); margin-bottom: 3px; }
.ags-help-glossary__item span { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }

/* ---------- Timeline (histórico unificado do equipamento, item 4) ---------- */
.ags-timeline { position: relative; padding-left: 32px; }
.ags-timeline::before { content: ""; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: var(--border-color); }
.ags-timeline__item { position: relative; padding-bottom: 20px; }
.ags-timeline__item:last-child { padding-bottom: 0; }
.ags-timeline__icon {
  position: absolute; left: -32px; top: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ags-blue-700); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; z-index: 1;
}
.ags-timeline__date { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.ags-timeline__title { font-weight: 600; margin-top: 2px; }
.ags-timeline__desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ---------- Skeleton loading ---------- */
.ags-skeleton { background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border-color) 37%, var(--surface-hover) 63%); background-size: 400% 100%; animation: ags-skeleton 1.4s ease infinite; border-radius: 6px; }
@keyframes ags-skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Botões ---------- */
.ags-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: var(--ags-radius);
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  font-family: var(--ags-font);
}
.ags-btn--primary { background: var(--accent); color: #fff; }
.ags-btn--primary:hover { background: var(--accent-strong); text-decoration: none; }
.ags-btn--ghost { background: transparent; color: var(--accent); border: 1px solid var(--border-strong); }
.ags-btn--ghost:hover { background: var(--surface-hover); text-decoration: none; }
.ags-btn--danger { background: var(--ags-danger); color: #fff; }
.ags-btn:disabled, .ags-btn[disabled] { opacity: .55; cursor: not-allowed; }
.ags-btn:focus-visible { outline-offset: 2px; }

/* ---------- Alertas / mensagens ---------- */
.ags-alert { border-radius: var(--ags-radius); padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; }
.ags-alert--success { background: rgba(41,163,122,0.12); color: var(--ags-success); }
.ags-alert--error { background: rgba(226,84,58,0.12); color: var(--ags-danger); }
.ags-alert--info { background: rgba(34,184,207,0.12); color: var(--accent-cyan); }
.ags-alert--warning { background: rgba(232,163,61,0.14); color: var(--ags-warning); }

/* ---------- Toasts ---------- */
.ags-toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: 320px; }
.ags-toast { border-radius: var(--ags-radius); padding: 12px 14px; font-size: 13px; box-shadow: var(--shadow-modal); color: #fff; display: flex; align-items: flex-start; gap: 8px; }
.ags-toast--success { background: var(--ags-success); }
.ags-toast--error { background: var(--ags-danger); }
.ags-toast--warning { background: var(--ags-warning); }
.ags-toast--info { background: var(--accent-strong); }

/* ---------- Login ---------- */
.ags-login {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at top left, var(--ags-blue-900), var(--ags-graphite-900) 60%);
  padding: 20px;
}
.ags-login__card {
  background: var(--surface-card);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-modal);
  text-align: center;
}
.ags-login__logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 14px; }
.ags-login__title { font-size: 18px; font-weight: 700; margin: 0; color: var(--text-primary); }
.ags-login__subtitle { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 24px; }
.ags-login__field { text-align: left; margin-bottom: 14px; }
.ags-login__field label { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 5px; }
.ags-login__password-wrap { position: relative; }
.ags-login__field input[type="text"],
.ags-login__field input[type="password"],
.ags-login__field input[type="email"] {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); font-size: 14px;
  background: var(--surface-input); color: var(--text-primary);
}
.ags-login__password-wrap input { padding-right: 38px; }
.ags-login__toggle-password {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 14px; padding: 4px;
}
.ags-login__remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 18px; }
.ags-login__submit { width: 100%; padding: 11px; font-size: 14px; justify-content: center; }
.ags-login__footer { margin-top: 20px; font-size: 11.5px; color: var(--text-muted); }
.ags-login__theme-toggle { margin-top: 16px; }

/* ---------- Tooltip simples ---------- */
.ags-hint { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ---------- Modal (Alpine.js controla show/hide) ---------- */
.ags-modal-backdrop { position: fixed; inset: 0; background: var(--surface-overlay); display: flex; align-items: center; justify-content: center; z-index: 70; padding: 16px; }
.ags-modal { background: var(--surface-card); border-radius: var(--ags-radius); padding: 24px; max-width: 460px; width: 100%; box-shadow: var(--shadow-modal); }
.ags-modal h3 { margin-top: 0; color: var(--text-primary); }
.ags-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.ags-modal code.ags-key {
  display: block; font-size: 18px; letter-spacing: .06em; text-align: center; padding: 14px;
  background: var(--surface-app); border: 1px dashed var(--border-strong); border-radius: 8px; margin: 12px 0; color: var(--text-primary);
}

.ags-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.ags-section-title h2 { font-size: 18px; margin: 0; color: var(--text-primary); }
.ags-section-title__actions { display: flex; gap: 8px; }

[x-cloak] { display: none !important; }
.ags-tabs {
  display: flex; border-bottom: 1px solid var(--border-color);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.ags-tab-btn.active, .ags-tab-btn:hover { color: var(--accent); border-bottom: 2px solid var(--accent-cyan) !important; }
.ags-tab-btn {
  border: none; border-bottom: 2px solid transparent; background: none;
  color: var(--text-secondary); font-family: var(--ags-font); font-size: 13.5px;
  padding: 14px 18px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}

/* ---------- Formulários padronizados ---------- */
.ags-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.ags-form-section { margin-bottom: 22px; }
.ags-form-section__title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-color); }
.ags-field { text-align: left; }
.ags-field label { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 600; }
.ags-field input, .ags-field select, .ags-field textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  font-size: 13.5px; background: var(--surface-input); color: var(--text-primary); font-family: var(--ags-font);
}
.ags-field input:focus, .ags-field select:focus, .ags-field textarea:focus { outline: 2px solid var(--accent-cyan); outline-offset: 1px; }
.ags-field-error { font-size: 12px; color: var(--ags-danger); margin-top: 3px; }
.ags-field--full { grid-column: 1 / -1; }

/* ===========================================================
   RESPONSIVIDADE
   Breakpoints: >1024 desktop cheio · 769-1024 tablet/notebook
   (sidebar já cabe) · <=768 tablet retrato/mobile (sidebar vira
   menu off-canvas) · <=480 telefone estreito (ajustes finos).
   =========================================================== */

/* ---- Tablet/notebook menor: sidebar um pouco mais estreita ---- */
@media (max-width: 1024px) {
  .ags-sidebar { width: 216px; }
  .ags-main { margin-left: 216px; }
  .ags-content { padding: 20px; }
}

/* ---- <=768px: sidebar vira menu off-canvas com hambúrguer ---- */
@media (max-width: 768px) {
  .ags-main { margin-left: 0; } /* sidebar vira overlay off-canvas, não reserva mais espaço fixo */

  .ags-help-layout { grid-template-columns: 1fr; }
  .ags-help-nav { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ags-help-nav__item { white-space: nowrap; }

  .ags-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 84vw;
    max-width: 300px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .ags-sidebar.is-open { transform: translateX(0); }

  .ags-sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: var(--surface-overlay);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .ags-sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .ags-main { width: 100%; }

  .ags-hamburger-btn { display: flex; }

  .ags-topbar { padding: 0 12px; height: 56px; gap: 8px; }
  .ags-topbar__search { max-width: none; min-width: 0; }
  .ags-topbar__search input { padding: 7px 10px 7px 30px; font-size: 13px; }
  .ags-content { padding: 16px; }

  .ags-user-menu__trigger span:not(.ags-user-menu__avatar) { display: none; } /* só o avatar em telas estreitas */
  .ags-user-menu__dropdown { right: -6px; min-width: 180px; }

  .ags-section-title { flex-direction: column; align-items: stretch; }
  .ags-section-title__actions { flex-wrap: wrap; }
  .ags-section-title__actions .ags-btn, .ags-section-title > .ags-btn { width: 100%; justify-content: center; }

  .ags-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .ags-grid--split, .ags-grid--split-wide { grid-template-columns: 1fr; }
  .ags-card { padding: 14px 16px; }
  .ags-kpi__value { font-size: 21px; }

  .ags-form-grid { grid-template-columns: 1fr; }
  .ags-modal { padding: 18px; max-height: 88vh; overflow-y: auto; }

  /* Tabelas: scroll horizontal com toque suave — aplicado direto na
     <table>, não só em .ags-table-wrap, porque nem todo template envolve
     a tabela no wrapper; isso garante que NENHUMA tabela nunca estoura a
     largura da tela em mobile, mesmo em telas esquecidas de envolver. */
  table.ags-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ags-table-wrap { -webkit-overflow-scrolling: touch; }
  .ags-table th, .ags-table td { padding: 10px 12px; font-size: 13px; }

  /* Sombra de scroll nas bordas — sem isso, colunas como "Status" somem da
     tela sem nenhuma pista visual de que dá pra arrastar pra ver o resto.
     Técnica "scroll shadows": dois gradientes sólidos (aparecem só quando
     há conteúdo pra rolar naquela direção, via background-attachment:local)
     mais dois gradientes de sombra fixos atrás. Funciona em qualquer
     posição de scroll, ao contrário de um ::after (que rolaria junto). */
  table.ags-table, .ags-table-wrap {
    background-image:
      linear-gradient(to right, rgba(0,0,0,.16), rgba(0,0,0,0) 10px) left,
      linear-gradient(to left, rgba(0,0,0,.16), rgba(0,0,0,0) 10px) right;
    background-repeat: no-repeat;
    background-color: var(--surface-card);
    background-size: 14px 100%, 14px 100%;
    background-attachment: scroll, scroll;
  }

  /* Toasts ocupam a largura útil, não ficam espremidos num canto */
  .ags-toasts { left: 12px; right: 12px; top: 12px; width: auto; }

  /* iOS Safari dá zoom automático em inputs com font-size < 16px ao focar
     — 16px aqui evita esse comportamento sem alterar a escala visual do
     resto da interface (só nos campos de formulário). */
  .ags-field input, .ags-field select, .ags-field textarea,
  .ags-login__field input, .ags-topbar__search input { font-size: 16px; }
}

/* ---- <=480px: telefone estreito ---- */
@media (max-width: 480px) {
  .ags-login__card { padding: 28px 22px; }
  .ags-content { padding: 12px; }
  .ags-card { padding: 12px 14px; }
  .ags-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ags-kpi__label { font-size: 10.5px; }
  .ags-kpi__value { font-size: 18px; }
  .ags-btn { padding: 10px 14px; font-size: 13px; } /* alvo de toque confortável */
  .ags-icon-btn { width: 40px; height: 40px; }
  .ags-modal-backdrop { padding: 10px; }
  .ags-user-menu__dropdown { position: fixed; left: 10px; right: 10px; top: auto; bottom: 10px; }
}

/* Área de toque mínima consistente em qualquer largura para elementos
   interativos pequenos (ícones, checkboxes) — acessibilidade (item 59). */
@media (pointer: coarse) {
  .ags-icon-btn, .ags-login__toggle-password { min-width: 40px; min-height: 40px; }
}
