/* ================================================================
   ClinicFlow2 — Modern Reset
   Box-sizing, rimozione margini default, focus-visible accessibile.
   ================================================================ */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  line-height: var(--leading-normal);
  color-scheme: light;
}

[data-theme="dark"] { color-scheme: dark; }

body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }

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

button { background: none; border: none; cursor: pointer; }

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

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

h1, h2, h3, h4, h5, h6 { font-weight: var(--weight-semibold); line-height: var(--leading-tight); }

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

ol, ul { padding: 0; list-style: none; }

hr { border: none; border-top: 1px solid var(--color-border); }

/* Focus visibile sempre — accessibilità WCAG */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* Skip-to-content (screen reader friendly) */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-text-inverted);
  padding: var(--space-3) var(--space-4);
  z-index: var(--z-tooltip);
  transition: top var(--motion-base) var(--ease-standard);
}
.skip-to-content:focus { top: 0; }

/* Scrollbar coerente */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: var(--radius-full); border: 2px solid var(--color-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--neutral-400); }

/* Sidebar: scrollbar scura */
.app-sidebar ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-color: var(--sidebar-bg); }
.app-sidebar ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

/* Alpine */
[x-cloak] { display: none !important; }

/* Selection */
::selection { background: var(--brand-500); color: #fff; }

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