/* ALLANDRICH UI/UX Completion Edition v3
   Shared consistency, accessibility and component polish for public/user/admin. */
:root{
  --ar-ui-radius:16px;
  --ar-ui-radius-sm:11px;
  --ar-ui-space-1:.35rem;
  --ar-ui-space-2:.65rem;
  --ar-ui-space-3:1rem;
  --ar-ui-space-4:1.5rem;
  --ar-ui-focus:0 0 0 .24rem rgba(255,211,90,.32);
}

/* Keyboard access */
.skip-link{
  position:fixed!important;top:.65rem;left:.65rem;z-index:2000;
  padding:.65rem 1rem;border-radius:10px;background:#fff;color:#111!important;
  font-weight:800;text-decoration:none;transform:translateY(-180%);
}
.skip-link:focus{transform:translateY(0)}
:where(a,button,input,select,textarea,[tabindex]):focus-visible{
  outline:2px solid #ffd35a!important;outline-offset:2px!important;box-shadow:var(--ar-ui-focus)!important;
}
:where(button,.btn,.nav-link,.dropdown-item){touch-action:manipulation}

/* Consistent page canvas and headers */
.app-content,.ar-uiux-page,main#main-content{min-width:0}
.app-content>.uiux-page-header,
.app-content>.d-flex:first-child:has(h1,h2,h3),
.app-content>.row:first-child:has(h1,h2,h3),
main#main-content .uiux-page-header{
  margin-bottom:var(--ar-ui-space-4);
}
.uiux-page-header{
  display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;flex-wrap:wrap;
}
.uiux-page-header-copy{min-width:0;flex:1 1 320px}
.uiux-page-title{margin:0 0 .3rem;font-weight:800;letter-spacing:-.025em;line-height:1.18}
.uiux-page-description{margin:0;max-width:72ch;line-height:1.65}
.uiux-page-actions{display:flex;gap:.65rem;align-items:center;flex-wrap:wrap}

/* Cards and metrics */
.app-content .card,.app-content .stat-card,.app-content .metric-card,.app-content .dashboard-card,
main#main-content .card{
  border-radius:var(--ar-ui-radius);overflow:hidden;
}
.app-content .row>[class*="col-"]>.card,
.app-content .row>[class*="col-"]>.stat-card,
.app-content .row>[class*="col-"]>.metric-card{height:100%}
.card-header{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap}
.card-title{margin-bottom:0;font-weight:750}
.card-footer{margin-top:auto}
.uiux-card-actions{display:flex;gap:.5rem;flex-wrap:wrap}

/* Forms */
.form-label,label{font-weight:650}
.uiux-required-marker{margin-left:.25rem;color:#ff8a8a;font-weight:900}
.form-text{line-height:1.45}
.form-control,.form-select,.input-group-text,textarea{border-radius:var(--ar-ui-radius-sm)}
.input-group>.form-control:not(:last-child),.input-group>.form-select:not(:last-child){border-start-end-radius:0;border-end-end-radius:0}
.input-group>.btn:not(:first-child),.input-group>.input-group-text:not(:first-child){border-start-start-radius:0;border-end-start-radius:0}
.invalid-feedback,.valid-feedback{font-weight:600}
fieldset{min-width:0}
legend{font-size:1rem;font-weight:750}

/* Buttons and action zones */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.45rem;border-radius:11px;font-weight:700;white-space:normal;text-align:center}
.btn-icon-only{width:44px;padding-inline:0}
.uiux-primary-actions{display:flex;gap:.65rem;flex-wrap:wrap;align-items:center}

/* Tables */
.uiux-table-region{position:relative;border-radius:var(--ar-ui-radius);overflow:auto;-webkit-overflow-scrolling:touch}
.uiux-table-region:focus-visible{outline:2px solid #ffd35a;outline-offset:2px}
.app-content table,.app-content .table{margin-bottom:0}
.app-content table caption,.app-content .table caption{caption-side:top;padding:.75rem 1rem;font-weight:750}
.app-content table th,.app-content .table th{font-weight:750;white-space:nowrap}
.app-content table td,.app-content .table td{vertical-align:middle}
.uiux-empty-state{text-align:center;padding:2.25rem 1rem!important}
.uiux-empty-state-icon{display:inline-flex;width:48px;height:48px;align-items:center;justify-content:center;border-radius:50%;margin-bottom:.75rem;font-size:1.2rem}
.uiux-empty-state-title{font-weight:800;margin-bottom:.25rem}
.uiux-empty-state-text{margin:0;opacity:.78}

/* Status badges created/normalized by JS */
.uiux-status{display:inline-flex;align-items:center;gap:.35rem;border-radius:999px;padding:.3rem .62rem;font-size:.78rem;font-weight:800;line-height:1.2}
.uiux-status::before{content:"";width:.42rem;height:.42rem;border-radius:50%;background:currentColor;opacity:.8}
.uiux-status-success{background:rgba(34,197,94,.14);color:#75e69a}
.uiux-status-warning{background:rgba(245,158,11,.16);color:#ffd166}
.uiux-status-danger{background:rgba(239,68,68,.16);color:#ff9292}
.uiux-status-info{background:rgba(59,130,246,.16);color:#8fc0ff}
.uiux-status-muted{background:rgba(148,163,184,.14);color:#c3cbd7}

/* Breadcrumbs, alerts, tabs and pagination */
.breadcrumb{align-items:center}
.alert{border-radius:var(--ar-ui-radius);line-height:1.55}
.nav-tabs,.nav-pills{gap:.25rem}
.nav-tabs .nav-link,.nav-pills .nav-link{border-radius:10px;font-weight:700}
.pagination .page-link{min-width:42px;min-height:42px;display:flex;align-items:center;justify-content:center}

/* Better long-content behavior */
.app-content :where(p,li,td,th,.card-body,.alert),main#main-content :where(p,li,td,th,.card-body,.alert){overflow-wrap:anywhere}
.app-content pre,.app-content code,main#main-content pre,main#main-content code{word-break:break-word}

/* Screen-reader-only utility if Bootstrap is unavailable during early paint */
.uiux-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}

@media (max-width:767.98px){
  .uiux-page-header{display:block}
  .uiux-page-actions,.uiux-primary-actions{display:grid;grid-template-columns:1fr;width:100%;margin-top:.85rem}
  .uiux-page-actions>.btn,.uiux-primary-actions>.btn{width:100%}
  .app-content .card-header{align-items:stretch}
  .app-content .card-header>.btn,.app-content .card-header>.uiux-card-actions{width:100%}
  .app-content .card-header>.uiux-card-actions{display:grid;grid-template-columns:1fr}
  .app-content .table-responsive,.app-content .uiux-table-region{border-radius:12px}
  .app-content form .row>[class*="col-"]{margin-bottom:.15rem}
}

@media (max-width:479.98px){
  .uiux-page-title{font-size:1.3rem}
  .btn{min-height:46px}
  .uiux-empty-state{padding:1.6rem .75rem!important}
}

@media (prefers-reduced-motion:reduce){.skip-link{transition:none}}
