/* ============================================================
   Gallo Rosso — Editorial Equestre layer
   Atop app.css (Tailwind precompiled). Hand-tuned components
   for the authenticated PWA shell. Stable Journal mood:
   parchment, hairlines, big serif numerals, rooster red CTAs.
   ============================================================ */

:root {
  /* Brand (invariati) */
  --gr-forest:    #2c4a3a;
  --gr-forest-d:  #1f3329;
  --gr-rooster:   #c9311e;
  --gr-bordeaux:  #8a2113;
  --gr-ochre:     #c89a4a;

  /* Neutri ridefiniti (off-white, niente paper/sand cromatici) */
  --gr-cream:     #fafaf7;
  --gr-ivory:     #ffffff;
  --gr-paper:     #ffffff;
  --gr-sand:      #f5f4ef;
  --gr-surface:   #ffffff;
  --gr-surface-2: #f5f4ef;
  --gr-char:      #231812;

  /* Testo */
  --gr-ink:       #1a1310;
  --gr-ink-soft:  rgba(26,19,16,.65);
  --gr-ink-mute:  rgba(26,19,16,.45);
  --gr-text-2:    rgba(26,19,16,.65);

  /* Bordi */
  --gr-rule:      rgba(26,19,16,.10);
  --gr-rule-soft: rgba(26,19,16,.06);
  --gr-border:    rgba(26,19,16,.10);

  /* Stato */
  --gr-success:   #2c4a3a;

  /* Layout */
  --gr-shell-w:   240px;
  --gr-tabbar-h:  56px;
}

html, body { background-color: var(--gr-cream); color: var(--gr-ink); }
body {
  font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Hide the legacy top header so the new shell can take over */
body > header { display: none !important; }

/* Type utilities — gli ex-"editorial" diventano sans compatti */
.gr-serif    { font-family: "Instrument Sans", ui-sans-serif, sans-serif; font-weight: 600; }
.gr-numeric  { font-family: "Instrument Sans", ui-sans-serif, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.gr-kicker   { font-family: "Instrument Sans", ui-sans-serif, sans-serif; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 500; color: var(--gr-text-2); }
.gr-kicker--bright { color: rgba(255,255,255,.55); }

/* Hairlines */
.gr-rule     { border: 0; border-top: 1px solid var(--gr-border); }
.gr-rule--soft { border-top-color: var(--gr-rule-soft); }

/* Paper → diventa "card" */
.gr-paper, .gr-paper--ivory {
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
}

/* Grain texture disattivata ovunque */
.gr-grain::before { display: none !important; }

/* ---------- Shell layout ---------- */

.gr-shell {
  display: grid;
  grid-template-columns: var(--gr-shell-w) 1fr;
  min-height: 100svh;
}
@media (max-width: 900px) {
  .gr-shell { grid-template-columns: 1fr; padding-bottom: var(--gr-tabbar-h); }
}

.gr-aside {
  position: sticky; top: 0; align-self: start;
  height: 100svh;
  background: linear-gradient(180deg, var(--gr-forest) 0%, var(--gr-forest-d) 100%);
  color: rgba(251,245,232,.85);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 16px;
  border-right: 1px solid rgba(0,0,0,.18);
  overflow-y: auto;
}
@media (max-width: 900px) { .gr-aside { display: none; } }

.gr-aside__brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--gr-ivory);
  padding: 0 4px;
}
.gr-aside__brand-mark {
  width: 48px; height: 48px;
  background: var(--gr-rooster);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gr-ivory);
  font-family: "Instrument Sans", sans-serif; font-weight: 700; font-size: 13px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.18);
}
.gr-aside__brand-name {
  font-family: "Instrument Sans", sans-serif;
  font-size: 15px; line-height: 1; letter-spacing: 0; font-weight: 600;
}
.gr-aside__brand-sub {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(251,245,232,.45); margin-top: 3px;
}

.gr-aside__user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  background: rgba(255,255,255,.03);
}
.gr-aside__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gr-ochre); color: var(--gr-char);
  display: grid; place-items: center;
  font-family: "Instrument Sans", sans-serif; font-weight: 700;
  font-size: 12px;
}
.gr-aside__user-name { font-size: 13px; line-height: 1.2; color: var(--gr-ivory); font-weight: 500; }
.gr-aside__user-role {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(251,245,232,.45); margin-top: 2px;
}

.gr-aside__group { display: flex; flex-direction: column; gap: 2px; }
.gr-aside__group-label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255,255,255,.45);
  margin: 8px 8px 4px;
  font-weight: 500;
}

.gr-aside__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: rgba(251,245,232,.85);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
  position: relative;
}
.gr-aside__link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.gr-aside__icon-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.gr-aside__dot {
  position: absolute; top: -2px; right: -2px;
  width: 6px; height: 6px;
  background: var(--gr-rooster);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--gr-forest);
}
.gr-aside__link:hover { background: rgba(255,255,255,.06); color: var(--gr-ivory); }
.gr-aside__link[aria-current="page"] {
  background: rgba(255,255,255,.10);
  color: var(--gr-ivory);
}
.gr-aside__link[aria-current="page"] svg { opacity: 1; }
.gr-aside__badge {
  margin-left: auto;
  background: var(--gr-rooster);
  color: var(--gr-ivory);
  font-size: 10px; font-weight: 600;
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 16px; text-align: center;
  line-height: 1.4;
}

.gr-aside__logout {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.10);
}
.gr-aside__logout button {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(251,245,232,.85);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px; letter-spacing: 0.04em; text-transform: none;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.gr-aside__logout button:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.32); }

.gr-aside__brand-mark--img {
  background: var(--gr-ivory);
  padding: 4px;
  object-fit: contain;
  font-size: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.1);
}

/* ---------- Main column ---------- */

.gr-main {
  min-width: 0;
  padding: 24px 32px 64px;
  max-width: 1280px;
  position: relative;
}
@media (max-width: 900px) { .gr-main { padding: 12px 12px 32px; } }

.gr-pushprompt {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(201,49,30,.06);
  border: 1px solid rgba(201,49,30,.25);
  border-left: 3px solid var(--gr-rooster);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 8px 0;
}
.gr-pushprompt[hidden] { display: none; }
.gr-pushprompt__icon {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(201,49,30,.12);
  color: var(--gr-rooster);
  display: flex; align-items: center; justify-content: center;
}
.gr-pushprompt__icon svg { width: 16px; height: 16px; }
.gr-pushprompt__body { flex: 1 1 auto; min-width: 0; }
.gr-pushprompt__title {
  margin: 0 0 1px;
  font-family: "Instrument Sans", sans-serif;
  font-size: 13.5px;
  color: var(--gr-ink);
  font-weight: 600;
}
.gr-pushprompt__text {
  margin: 0;
  font-size: 12.5px;
  color: var(--gr-text-2);
  line-height: 1.4;
}
.gr-pushprompt__actions {
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto;
}
.gr-pushprompt__link {
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gr-text-2);
  text-decoration: none;
}
.gr-pushprompt__link:hover { color: var(--gr-rooster); }
@media (max-width: 720px) {
  .gr-pushprompt { flex-wrap: wrap; }
  .gr-pushprompt__body { flex-basis: calc(100% - 40px); }
  .gr-pushprompt__actions { flex-basis: 100%; justify-content: flex-end; }
}

.gr-masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--gr-border);
  margin-bottom: 20px;
}
@media (max-width: 900px) { .gr-masthead { padding: 4px 0 12px; margin-bottom: 14px; } }

.gr-masthead__kicker {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gr-text-2);
  font-weight: 500;
}
.gr-masthead__title {
  font-family: "Instrument Sans", sans-serif;
  font-weight: 600; line-height: 1.2;
  font-size: 22px;
  margin-top: 4px;
  letter-spacing: -0.01em;
  color: var(--gr-ink);
}
.gr-masthead__title em { font-style: normal; color: var(--gr-rooster); font-weight: 600; }
.gr-masthead__meta {
  font-size: 12px; letter-spacing: 0; text-transform: none;
  color: var(--gr-text-2);
  text-align: right;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .gr-masthead { grid-template-columns: 1fr; }
  .gr-masthead__meta { text-align: left; }
}

/* ---------- Section heading ---------- */

.gr-section { margin-top: 24px; }
.gr-section__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gr-border);
  margin-bottom: 12px;
}
.gr-section__title {
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px; font-weight: 600; letter-spacing: 0;
  color: var(--gr-ink);
}
.gr-section__kicker {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gr-text-2);
  font-weight: 500;
  margin-bottom: 2px;
}
.gr-section__action {
  font-size: 12.5px; color: var(--gr-forest); text-decoration: none;
  border-bottom: 0;
  padding-bottom: 0;
  transition: color .15s;
  font-weight: 500;
}
.gr-section__action:hover { color: var(--gr-rooster); text-decoration: underline; }

/* ---------- Stat cards (compact) ---------- */

.gr-statgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border: 0;
  margin-top: 12px;
}
@media (max-width: 900px) { .gr-statgrid { grid-template-columns: repeat(2, 1fr); } }

.gr-stat {
  padding: 12px 14px;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  text-decoration: none;
  display: block;
  transition: border-color .12s ease, box-shadow .12s ease;
  color: inherit;
}
.gr-stat:hover {
  border-color: rgba(26,19,16,.22);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.gr-stat__kicker {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gr-text-2);
  font-weight: 500;
}
.gr-stat__num {
  font-family: "Instrument Sans", sans-serif;
  font-size: 22px; line-height: 1.2; font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--gr-ink);
}
.gr-stat__num--alert { color: var(--gr-rooster); }
.gr-stat__hint { font-size: 12px; color: var(--gr-text-2); margin-top: 2px; }
.gr-stat__cta {
  font-size: 12px; letter-spacing: 0; text-transform: none;
  color: var(--gr-forest);
  margin-top: 8px;
  display: inline-block;
  font-weight: 500;
}
.gr-stat:hover .gr-stat__cta { color: var(--gr-rooster); }

/* ---------- List rows (card-row pattern) ---------- */

.gr-list { display: flex; flex-direction: column; gap: 6px; }

.gr-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.gr-row:hover {
  border-color: rgba(26,19,16,.22);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.gr-row__time {
  font-family: "Instrument Sans", sans-serif;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--gr-ink);
  letter-spacing: 0;
}
.gr-row__time small {
  display: block;
  font-family: "Instrument Sans", sans-serif;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gr-text-2);
  font-weight: 400;
  margin-top: 1px;
}
.gr-row__title {
  font-size: 14px;
  color: var(--gr-ink);
  font-weight: 600;
}
.gr-row__sub {
  font-size: 12.5px;
  color: var(--gr-text-2);
  margin-top: 2px;
}
.gr-row__meta {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--gr-text-2);
  text-align: right;
  font-weight: 500;
}
.gr-row__pip {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gr-forest);
  margin-right: 6px;
  vertical-align: middle;
}
.gr-row__pip--alert { background: var(--gr-rooster); }
.gr-row__pip--warn  { background: var(--gr-ochre); }

.gr-row__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gr-forest);
  color: var(--gr-ivory);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "Instrument Sans", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: none;
}
.gr-row__avatar--ochre { background: var(--gr-ochre); color: var(--gr-char); }
.gr-row__avatar--rooster { background: var(--gr-rooster); }

@media (max-width: 720px) {
  .gr-row { grid-template-columns: 64px 1fr; padding: 10px 12px; }
  .gr-row__meta { grid-column: 2; text-align: left; }
}

.gr-row--block { align-items: flex-start; padding: 12px 14px; }

.gr-empty {
  padding: 16px;
  background: var(--gr-surface);
  border: 1px dashed var(--gr-border);
  border-radius: 8px;
  color: var(--gr-text-2);
  font-size: 13px;
  font-style: normal;
}

/* ---------- Row card (generic) ---------- */

.gr-row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.gr-row-card:hover {
  border-color: rgba(26,19,16,.22);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.gr-row-card__main { flex: 1 1 auto; min-width: 0; }
.gr-row-card__title { font-size: 14px; font-weight: 600; color: var(--gr-ink); line-height: 1.3; }
.gr-row-card__sub   { font-size: 12.5px; color: var(--gr-text-2); margin-top: 2px; }
.gr-row-card__time  { font-size: 12px; color: var(--gr-text-2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.gr-row-card__meta  { flex: 0 0 auto; }
.gr-row-card__actions { display: inline-flex; gap: 6px; flex: 0 0 auto; }

/* ---------- Quick actions strip ---------- */

.gr-quickbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px;
}
.gr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--gr-surface);
  color: var(--gr-ink);
  border: 1px solid var(--gr-border);
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-decoration: none;
  transition: border-color .12s, background-color .12s, color .12s;
}
.gr-chip:hover { border-color: rgba(26,19,16,.22); background: rgba(0,0,0,.02); }
.gr-chip svg { width: 14px; height: 14px; }
.gr-chip--ghost { background: transparent; }
.gr-chip--ghost:hover { background: rgba(0,0,0,.03); }
.gr-chip--rooster {
  background: var(--gr-rooster);
  color: var(--gr-ivory);
  border-color: var(--gr-rooster);
}
.gr-chip--rooster:hover { background: var(--gr-bordeaux); border-color: var(--gr-bordeaux); color: var(--gr-ivory); }

/* ---------- Quick actions grid (dashboard) ---------- */

.gr-quickgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}
@media (max-width: 720px) { .gr-quickgrid { grid-template-columns: repeat(2, 1fr); } }

.gr-quickcard {
  display: flex; align-items: center; gap: 12px;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.gr-quickcard:hover {
  border-color: rgba(26,19,16,.22);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.gr-quickcard__icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(44,74,58,.08);
  color: var(--gr-forest);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.gr-quickcard__icon svg { width: 18px; height: 18px; }
.gr-quickcard__body { display: flex; flex-direction: column; gap: 1px; }
.gr-quickcard__label { font-size: 13.5px; font-weight: 600; color: var(--gr-ink); }
.gr-quickcard__sub   { font-size: 12px; color: var(--gr-text-2); }

/* ---------- Legacy mobile tabbar/mobilebar (superseded by .gra-* shell) ---------- */
.gr-tabbar,
.gr-mobilebar { display: none !important; }

/* ---------- Calendar toolbar ---------- */

.gr-cal-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.gr-cal-views {
  display: inline-flex; border: 1px solid var(--gr-border); border-radius: 6px; padding: 2px;
  background: var(--gr-surface);
  gap: 2px;
}
.gr-cal-views a {
  padding: 5px 12px; border-radius: 4px;
  text-decoration: none; color: var(--gr-text-2);
  font-size: 12.5px; letter-spacing: 0; text-transform: none;
  font-weight: 500;
  transition: background-color .15s, color .15s;
}
.gr-cal-views a[aria-current="page"] { background: var(--gr-ink); color: var(--gr-ivory); }
.gr-cal-nav {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--gr-border); border-radius: 6px;
  background: var(--gr-surface);
  padding: 2px;
}
.gr-cal-nav a, .gr-cal-nav button {
  padding: 5px 10px; border-radius: 4px;
  background: transparent; border: 0;
  text-decoration: none; color: var(--gr-ink); font-size: 13px;
  cursor: pointer;
}
.gr-cal-nav a:hover, .gr-cal-nav button:hover { background: rgba(0,0,0,.04); }
.gr-cal-title {
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px; font-weight: 600;
  color: var(--gr-ink);
  margin-right: 6px;
}

.gr-cal-week {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  background: var(--gr-surface);
  position: relative;
}
.gr-cal-week__corner {
  border-bottom: 1px solid var(--gr-border);
  border-right: 1px solid var(--gr-border);
  padding: 8px 6px;
}
.gr-cal-week__day-head {
  border-bottom: 1px solid var(--gr-border);
  border-right: 1px solid var(--gr-border);
  padding: 8px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.gr-cal-week__day-head:last-child { border-right: 0; }
.gr-cal-week__day-head .day {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gr-text-2);
  font-weight: 500;
}
.gr-cal-week__day-head .num {
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px; font-weight: 600; line-height: 1.2; color: var(--gr-ink);
}
.gr-cal-week__day-head.is-today .num { color: var(--gr-rooster); }
.gr-cal-week__day-head.is-today {
  background: rgba(201,49,30,.04);
}

.gr-cal-week__hour-cell {
  border-right: 1px solid var(--gr-border);
  border-bottom: 1px solid var(--gr-rule-soft);
  padding: 4px 6px;
  font-size: 11px; letter-spacing: 0; text-transform: none;
  color: var(--gr-text-2);
  text-align: right;
}
.gr-cal-week__col {
  border-right: 1px solid var(--gr-border);
  position: relative;
  min-height: 100%;
}
.gr-cal-week__col:last-child { border-right: 0; }
.gr-cal-week__col.is-today { background: rgba(201,49,30,.02); }
.gr-cal-week__hour-row {
  height: 48px;
  border-bottom: 1px solid var(--gr-rule-soft);
  position: relative;
  cursor: pointer;
  transition: background-color .12s ease;
}
.gr-cal-week__hour-row:hover { background: rgba(44,74,58,.04); }
.gr-cal-week__hour-row.is-paste-hint { background: rgba(201,49,30,.06); outline: 1px dashed var(--gr-rooster); outline-offset: -2px; }

.gr-cal-event {
  position: absolute; left: 3px; right: 3px;
  background: var(--gr-forest); color: var(--gr-ivory);
  border-left: 3px solid var(--gr-rooster);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px; line-height: 1.2;
  text-decoration: none;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 1px;
  box-shadow: none;
  z-index: 2;
}
.gr-cal-event:hover { filter: brightness(0.92); }
.gr-cal-event--mine { background: var(--gr-bordeaux); border-left-color: var(--gr-ochre); }
.gr-cal-event--cancelled { background: rgba(26,19,16,.55); border-left-color: rgba(255,255,255,.4); text-decoration: line-through; }
.gr-cal-event--copied { outline: 2px dashed var(--gr-ochre); outline-offset: 2px; }
.gr-cal-event--agenda { background: var(--gr-ochre); color: #1a1310; border-left-color: var(--gr-bordeaux); }
.gr-cal-event--agenda.gr-cal-event--ochre   { background: var(--gr-ochre);    color: #1a1310;          border-left-color: var(--gr-bordeaux); }
.gr-cal-event--agenda.gr-cal-event--forest  { background: var(--gr-forest);   color: var(--gr-ivory); border-left-color: var(--gr-ochre); }
.gr-cal-event--agenda.gr-cal-event--rooster { background: var(--gr-rooster);  color: var(--gr-ivory); border-left-color: var(--gr-ochre); }
.gr-cal-event--agenda.gr-cal-event--sky     { background: #4a6d7c;            color: var(--gr-ivory); border-left-color: var(--gr-ochre); }
.gr-cal-event--agenda.gr-cal-event--bord    { background: var(--gr-bordeaux); color: var(--gr-ivory); border-left-color: var(--gr-ochre); }
.gr-cal-event--agenda.gr-cal-event--sand    { background: #d4c4a3;            color: #1a1310;          border-left-color: var(--gr-bordeaux); }
.gr-cal-event--personal { background: #2d4a3e; color: var(--gr-ivory); border-left: 3px solid var(--gr-ochre); border-style: solid; }

.gr-cal-event__time { font-family: "Instrument Sans", sans-serif; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gr-cal-event__title { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-cal-event__sub { font-size: 11px; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-cal-event__copybtn {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,.30); border: 0; color: var(--gr-ivory);
  border-radius: 3px; padding: 2px 4px;
  font-size: 10px; letter-spacing: 0;
  cursor: pointer; opacity: 0; transition: opacity .12s;
}
.gr-cal-event:hover .gr-cal-event__copybtn { opacity: 1; }
.gr-cal-event__copybtn:hover { background: var(--gr-rooster); }

.gr-cal-clipboard {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--gr-ink); color: var(--gr-ivory);
  padding: 8px 16px; border-radius: 6px;
  font-size: 13px; letter-spacing: 0;
  display: inline-flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.20);
  z-index: 80;
}
.gr-cal-clipboard button {
  background: transparent; border: 1px solid rgba(255,255,255,.3);
  color: var(--gr-ivory); padding: 4px 10px; border-radius: 4px;
  font-size: 12px; letter-spacing: 0;
  cursor: pointer;
}
.gr-cal-clipboard button:hover { background: rgba(255,255,255,.12); }

/* ---------- Month view (compact) ---------- */

.gr-cal-month {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  background: var(--gr-surface);
}
.gr-cal-month__dow {
  padding: 6px 10px;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gr-text-2);
  border-bottom: 1px solid var(--gr-border);
  border-right: 1px solid var(--gr-border);
  font-weight: 500;
}
.gr-cal-month__dow:last-child { border-right: 0; }
.gr-cal-month__cell {
  min-height: 88px;
  padding: 6px 8px;
  border-right: 1px solid var(--gr-border);
  border-bottom: 1px solid var(--gr-border);
  position: relative;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 3px;
}
.gr-cal-month__cell:nth-child(7n) { border-right: 0; }
.gr-cal-month__cell.is-other { background: rgba(0,0,0,.02); color: var(--gr-text-2); }
.gr-cal-month__cell.is-today { background: rgba(201,49,30,.04); }
.gr-cal-month__cell:hover { background: rgba(44,74,58,.03); }
.gr-cal-month__num {
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--gr-ink);
  font-variant-numeric: tabular-nums;
}
.gr-cal-month__cell.is-today .gr-cal-month__num { color: var(--gr-rooster); }
.gr-cal-month__pill {
  font-size: 11px; line-height: 1.2;
  background: var(--gr-forest); color: var(--gr-ivory);
  border-radius: 3px; padding: 2px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 2px solid var(--gr-rooster);
}
.gr-cal-month__pill--forest  { background: var(--gr-forest);   color: var(--gr-ivory); }
.gr-cal-month__pill--rooster { background: var(--gr-rooster);  color: var(--gr-ivory); }
.gr-cal-month__pill--ochre   { background: var(--gr-ochre);    color: #1a1310; }
.gr-cal-month__pill--sky     { background: #4a6d7c;            color: var(--gr-ivory); }
.gr-cal-month__pill--bord    { background: var(--gr-bordeaux); color: var(--gr-ivory); }
.gr-cal-month__pill--sand    { background: #d4c4a3;            color: #1a1310; }
.gr-cal-month__pill--personal{ background: #2d4a3e;            color: var(--gr-ivory); border-left: 2px solid var(--gr-ochre); }
.gr-cal-month__more { font-size: 11px; color: var(--gr-text-2); font-weight: 500; }

/* ---------- Deadlines pill + popover ---------- */

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

.gr-dl { position: relative; display: inline-block; }
.gr-dl__pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; font-size: 10.5px; font-weight: 600;
  letter-spacing: .02em;
  color: var(--gr-ivory); background: var(--gr-bordeaux);
  border: 0; border-radius: 999px;
  padding: 2px 8px;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}
.gr-dl__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}
.gr-dl__count,
.gr-dl__label {
  min-width: 0;
}
.gr-dl__pill:hover { filter: brightness(1.08); }
.gr-dl__pop {
  position: absolute;
  z-index: 40;
  left: 0;
  min-width: 260px; max-width: 340px;
  background: var(--gr-paper);
  border: 1px solid var(--gr-rule);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.16);
  padding: 8px 0;
  text-align: left;
}
.gr-dl__pop--down { top: calc(100% + 6px); }
.gr-dl__pop--up   { bottom: calc(100% + 6px); }
.gr-dl__pop-head {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--gr-text-2);
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--gr-rule-soft);
  margin-bottom: 4px;
}
.gr-dl__list { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow-y: auto; }
.gr-dl__row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  align-items: start;
}
.gr-dl__row + .gr-dl__row { border-top: 1px dotted var(--gr-rule-soft); }
.gr-dl__kind {
  font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 3px;
  color: var(--gr-ivory);
  background: var(--gr-text-2);
  white-space: nowrap;
  margin-top: 1px;
}
.gr-dl__kind--event    { background: var(--gr-forest); }
.gr-dl__kind--cert     { background: var(--gr-bordeaux); }
.gr-dl__kind--document { background: #4a6d7c; }
.gr-dl__main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gr-dl__title { color: var(--gr-text-1); text-decoration: none; font-weight: 500; line-height: 1.3; }
.gr-dl__title:hover { text-decoration: underline; color: var(--gr-rooster); }
.gr-dl__subject { color: var(--gr-text-2); font-size: 11px; line-height: 1.2; }

@media (max-width: 720px) {
  .gr-cal-week__day-head {
    min-width: 0;
  }

  .gr-cal-week__day-head .gr-dl {
    max-width: 100%;
    min-width: 0;
  }

  .gr-cal-week__day-head .gr-dl__pill {
    width: 100%;
    justify-content: center;
    gap: 3px;
    padding: 2px 4px;
    font-size: 10px;
  }

  .gr-cal-week__day-head .gr-dl__label {
    display: none;
  }

  .gr-dl__pop {
    max-width: min(320px, calc(100vw - 32px));
  }
}

/* ---------- Form refinement ---------- */

.gr-form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .gr-form-grid { grid-template-columns: 1fr; } }
.gr-form-grid > .gr-full { grid-column: 1 / -1; }

/* ---------- Form fields ---------- */
.gr-field { display: block; }
.gr-field__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gr-text-2);
  font-weight: 500;
  margin-bottom: 4px;
}
.gr-input, .gr-select, .gr-textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  padding: 6px 10px;
  font-family: "Instrument Sans", sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--gr-ink);
  border-radius: 6px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.gr-input[type="date"],
.gr-input[type="datetime-local"],
.gr-input[type="time"],
.gr-input[type="month"],
.gr-input[type="week"] {
  -webkit-appearance: none;
  appearance: none;
}
.gr-field { min-width: 0; }
.gr-input, .gr-select { height: 34px; }
.gr-input:focus, .gr-select:focus, .gr-textarea:focus {
  border-color: var(--gr-rooster);
  box-shadow: 0 0 0 2px rgba(201,49,30,.15);
}
.gr-textarea { font-family: "Instrument Sans", sans-serif; font-size: 13.5px; line-height: 1.5; min-height: 80px; resize: vertical; padding: 8px 10px; }
.gr-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gr-ink) 50%),
                    linear-gradient(135deg, var(--gr-ink) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 10px) center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 26px;
  cursor: pointer;
}

.gr-fieldset {
  border: 0;
  border-top: 1px solid var(--gr-border);
  padding: 20px 0 0;
  margin: 24px 0 0;
}
.gr-fieldset:first-of-type { margin-top: 16px; }
.gr-fieldset__legend {
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--gr-ink);
  margin-bottom: 14px;
  padding-top: 4px;
}
.gr-fieldset__hint {
  font-size: 12.5px;
  color: var(--gr-text-2);
  font-family: "Instrument Sans", sans-serif;
}

.gr-checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  font-family: "Instrument Sans", sans-serif;
  color: var(--gr-ink);
  padding: 4px 0;
  cursor: pointer;
}
.gr-checkbox input[type="checkbox"] { accent-color: var(--gr-rooster); width: 16px; height: 16px; }

.gr-formhead {
  border-bottom: 1px solid var(--gr-border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.gr-formhead__kicker {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gr-text-2); font-weight: 500;
}
.gr-formhead__title {
  font-family: "Instrument Sans", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 22px;
  color: var(--gr-ink);
  margin-top: 4px;
  line-height: 1.2;
}

.gr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--gr-rooster);
  background: var(--gr-rooster);
  color: var(--gr-ivory);
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.gr-btn:hover { background: var(--gr-bordeaux); border-color: var(--gr-bordeaux); }
.gr-btn--ghost {
  background: transparent;
  color: var(--gr-ink);
  border-color: var(--gr-border);
}
.gr-btn--ghost:hover { background: rgba(0,0,0,.03); border-color: rgba(26,19,16,.22); color: var(--gr-ink); }
.gr-btn--danger {
  background: transparent;
  color: var(--gr-rooster);
  border-color: var(--gr-rooster);
}
.gr-btn--danger:hover { background: var(--gr-rooster); color: var(--gr-ivory); border-color: var(--gr-rooster); }

.gr-formactions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--gr-border);
}

.gr-errors {
  border-left: 3px solid var(--gr-rooster);
  background: rgba(201,49,30,.06);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--gr-bordeaux);
  font-family: "Instrument Sans", sans-serif;
  border-radius: 6px;
}
.gr-errors ul { list-style: none; padding: 0; margin: 0; }
.gr-errors li { padding: 2px 0; }
.gr-errors li::before { content: "· "; opacity: .6; }

.gr-formwrap { max-width: 720px; margin: 0 auto; }

/* ---------- Filter bar (announcements / lists) ---------- */
.gr-filterbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 8px 0;
  border-top: 0;
  border-bottom: 1px solid var(--gr-border);
}
@media (max-width: 720px) {
  .gr-filterbar { grid-template-columns: 1fr 1fr; }
  .gr-filterbar > * { grid-column: span 2; }
  .gr-filterbar > .gr-btn { grid-column: span 1; }
}
.gr-input--ghost, .gr-select--ghost {
  border: 1px solid var(--gr-border);
  padding: 6px 10px;
  height: 34px;
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  background: var(--gr-surface);
  border-radius: 6px;
}

/* ---------- Market grid (announcements) ---------- */

.gr-marketgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding-top: 8px;
}
@media (max-width: 720px) { .gr-marketgrid { grid-template-columns: 1fr; } }

.gr-marketcard {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
}
.gr-marketcard__cover {
  display: block;
  width: 96px; height: 96px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--gr-surface-2);
  border: 1px solid var(--gr-border);
}
.gr-marketcard__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gr-marketcard__nocover {
  width: 100%; height: 100%;
  background-image: url('/brand/logo-gallo-rosso.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 70%;
  opacity: .22;
  font-size: 0;
}
.gr-marketcard__body { min-width: 0; }
.gr-marketcard__meta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.gr-marketcard__title {
  font-family: "Instrument Sans", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  margin: 0 0 4px;
  color: var(--gr-ink);
}
.gr-marketcard__title a { color: inherit; text-decoration: none; }
.gr-marketcard__title a:hover { color: var(--gr-rooster); }
.gr-marketcard__price {
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--gr-forest);
  margin: 0 0 4px;
}
.gr-marketcard__byline { font-size: 12px; color: var(--gr-text-2); margin: 0; }

/* ---------- Article (announcement detail) ---------- */

.gr-article {
  margin-top: 16px;
  max-width: 760px;
}
.gr-article__hero {
  display: block;
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--gr-surface-2);
  margin-bottom: 16px;
}
.gr-article__hero img { width: 100%; max-height: 480px; object-fit: cover; display: block; }
.gr-article__body {
  font-family: "Instrument Sans", sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--gr-ink);
  border-left: 3px solid var(--gr-ochre);
  padding: 4px 0 4px 16px;
  margin-top: 6px;
}
.gr-article__body p { margin: 0 0 12px; }

/* ---------- Pills ---------- */

.gr-emptystate {
  border: 1px dashed var(--gr-border);
  background: var(--gr-surface);
  padding: 24px 16px;
  text-align: center;
  color: var(--gr-text-2);
  border-radius: 8px;
}
.gr-emptystate__title {
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gr-ink);
  margin-bottom: 4px;
}

.gr-pillrow { display: flex; flex-wrap: wrap; gap: 4px; }
.gr-pill {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--gr-border); color: var(--gr-ink);
  padding: 2px 6px; border-radius: 4px;
  font-weight: 500;
  line-height: 1.5;
}
.gr-pill--forest   { background: rgba(44,74,58,.12);  color: var(--gr-forest); }
.gr-pill--rooster  { background: rgba(201,49,30,.14); color: var(--gr-rooster); }
.gr-pill--ochre    { background: rgba(200,154,74,.18); color: #6e5b2f; }
.gr-pill--bordeaux { background: rgba(138,33,19,.12); color: var(--gr-bordeaux); }
.gr-pill--ghost    { background: transparent; color: var(--gr-text-2); border: 1px solid var(--gr-border); }
.gr-pill--success  { background: rgba(44,74,58,.12);  color: var(--gr-forest); }
.gr-pill--warning  { background: rgba(200,154,74,.18); color: #6e5b2f; }
.gr-pill--danger   { background: rgba(201,49,30,.14); color: var(--gr-rooster); }
.gr-pill--neutral  { background: var(--gr-border); color: var(--gr-ink); }

/* ---------- Masthead variant: horse profile (avatar + title) ---------- */
.gr-masthead--horse { align-items: center; gap: 28px; }
.gr-masthead__left { display: flex; align-items: center; gap: 22px; }
.gr-masthead__sub {
  margin-top: 6px;
  font-size: .82rem;
  color: var(--gr-ink-soft);
  letter-spacing: .02em;
}

/* ---------- Sub-nav (horse tabs) ---------- */
.gr-magnav {
  display: flex; gap: 4px;
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  background: var(--gr-surface);
  margin-top: 16px;
  padding: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gr-magnav::-webkit-scrollbar { display: none; }
.gr-magnav__item {
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gr-text-2);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
  flex: 1 0 auto;
  text-align: center;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gr-magnav__item:hover { color: var(--gr-ink); background: var(--gr-surface-2); }
.gr-magnav__item.is-active {
  color: var(--gr-rooster);
  background: rgba(201,49,30,.10);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--gr-rooster);
}

@media (max-width: 720px) {
  .gr-magnav {
    margin-top: 12px;
    padding: 4px;
    gap: 4px;
    border-radius: 10px;
  }
  .gr-magnav__item {
    font-size: 15px;
    padding: 12px 18px;
    min-height: 46px;
    flex: 0 0 auto;
  }
}

/* ---------- Libretto card (anagrafica) ---------- */
.gr-libretto {
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  padding: 16px 20px;
}
.gr-libretto__head {
  border-bottom: 1px solid var(--gr-border);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.gr-libretto__kicker {
  font-family: "Instrument Sans", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gr-text-2);
}
.gr-libretto__title {
  font-family: "Instrument Sans", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 18px;
  color: var(--gr-ink);
  margin-top: 2px;
  line-height: 1.2;
}
.gr-libretto__sub {
  font-family: "Instrument Sans", sans-serif;
  font-size: 12.5px;
  color: var(--gr-text-2);
  margin-top: 4px;
}

.gr-libretto__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
@media (max-width: 720px) { .gr-libretto__grid { grid-template-columns: 1fr; } }
.gr-libretto__row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gr-border);
  align-items: baseline;
}
.gr-libretto__row dt {
  font-family: "Instrument Sans", sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gr-text-2);
}
.gr-libretto__row dd {
  font-family: "Instrument Sans", sans-serif;
  font-size: 13.5px;
  color: var(--gr-ink);
  margin: 0;
}
.gr-libretto__row--mono dd {
  font-family: "Instrument Sans", monospace, sans-serif;
  font-size: 12.5px;
  letter-spacing: 0;
}
.gr-libretto__notes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--gr-border);
}
.gr-libretto__body {
  font-family: "Instrument Sans", sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--gr-ink);
  margin-top: 4px;
}

/* ---------- Row variant for timeline entries (block style) ---------- */
.gr-row--block { align-items: flex-start; padding: 18px 4px; }

/* ---------- Data table (fallback for legacy <table>) ---------- */

.gr-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 8px;
  overflow: hidden;
}
.gr-data-table th, .gr-data-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gr-border);
}
.gr-data-table th {
  background: var(--gr-surface-2);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gr-text-2);
}
.gr-data-table tr:last-child td { border-bottom: 0; }

/* PWA mobile: evita zoom automatico su tap/focus degli input. */
@media (max-width: 900px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
  }

  body,
  input,
  select,
  textarea,
  button {
    -webkit-text-size-adjust: 100%;
  }

  input,
  select,
  textarea {
    font-size: max(16px, 1rem);
  }
}

/* Login/public shell background: caffelatte chiaro coerente con l'app. */
:root {
  --gr-cream: #f4ead2;
  --gr-sand: #eadbb6;
  --gr-surface-2: #fbf6e9;
}

html,
body,
body.gr-loginbody {
  background:
    radial-gradient(circle at top left, rgba(44,74,58,.07), transparent 32rem),
    linear-gradient(180deg, #fbf6e9 0%, #f4ead2 48%) !important;
}

.gr-login {
  background: rgba(255,255,255,.86);
  border-color: rgba(44,74,58,.16);
}

.btn-primary,
.btn-primary svg,
.bg-brand-forest,
.bg-brand-forest svg {
  color: #ffffff !important;
  stroke: currentColor !important;
}

/* ============================================================
   Libretto sanitario — tab Salute (v0.12.0)
   ============================================================ */
.gr-health-header {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--gr-paper, #fff);
  padding: 10px 0 12px;
  margin: 0 -16px 14px;
  padding-left: 16px; padding-right: 16px;
  border-bottom: 1px solid var(--gr-rule, rgba(0,0,0,.08));
}
.gr-health-header__chips {
  display: flex;
  gap: 8px;
}
.gr-health-chip {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.2;
  transition: transform 120ms ease;
}
.gr-health-chip:active { transform: scale(0.97); }
.gr-health-chip__icon { font-size: 1.05rem; line-height: 1; }
.gr-health-chip__label { font-weight: 700; font-size: 0.82rem; }
.gr-health-chip__countdown { font-size: 0.7rem; opacity: 0.85; }

.gr-health-chip--red {
  background: #f9d6d2;
  color: #6b1e15;
  border-color: #d6584b;
}
.gr-health-chip--amber {
  background: #f7e6c4;
  color: #6b4a0e;
  border-color: #d6a23f;
}
.gr-health-chip--green {
  background: #d8e9d6;
  color: #1f4a1d;
  border-color: #7da97a;
}
.gr-health-chip--gap {
  background: #ececec;
  color: #6a6a6a;
  border-color: #c8c8c8;
}

.gr-health-header__empty {
  padding: 12px;
  font-size: 0.85rem;
  color: var(--gr-ink-soft, #777);
  text-align: center;
}

@media (max-width: 380px) {
  .gr-health-chip { padding: 8px 9px; font-size: 0.72rem; }
  .gr-health-chip__label { font-size: 0.76rem; }
  .gr-health-chip__countdown { font-size: 0.66rem; }
}

/* Bollini stato sulle righe timeline Salute */
.gr-row__dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  margin-right: 6px;
  vertical-align: middle;
}
.gr-row__dot--red    { background: #d6584b; }
.gr-row__dot--amber  { background: #d6a23f; }
.gr-row__dot--green  { background: #7da97a; }
.gr-row__dot--gap    { background: #c8c8c8; }

.gr-section__head--sticky {
  position: sticky;
  top: 88px;
  z-index: 4;
  background: var(--gr-paper, #fff);
  padding-top: 8px;
  padding-bottom: 6px;
}

/* FAB nuovo evento (tab Salute) */
.gr-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--gra-tabbar-h, 56px) + 24px + env(safe-area-inset-bottom, 0));
  width: 56px; height: 56px;
  border-radius: 999px;
  background: var(--gr-rooster, #c44539);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 600;
  border: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  cursor: pointer;
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.gr-fab:active { transform: scale(0.95); }
@media (min-width: 720px) {
  .gr-fab { right: 28px; bottom: 28px; }
}

/* ---------- User detail hero + cards ---------- */

.gr-userhero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
  padding: 22px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f7fa 100%);
  border: 1px solid var(--gr-border);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  margin-bottom: 22px;
}
.gr-userhero__photo {
  position: relative;
  width: 140px; height: 140px;
  border-radius: 50%;
  padding: 5px;
  background:
    conic-gradient(from 210deg, #c44539 0%, #b88a3a 35%, #2c4a3a 70%, #c44539 100%);
  box-shadow: 0 8px 22px -10px rgba(15,23,42,.25);
}
.gr-userhero__photo-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--gr-surface-2);
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.05);
}
.gr-userhero__photo-inner img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.gr-userhero__photo-empty {
  font-family: "Fraunces", "Georgia", serif;
  font-size: 44px;
  font-weight: 500;
  color: var(--gr-text-2);
  letter-spacing: -.02em;
}
.gr-userhero__body { min-width: 0; }
.gr-userhero__name {
  font-family: "Fraunces", "Georgia", serif;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.025em;
  color: var(--gr-ink);
  margin: 0 0 8px;
  word-break: break-word;
}
.gr-userhero__pills {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-bottom: 12px;
}
.gr-userhero__sub {
  font-size: 13px;
  color: var(--gr-text-2);
  margin-bottom: 12px;
}
.gr-userhero__sub strong { color: var(--gr-ink); font-weight: 600; }
.gr-userhero__actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.gr-userhero__actions form { margin: 0; }
@media (max-width: 640px) {
  .gr-userhero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 20px 18px;
  }
  .gr-userhero__photo { margin: 0 auto; width: 120px; height: 120px; }
  .gr-userhero__pills, .gr-userhero__actions { justify-content: center; }
  .gr-userhero__name { text-align: center; }
}

.gr-fieldset--card {
  border: 1px solid var(--gr-border);
  border-radius: 14px;
  background: var(--gr-paper);
  padding: 18px 22px 20px;
  margin: 18px 0 0;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.gr-fieldset--card:first-of-type { margin-top: 0; }
.gr-fieldset--card > .gr-fieldset__legend {
  display: flex; align-items: center; gap: 9px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gr-text-2);
  margin-bottom: 14px;
  padding: 0;
  width: 100%;
}
.gr-fieldset--card .gr-card__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--gr-surface-2);
  color: var(--gr-ink);
  flex-shrink: 0;
}
.gr-fieldset--card .gr-card__icon svg { width: 13px; height: 13px; }

.gr-fise-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 12px;
  margin: 18px 0 0;
  border: 1px solid;
  font-size: 13px;
}
.gr-fise-banner__icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.gr-fise-banner__main { line-height: 1.4; }
.gr-fise-banner__title { font-weight: 700; color: var(--gr-ink); margin-bottom: 2px; }
.gr-fise-banner__sub { color: var(--gr-text-2); font-size: 12.5px; }
.gr-fise-banner__status { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.gr-fise-banner--ok    { background: #e9f4ec; border-color: #b9dcc4; }
.gr-fise-banner--ok    .gr-fise-banner__icon  { background: #2c4a3a; color: #fff; }
.gr-fise-banner--ok    .gr-fise-banner__status { color: #2c4a3a; }
.gr-fise-banner--warn  { background: #fbf2dc; border-color: #ecd99a; }
.gr-fise-banner--warn  .gr-fise-banner__icon  { background: #b88a3a; color: #fff; }
.gr-fise-banner--warn  .gr-fise-banner__status { color: #8b6420; }
.gr-fise-banner--danger{ background: #fbe6e2; border-color: #f0b8af; }
.gr-fise-banner--danger .gr-fise-banner__icon { background: #c44539; color: #fff; }
.gr-fise-banner--danger .gr-fise-banner__status{ color: #8c2a20; }
@media (max-width: 560px) {
  .gr-fise-banner { grid-template-columns: auto 1fr; }
  .gr-fise-banner__status { grid-column: 1 / -1; padding-left: 50px; }
}

.gr-section--card {
  border: 1px solid var(--gr-border);
  border-radius: 14px;
  background: var(--gr-paper);
  padding: 18px 22px 20px;
  margin: 18px 0 0;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.gr-section--card .gr-section__head {
  border: 0;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: flex-start;
}
.gr-section--card .gr-section__head > div { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.gr-section--card .gr-section__kicker { display: none; }
.gr-section--card .gr-section__title {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gr-text-2);
  margin: 0;
  line-height: 1.4;
}
.gr-section--card .gr-section__sub {
  display: block;
  width: 100%;
  font-size: 12.5px;
  color: var(--gr-text-2);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  margin: 4px 0 0;
}
