/* Guardião — identidade compartilhada dos protótipos.
   Tokens: docs/identidade-visual + web-theme/design-tokens.css */

html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cr-skip {
  position: absolute;
  left: 1rem;
  top: 0;
  z-index: 100;
  transform: translateY(-120%);
  padding: 0.5rem 0.75rem;
  background: var(--cr-bg-1);
  color: var(--cr-text-0);
  border: 1px solid var(--cr-border);
  border-radius: 8px;
}

.cr-skip:focus {
  transform: translateY(0.5rem);
}

header [class*="tracking-[0.2em]"] {
  display: none;
}

main {
  padding-bottom: 2rem;
}

body {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--cr-text-0);
  background-color: var(--cr-bg-0);
  caret-color: var(--cr-primary);
  touch-action: manipulation;
}

a {
  text-underline-offset: 0.15em;
}

::placeholder {
  color: var(--cr-text-1);
  opacity: 0.85;
}

button:disabled,
[aria-busy="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

table {
  font-variant-numeric: tabular-nums;
}

tr[data-row-href] {
  cursor: pointer;
}

tr[data-row-href]:focus-visible {
  outline: 2px solid var(--cr-ring);
  outline-offset: -2px;
}

@media (max-width: 639px) {
  .grid.grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

main [data-harden],
main label.cursor-pointer {
  min-height: 44px;
}

:root,
html[data-theme="dark"] {
  --cr-bg-0: #0f1c2e;
  --cr-bg-1: #182c46;
  --cr-bg-2: #203a59;
  --cr-text-0: #f5f8ff;
  --cr-text-1: #a9b7cc;
  --cr-primary: #38bdf8;
  --cr-secondary: #2563eb;
  --cr-success: #22c55e;
  --cr-warning: #f59e0b;
  --cr-danger: #ef4444;
  --cr-border: rgba(169, 183, 204, 0.22);
  --cr-ring: rgba(56, 189, 248, 0.45);
  --cr-radius: 12px;
  --cr-shadow: 0 12px 28px rgba(8, 14, 24, 0.32);
  --cr-on-cyan: #0f1c2e;
}

html[data-theme="light"] {
  --cr-bg-0: #f5f8ff;
  --cr-bg-1: #e8eef8;
  --cr-bg-2: #dce6f4;
  --cr-text-0: #0f1c2e;
  --cr-text-1: #3d5a7a;
  --cr-primary: #0369a1;
  --cr-secondary: #2563eb;
  --cr-success: #15803d;
  --cr-warning: #b45309;
  --cr-danger: #b91c1c;
  --cr-border: rgba(15, 28, 46, 0.14);
  --cr-ring: rgba(3, 105, 161, 0.4);
  --cr-shadow: 0 12px 28px rgba(15, 28, 46, 0.1);
  --cr-on-cyan: #0f1c2e;
}

.bg-ink {
  background-color: var(--cr-bg-0) !important;
}
.bg-panel {
  background-color: var(--cr-bg-1) !important;
}
.bg-card {
  background-color: var(--cr-bg-2) !important;
}
.text-white {
  color: var(--cr-text-0) !important;
}
.text-fog {
  color: var(--cr-text-1) !important;
}
.border-edge {
  border-color: var(--cr-border) !important;
}
.divide-line > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--cr-border) !important;
}
.bg-cyan {
  background-color: #38bdf8 !important;
}
.text-ink {
  color: var(--cr-on-cyan) !important;
}

body.cr-shell {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  align-items: stretch;
}

.cr-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cr-foot {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--cr-border);
  background: var(--cr-bg-0);
}

.cr-foot p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--cr-text-1);
  text-align: center;
}

@media print {
  .cr-foot {
    display: none !important;
  }
}

.cr-top {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--cr-border);
  background: var(--cr-bg-0);
}

.cr-top__tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cr-session {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cr-session img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  object-fit: cover;
  border: 1px solid var(--cr-border);
}

.cr-session-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--cr-text-0);
  text-decoration: none;
  border-radius: 8px;
  padding: 0.2rem 0.4rem;
  margin: -0.2rem -0.4rem;
}

.cr-session-profile:hover {
  background: color-mix(in srgb, var(--cr-bg-2) 65%, transparent);
}

.cr-session-profile span {
  color: var(--cr-text-1);
}

@media (max-width: 639px) {
  .cr-session .text-sm {
    display: none;
  }
}

.cr-icon-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--cr-border);
  background: var(--cr-bg-1);
  color: var(--cr-text-0);
  cursor: pointer;
}

.cr-side {
  width: 15.5rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.75rem 0.65rem 1rem;
  background: var(--cr-bg-1);
  border-right: 1px solid var(--cr-border);
  overflow: auto;
}

.cr-side__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-height: 0;
}


.cr-side__group--admin {
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--cr-border);
}

.cr-side__subs {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  margin-top: 0.125rem;
  padding-left: 0.35rem;
  border-left: 2px solid color-mix(in srgb, var(--cr-primary) 35%, transparent);
  margin-left: 0.65rem;
}

.cr-side__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.5rem 0.85rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--cr-border);
  color: var(--cr-text-0);
  text-decoration: none;
  font-weight: 600;
}

.cr-side__list {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.cr-side a.cr-side__main {
  font-weight: 600;
  color: var(--cr-text-0);
}

.cr-side a.cr-side__flat {
  min-height: 40px;
  font-size: 0.8125rem;
}

.cr-side a.cr-side__sub {
  min-height: 38px;
  padding-left: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.cr-side a.cr-side__sub i {
  display: none;
}

body.cr-nav-collapsed .cr-side a.cr-side__sub,
body.cr-nav-collapsed .cr-side__subs,
body.cr-nav-collapsed .cr-side__group--admin {
  display: none;
}

body.cr-nav-collapsed .cr-side a.cr-side__main {
  justify-content: center;
  padding: 0;
}

.cr-side__label {
  margin: 0 0 0.35rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cr-text-1);
}

.cr-side a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0 0.65rem;
  border-radius: 8px;
  color: var(--cr-text-1);
  text-decoration: none;
  font-size: 0.875rem;
}

.cr-side i,
.cr-icon-btn i {
  width: 1.1rem;
  text-align: center;
  font-size: 0.95rem;
}

.cr-side a:hover {
  color: var(--cr-text-0);
  background: color-mix(in srgb, var(--cr-bg-2) 70%, transparent);
}

.cr-side a[aria-current="page"] {
  color: var(--cr-text-0);
  background: var(--cr-bg-2);
}

body.cr-nav-collapsed .cr-side {
  width: 4.25rem;
}

body.cr-nav-collapsed .cr-side__brand span,
body.cr-nav-collapsed .cr-side__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

body.cr-nav-collapsed .cr-side__group + .cr-side__group {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

body.cr-nav-collapsed .cr-side a {
  justify-content: center;
  padding: 0;
}

body.cr-nav-collapsed .cr-side a.cr-side__main span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.cr-nav-mask {
  display: none;
}

@media (max-width: 767px) {
  .cr-side {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 85;
    transform: translateX(-105%);
    box-shadow: var(--cr-shadow);
  }

  body.cr-nav-open .cr-side {
    transform: none;
  }

  body.cr-nav-collapsed .cr-side {
    width: 15.5rem;
  }

  body.cr-nav-collapsed .cr-side__brand span,
  body.cr-nav-collapsed .cr-side__label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  body.cr-nav-collapsed .cr-side a {
    justify-content: flex-start;
    padding: 0 0.65rem;
  }

  body.cr-nav-collapsed .cr-side a span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .cr-nav-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(8, 14, 24, 0.45);
    border: 0;
  }

  .cr-nav-mask[hidden] {
    display: none;
  }
}

h1, h2, h3, .font-display {
  font-family: "Inter Tight", Inter, sans-serif;
  overflow-wrap: anywhere;
}

.font-mono,
[class*="font-mono"] {
  font-variant-numeric: tabular-nums;
}

::selection {
  background: color-mix(in srgb, var(--cr-primary) 35%, transparent);
  color: var(--cr-text-0);
}

:focus-visible {
  outline: 2px solid var(--cr-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--cr-bg-0);
}
::-webkit-scrollbar-thumb {
  background: var(--cr-bg-2);
  border-radius: 4px;
}

/* Craft floor: no decorative two-axis grid, no zero-offset glow */
.gridlines,
.scanline {
  background-image: none !important;
}

.glow-cyan,
.glow-green,
.glow-red {
  box-shadow: var(--cr-shadow) !important;
}

.rounded-xl {
  border-radius: var(--cr-radius);
}

/* Active nav: 1px, not a 2–4px side-tab costume */
header nav a.border-l-2,
aside nav a.border-l-2,
aside a.border-l-2 {
  border-left-width: 1px;
}

input[type="range"]::-webkit-slider-thumb {
  background: var(--cr-primary) !important;
  box-shadow: none !important;
}

.cr-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

dialog.cr-custody {
  width: min(32rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: var(--cr-bg-1);
  color: var(--cr-text-0);
  box-shadow: var(--cr-shadow);
}

dialog.cr-custody::backdrop {
  background: rgba(8, 14, 24, 0.72);
}

.cr-custody__body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.cr-custody__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.cr-toast {
  position: fixed;
  inset-inline-end: 1rem;
  inset-block-end: 1rem;
  z-index: 80;
  max-width: 24rem;
  padding: 0.75rem 1rem;
  border-radius: var(--cr-radius);
  border: 1px solid var(--cr-border);
  background: var(--cr-bg-1);
  color: var(--cr-text-0);
  box-shadow: var(--cr-shadow);
}

.cr-form-field {
  display: block;
}

.cr-form-field + .cr-form-field {
  margin-top: 1rem;
}

.cr-form-field__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cr-text-1);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.cr-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--cr-border);
  background: var(--cr-bg-0);
  color: var(--cr-text-0);
  font-size: 0.875rem;
  outline: none;
}

.cr-input:focus {
  border-color: var(--cr-primary);
  box-shadow: 0 0 0 2px var(--cr-ring);
}

.cr-input:read-only {
  opacity: 0.75;
  cursor: not-allowed;
}

.cr-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
  padding: 0.35rem 0;
}

.cr-switch-row + .cr-switch-row {
  border-top: 1px solid var(--cr-border);
}

.cr-offline {
  position: sticky;
  top: 0;
  z-index: 70;
  padding: 0.5rem 1rem;
  text-align: center;
  background: color-mix(in srgb, var(--cr-warning) 18%, var(--cr-bg-0));
  color: var(--cr-text-0);
  border-bottom: 1px solid var(--cr-warning);
}

@media (max-width: 767px) {
  header nav details > div {
    left: 0;
    right: auto;
  }
}

.cr-deck {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--cr-text-1);
  background: color-mix(in srgb, var(--cr-bg-0) 92%, transparent);
  border-top: 1px solid var(--cr-border);
}

.cr-deck button {
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 8px;
  border: 1px solid var(--cr-border);
  background: var(--cr-bg-2);
  color: var(--cr-text-0);
  cursor: pointer;
}

body.cr-apresentar {
  padding-bottom: 2.75rem;
}

@media (prefers-reduced-motion: reduce) {
  .ticker,
  .fa-spin {
    animation: none !important;
  }
}
