/* =========================================================
   Vivanto Digital — AppKit (interface das demonstrações de sistemas)
   Temas por variáveis: cada demonstração pode trocar acento e fontes.
   ========================================================= */
.ak {
  --ak-bg: #F4F3EF; --ak-card: #FFFFFF; --ak-ink: #1A1A18; --ak-ink-2: #5B5A55; --ak-line: #E3E0D8; --ak-line-2: #EFEDE7;
  --ak-side: #111111; --ak-side-ink: #CFCBC2; --ak-side-line: #2A2926;
  --ak-accent: #C8F031; --ak-accent-ink: #111111; --ak-strong: #111111;
  --ak-ok: #1F7A4D; --ak-ok-bg: #E3F4EA; --ak-warn: #8A5A00; --ak-warn-bg: #FFF1CC; --ak-bad: #B3261E; --ak-bad-bg: #FBE3E1; --ak-info: #1F4E8A; --ak-info-bg: #E2ECF8;
  --ak-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ak-display: "Bricolage Grotesque", "Manrope", system-ui, sans-serif;
  display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh;
  background: var(--ak-bg); color: var(--ak-ink); font-family: var(--ak-font); font-size: 15px; line-height: 1.5;
}
.ak *, .ak *::before, .ak *::after { box-sizing: border-box; }
body.ak-host { margin: 0; background: #F4F3EF; }
body.ak-locked { overflow: hidden; }
.ak [hidden] { display: none !important; }
.ak button, .ak input, .ak select, .ak textarea { font: inherit; color: inherit; }
.ak-ic { width: 18px; height: 18px; flex: none; }
.ak-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ak-skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ak-accent); color: var(--ak-accent-ink); padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.ak-skip:focus { top: 12px; }
.ak :focus-visible { outline: 3px solid var(--ak-accent); outline-offset: 2px; }
.ak-main :focus-visible, .ak-modal :focus-visible { outline-color: var(--ak-strong); }

/* Barra lateral */
.ak-side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; background: var(--ak-side); color: var(--ak-side-ink); overflow-y: auto; z-index: 80; }
.ak-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-bottom: 1px solid var(--ak-side-line); }
.ak-brand svg { width: 34px; height: 34px; flex: none; }
.ak-brand b { display: block; color: #fff; font-family: var(--ak-display); font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; }
.ak-brand small { display: block; font-size: 12px; color: #8F8B83; }
.ak-nav { display: flex; flex-direction: column; gap: 2px; }
.ak-nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 12px; border-radius: 9px; color: var(--ak-side-ink); text-decoration: none; font-weight: 600; font-size: 14.5px; transition: background .15s, color .15s; }
.ak-nav a:hover { background: #1E1D1B; color: #fff; }
.ak-nav a.on { background: var(--ak-accent); color: var(--ak-accent-ink); }
.ak-side-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--ak-side-line); }
.ak-reset, .ak-back { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border-radius: 9px; border: 0; background: transparent; color: #A9A69F; font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer; text-align: left; }
.ak-reset:hover, .ak-back:hover { background: #1E1D1B; color: #fff; }

/* Topo e conteúdo */
.ak-body { min-width: 0; display: flex; flex-direction: column; }
.ak-top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px clamp(16px, 3vw, 32px); background: rgba(244, 243, 239, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--ak-line); }
.ak-menu { display: none; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--ak-line); background: var(--ak-card); align-items: center; justify-content: center; cursor: pointer; }
.ak-title { margin: 0; font-family: var(--ak-display); font-size: 21px; letter-spacing: -0.02em; }
.ak-top-extra { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ak-demo { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: #111; color: #F2EFE8; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ak-demo .ak-ic { width: 14px; height: 14px; color: #C8F031; }
.ak-main { padding: clamp(18px, 3vw, 32px); outline: none; }
.ak-main.ak-in { animation: ak-in .35s cubic-bezier(.22, .8, .24, 1); }
@keyframes ak-in { from { opacity: 0; transform: translateY(8px); } }
.ak-shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 70; }

@media (max-width: 960px) {
  .ak { grid-template-columns: 1fr; }
  .ak-side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-102%); transition: transform .3s cubic-bezier(.22, .8, .24, 1); }
  .ak-side.is-open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .ak-menu { display: inline-flex; }
}
@media (max-width: 620px) {
  .ak-demo span { display: none; }
  .ak-demo { padding: 8px; }
  .ak-title { font-size: 18px; }
}

/* Cabeçalho de módulo */
.ak-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px 24px; margin-bottom: 20px; }
.ak-head h2 { margin: 0 0 4px; font-family: var(--ak-display); font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.02em; line-height: 1.1; }
.ak-head p { margin: 0; color: var(--ak-ink-2); max-width: 640px; }
.ak-head-act { display: flex; flex-wrap: wrap; gap: 10px; }

/* Botões */
.ak-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--ak-strong); background: var(--ak-strong); color: #fff; font-weight: 700; font-size: 14.5px; cursor: pointer; text-decoration: none; transition: transform .15s, background .15s, box-shadow .15s; }
.ak-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.ak-btn.accent { background: var(--ak-accent); border-color: var(--ak-accent); color: var(--ak-accent-ink); }
.ak-btn.ghost { background: transparent; color: var(--ak-ink); border-color: var(--ak-line); }
.ak-btn.ghost:hover { border-color: var(--ak-ink-2); }
.ak-btn.danger { background: var(--ak-bad); border-color: var(--ak-bad); }
.ak-btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.ak-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.ak-ibtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--ak-line); background: var(--ak-card); color: var(--ak-ink-2); cursor: pointer; transition: border-color .15s, color .15s; }
.ak-ibtn:hover { border-color: var(--ak-ink-2); color: var(--ak-ink); }
.ak-ibtn.danger:hover { border-color: var(--ak-bad); color: var(--ak-bad); }
.ak-ibtn.text { font-size: 13px; font-weight: 700; padding: 0 10px; }
.ak-ibtn .ak-ic { width: 16px; height: 16px; }

/* Cartões e grade */
.ak-card { background: var(--ak-card); border: 1px solid var(--ak-line); border-radius: 14px; padding: 18px; }
.ak-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ak-card h3 small { font-weight: 600; color: var(--ak-ink-2); font-size: 13px; }
.ak-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; margin-top: 16px; }
.ak-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 14px; }
.ak-kpi { position: relative; background: var(--ak-card); border: 1px solid var(--ak-line); border-radius: 14px; padding: 16px 16px 14px; display: grid; gap: 2px; }
.ak-kpi .ak-ic { position: absolute; right: 14px; top: 14px; color: var(--ak-ink-2); }
.ak-kpi span { font-size: 13px; color: var(--ak-ink-2); font-weight: 600; }
.ak-kpi b { font-family: var(--ak-display); font-size: 26px; letter-spacing: -0.02em; line-height: 1.15; }
.ak-kpi small { font-size: 12.5px; color: var(--ak-ink-2); }
.ak-kpi.hi { background: var(--ak-strong); color: #fff; border-color: var(--ak-strong); }
.ak-kpi.hi span, .ak-kpi.hi small, .ak-kpi.hi .ak-ic { color: #CFCBC2; }
.ak-kpi.hi b { color: var(--ak-accent); }
.ak-kpi.warn b { color: var(--ak-warn); }

/* Gráficos simples */
.ak-bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 22px; }
.ak-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.ak-bar i { width: 100%; max-width: 46px; height: var(--h); border-radius: 7px 7px 3px 3px; background: #D9D6CE; transform-origin: bottom; animation: ak-grow .7s cubic-bezier(.22, .8, .24, 1) both; }
.ak-bar:last-child i { background: var(--ak-strong); }
.ak-bar-v { font-size: 11.5px; font-weight: 700; color: var(--ak-ink-2); white-space: nowrap; }
.ak-bar-l { font-size: 12px; color: var(--ak-ink-2); font-weight: 600; }
@keyframes ak-grow { from { transform: scaleY(0); } }
.ak-hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ak-hbars li { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.ak-hbars li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ak-hbars i { height: 10px; border-radius: 6px; background: var(--ak-line-2); overflow: hidden; }
.ak-hbars i b { display: block; height: 100%; border-radius: 6px; background: var(--ak-strong); animation: ak-grow-x .8s cubic-bezier(.22, .8, .24, 1) both; transform-origin: left; }
.ak-hbars em { font-style: normal; font-weight: 700; font-size: 13px; }
@keyframes ak-grow-x { from { transform: scaleX(0); } }

/* Listas */
.ak-list { list-style: none; margin: 0; padding: 0; display: grid; }
.ak-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ak-line-2); font-size: 14px; }
.ak-list li:last-child { border-bottom: 0; }
.ak-list li > div { min-width: 0; }
.ak-list b { display: block; font-weight: 700; }
.ak-list small { color: var(--ak-ink-2); }

/* Badges de status */
.ak-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--ak-line-2); color: var(--ak-ink-2); white-space: nowrap; }
.ak-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ak-badge.ok { background: var(--ak-ok-bg); color: var(--ak-ok); }
.ak-badge.warn { background: var(--ak-warn-bg); color: var(--ak-warn); }
.ak-badge.bad { background: var(--ak-bad-bg); color: var(--ak-bad); }
.ak-badge.info { background: var(--ak-info-bg); color: var(--ak-info); }

/* Tabela */
.ak-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.ak-search { position: relative; flex: 1; min-width: 200px; max-width: 420px; display: flex; align-items: center; }
.ak-search .ak-ic { position: absolute; left: 12px; color: var(--ak-ink-2); }
.ak-search input { width: 100%; min-height: 42px; padding: 8px 12px 8px 38px; border-radius: 10px; border: 1px solid var(--ak-line); background: var(--ak-card); }
.ak-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ak-chip { min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ak-line); background: var(--ak-card); font-size: 13px; font-weight: 700; color: var(--ak-ink-2); cursor: pointer; }
.ak-chip[aria-pressed="true"] { background: var(--ak-strong); color: #fff; border-color: var(--ak-strong); }
.ak-table-wrap { background: var(--ak-card); border: 1px solid var(--ak-line); border-radius: 14px; overflow-x: auto; }
.ak-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ak-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ak-ink-2); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--ak-line); white-space: nowrap; background: #FAF9F6; }
.ak-table td { padding: 12px 14px; border-bottom: 1px solid var(--ak-line-2); vertical-align: middle; }
.ak-table tr:last-child td { border-bottom: 0; }
.ak-table tbody tr { transition: background .12s; }
.ak-table tbody tr:hover { background: #FBFAF7; }
.ak-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ak-table .act { text-align: right; white-space: nowrap; width: 1%; }
.ak-table .act button + button { margin-left: 6px; }
.ak-table td b { font-weight: 700; }
.ak-table td small { display: block; color: var(--ak-ink-2); font-size: 12.5px; }
.ak-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--ak-line-2); flex: none; }
.ak-cell { display: flex; align-items: center; gap: 10px; }
.ak-empty { padding: 40px 16px; text-align: center; color: var(--ak-ink-2); display: grid; justify-items: center; gap: 8px; }
.ak-empty .ak-ic { width: 26px; height: 26px; }
.ak-empty p { margin: 0; }
@media (max-width: 720px) {
  .ak-table thead { display: none; }
  .ak-table, .ak-table tbody, .ak-table tr, .ak-table td { display: block; width: 100%; }
  .ak-table tr { padding: 10px 14px; border-bottom: 1px solid var(--ak-line); }
  .ak-table tr:last-child { border-bottom: 0; }
  .ak-table td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .ak-table td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--ak-ink-2); text-align: left; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
  .ak-table td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  .ak-table td:first-child::before { content: none; }
  .ak-table td.act { width: 100%; justify-content: flex-end; padding-top: 8px; }
  .ak-table td.act::before { content: none; }
}

/* Modal e formulários */
.ak-modal { position: fixed; inset: 0; z-index: 120; background: rgba(17, 17, 17, .55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: ak-fade .2s; }
@keyframes ak-fade { from { opacity: 0; } }
.ak-modal-box { width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--ak-card); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: ak-pop .3s cubic-bezier(.22, .8, .24, 1); }
.ak-modal.wide .ak-modal-box { max-width: 820px; }
@keyframes ak-pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.ak-modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--ak-card); border-bottom: 1px solid var(--ak-line); }
.ak-modal-head h2 { margin: 0; font-family: var(--ak-display); font-size: 20px; letter-spacing: -0.02em; }
.ak-x { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--ak-line); background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ak-modal-body { padding: 20px; }
.ak-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ak-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ak-field.full { grid-column: 1 / -1; }
.ak-field label { font-size: 13.5px; font-weight: 700; }
.ak-field input, .ak-field select, .ak-field textarea { width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--ak-line); background: #FDFCFA; font-size: 15px; }
.ak-field input:focus, .ak-field select:focus, .ak-field textarea:focus { outline: none; border-color: var(--ak-strong); box-shadow: 0 0 0 3px rgba(17, 17, 17, .1); }
.ak-field small { font-size: 12.5px; color: var(--ak-ink-2); }
.ak-err { display: none; font-size: 12.5px; font-weight: 700; color: var(--ak-bad); }
.ak-field.invalid .ak-err { display: block; }
.ak-field.invalid input, .ak-field.invalid select, .ak-field.invalid textarea { border-color: var(--ak-bad); }
.ak-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.ak-confirm { margin: 0; font-size: 15.5px; }
@media (max-width: 560px) { .ak-grid { grid-template-columns: 1fr; } }

/* Itens dentro de formulários (orçamento, venda) */
.ak-lines { margin-top: 16px; border: 1px solid var(--ak-line); border-radius: 12px; overflow: hidden; }
.ak-lines-add { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: #FAF9F6; border-bottom: 1px solid var(--ak-line); }
.ak-lines-add select { flex: 1; min-width: 180px; min-height: 42px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--ak-line); background: #fff; }
.ak-lines-add input { width: 80px; min-height: 42px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--ak-line); }
.ak-lines ul { list-style: none; margin: 0; padding: 0; }
.ak-lines li { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--ak-line-2); font-size: 14px; }
.ak-lines li:last-child { border-bottom: 0; }
.ak-lines .tot { display: flex; justify-content: space-between; padding: 12px; font-weight: 800; font-size: 16px; background: #FAF9F6; border-top: 1px solid var(--ak-line); }
.ak-lines .none { padding: 14px 12px; color: var(--ak-ink-2); font-size: 14px; }
.ak-qty { display: inline-flex; align-items: center; gap: 4px; }
.ak-qty button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--ak-line); background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ak-qty span { min-width: 24px; text-align: center; font-weight: 700; }

/* Kanban */
.ak-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.ak-col { background: #ECEAE4; border-radius: 14px; padding: 12px; min-height: 220px; }
.ak-col h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ak-ink-2); display: flex; justify-content: space-between; }
.ak-col h3 span { background: #fff; border-radius: 999px; padding: 0 8px; color: var(--ak-ink); }
.ak-ticket { background: var(--ak-card); border: 1px solid var(--ak-line); border-radius: 12px; padding: 12px; margin-bottom: 10px; display: grid; gap: 6px; font-size: 13.5px; animation: ak-in .3s both; }
.ak-ticket b { font-size: 14.5px; }
.ak-ticket small { color: var(--ak-ink-2); }
.ak-ticket .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* Toasts */
.ak-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 150; display: grid; gap: 8px; }
.ak-toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: #111; color: #F2EFE8; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: ak-pop .3s both; transition: opacity .4s, transform .4s; }
.ak-toast .ak-ic { color: #C8F031; }
.ak-toast.out { opacity: 0; transform: translateY(8px); }

/* Seletor no topo */
.ak-select { min-height: 40px; padding: 6px 34px 6px 12px; border-radius: 10px; border: 1px solid var(--ak-line); background: var(--ak-card) 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='%235B5A55' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; appearance: none; -webkit-appearance: none; font-weight: 700; font-size: 13.5px; }
@media (max-width: 620px) { .ak-top-extra .ak-label { display: none; } }

.ak-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--ak-info-bg); color: var(--ak-info); font-size: 13.5px; font-weight: 600; margin-bottom: 16px; }
.ak-note .ak-ic { margin-top: 1px; }

@media (prefers-reduced-motion: reduce) {
  .ak *, .ak *::before, .ak *::after { animation: none !important; transition: none !important; }
}
.ak-top { min-width: 0; }
.ak-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 620px) {
  .ak-top { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .ak-top-extra { min-width: 0; flex-shrink: 1; }
  .ak-select { max-width: 132px; text-overflow: ellipsis; }
  .ak-demo { flex: none; }
}
