/* my.reweke.it — stesso design system del Reweke Proposals Portal (brand: Deep Teal #1A7A7A, Mint #4ECDC4) */
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --brand: #1A7A7A; --brand-700: #136262; --brand-100: #D5EEEE; --brand-50: #EDF7F7; --mint: #4ECDC4;
  --bg: #FFFFFF; --soft: #F4F6F9; --line: #E4E9EF; --line-strong: #CFD7E0;
  --text: #0E1B2C; --muted: #5D6B7C; --faint: #8794A3;
  --danger: #C0362C; --danger-50: #FDEDEB; --warn: #B45309; --warn-50: #FEF3E2; --ok: #1E7B4B; --ok-50: #E6F5EC; --info: #2456C7; --info-50: #E8EFFD;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-head: "Plus Jakarta Sans", var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 650; letter-spacing: -.01em; margin: 0; color: var(--text); }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .strong { font-weight: 600; }
.hidden { display: none !important; } .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- App shell: header in alto, niente sidebar ---------- */
.header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 32px; background: var(--bg); border-bottom: 3px solid var(--brand); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 30; }
.header .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.header .brand img { height: 28px; display: block; }
.header .brand b { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--brand-700); }
.header .right { display: flex; align-items: center; gap: 10px; position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; font-weight: 700; flex: none; border: none; cursor: pointer; font: inherit; }
.profile-panel { position: absolute; right: 0; top: 48px; width: 270px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; display: none; z-index: 40; }
.profile-panel.open { display: block; }
.profile-panel .who { line-height: 1.3; margin-bottom: 10px; } .profile-panel .who b { display: block; }
.main { min-width: 0; }
.content { max-width: 1320px; margin: 0 auto; padding: 28px 32px 90px; }

/* ---------- Hero di benvenuto ---------- */
.hero { margin-bottom: 26px; }
.hero h1 { font-size: 28px; }
.hero .tagline { margin: 6px 0 0; color: var(--muted); }

/* ---------- Componenti ---------- */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: 600 13.5px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-700); text-decoration: none; }
.btn.secondary { background: var(--bg); color: var(--text); border-color: var(--line-strong); } .btn.secondary:hover { background: var(--soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { background: var(--soft); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; } .btn.icon { width: 34px; padding: 0; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

select { font: 14px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; height: 38px; width: 100%; }
.field { display: flex; flex-direction: column; gap: 5px; } .field > label { font-size: 11.5px; font-weight: 600; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.role { background: var(--brand-50); color: var(--brand-700); }
.badge.neutral { background: var(--soft); color: var(--muted); }
.badge.soon { background: var(--warn-50); color: var(--warn); }

.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.notice.info { background: var(--info-50); color: #1c419a; } .notice.warn { background: var(--warn-50); color: #7c3a06; }

/* ---------- Griglia tile app (specifico della Home): sempre affiancate, min. 4 per riga da desktop ---------- */
.widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); align-items: start; gap: 16px; margin-bottom: 28px; }
.app-foot { margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; font-size: 11.5px; color: var(--faint); }
.widget .muted { margin: 0 0 10px; }
.widget .empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--faint); }
.widget .counts { display: flex; gap: 28px; margin: 4px 0 12px; }
.widget .counts b { display: block; font: 700 22px var(--font-head); }
.ticket-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ticket-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.ticket-list a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; text-decoration: none; color: var(--text); transition: box-shadow .12s, border-color .12s, transform .12s; }
.tile:hover { box-shadow: var(--shadow-lg); border-color: var(--brand-100); text-decoration: none; transform: translateY(-1px); }
.tile .ico-wrap { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; }
.tile .ico-wrap .ico { width: 22px; height: 22px; }
.tile h3 { font-size: 15.5px; }
.tile p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.tile.disabled { opacity: .55; cursor: default; pointer-events: none; }
.tile .tile-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.field.spaced { margin-top: 10px; }
.stack.tight { gap: 4px; }
.row.check { gap: 6px; }
.btn.block { width: 100%; }
.btn.block.spaced { margin-top: 10px; }

/* ---------- Sign-in (AUTH_MODE=google) ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--brand-50); }
.signin-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.signin-top { background: var(--brand); border-bottom: 3px solid var(--mint); padding: 22px; display: grid; place-items: center; }
.signin-top img { height: 34px; display: block; }
.signin-body { padding: 26px 24px 28px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; }
.signin-body p { margin: 0 0 8px; }
.signin-body .btn { height: 42px; white-space: normal; text-align: center; line-height: 1.25; padding: 6px 15px; }

.loading { display: grid; place-items: center; min-height: 60vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .header { padding: 10px 16px; }
  .header .brand b { display: none; }
  .content { padding: 20px 16px 60px; }
  .profile-panel { right: 16px; }
}
.badge.bad { background: #FDEDEB; color: #C0362C; }

/* Selettore lingua e testo solo per screen reader */
.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; }
.lang-pick select { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line, #d7dde5); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }

.tile.multi { cursor: default; } .tile .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; } .tile .actions .btn { gap: 6px; } .tile .actions .ico { width: 15px; height: 15px; }
.bell { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--muted); } .bell:hover { background: var(--soft); } .bell .ico { width: 20px; height: 20px; }
.bell-count { position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--danger); color: #fff; font: 700 10.5px var(--font); display: grid; place-items: center; padding: 0 4px; }
.note.unread b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); margin-right: 8px; }
.note { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }

/* ---------- Selettore lingua nella topbar ---------- */
.lang-top { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-right: 6px; }
.lang-top .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lang-top .lang-text { font-size: 13px; font-weight: 500; }
.lang-top .lang-pick select { height: 34px; padding: 0 28px 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background-color: var(--bg); color: var(--text); font: 600 13px var(--font); cursor: pointer; }
.lang-top .lang-pick select:hover { border-color: var(--brand); }
@media (max-width: 700px) { .lang-top .lang-text { display: none; } }
.lang-top .lang-pick select { min-width: 110px; }
@media (max-width: 700px) {
  .lang-top { margin-right: 0; gap: 4px; } .lang-top .lang-pick select { min-width: 0; width: 92px; padding: 0 22px 0 8px; font-size: 12.5px; }
  .topbar .top-brand b { font-size: 18px; } .topbar .top-brand img { height: 22px; }
  .shell > .topbar { gap: 8px; } .topbar .top-brand { min-width: 0; flex: 0 1 auto; }
}
@media (max-width: 700px) { .lang-top .lang-pick select { width: 106px; } }

/* Riquadri della Home: stessa altezza sulla riga, anche con lo stato vuoto allineato a sinistra */
.widgets { align-items: stretch; }
.widget { display: flex; flex-direction: column; }
.widget > .row, .widget > p:last-child:has(.btn) { margin-top: auto; }
.widget li.empty { justify-content: flex-start; color: var(--faint); border-style: dashed; border-color: var(--line-strong); padding: 14px; }
.widget .empty { justify-content: flex-start; }
