:root {
  --ock-blue-1: #367CDD;
  --ock-blue-2: #2F6FD1;
  --ock-blue-3: #1D4FB3;
  --ock-blue-4: #1947AB;
  --ock-gray-1: #2B2B2B;
  --ock-black: #0F0F0F;

  --bg: #0F0F0F;
  --bg-soft: #121822;
  --sidebar: #11151D;
  --panel: #151B25;
  --panel-2: #1A2230;
  --border: rgba(255, 255, 255, 0.08);
  --text: #F4F7FB;
  --muted: #A9B4C7;
  --accent: #367CDD;
  --accent-strong: #1947AB;
  --accent-soft: rgba(54, 124, 221, 0.14);
  --success: #4FC58B;
  --danger: #FF7F7F;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] {
  --bg: #F3F7FD;
  --bg-soft: #E8F0FB;
  --sidebar: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #F4F8FF;
  --border: rgba(25, 71, 171, 0.12);
  --text: #17233B;
  --muted: #5A6A83;
  --accent: #2F6FD1;
  --accent-strong: #1947AB;
  --accent-soft: rgba(47, 111, 209, 0.09);
  --success: #278C60;
  --danger: #C74C4C;
  --shadow: 0 20px 55px rgba(25, 71, 171, 0.08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(54, 124, 221, 0.10), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.utility-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.utility-pill,
.utility-theme-toggle {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}

.utility-logo-pill {
  min-width: 54px;
  padding-inline: 10px;
}

.utility-logo-pill img {
  height: 14px;
  width: auto;
  display: block;
}

.utility-version-pill {
  font-size: 12px;
  font-weight: 800;
}

.utility-theme-toggle {
  gap: 9px;
  padding: 0 11px;
}

.utility-theme-toggle span:last-child {
  font-size: 12px;
  font-weight: 800;
}

.switch-track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.13);
  position: relative;
  transition: .18s ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transition: .18s ease;
}

html[data-theme="light"] .switch-track {
  background: rgba(47,111,209,0.22);
}

html[data-theme="light"] .switch-thumb {
  transform: translateX(14px);
  background: var(--accent);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  padding: 18px 22px 22px;
  gap: 18px;
}

.sidebar,
.card,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.sidebar {
  border-radius: 26px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: grid;
  gap: 18px;
  margin-bottom: 34px;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
}

.brand-texts strong, .brand-texts span { display: block; }
.brand-texts strong { font-size: 22px; margin-bottom: 4px; }
.brand-texts span { color: var(--muted); font-size: 13px; line-height: 1.45; }

.sidebar-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 10px;
  font-weight: 800;
}
nav { display: grid; gap: 8px; }

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
}
.nav-item.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(54, 124, 221, 0.18);
}
.nav-item:disabled { opacity: .55; cursor: not-allowed; }

.sidebar-footer {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.sidebar-footer small { color: var(--muted); line-height: 1.4; }
.online-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); }

.content { min-width: 0; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 8px 2px;
}
.page-description { margin: 8px 0 0; max-width: 640px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 800;
}

h1 { margin: 0; font-size: 34px; }
h2 { margin: 0 0 6px; font-size: 20px; }
p { color: var(--muted); }

.primary, .secondary, .icon-button {
  border-radius: 14px;
  transition: .18s ease;
}
.primary {
  border: 1px solid rgba(25, 71, 171, 0.2);
  background: linear-gradient(135deg, var(--ock-blue-1), var(--ock-blue-3));
  color: white;
  font-weight: 800;
  padding: 12px 18px;
}
.primary:hover { transform: translateY(-1px); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.secondary, .icon-button {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
.secondary { padding: 12px 16px; }
.icon-button { width: 38px; height: 38px; font-size: 22px; line-height: 1; }

.cards {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.compact-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { border-radius: 22px; }
.metric { padding: 20px; }
.metric span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.metric strong { font-size: 28px; }

.panel { padding: 22px; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.panel-head p { margin: 0; font-size: 14px; }

.badge, .status-badge {
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.badge.ok, .status-badge.active {
  color: var(--success);
  border-color: rgba(79, 197, 139, .35);
  background: rgba(79, 197, 139, .08);
}
.status-badge.inactive { color: var(--muted); background: rgba(255,255,255,0.03); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 660px; }
th, td { padding: 14px 10px; border-top: 1px solid var(--border); text-align: left; font-size: 14px; }
th { color: var(--muted); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 36px 10px; }

footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-top: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  width: min(520px, 100%);
  border-radius: 22px;
  padding: 22px;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); font-size: 11px; }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 13px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: rgba(47,111,209,0.55); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-error {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 127, 127, .25);
  background: rgba(255, 127, 127, .08);
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 14px;
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 60;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .compact-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .top-utility { padding: 14px 14px 0; }
  .utility-group { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .app-shell { padding: 12px 14px 14px; gap: 14px; }
  .page-header { flex-direction: column; }
  .compact-cards { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button, .page-header .primary { width: 100%; }
}

.brand-logo-wrap { display: block; width: 100%; max-width: 210px; }
.brand-logo-wrap img { width: 100%; height: auto; display: block; }

html[data-theme="dark"] .theme-logo {
  content: url("/assets/ockham-logo-dark.png");
}

html[data-theme="light"] .theme-logo {
  content: url("/assets/ockham-logo.png");
}

@media (max-width: 720px) {
  .header-actions { width: 100%; align-items: stretch; }
  .utility-group { justify-content: flex-end; flex-wrap: wrap; }
  .header-actions .primary { width: 100%; }
}

/* v0.4.0 - autenticação e usuários */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 34px;
}
.auth-logo { width: 210px; max-width: 52%; height: auto; display: block; }
.auth-form { margin-top: 24px; }
.full-button { width: 100%; }
.user-summary { display: grid; gap: 3px; }
.user-summary strong { font-size: 14px; }
.user-summary span { color: var(--muted); font-size: 12px; }
.logout-button { width: 100%; }
.table-action {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}
.muted-text { color: var(--muted); font-size: 12px; }
@media (max-width: 720px) {
  .auth-top { flex-direction: column; }
  .auth-logo { max-width: 70%; }
}

.back-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  margin: 0 0 16px;
  font-weight: 800;
}

.table-action-cell {
  text-align: right;
}

.table-action {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 11px;
  font-weight: 700;
}

.analysis-status {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--border);
}
.analysis-status.processando,
.analysis-status.solicitada {
  color: var(--accent);
  background: var(--accent-soft);
}
.analysis-status.concluida {
  color: var(--success);
  background: rgba(79, 197, 139, .08);
}
.analysis-status.erro {
  color: var(--danger);
  background: rgba(255, 127, 127, .08);
}


.row-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.danger-action {
  color: var(--danger);
  border-color: rgba(255, 127, 127, .28);
  background: rgba(255, 127, 127, .06);
}

.danger-action:hover {
  background: rgba(255, 127, 127, .12);
}
