/* ---------- botões ---------- */
.btn {
  --bh: 44px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--bh); padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--r-pill); font-weight: 600; font-size: .95rem; letter-spacing: -.005em; white-space: nowrap;
  background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 10px 24px -10px var(--brand-glow);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), background var(--t-fast), opacity var(--t-fast), filter var(--t-fast);
  overflow: hidden; isolation: isolate; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 16px 30px -10px var(--brand-glow); }
.btn:active { transform: translateY(0) scale(.97); }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn-secondary:hover { background: var(--surface-2); box-shadow: var(--shadow-2); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-2); box-shadow: none; transform: none; filter: none; }
.btn-soft { background: var(--brand-wash); color: var(--brand); box-shadow: none; }
.btn-soft:hover { filter: none; background: color-mix(in srgb, var(--brand) 16%, var(--surface)); box-shadow: none; }
.btn-danger { background: var(--bad); box-shadow: 0 10px 24px -10px rgba(210, 59, 59, .5); }
.btn-ok { background: var(--ok); box-shadow: 0 10px 24px -10px rgba(30, 138, 90, .5); }
.btn-dark { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); }
.btn-sm { --bh: 34px; padding: 0 14px; font-size: .85rem; }
.btn-lg { --bh: 54px; padding: 0 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { width: var(--bh); padding: 0; }
.btn .ico { width: 18px; height: 18px; flex: none; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.4); transform: scale(0); animation: ripple .6s var(--ease-out); pointer-events: none; z-index: -1; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

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

/* ---------- campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .8rem; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.field .hint { font-size: .78rem; color: var(--ink-3); }
.field .error { font-size: .8rem; color: var(--bad); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t) var(--ease), background var(--t-fast); appearance: none; -webkit-appearance: none;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394838c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line-strong)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input-group { position: relative; }
.input-group .input { padding-right: 46px; }
.input-group .toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: transparent; color: var(--ink-3); border-radius: 50%; display: grid; place-items: center; }
.input-group .toggle:hover { color: var(--ink); background: var(--bg-2); }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 600; pointer-events: none; }
.input-prefix .input { padding-left: 42px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background var(--t) var(--ease); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform var(--t) var(--spring); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: var(--ring); }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; }
.check input { appearance: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; transition: all var(--t-fast); margin: 0; flex: none; cursor: pointer; }
.check input::after { content: ""; width: 10px; height: 6px; border: 2.4px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) scale(0); margin-top: -2px; transition: transform var(--t) var(--spring); }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible { box-shadow: var(--ring); }

.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--bg-2); border-radius: var(--r-pill); position: relative; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { position: relative; z-index: 1; border: 0; background: transparent; padding: 8px 16px; border-radius: var(--r-pill); font-weight: 600; font-size: .88rem; color: var(--ink-2); white-space: nowrap; transition: color var(--t-fast); }
.segmented button[aria-pressed="true"], .segmented button.on { color: var(--ink); }
.segmented .thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; background: var(--surface); border-radius: var(--r-pill); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); transition: transform var(--t) var(--ease-out), width var(--t) var(--ease-out); }
.segmented button .count { margin-left: 6px; font-size: .75rem; color: var(--ink-3); font-weight: 700; }

/* ---------- cartões e superfícies ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 24px; position: relative; }
.card-lift { transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease), border-color var(--t); }
.card-lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.card-flat { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card h3 { font-size: 1.05rem; letter-spacing: -.015em; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.glass { background: var(--glass); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: .74rem; font-weight: 700; letter-spacing: .01em; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-wash); color: var(--ok); }
.badge.warn { background: var(--warn-wash); color: var(--warn); }
.badge.bad { background: var(--bad-wash); color: var(--bad); }
.badge.info { background: var(--info-wash); color: var(--info); }
.badge.brand { background: var(--brand-wash); color: var(--brand); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-2), var(--violet)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.4rem; }

.kbd { font: 600 .72rem var(--mono); padding: 2px 6px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3); }
.divider { height: 1px; background: var(--line); border: 0; margin: 20px 0; }
.skeleton { background: linear-gradient(100deg, var(--bg-2) 30%, var(--surface-2) 50%, var(--bg-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-sm); }

.empty { text-align: center; padding: 56px 24px; color: var(--ink-2); }
.empty .art { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 28px; background: var(--brand-wash); color: var(--brand); display: grid; place-items: center; animation: float 5s ease-in-out infinite; }
.empty .art .ico { width: 38px; height: 38px; stroke-width: 1.5; }
.empty h3 { color: var(--ink); font-size: 1.15rem; margin-bottom: 6px; }
.empty p { max-width: 38ch; margin: 0 auto 20px; }

/* ---------- tabelas e listas ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table .r { text-align: right; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); transition: background var(--t-fast), padding var(--t) var(--ease-out); border-radius: var(--r-sm); }
.item:last-child { border-bottom: 0; }
a.item:hover, button.item:hover { background: var(--surface-2); padding-left: 12px; padding-right: 12px; }
.item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.item .title { font-weight: 600; }
.item .sub { font-size: .85rem; color: var(--ink-3); }

/* ---------- abas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: relative; margin-bottom: 24px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { position: relative; border: 0; background: transparent; padding: 12px 16px; font-weight: 600; font-size: .93rem; color: var(--ink-3); white-space: nowrap; transition: color var(--t-fast); }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a[aria-current="page"], .tabs button.on { color: var(--ink); }
.tabs .bar { position: absolute; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; transition: transform var(--t) var(--ease-out), width var(--t) var(--ease-out); left: 0; width: 0; }

/* ---------- janelas ---------- */
.overlay { position: fixed; inset: 0; z-index: 200; background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade-in .25s var(--ease) both; }
.overlay.closing { animation: fade-in .2s var(--ease) reverse both; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: 0 40px 100px -20px rgba(0,0,0,.5); border: 1px solid var(--line); animation: scale-in .4s var(--spring) both; display: flex; flex-direction: column; }
.modal.wide { width: min(860px, 100%); }
.modal header { padding: 26px 28px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal header h2 { font-size: 1.45rem; }
.modal .body { padding: 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.modal footer { padding: 0 28px 26px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.overlay.closing .modal { animation: scale-in .2s var(--ease) reverse both; }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; animation: slide-up .45s var(--ease-out) both; }
  .overlay.closing .modal { animation: slide-up .25s var(--ease) reverse both; }
}

.toasts { position: fixed; z-index: 400; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; width: min(440px, calc(100% - 32px)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-weight: 500; font-size: .93rem; box-shadow: 0 20px 50px -12px rgba(0,0,0,.5); animation: toast-in .5s var(--spring) both; max-width: 100%; }
.toast.out { animation: toast-out .3s var(--ease) both; }
.toast .ico { width: 20px; height: 20px; flex: none; }
.toast.ok .ico { color: #5fe0a4; } .toast.bad .ico { color: #ff8b8b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(24px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(.96); } }

.menu { position: absolute; z-index: 150; min-width: 220px; padding: 8px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2), 0 30px 60px -20px rgba(0,0,0,.3); animation: scale-in .22s var(--ease-out) both; transform-origin: top right; }
.menu button, .menu a { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: transparent; border-radius: var(--r-sm); text-align: left; font-weight: 500; font-size: .92rem; transition: background var(--t-fast); }
.menu button:hover, .menu a:hover { background: var(--bg-2); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .head { padding: 10px 12px 8px; font-size: .75rem; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.menu .on { color: var(--brand); }

.progress { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 1s var(--ease-out); }

/* ---------- painel de busca (⌘K) ---------- */
.palette { width: min(640px, 100%); background: var(--surface); border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: 0 50px 120px -20px rgba(0,0,0,.55); overflow: hidden; animation: scale-in .3s var(--spring) both; align-self: flex-start; margin-top: 12vh; }
.palette input { width: 100%; border: 0; outline: 0; background: transparent; padding: 22px 26px; font-size: 1.15rem; border-bottom: 1px solid var(--line); }
.palette .results { max-height: 46vh; overflow: auto; padding: 8px; }
.palette .res { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; padding: 12px 14px; border-radius: var(--r-sm); text-align: left; }
.palette .res.on, .palette .res:hover { background: var(--brand-wash); }
.palette .res small { color: var(--ink-3); font-size: .78rem; }
.palette .none { padding: 28px; text-align: center; color: var(--ink-3); }
.palette .foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--ink-3); }
.btn.disabled { opacity: .55; pointer-events: none; }
