/* ============================================================
   SAFENTRA DESIGN SYSTEM — BASE
   Reset, document defaults, element styling, accessibility.
   ============================================================ */

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{
  margin:0;
  font-family:var(--font-sans);
  font-size:var(--text-base);
  line-height:var(--lh-base);
  color:var(--color-text);
  background:var(--color-bg);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
[hidden]{display:none!important}

h1,h2,h3,h4,h5,h6{margin:0;font-weight:var(--fw-semibold);line-height:var(--lh-snug);color:var(--color-text)}
h1{font-size:var(--text-3xl);letter-spacing:-.02em}
h2{font-size:var(--text-2xl);letter-spacing:-.015em}
h3{font-size:var(--text-xl)}
h4{font-size:var(--text-lg)}
h5{font-size:var(--text-base)}
h6{font-size:var(--text-sm);text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-2)}
p{margin:0}
small{font-size:var(--text-xs)}

a{color:var(--color-primary);text-decoration:none}
a:hover{color:var(--color-primary-hover);text-decoration:underline}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{
  outline:2px solid var(--color-primary);outline-offset:2px;border-radius:var(--r-xs);
}
img,svg,video{display:inline-block;vertical-align:middle;max-width:100%}
ul,ol{margin:0;padding:0;list-style:none}
button{margin:0;padding:0;border:0;background:none;font:inherit;color:inherit;cursor:pointer}
input,select,textarea{font:inherit;color:inherit}
label{display:block}
table{border-collapse:collapse}
hr{border:0;border-top:1px solid var(--color-border);margin:var(--sp-6) 0}
code,kbd,pre,samp{font-family:var(--font-mono);font-size:.92em}
code{background:var(--color-surface-3);border:1px solid var(--color-border);border-radius:var(--r-xs);padding:1px 5px;color:var(--color-text-2)}
pre{background:var(--color-surface-2);border:1px solid var(--color-border);border-radius:var(--r-md);padding:var(--sp-4);overflow:auto;margin:0}
pre code{background:none;border:0;padding:0}
kbd{
  display:inline-flex;align-items:center;min-height:20px;padding:0 6px;
  background:var(--color-surface-2);border:1px solid var(--color-border-strong);
  border-bottom-width:2px;border-radius:var(--r-sm);
  font-size:var(--text-2xs);font-weight:var(--fw-semibold);color:var(--color-text-2);
  letter-spacing:.04em;
}
::selection{background:rgba(15,98,254,.18)}
[data-theme="dark"] ::selection{background:rgba(79,132,255,.3)}

/* Scrollbars */
*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-thumb{background:var(--color-border-strong);border-radius:6px;border:2px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-thumb:hover{background:var(--color-text-3);border:2px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-corner{background:transparent}

/* Consistent inline icon */
.ic{width:18px;height:18px;flex:none;vertical-align:-3px;stroke:currentColor;fill:none;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.ic-14{width:14px;height:14px}.ic-16{width:16px;height:16px}.ic-20{width:20px;height:20px}.ic-22{width:22px;height:22px}.ic-24{width:24px;height:24px}.ic-28{width:28px;height:28px}.ic-32{width:32px;height:32px}

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

.skip-link{
  position:fixed;top:-48px;left:16px;z-index:var(--z-toast);
  background:var(--color-primary);color:var(--color-on-primary);
  padding:8px 14px;border-radius:var(--r-md);font-weight:var(--fw-semibold);font-size:var(--text-sm);
  transition:top var(--t) var(--ease);text-decoration:none;
}
.skip-link:focus{top:12px;color:var(--color-on-primary)}

/* Focus ring utility for custom controls */
.focus-ring:focus-visible{outline:none;box-shadow:var(--ring)}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
}
