/* CodeHub Design System — UI First (Web + Mobile) */

:root {
  /* Brand */
  --ch-primary: #0756D9;
  --ch-primary-dark: #06368F;
  --ch-primary-light: #4A94DF;
  --ch-secondary: #061B45;
  --ch-text: #111923;
  --ch-steel: #367FC5;
  --ch-midnight: #07172E;
  --ch-white: #FFFFFF;

  /* Surfaces */
  --ch-bg: #F3F6FB;
  --ch-bg-accent: #E8F0FB;
  --ch-surface: #FFFFFF;
  --ch-surface-2: #F7F9FC;
  --ch-border: #D5E0EF;
  --ch-border-strong: #B7C9E0;
  --ch-muted: #5A6B7F;
  --ch-muted-soft: #8A9BB0;

  /* Semantic */
  --ch-danger: #C0392B;
  --ch-danger-soft: #FDECEC;
  --ch-warning: #B7791F;
  --ch-warning-soft: #FEF3C7;
  --ch-success: #1F7A4D;
  --ch-success-soft: #E8F7EF;
  --ch-info-soft: #EAF2FC;

  /* Layout */
  --ch-sidebar-w: 15.5rem;
  --ch-radius: 0.75rem;
  --ch-radius-sm: 0.5rem;
  --ch-touch: 2.75rem;
  --ch-nav-h: 4.25rem;
  --ch-shadow: 0 1px 2px rgba(6, 27, 69, 0.06), 0 8px 24px rgba(6, 27, 69, 0.06);
  --ch-focus: 0 0 0 3px rgba(7, 86, 217, 0.28);

  /* Motion */
  --ch-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ch-dur: 220ms;

  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--ch-text);
  background: var(--ch-bg);
}

.dark {
  --ch-bg: #07172E;
  --ch-bg-accent: #0B213F;
  --ch-surface: #0E1F38;
  --ch-surface-2: #122745;
  --ch-border: #243B5C;
  --ch-border-strong: #35557A;
  --ch-muted: #A8B8CC;
  --ch-muted-soft: #7E92AB;
  --ch-text: #F3F6FB;
  --ch-danger-soft: #3A1A18;
  --ch-warning-soft: #3A2E14;
  --ch-success-soft: #143024;
  --ch-info-soft: #143055;
  --ch-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.28);
  --ch-focus: 0 0 0 3px rgba(74, 148, 223, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

.ml-1 {
  margin-left: 0.25rem;
}

.uppercase {
  text-transform: uppercase;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(74, 148, 223, 0.18), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(7, 86, 217, 0.12), transparent 55%),
    linear-gradient(180deg, var(--ch-bg-accent) 0%, var(--ch-bg) 42%, var(--ch-bg) 100%);
  color: var(--ch-text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.dark body,
body.dark-mode {
  background:
    radial-gradient(1000px 480px at 0% 0%, rgba(7, 86, 217, 0.22), transparent 55%),
    radial-gradient(800px 400px at 100% 10%, rgba(54, 127, 197, 0.16), transparent 50%),
    linear-gradient(180deg, #07172E 0%, #061B45 100%);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ch-focus);
}

.ch-skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: var(--ch-radius-sm);
  background: var(--ch-primary);
  color: var(--ch-white);
}

.ch-skip-link:focus {
  left: 0.75rem;
}

.ch-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- Buttons ---------- */
.ch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--ch-touch);
  padding: 0.65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--ch-radius-sm);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform var(--ch-dur) var(--ch-ease), background-color var(--ch-dur) var(--ch-ease), box-shadow var(--ch-dur) var(--ch-ease), border-color var(--ch-dur) var(--ch-ease);
}

.ch-btn:hover {
  transform: translateY(-1px);
}

.ch-btn:active {
  transform: translateY(0);
}

.ch-btn:disabled,
.ch-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ch-btn-primary {
  background: linear-gradient(135deg, var(--ch-primary) 0%, var(--ch-primary-dark) 100%);
  color: var(--ch-white);
  box-shadow: 0 8px 18px rgba(7, 86, 217, 0.25);
}

.ch-btn-primary:hover {
  background: linear-gradient(135deg, var(--ch-primary-light) 0%, var(--ch-primary) 100%);
}

.ch-btn-secondary {
  background: var(--ch-surface-2);
  color: var(--ch-text);
  border-color: var(--ch-border);
}

.ch-btn-ghost {
  background: transparent;
  color: var(--ch-muted);
  border-color: transparent;
}

.ch-btn-danger {
  background: var(--ch-danger);
  color: var(--ch-white);
}

.ch-btn-danger-soft {
  background: var(--ch-danger-soft);
  color: var(--ch-danger);
  border-color: transparent;
}

.ch-btn-warn {
  background: var(--ch-warning);
  color: var(--ch-white);
}

.ch-btn-warn-soft {
  background: var(--ch-warning-soft);
  color: var(--ch-warning);
}

.ch-btn-sm {
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.ch-btn-block {
  width: 100%;
}

/* ---------- Fields ---------- */
.ch-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ch-muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.ch-field,
.ch-select,
.ch-file {
  width: 100%;
  min-height: var(--ch-touch);
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-sm);
  background: var(--ch-surface);
  color: var(--ch-text);
  transition: border-color var(--ch-dur) var(--ch-ease), box-shadow var(--ch-dur) var(--ch-ease);
}

.ch-field:focus,
.ch-select:focus,
.ch-file:focus {
  border-color: var(--ch-primary);
  box-shadow: var(--ch-focus);
  outline: none;
}

.ch-field::placeholder {
  color: var(--ch-muted-soft);
}

.ch-search {
  position: relative;
}

.ch-search .ch-field {
  padding-right: 2.5rem;
}

.ch-search-clear {
  position: absolute;
  inset: 0 0.35rem 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  border: 0;
  background: transparent;
  color: var(--ch-muted);
  cursor: pointer;
}

/* ---------- Layout shells ---------- */
.ch-boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background:
    radial-gradient(520px 260px at 15% 20%, rgba(74, 148, 223, 0.22), transparent 60%),
    radial-gradient(480px 240px at 85% 80%, rgba(7, 86, 217, 0.18), transparent 55%),
    linear-gradient(160deg, var(--ch-bg) 0%, var(--ch-bg-accent) 100%);
  animation: ch-fade 240ms var(--ch-ease) both;
}

.ch-boot-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ch-secondary);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  animation: ch-fade-up 420ms var(--ch-ease) both;
}

.dark .ch-boot-mark {
  color: var(--ch-white);
}

.ch-boot-mark img {
  width: 3.25rem;
  height: 3.25rem;
  object-fit: contain;
  animation: ch-pulse 2.4s ease-in-out infinite;
}

.ch-boot-text {
  margin: 0;
  color: var(--ch-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.ch-login {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  overflow: hidden;
  background:
    radial-gradient(640px 320px at 12% 18%, rgba(74, 148, 223, 0.28), transparent 62%),
    radial-gradient(520px 280px at 88% 82%, rgba(6, 54, 143, 0.18), transparent 58%),
    linear-gradient(165deg, var(--ch-bg) 0%, var(--ch-bg-accent) 52%, var(--ch-bg) 100%);
  animation: ch-fade 320ms var(--ch-ease) both;
}

.ch-login::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(7, 86, 217, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 86, 217, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 78%);
  pointer-events: none;
}

.dark .ch-login::before {
  background-image:
    linear-gradient(rgba(74, 148, 223, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 148, 223, 0.08) 1px, transparent 1px);
}

.ch-login-theme {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-sm);
  background: color-mix(in srgb, var(--ch-surface) 88%, transparent);
  color: var(--ch-text);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 160ms var(--ch-ease), border-color 160ms var(--ch-ease);
}

.ch-login-theme:hover {
  transform: translateY(-1px);
  border-color: var(--ch-border-strong);
}

.ch-login-shell {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  border: 1px solid var(--ch-border);
  border-radius: 1.25rem;
  background: var(--ch-surface);
  box-shadow: var(--ch-shadow);
  animation: ch-fade-up 480ms var(--ch-ease) both;
}

.ch-login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 28rem;
  padding: 2.25rem;
  color: var(--ch-white);
  background:
    radial-gradient(600px 280px at 20% 10%, rgba(74, 148, 223, 0.35), transparent 60%),
    linear-gradient(160deg, var(--ch-midnight) 0%, var(--ch-secondary) 48%, var(--ch-primary-dark) 100%);
  overflow: hidden;
}

.ch-login-brand::after {
  content: "";
  position: absolute;
  inset: auto -20% -30% 20%;
  height: 70%;
  background: radial-gradient(circle, rgba(7, 86, 217, 0.35), transparent 65%);
  pointer-events: none;
  animation: ch-pulse 5.5s ease-in-out infinite;
}

.ch-login-brand-copy {
  position: relative;
  z-index: 1;
  animation: ch-fade-up 560ms var(--ch-ease) 80ms both;
}

.ch-login-brand h1 {
  margin: 1rem 0 0.5rem;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.15;
  font-weight: 700;
}

.ch-login-brand p {
  margin: 0;
  max-width: 28ch;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1.55;
}

.ch-login-brand-foot {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
}

.ch-login-logo {
  position: relative;
  z-index: 1;
  width: min(220px, 70%);
}

.ch-login-brand-mark {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: ch-fade-up 420ms var(--ch-ease) both;
}

.ch-login-brand-mark img {
  width: 3.25rem;
  height: 3.25rem;
  object-fit: contain;
}

.ch-login-brand-mark span {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ch-white);
}

.ch-login-form-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.75rem;
  animation: ch-fade-up 520ms var(--ch-ease) 120ms both;
}

.ch-login-form-wrap h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ch-text);
}

.ch-login-form-wrap .ch-lead {
  margin: 0 0 1.25rem;
  color: var(--ch-muted);
}

.ch-login-error {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--ch-danger) 28%, var(--ch-border));
  border-radius: var(--ch-radius-sm);
  background: var(--ch-danger-soft);
  color: var(--ch-danger);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  animation: ch-fade-up 220ms var(--ch-ease) both;
}

.ch-login-error i {
  margin-top: 0.1rem;
}

.ch-login-meta {
  margin: 1.25rem 0 0;
  color: var(--ch-muted-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.ch-input-icon {
  position: relative;
}

.ch-input-icon > i:first-child {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ch-muted-soft);
  pointer-events: none;
}

.ch-input-icon .ch-field {
  padding-left: 2.5rem;
}

.ch-input-icon-trail .ch-field {
  padding-right: 2.75rem;
}

.ch-input-action {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 0;
  border-radius: var(--ch-radius-sm);
  background: transparent;
  color: var(--ch-muted);
  cursor: pointer;
}

.ch-input-action:hover {
  color: var(--ch-primary);
}

.ch-field-stack {
  display: grid;
  gap: 1rem;
}

.ch-app {
  min-height: 100dvh;
}

.ch-app-shell {
  display: flex;
  min-height: 100dvh;
}

.ch-sidebar {
  position: sticky;
  top: 0;
  display: none;
  width: var(--ch-sidebar-w);
  height: 100dvh;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.1rem 0.85rem;
  background: linear-gradient(180deg, var(--ch-secondary) 0%, var(--ch-midnight) 100%);
  color: var(--ch-white);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 30;
}

.ch-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.55rem 1rem;
}

.ch-sidebar-brand img {
  width: 2.35rem;
  height: 2.35rem;
  object-fit: contain;
}

.ch-sidebar-brand span {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.ch-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ch-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--ch-touch);
  padding: 0.55rem 0.8rem;
  border-radius: var(--ch-radius-sm);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: background-color var(--ch-dur) var(--ch-ease), color var(--ch-dur) var(--ch-ease), transform var(--ch-dur) var(--ch-ease);
}

.ch-nav-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
}

.ch-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ch-white);
}

.ch-nav-link.active {
  background: linear-gradient(135deg, var(--ch-primary) 0%, var(--ch-steel) 100%);
  color: var(--ch-white);
  box-shadow: 0 10px 22px rgba(7, 86, 217, 0.28);
}

.ch-sidebar-footer {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ch-main {
  flex: 1;
  min-width: 0;
  padding: 1rem 1rem calc(var(--ch-nav-h) + 1.25rem);
}

.ch-panel {
  padding: 1.25rem;
  border: 1px solid var(--ch-border);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--ch-surface) 92%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: var(--ch-shadow);
  animation: ch-fade-up 360ms var(--ch-ease) both;
}

.ch-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.ch-page-header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ch-page-header p {
  margin: 0.25rem 0 0;
  color: var(--ch-muted);
  font-size: 0.95rem;
}

.ch-form-grid {
  display: grid;
  gap: 0.85rem;
}

.ch-form-row {
  display: grid;
  gap: 0.85rem;
}

.ch-form-row-2 {
  grid-template-columns: 1fr;
}

.ch-result-row {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.ch-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--ch-radius-sm);
  background: var(--ch-info-soft);
  color: var(--ch-secondary);
  border: 1px solid var(--ch-border);
}

.dark .ch-chip {
  color: var(--ch-primary-light);
}

.ch-chip strong {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.ch-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0.75rem 0;
}

.ch-toolbar .ch-search {
  width: min(100%, 28rem);
}

.ch-table-wrap {
  overflow: auto;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  background: var(--ch-surface);
  max-height: min(40rem, 65dvh);
}

.ch-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}

.ch-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ch-muted);
  background: var(--ch-surface-2);
  border-bottom: 1px solid var(--ch-border);
  white-space: nowrap;
}

.ch-table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--ch-border);
  vertical-align: middle;
  font-size: 0.925rem;
}

.ch-table tbody tr:last-child td {
  border-bottom: 0;
}

.ch-row {
  background: var(--ch-surface);
  transition: background-color var(--ch-dur) var(--ch-ease);
}

.ch-row:nth-child(even) {
  background: var(--ch-surface-2);
}

.ch-row:hover {
  background: color-mix(in srgb, var(--ch-primary-light) 12%, var(--ch-surface));
}

.ch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ch-count {
  margin-top: 0.75rem;
  color: var(--ch-muted);
  font-size: 0.9rem;
}

.ch-empty {
  margin-top: 1rem;
  text-align: center;
  color: var(--ch-muted);
}

.ch-td {
  white-space: nowrap;
}

.ch-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.85rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--ch-surface-2);
  color: var(--ch-muted);
  border: 1px solid var(--ch-border);
}

.ch-status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
}

.ch-status-green {
  color: var(--ch-success);
  background: var(--ch-success-soft);
  border-color: transparent;
}

.ch-status-yellow {
  color: var(--ch-warning);
  background: var(--ch-warning-soft);
  border-color: transparent;
}

.ch-status-gray {
  color: var(--ch-muted);
}

.ch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ch-table tbody td .ch-btn {
  margin: 0.1rem 0.1rem 0.1rem 0;
}

.ch-home {
  display: grid;
  gap: 1.1rem;
  animation: ch-fade-up 360ms var(--ch-ease) both;
}

.ch-home-banner {
  display: grid;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border: 1px solid var(--ch-border);
  border-radius: 1rem;
  background:
    radial-gradient(420px 180px at 0% 0%, rgba(74, 148, 223, 0.16), transparent 65%),
    linear-gradient(135deg, var(--ch-surface) 0%, var(--ch-surface-2) 100%);
  box-shadow: var(--ch-shadow);
}

.ch-home-banner-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  color: var(--ch-secondary);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dark .ch-home-banner-brand {
  color: var(--ch-white);
}

.ch-home-banner-brand img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}

.ch-home-welcome {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  font-weight: 600;
  color: var(--ch-muted);
  line-height: 1.3;
}

.ch-home-welcome strong {
  color: var(--ch-text);
  font-weight: 800;
}

.ch-home-lead {
  margin: 0.35rem 0 0;
  max-width: 42ch;
  color: var(--ch-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.ch-home-brands {
  justify-self: start;
}

.ch-home-brand-plate {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: max-content;
  max-width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 0.75rem;
  background: var(--ch-white);
  border: 1px solid var(--ch-border);
  box-shadow: var(--ch-shadow);
}

.dark .ch-home-brand-plate {
  background: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.12);
}

.ch-home-brand-codehub {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ch-secondary);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.ch-home-brand-codehub img {
  width: 1.55rem;
  height: 1.55rem;
  object-fit: contain;
}

.ch-home-brand-divider {
  width: 1px;
  align-self: stretch;
  background: #D5E0EF;
}

.ch-home-brand-menegotti {
  width: min(118px, 28vw);
  height: auto;
  display: block;
}

.ch-home-section-title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ch-muted);
}

.ch-home-primary-grid {
  display: grid;
  gap: 0.65rem;
}

.ch-home-primary-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 4.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  background: var(--ch-surface);
  box-shadow: var(--ch-shadow);
  color: var(--ch-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ch-ease), transform 160ms var(--ch-ease), background-color 160ms var(--ch-ease);
  animation: ch-fade-up 420ms var(--ch-ease) both;
}

.ch-home-primary-card:nth-child(2) {
  animation-delay: 60ms;
}

.ch-home-primary-card:hover,
.ch-home-primary-card:focus-visible {
  border-color: color-mix(in srgb, var(--ch-primary) 40%, var(--ch-border));
  background: color-mix(in srgb, var(--ch-primary) 6%, var(--ch-surface));
  transform: translateY(-1px);
}

.ch-home-primary-icon {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--ch-primary) 14%, transparent);
  color: var(--ch-primary);
  font-size: 1.05rem;
}

.ch-home-primary-text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.ch-home-primary-text strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ch-home-primary-text span {
  color: var(--ch-muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.ch-home-primary-arrow {
  color: var(--ch-muted-soft);
  transition: transform 160ms var(--ch-ease), color 160ms var(--ch-ease);
}

.ch-home-primary-card:hover .ch-home-primary-arrow {
  color: var(--ch-primary);
  transform: translateX(3px);
}

.ch-home-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.75rem, 1fr));
  gap: 0.5rem;
}

.ch-home-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-sm);
  background: var(--ch-surface);
  color: var(--ch-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ch-ease), background-color 160ms var(--ch-ease);
  animation: ch-fade-up 420ms var(--ch-ease) both;
}

.ch-home-admin-link:nth-child(1) { animation-delay: 80ms; }
.ch-home-admin-link:nth-child(2) { animation-delay: 110ms; }
.ch-home-admin-link:nth-child(3) { animation-delay: 140ms; }
.ch-home-admin-link:nth-child(4) { animation-delay: 170ms; }
.ch-home-admin-link:nth-child(5) { animation-delay: 200ms; }

.ch-home-admin-link:hover,
.ch-home-admin-link:focus-visible {
  border-color: color-mix(in srgb, var(--ch-primary) 35%, var(--ch-border));
  background: color-mix(in srgb, var(--ch-primary) 7%, var(--ch-surface));
}

.ch-home-admin-link i {
  width: 1.1rem;
  text-align: center;
  color: var(--ch-primary);
}

.ch-home-meta {
  margin: 0.15rem 0 0;
  color: var(--ch-muted-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.ch-home-release-badge {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 0.4rem;
  border: 1px solid color-mix(in srgb, var(--ch-primary) 28%, var(--ch-border));
  background: color-mix(in srgb, var(--ch-primary) 10%, var(--ch-surface));
  color: var(--ch-primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ch-home-release-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--ch-primary) 8%, var(--ch-surface)) 0%, var(--ch-surface) 60%);
  box-shadow: var(--ch-shadow);
  color: var(--ch-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ch-ease), transform 160ms var(--ch-ease), background-color 160ms var(--ch-ease);
  animation: ch-fade-up 420ms var(--ch-ease) both;
  animation-delay: 120ms;
}

.ch-home-release-card:hover,
.ch-home-release-card:focus-visible {
  border-color: color-mix(in srgb, var(--ch-primary) 40%, var(--ch-border));
  background: color-mix(in srgb, var(--ch-primary) 10%, var(--ch-surface));
  transform: translateY(-1px);
}

.ch-home-release-card-icon {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--ch-primary) 14%, transparent);
  color: var(--ch-primary);
  font-size: 1.05rem;
}

.ch-home-release-card-body {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.ch-home-release-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.ch-home-release-card-top strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ch-home-release-card-summary {
  color: var(--ch-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.ch-home-release-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  color: var(--ch-primary);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.ch-home-release-card:hover .ch-home-release-card-cta i {
  transform: translateX(3px);
}

.ch-home-release-card-cta i {
  transition: transform 160ms var(--ch-ease);
}

.ch-release-modal-dialog {
  width: min(36rem, 100%);
  max-height: min(88vh, 44rem);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: 0;
  overflow: hidden;
}

.ch-release-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.15rem 1.25rem 0.35rem;
}

.ch-release-modal-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--ch-primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ch-release-modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.ch-release-modal-intro {
  margin: 0;
  padding: 0 1.25rem 0.85rem;
  color: var(--ch-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.ch-release-modal-body {
  overflow: auto;
  padding: 0 1.25rem 0.5rem;
  display: grid;
  gap: 0.75rem;
}

.ch-release-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-sm);
  background: color-mix(in srgb, var(--ch-surface-2) 70%, var(--ch-surface));
}

.ch-release-item h3 {
  margin: 0 0 0.3rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ch-text);
}

.ch-release-item p {
  margin: 0;
  color: var(--ch-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.ch-release-modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem 0.75rem;
  padding: 0.9rem 1.25rem 1.15rem;
  border-top: 1px solid var(--ch-border);
  background: var(--ch-surface);
}

@media (max-width: 640px) {
  .ch-home-release-card {
    grid-template-columns: auto 1fr;
  }

  .ch-home-release-card-cta {
    grid-column: 2;
  }

  .ch-release-modal-footer .ch-btn-primary {
    width: 100%;
  }
}

.ch-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 23, 46, 0.55);
  backdrop-filter: blur(4px);
  animation: ch-fade 180ms var(--ch-ease) both;
}

.ch-modal-dialog {
  width: min(28rem, 100%);
  padding: 1.35rem;
  border-radius: 1rem;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  box-shadow: var(--ch-shadow);
  animation: ch-fade-up 240ms var(--ch-ease) both;
}

.ch-modal-dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.ch-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.ch-toast-host {
  position: fixed;
  inset: auto 1rem 1rem auto;
  z-index: 80;
  pointer-events: none;
}

.ch-toast {
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: auto;
  border-radius: var(--ch-radius);
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  box-shadow: var(--ch-shadow);
  overflow: hidden;
  animation: ch-fade-up 240ms var(--ch-ease) both;
}

.ch-toast-body {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
}

.ch-toast-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--ch-warning-soft);
  color: var(--ch-warning);
}

.ch-mobile-top,
.ch-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.35rem 0.15rem;
}

.ch-topbar {
  justify-content: flex-start;
}

.ch-topbar .ch-mobile-indicator {
  margin-left: auto;
}

.ch-hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border: 1px solid var(--ch-border);
  border-radius: 0.7rem;
  background: var(--ch-surface);
  color: var(--ch-text);
  cursor: pointer;
  transition: background 160ms var(--ch-ease), border-color 160ms var(--ch-ease);
}

.ch-hamburger:hover {
  background: color-mix(in srgb, var(--ch-primary) 10%, var(--ch-surface));
  border-color: color-mix(in srgb, var(--ch-primary) 28%, var(--ch-border));
}

.ch-hamburger-box {
  position: relative;
  display: block;
  width: 1.15rem;
  height: 0.9rem;
}

.ch-hamburger-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 200ms var(--ch-ease), opacity 160ms var(--ch-ease), top 200ms var(--ch-ease);
}

.ch-hamburger-line:nth-child(1) { top: 0; }
.ch-hamburger-line:nth-child(2) { top: 50%; margin-top: -1px; }
.ch-hamburger-line:nth-child(3) { bottom: 0; }

.ch-hamburger.is-open .ch-hamburger-line:nth-child(1) {
  top: 50%;
  margin-top: -1px;
  transform: rotate(45deg);
}

.ch-hamburger.is-open .ch-hamburger-line:nth-child(2) {
  opacity: 0;
}

.ch-hamburger.is-open .ch-hamburger-line:nth-child(3) {
  bottom: auto;
  top: 50%;
  margin-top: -1px;
  transform: rotate(-45deg);
}

.ch-mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
}

.ch-mobile-brand img {
  width: 1.85rem;
  height: 1.85rem;
  object-fit: contain;
}

.ch-mobile-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ch-primary) 12%, var(--ch-surface));
  color: var(--ch-primary-dark);
  font-size: 0.75rem;
  font-weight: 700;
}

.dark .ch-mobile-indicator {
  color: var(--ch-primary-light);
}

.ch-workspace-tabs {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0.2rem 0.15rem 0.45rem;
  overflow-x: auto;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--ch-border);
}

.ch-workspace-tabs.is-empty {
  display: none;
}

.ch-workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  max-width: 14rem;
  min-height: 2.35rem;
  padding: 0.35rem 0.35rem 0.35rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 0.7rem 0.7rem 0 0;
  background: color-mix(in srgb, var(--ch-surface-2) 80%, transparent);
  color: var(--ch-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms var(--ch-ease), color 160ms var(--ch-ease), border-color 160ms var(--ch-ease);
}

.ch-workspace-tab:hover {
  background: color-mix(in srgb, var(--ch-primary) 10%, var(--ch-surface));
  color: var(--ch-text);
}

.ch-workspace-tab.is-active {
  background: var(--ch-surface);
  border-color: var(--ch-border);
  border-bottom-color: var(--ch-surface);
  color: var(--ch-text);
  box-shadow: 0 -1px 0 var(--ch-surface);
}

.ch-workspace-tab > i:first-child {
  font-size: 0.78rem;
  opacity: 0.85;
}

.ch-workspace-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-workspace-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 0.4rem;
  color: var(--ch-muted);
}

.ch-workspace-tab-close:hover {
  background: color-mix(in srgb, var(--ch-danger, #c0392b) 14%, transparent);
  color: var(--ch-danger, #c0392b);
}

.dark .ch-workspace-tab.is-active {
  background: var(--ch-surface);
}

.ch-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: block;
  padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--ch-surface) 92%, transparent);
  border-top: 1px solid var(--ch-border);
  backdrop-filter: blur(12px);
  box-shadow: 0 -8px 24px rgba(6, 27, 69, 0.08);
}

.ch-bottom-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.ch-bottom-nav ul::-webkit-scrollbar {
  display: none;
}

.ch-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 4.35rem;
  min-height: 3.4rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.65rem;
  color: var(--ch-muted);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--ch-dur) var(--ch-ease), color var(--ch-dur) var(--ch-ease);
}

.ch-bottom-nav a i {
  font-size: 1.05rem;
}

.ch-bottom-nav a.active {
  background: color-mix(in srgb, var(--ch-primary) 14%, transparent);
  color: var(--ch-primary-dark);
}

.dark .ch-bottom-nav a.active {
  color: var(--ch-primary-light);
}

.ch-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  color: var(--ch-text);
  font-weight: 500;
}

.ch-check input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--ch-primary);
}

.ch-skeleton {
  animation: ch-pulse 1.4s ease-in-out infinite;
}

.ch-skeleton-bar {
  height: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ch-border), var(--ch-surface-2), var(--ch-border));
  background-size: 200% 100%;
}

.versaoJS {
  font-size: 0.75rem;
  color: var(--ch-muted-soft);
}

/* Compat: keep old utility-heavy markup readable */
#areaHome .content > div,
#areaHome .ch-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: auto;
  padding: 0;
}

#nameApp {
  color: var(--ch-primary);
}

#navigatorDesktop > li > a.active,
#navigatorMobile > li > a.active {
  /* handled by .ch-nav-link.active / bottom nav */
}

@keyframes ch-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ch-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ch-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.04); }
}

@media (min-width: 640px) {
  .ch-form-row-2 {
    grid-template-columns: 1fr 1fr;
  }

  .ch-result-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ch-home-banner {
    grid-template-columns: 1.35fr auto;
  }

  .ch-home-brands {
    justify-self: end;
  }

  .ch-home-primary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .ch-sidebar {
    display: flex;
    transition: width 220ms var(--ch-ease), transform 220ms var(--ch-ease), padding 220ms var(--ch-ease), opacity 180ms var(--ch-ease);
  }

  html.ch-sidebar-collapsed .ch-sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    overflow: hidden;
    border-right: 0;
    pointer-events: none;
  }

  .ch-bottom-nav {
    display: none;
  }

  .ch-main {
    padding: 1.25rem 1.5rem;
  }

  .ch-panel {
    padding: 1.5rem 1.65rem;
  }

  .ch-topbar .ch-mobile-brand {
    display: none;
  }
}

@media (max-width: 860px) {
  .ch-login {
    padding: 0;
    align-items: stretch;
  }

  .ch-login-shell {
    width: 100%;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .ch-login-brand {
    min-height: 0;
    padding: 1.35rem 1.35rem 1.15rem;
    gap: 1rem;
  }

  .ch-login-brand h1 {
    font-size: 1.45rem;
    margin-top: 0.65rem;
  }

  .ch-login-brand p {
    font-size: 0.92rem;
  }

  .ch-login-brand-foot {
    display: none;
  }

  .ch-login-form-wrap {
    padding: 1.5rem 1.25rem calc(1.75rem + env(safe-area-inset-bottom));
  }

  .ch-login-theme {
    top: 0.85rem;
    right: 0.85rem;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: var(--ch-white);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ch-steel) 55%, transparent);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Sections & layout ---------- */
.ch-stack {
  display: grid;
  gap: 1rem;
}

.ch-section {
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  background: var(--ch-surface);
  box-shadow: 0 1px 2px rgba(6, 27, 69, 0.04);
}

.ch-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}

.ch-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ch-section-head p {
  margin: 0.2rem 0 0;
  color: var(--ch-muted);
  font-size: 0.88rem;
}

.ch-section-head-row .ch-search {
  width: min(100%, 22rem);
}

.ch-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  width: min(100%, 36rem);
}

.ch-list-toolbar .ch-search {
  flex: 1 1 14rem;
  min-width: 10rem;
}

.ch-select-compact {
  flex: 0 1 auto;
  min-width: 9.5rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  font-size: 0.88rem;
}

.ch-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.ch-filter-hint {
  display: block;
  margin: -0.15rem 0 0.35rem;
  color: var(--ch-muted-soft);
  font-size: 0.78rem;
}

.ch-filter-input {
  margin-bottom: 0.45rem;
}

.ch-combo-field {
  display: grid;
  gap: 0.4rem;
}

.ch-combo-field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
}

.ch-combo-field-head .ch-label {
  margin: 0;
}

.ch-combo-field-head .ch-filter-input {
  width: min(100%, 11rem);
  min-height: 2.15rem;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.ch-code-result {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid color-mix(in srgb, var(--ch-primary) 28%, var(--ch-border));
  border-radius: var(--ch-radius);
  background:
    radial-gradient(280px 120px at 0% 0%, rgba(74, 148, 223, 0.14), transparent 70%),
    var(--ch-info-soft);
  animation: ch-fade-up 280ms var(--ch-ease) both;
}

.ch-code-result-label {
  display: block;
  color: var(--ch-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ch-code-result-value {
  display: block;
  margin-top: 0.2rem;
  color: var(--ch-primary-dark);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dark .ch-code-result-value {
  color: var(--ch-primary-light);
}

.ch-code-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  color: var(--ch-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.ch-table-section .ch-table-wrap {
  max-height: min(36rem, 58dvh);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-sm);
}

.ch-table-section .ch-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ch-surface-2);
}

.ch-file-wrap {
  display: grid;
  gap: 0.45rem;
}

.ch-file-wrap input[type="file"] {
  padding: 0.55rem;
  font-size: 0.9rem;
}

.ch-table thead th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
}

.ch-table .fa-sort,
.ch-table .fa-sort-up,
.ch-table .fa-sort-down {
  margin-left: 0.25rem;
  color: var(--ch-muted-soft);
  cursor: pointer;
}

.ch-td-actions .ch-actions {
  justify-content: flex-start;
}

.ch-empty-state {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ch-muted);
  border: 1px dashed var(--ch-border);
  border-radius: var(--ch-radius);
  background: var(--ch-surface-2);
}

.ch-empty-state i {
  font-size: 1.35rem;
  color: var(--ch-primary-light);
}

/* Mobile bottom nav + hamburger drawer */
.ch-bottom-nav ul {
  justify-content: space-around;
}

.ch-bottom-nav .ch-nav-more {
  color: var(--ch-primary-dark);
}

.dark .ch-bottom-nav .ch-nav-more {
  color: var(--ch-primary-light);
}

.ch-nav-drawer,
.ch-mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.ch-nav-drawer-backdrop,
.ch-mobile-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 23, 46, 0.5);
  backdrop-filter: blur(3px);
}

.ch-nav-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(19rem, 86vw);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: auto;
  padding: 1rem 0.9rem calc(1rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--ch-secondary) 0%, var(--ch-midnight) 100%);
  color: var(--ch-white);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 16px 0 40px rgba(7, 23, 46, 0.28);
  animation: ch-drawer-in 220ms var(--ch-ease) both;
}

@keyframes ch-drawer-in {
  from {
    transform: translateX(-100%);
    opacity: 0.7;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.ch-nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ch-nav-drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ch-nav-drawer-brand img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}

.ch-nav-drawer-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ch-white);
}

.ch-nav-drawer-panel .ch-btn-ghost {
  color: rgba(255, 255, 255, 0.85);
}

.ch-nav-drawer-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ch-nav-drawer .ch-mobile-menu a,
.ch-mobile-sheet .ch-mobile-menu a {
  color: rgba(255, 255, 255, 0.86);
}

.ch-nav-drawer .ch-mobile-menu a:hover,
.ch-nav-drawer .ch-mobile-menu a.active,
.ch-mobile-sheet .ch-mobile-menu a:hover,
.ch-mobile-sheet .ch-mobile-menu a.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ch-white);
}

.ch-nav-drawer .ch-mobile-menu i,
.ch-mobile-sheet .ch-mobile-menu i {
  color: rgba(255, 255, 255, 0.9);
}

/* legacy bottom sheet (kept for compatibility) */
.ch-mobile-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78dvh;
  overflow: auto;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  border-radius: 1rem 1rem 0 0;
  background: var(--ch-surface);
  border-top: 1px solid var(--ch-border);
  box-shadow: var(--ch-shadow);
  animation: ch-fade-up 240ms var(--ch-ease) both;
}

.ch-mobile-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.ch-mobile-sheet-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.ch-mobile-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.ch-mobile-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--ch-touch);
  padding: 0.65rem 0.8rem;
  border-radius: var(--ch-radius-sm);
  color: var(--ch-text);
  font-weight: 600;
  cursor: pointer;
}

.ch-mobile-menu a:hover,
.ch-mobile-menu a.active {
  background: color-mix(in srgb, var(--ch-primary) 12%, transparent);
  color: var(--ch-primary-dark);
}

.ch-mobile-menu li:has(> a.hidden),
.ch-mobile-menu li:has(> button.hidden) {
  display: none;
}

.dark .ch-mobile-menu a.active {
  color: var(--ch-primary-light);
}

.ch-mobile-menu i {
  width: 1.2rem;
  text-align: center;
  color: var(--ch-primary);
}

html.ch-nav-open,
html.ch-nav-open body {
  overflow: hidden;
}

.ch-mobile-only {
  display: none;
}

.ch-desktop-only {
  display: initial;
}

/* Responsive tables → cards */
@media (max-width: 900px) {
  .ch-table-responsive .ch-table {
    min-width: 0;
  }

  .ch-table-responsive .ch-table thead {
    display: none;
  }

  .ch-table-responsive .ch-table tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius-sm);
    background: var(--ch-surface);
  }

  .ch-table-responsive .ch-table tbody tr:nth-child(even) {
    background: var(--ch-surface-2);
  }

  .ch-table-responsive .ch-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--ch-border);
    white-space: normal;
    text-align: right;
  }

  .ch-table-responsive .ch-table tbody td:last-child {
    border-bottom: 0;
    padding-top: 0.65rem;
  }

  .ch-table-responsive .ch-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--ch-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: left;
  }

  .ch-table-responsive .ch-table tbody td.ch-td-actions::before {
    content: none;
  }

  .ch-table-responsive .ch-table tbody td.ch-td-actions {
    justify-content: flex-start;
  }

  .ch-table-responsive .ch-table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .ch-filter-input {
    font-size: 0.92rem;
  }

  .ch-mobile-only {
    display: block;
  }

  .ch-desktop-only {
    display: none !important;
  }

  .ch-bottom-nav .ch-nav-admin-item {
    display: none;
  }

  .ch-form-actions .ch-btn-primary {
    width: 100%;
  }

  .ch-section-head-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ch-section-head-row .ch-search {
    width: 100%;
  }

  .ch-home-banner {
    padding: 1rem;
  }

  .ch-home-brands {
    display: none;
  }

  .ch-home {
    gap: 1.1rem;
  }

  .ch-home-primary-card {
    min-height: 3.85rem;
    padding: 0.8rem 0.85rem;
  }
}

@media (min-width: 768px) {
  .ch-form-actions .ch-btn-primary {
    width: auto;
    min-width: 11rem;
  }
}



/* ---------- Screen tour ---------- */
.ch-tour-btn {
  flex-shrink: 0;
  gap: 0.4rem;
  color: var(--ch-primary);
  border-color: color-mix(in srgb, var(--ch-primary) 28%, var(--ch-border));
  background: color-mix(in srgb, var(--ch-primary) 8%, var(--ch-surface));
}

.ch-tour-btn:hover,
.ch-tour-btn:focus-visible {
  color: var(--ch-primary);
  border-color: color-mix(in srgb, var(--ch-primary) 45%, var(--ch-border));
  background: color-mix(in srgb, var(--ch-primary) 14%, var(--ch-surface));
}

.ch-home-tour-wrap {
  margin-top: 0.75rem;
}

.driver-popover.ch-driver-theme {
  background: var(--ch-surface);
  color: var(--ch-text);
  border: 1px solid var(--ch-border);
  border-radius: 0.9rem;
  box-shadow: var(--ch-shadow-lg, 0 18px 40px rgba(7, 23, 46, 0.18));
  max-width: 22rem;
}

.driver-popover.ch-driver-theme .driver-popover-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.driver-popover.ch-driver-theme .driver-popover-description {
  color: var(--ch-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.driver-popover.ch-driver-theme .driver-popover-progress-text {
  color: var(--ch-muted-soft, var(--ch-muted));
  font-size: 0.78rem;
  font-weight: 600;
}

.driver-popover.ch-driver-theme .driver-popover-navigation-btns {
  gap: 0.45rem;
}

.driver-popover.ch-driver-theme .driver-popover-prev-btn,
.driver-popover.ch-driver-theme .driver-popover-next-btn {
  border-radius: 0.55rem;
  text-shadow: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.driver-popover.ch-driver-theme .driver-popover-prev-btn {
  background: transparent;
  color: var(--ch-muted);
  border: 1px solid var(--ch-border);
  text-shadow: none;
}

.driver-popover.ch-driver-theme .driver-popover-next-btn {
  background: var(--ch-primary);
  color: #fff;
  border: 1px solid var(--ch-primary);
  text-shadow: none;
}

.driver-popover.ch-driver-theme .driver-popover-close-btn {
  color: var(--ch-muted);
}

.dark .driver-popover.ch-driver-theme {
  background: var(--ch-surface);
  border-color: var(--ch-border);
}
