:root{
  --motion-fast: 150ms;
  --motion-med: 220ms;
  --focus-ring: rgb(var(--brand, 59 130 246) / 0.55);
}

*,
*::before,
*::after{
  box-sizing: border-box;
}

img,
svg,
video,
canvas{
  max-width: 100%;
  height: auto;
}

body{
  overflow-x: hidden;
}

button,
a,
.btn,
.btn-brand,
.nav-btn,
.nav-pill,
.chip,
.pill{
  transition: transform var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    color var(--motion-fast) ease,
    opacity var(--motion-fast) ease;
}

.btn:hover,
.btn-brand:hover,
.nav-btn:hover,
.nav-pill:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.12);
}

.btn:active,
.btn-brand:active,
.nav-btn:active,
.nav-pill:active,
button:active{
  transform: translateY(1px) scale(0.99);
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}


main,
.page-shell,
.page-content{
  min-width: 0;
}

table{
  width: 100%;
  border-collapse: collapse;
}

.table-scroll,
.table-responsive,
.table-wrap{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table,
.table-responsive table,
.table-wrap table{
  min-width: 640px;
}

body.density-compact .table-scroll table,
body.density-compact .table-responsive table,
body.density-compact .table-wrap table{
  min-width: 560px;
}

body.density-compact .table-scroll th,
body.density-compact .table-scroll td,
body.density-compact .table-responsive th,
body.density-compact .table-responsive td,
body.density-compact .table-wrap th,
body.density-compact .table-wrap td{
  padding: 0.45rem 0.6rem !important;
  font-size: 0.8125rem;
  line-height: 1.25;
}

body.density-compact .card.p-8{
  padding: 1rem !important;
}

body.density-compact .card.p-6,
body.density-compact .card-hover.p-6{
  padding: 0.95rem !important;
}

body.density-compact .card.p-5,
body.density-compact .card-hover.p-5{
  padding: 0.85rem !important;
}

body.density-compact .card.p-4,
body.density-compact .card-hover.p-4,
body.density-compact .stats-card.p-4{
  padding: 0.75rem !important;
}

pre,
code{
  white-space: pre-wrap;
  word-break: break-word;
}

.form-banner{
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  font-size: 0.875rem;
}

.field-error{
  border-color: rgba(239, 68, 68, 0.9) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

label.field-error{
  border-radius: 0.5rem;
}

.form-error{
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #ef4444;
  line-height: 1.35;
}

.search-bar{
  display:flex;
  flex-wrap:wrap;
  gap:0.5rem;
  align-items:center;
}

.search-group{
  display:flex;
  align-items:center;
  gap:0.5rem;
  flex:1 1 220px;
  min-width:0;
}

.search-action{
  flex:0 0 auto;
}

@media (max-width: 640px){
  .search-bar{
    flex-direction:column;
    align-items:stretch;
  }

  .search-group,
  .search-action{
    width:100%;
  }

  [role="tablist"]{
    overflow-x:auto;
    flex-wrap:nowrap;
    gap:0.5rem;
    padding-bottom:0.25rem;
  }

  [role="tablist"] > *{
    flex:0 0 auto;
  }

  .tab-btn,
  .tabbtn,
  .tabbtn2,
  .nav-btn,
  .nav-pill,
  .top-tab{
    padding:0.35rem 0.6rem !important;
    font-size:0.75rem !important;
  }

  h1{ font-size:1.6rem; line-height:1.2; }
  h2{ font-size:1.3rem; line-height:1.25; }
  h3{ font-size:1.1rem; line-height:1.3; }
  .text-3xl{ font-size:1.5rem !important; line-height:1.2 !important; }
  .text-2xl{ font-size:1.25rem !important; line-height:1.25 !important; }
  .text-xl{ font-size:1.125rem !important; line-height:1.3 !important; }
}

@media (prefers-reduced-motion: reduce){
  *,
  *::before,
  *::after{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
