/* ============================================================
   SKETCH STYLE — leggibile, leggero, Swiss Made
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&family=Patrick+Hand&display=swap');

/* ---- Variabili ---- */
:root {
  --ink:         #1c1917;
  --ink-light:   #57534e;
  --paper:       #fdf8f0;
  --paper-warm:  #f5ede0;
  --paper-card:  #fffcf5;
  --accent:      #2563eb;
  --swiss-red:   #D52B1E;
  --green:       #16a34a;
  --red:         #dc2626;
  --hi-yellow:   #fde047;
  --hi-pink:     #fbcfe8;
  --hi-blue:     #bae6fd;
  --hi-green:    #bbf7d0;
  /* Ombre ridotte — meno pesanti */
  --shadow:      1px 2px 0 rgba(28,25,23,0.55);
  --shadow-sm:   1px 1px 0 rgba(28,25,23,0.45);
  --shadow-lg:   2px 3px 0 rgba(28,25,23,0.55);
  /* Raggi irregolari ma moderati */
  --r1: 6px 14px 8px 18px / 16px 6px 18px 8px;
  --r2: 8px 6px 18px 12px / 6px 16px 10px 18px;
  --r3: 14px 6px 12px 8px / 6px 14px 8px 12px;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Patrick Hand', 'Caveat', cursive;
  font-size: 18px;
  line-height: 1.65;
  background-color: var(--paper);
  color: var(--ink);
  background-image:
    radial-gradient(900px 520px at 14% 10%, rgba(186,230,253,0.22), transparent 60%),
    radial-gradient(820px 480px at 86% 18%, rgba(251,207,232,0.18), transparent 60%),
    radial-gradient(1000px 620px at 70% 92%, rgba(187,247,208,0.12), transparent 65%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 32px,
      rgba(180,155,110,0.035) 32px,
      rgba(180,155,110,0.035) 33px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 140px,
      rgba(213,43,30,0.018) 140px,
      rgba(213,43,30,0.018) 141px
    );
  background-attachment: scroll;
}

/* ---- Tipografia ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Caveat', cursive;
  line-height: 1.2;
}
h1 { font-size: 2rem;   font-weight: 700; }
h2 { font-size: 1.6rem; font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; }

/* Classi font Tailwind → Caveat */
.font-bold, .font-semibold { font-family: 'Caveat', cursive; }

/* ---- Testo piccolo leggibile ---- */
.text-xs  { font-size: 15px !important; font-family: 'Patrick Hand', cursive; }
.text-sm  { font-size: 17px !important; font-family: 'Patrick Hand', cursive; }
.text-base{ font-size: 18px !important; }
.text-lg  { font-size: 20px !important; }
.text-2xl { font-size: 1.9rem !important; font-family: 'Caveat', cursive; }
.text-3xl { font-size: 2rem   !important; font-family: 'Caveat', cursive; }

/* Label e intestazioni tabella sempre leggibili */
label {
  font-family: 'Patrick Hand', cursive;
  font-size: 16px;
  color: var(--ink);
}
thead th {
  font-family: 'Caveat', cursive;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink) !important;
}

/* ---- Cards ---- */
.bg-white {
  background: var(--paper-card) !important;
  border: 1px solid rgba(28,25,23,0.7) !important;
  border-radius: var(--r1) !important;
  box-shadow: var(--shadow) !important;
}
.bg-gray-50 {
  background: var(--paper-warm) !important;
  border: 1px solid rgba(28,25,23,0.24) !important;
  border-radius: var(--r2) !important;
}
.bg-blue-50 {
  background: #eff6ff !important;
  border: 1.5px solid rgba(37,99,235,0.5) !important;
  border-radius: var(--r3) !important;
}
.bg-yellow-50 {
  background: #fefce8 !important;
  border: 1.5px solid rgba(202,138,4,0.5) !important;
  border-radius: var(--r1) !important;
}
.bg-green-50 { background: #f0fdf4 !important; border: 1.5px solid rgba(22,163,74,0.4) !important; border-radius: var(--r2) !important; }
.bg-red-50   { background: #fef2f2 !important; border: 1.5px solid rgba(220,38,38,0.4) !important; border-radius: var(--r3) !important; }

/* ---- Bordi ---- */
.border, .border-gray-200, .border-gray-300 {
  border-color: rgba(28,25,23,0.35) !important;
}
.divide-y > *:not(:first-child) {
  border-top: 1px dashed rgba(28,25,23,0.16) !important;
}

/* ---- Overflow hidden (wrapper tabelle) ---- */
.overflow-hidden {
  border: 1px solid rgba(28,25,23,0.7) !important;
  border-radius: var(--r1) !important;
  box-shadow: var(--shadow) !important;
}

/* ---- Inputs ---- */
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="tel"],
select, textarea {
  font-family: 'Patrick Hand', cursive !important;
  font-size: 17px !important;
  background: var(--paper-card) !important;
  border: 1.5px solid rgba(28,25,23,0.5) !important;
  border-radius: 4px 12px 5px 10px / 10px 4px 12px 5px !important;
  color: var(--ink) !important;
  outline: none !important;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 1px 2px 0 rgba(37,99,235,0.7) !important;
}
input[disabled], input[readonly] {
  background: var(--paper-warm) !important;
  opacity: 0.65;
}
::placeholder { color: #a8a29e; font-family: 'Patrick Hand', cursive; }

/* ---- Bottoni — meno pesanti ---- */
button[type="submit"],
button[type="button"] {
  font-family: 'Caveat', cursive !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  border: 1.5px solid rgba(28,25,23,0.75) !important;
  border-radius: 5px 14px 6px 16px / 14px 5px 16px 6px !important;
  box-shadow: var(--shadow-sm) !important;
  transform: rotate(-0.3deg);
  transition: box-shadow 0.1s ease, transform 0.1s ease !important;
  cursor: pointer;
}
button:hover { box-shadow: 1px 1px 0 rgba(28,25,23,0.35) !important; transform: rotate(-0.3deg) translate(1px, 1px) !important; }
button:active { box-shadow: 0 0 0 rgba(28,25,23,0.25) !important; transform: rotate(-0.3deg) translate(2px, 2px) !important; }

.bg-blue-600 { background-color: var(--accent) !important; color: #fff !important; }
.bg-blue-700, .hover\:bg-blue-700:hover { background-color: #1d4ed8 !important; }

/* ---- Tabelle ---- */
table { border-collapse: separate !important; border-spacing: 0 !important; }
thead { background: var(--paper-warm) !important; }
thead th { border-bottom: 2px solid var(--ink) !important; padding: 10px 16px !important; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--paper-warm) !important; }
tbody td { padding: 10px 16px !important; border-bottom: 1px dashed rgba(28,25,23,0.16) !important; font-family: 'Patrick Hand', cursive; font-size: 17px; }

/* ---- Badges ---- */
span[class*="rounded-full"] {
  border-radius: 40% 60% 60% 40% / 50% 50% 50% 50% !important;
  font-family: 'Caveat', cursive !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  border: 1.5px solid var(--ink) !important;
}
.bg-green-100  { background: var(--hi-green)  !important; color: #166534 !important; }
.bg-yellow-100 { background: var(--hi-yellow) !important; color: #713f12 !important; }
.bg-blue-100   { background: var(--hi-blue)   !important; color: #1e40af !important; }
.bg-gray-100   { background: var(--paper-warm)!important; color: #44403c !important; }
.bg-red-100    { background: var(--hi-pink)   !important; color: #9f1239 !important; }
.bg-purple-100 { background: #f5d0fe         !important; color: #6b21a8 !important; }

/* ---- Sidebar ---- */
aside {
  background: var(--paper-warm) !important;
  border-right: 2px solid var(--ink) !important;
  box-shadow: none !important;
}
aside .border-b, aside .border-t {
  border-color: rgba(28,25,23,0.25) !important;
  border-style: dashed !important;
}
aside a {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.12s, transform 0.1s;
  text-decoration: none !important;
}
aside a:hover { transform: translateX(2px); }

/* ---- Link ---- */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.text-gray-500 { color: var(--ink-light); }
a.text-gray-500:hover { color: var(--ink); text-decoration: none; }

/* ---- Progress bars ---- */
.h-1\.5 {
  border-radius: 99px;
  border: 1px solid rgba(28,25,23,0.2);
}

/* ---- Upload zone ---- */
label.flex.flex-col.items-center {
  border: 2px dashed rgba(28,25,23,0.45) !important;
  border-radius: var(--r1) !important;
  background: var(--paper-warm) !important;
}
label.flex.flex-col.items-center:hover { background: var(--hi-blue) !important; }

/* ---- Code ---- */
code {
  font-family: 'Caveat', cursive !important;
  font-size: 14px;
  background: var(--hi-yellow) !important;
  border: 1px solid rgba(28,25,23,0.25);
  border-radius: 3px 8px 4px 6px;
  padding: 1px 5px;
  color: var(--ink) !important;
}

/* ---- Selection & scroll ---- */
::selection { background: var(--hi-yellow); color: var(--ink); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--paper-warm); }
::-webkit-scrollbar-thumb { background: rgba(28,25,23,0.3); border-radius: 3px; }

/* ---- Focus ---- */
*:focus-visible {
  outline: 2px dashed var(--accent) !important;
  outline-offset: 2px;
}

/* ====================================================
   SWISS MADE — badge + accenti svizzeri
   ==================================================== */
.swiss-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Patrick Hand', cursive;
  font-size: 13px;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.swiss-cross {
  width: 16px;
  height: 16px;
  background: var(--swiss-red);
  border-radius: 2px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.swiss-cross::before {
  content: '';
  display: block;
  width: 8px;
  height: 6px;
  background: white;
  clip-path: polygon(30% 0%, 70% 0%, 70% 30%, 100% 30%, 100% 70%, 70% 70%, 70% 100%, 30% 100%, 30% 70%, 0% 70%, 0% 30%, 30% 30%);
}

/* ---- Step progress dots ---- */
.step-dot {
  width: 30px;
  height: 30px;
  border-radius: 50% 60% 50% 40%/60% 50% 40% 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.step-dot.active  { background: var(--accent); color: white; box-shadow: 1px 2px 0 var(--ink); }
.step-dot.done    { background: var(--hi-green); color: #166534; }
.step-dot.pending { background: var(--paper-warm); color: var(--ink-light); opacity: 0.7; }

/* ---- Sketch annotation arrow ---- */
.sketch-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Caveat', cursive;
  font-size: 14px;
  color: var(--ink-light);
  font-style: italic;
}

/* ====================================================
   MOBILE RESPONSIVE
   ==================================================== */

/* Tables scroll horizontally on small screens */
@media (max-width: 767px) {
  .overflow-hidden { overflow-x: auto !important; }

  table { font-size: 15px; min-width: 560px; }
  thead th { padding: 8px 12px !important; }
  tbody td { padding: 8px 12px !important; }

  /* Grid → single column */
  .grid-cols-2, .grid-cols-3, .md\:grid-cols-2, .md\:grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  .lg\:grid-cols-3, .lg\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Touch targets: min 44px height */
  a, button, input[type="submit"], input[type="button"],
  select, label[for], .nav-link {
    min-height: 44px;
  }

  /* Inputs: full width + comfortable size */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="date"], input[type="number"], input[type="tel"],
  select, textarea {
    font-size: 16px !important; /* prevents iOS zoom */
    width: 100%;
  }

  /* Cards: reduce horizontal padding */
  .px-6 { padding-left: 14px !important; padding-right: 14px !important; }
  .px-8 { padding-left: 14px !important; padding-right: 14px !important; }

  /* Headings slightly smaller */
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.4rem; }

  /* Flex row → column for certain layouts */
  .sm\:flex-row { flex-direction: column !important; }

  /* Hide decorative doodle SVG on mobile for performance */
  .fixed.opacity-\[0\.04\] { display: none !important; }

  /* Flash messages full-width on mobile */
  #flash-container {
    left: 8px !important;
    right: 8px !important;
    top: 60px !important;
  }
  #flash-container > div {
    max-width: 100% !important;
    min-width: unset !important;
  }

  /* Buttons: full-width on mobile forms */
  form button[type="submit"] { width: 100%; }

  /* Tabs / pill nav: horizontal scroll */
  .flex.gap-2.border-b, .flex.gap-1 { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
}

/* ---- Upload drop zone ---- */
.upload-zone {
  border: 2.5px dashed rgba(28,25,23,0.4);
  border-radius: var(--r1);
  background: var(--paper-warm);
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over {
  background: #eff6ff;
  border-color: var(--accent);
  border-style: dashed;
}
.upload-zone.has-file {
  background: #f0fdf4;
  border-color: var(--green);
  border-style: solid;
}
