/* Foglio Firme — palette and layout ported from Foglio Firme.dc.html */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Work Sans", system-ui, sans-serif;
  color: #2c2621;
  background: #f2e9db;
  -webkit-font-smoothing: antialiased;
}
a { color: #a2542f; }
a:hover { color: #bc6a43; }
input, select, button { font-family: inherit; }
input:disabled, select:disabled {
  color: #2c2621; opacity: 1; -webkit-text-fill-color: #2c2621;
}

.ff-scroll::-webkit-scrollbar { height: 10px; width: 10px; }
.ff-scroll::-webkit-scrollbar-thumb { background: #d9cbb4; border-radius: 6px; }

@keyframes ffToast {
  0% { opacity: 0; transform: translate(-50%, 12px); }
  3% { opacity: 1; transform: translate(-50%, 0); }
  97% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 12px); }
}
@keyframes ffFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ff-fade { animation: ffFade 0.3s ease; }

.ff-h1 { font-family: "Bitter", serif; font-weight: 600; margin: 0; }
.ff-brand { font-family: "Bitter", serif; font-weight: 700; }

/* header */
.ff-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px; row-gap: 10px;
  padding: 12px 24px;
  background: rgba(255,253,250,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e6d8c1;
}
.ff-header-brand { display: flex; align-items: center; gap: 11px; }
.ff-header-right {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px; row-gap: 8px;
  margin-left: auto;
}
.ff-header-divider { width: 1px; height: 26px; background: #e6d8c1; flex: none; }
.ff-header-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.ff-hamburger {
  position: relative;
  display: none; width: 34px; height: 34px; flex: none;
  align-items: center; justify-content: center;
  border: 1px solid #e6d8c1; background: #fffdfa; border-radius: 9px;
  color: #6b5f52; font-size: 16px; cursor: pointer;
}
.ff-hamburger:hover { border-color: #bc6a43; color: #bc6a43; }
.ff-hamburger-dot {
  position: absolute; top: -2px; right: -2px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #a3453a; border: 1.5px solid #fffdfa;
}
.ff-nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #a3453a; color: #fff5ec;
  font-size: 10px; font-weight: 700; line-height: 1;
}
.ff-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: #bc6a43; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: "Bitter", serif; font-weight: 700; font-size: 17px;
}
.ff-avatar {
  border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}
.ff-month-nav {
  display: flex; align-items: center; gap: 4px;
  background: #f2e9db; border: 1px solid #e6d8c1; border-radius: 10px; padding: 3px;
}
.ff-month-nav button {
  width: 28px; height: 28px; border: none; background: transparent;
  border-radius: 7px; cursor: pointer; color: #8a6a4a; font-size: 16px;
}
.ff-month-nav button:hover { background: #e6d8c1; }
.ff-month-label {
  font-weight: 600; font-size: 13.5px; min-width: 118px; text-align: center; text-transform: capitalize;
}
.ff-month-input {
  border: none; background: transparent; color: #2c2621; cursor: pointer;
  font-family: inherit; padding: 4px 2px;
}
.ff-month-input:hover, .ff-month-input:focus { outline: none; color: #bc6a43; }

.ff-iconbtn {
  width: 32px; height: 32px; border: 1px solid #e6d8c1; background: #fffdfa;
  border-radius: 9px; cursor: pointer; color: #8f8577; font-size: 14px;
}
.ff-iconbtn:hover { border-color: #bc6a43; color: #bc6a43; }

/* cards */
.ff-card {
  background: #fffdfa; border: 1px solid #e6d8c1; border-radius: 16px;
}
.ff-stat {
  text-align: center; padding: 8px 16px; background: #fffdfa;
  border: 1px solid #e6d8c1; border-radius: 12px;
}
.ff-stat-value { font-family: "Bitter", serif; font-size: 20px; font-weight: 600; }
.ff-stat-label { font-size: 10.5px; color: #8f8577; text-transform: uppercase; letter-spacing: 0.04em; }

/* list */
.ff-list-head {
  display: grid; grid-template-columns: 2fr 1fr 1.1fr 1.6fr auto; gap: 12px;
  padding: 12px 20px; background: #f7f0e5; border-bottom: 1px solid #e6d8c1;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #a39685;
}
.ff-list-row {
  display: grid; grid-template-columns: 2fr 1fr 1.1fr 1.6fr auto; gap: 12px;
  align-items: center; padding: 14px 20px; border-bottom: 1px solid #f0e7d8;
  text-decoration: none; color: inherit;
}
.ff-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.ff-pill-dot { width: 7px; height: 7px; border-radius: 50%; }
.ff-cta {
  padding: 8px 16px; border-radius: 9px; border: 1px solid; font-weight: 600;
  font-size: 12.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  display: inline-block;
}

/* small dropdown menu (export format choice, etc.) */
.ff-export-menu {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
  flex-direction: column; gap: 2px; min-width: 170px;
  background: #fffdfa; border: 1px solid #e6d8c1; border-radius: 10px; padding: 6px;
  box-shadow: 0 14px 34px rgba(44,38,33,0.16); z-index: 30;
}
.ff-export-menu.ff-open { display: flex; }
.ff-export-menu a {
  padding: 9px 12px; border-radius: 7px; font-size: 13px; color: #3a332c; text-decoration: none;
}
.ff-export-menu a:hover { background: #f7f0e5; }
.ff-export-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none; font-family: inherit;
  cursor: pointer; padding: 9px 12px; border-radius: 7px; font-size: 13px; color: #3a332c;
}
.ff-export-menu button:hover { background: #f7f0e5; }

.ff-nav-dropdown { position: relative; }
.ff-nav-dropdown-btn {
  background: none; border: none; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; gap: 3px; font-size: 12.5px; color: #6b5f52; padding: 0;
}

/* sheet layout (day table + sidebar) */
.ff-sheet-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 22px; align-items: start;
}
.ff-sheet-sidebar { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }

/* sheet grid */
.ff-grid-head {
  display: grid; grid-template-columns: 38px 62px minmax(300px, 1fr) 76px 210px; gap: 0;
  background: #f7f0e5; border-bottom: 1px solid #e6d8c1;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #a39685;
}
.ff-grid-head > span { padding: 11px 14px; }
.ff-grid-head > span + span { border-left: 1px solid #ece1cf; }
.ff-grid-head > span:first-child + span { border-left: none; }

.ff-row {
  display: grid; grid-template-columns: 38px 62px minmax(300px, 1fr) 76px 210px; gap: 0;
  border-bottom: 1px solid #f2ebdd;
  border-left: 3px solid transparent;
}
.ff-row-today { border-left-color: #bc6a43; }
.ff-row-note { display: flex; align-items: center; justify-content: center; }
.ff-note-btn {
  width: 24px; height: 24px; border: 1px solid #e6d8c1; background: transparent;
  border-radius: 7px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.ff-note-btn:hover { border-color: #a3453a; background: #fdf6ee; }
.ff-note-btn svg path { fill: none; stroke: #c2b39c; }
.ff-note-btn:hover svg path { stroke: #a3453a; }
.ff-note-btn-active { border-color: #a3453a; background: #f7e8e5; }
.ff-note-btn-active svg path { fill: #a3453a; stroke: #a3453a; }

.ff-row-day { padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; }
.ff-row-turni {
  padding: 8px 14px; border-left: 1px solid #f2ebdd;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 52px;
}
.ff-row-ore {
  padding: 10px 14px; border-left: 1px solid #f2ebdd;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
}
.ff-row-giust {
  padding: 8px 14px; border-left: 1px solid #f2ebdd; display: flex; align-items: center; gap: 8px;
}

.ff-turno {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 3px 4px;
  background: #fffdfa; border: 1px solid #e6d8c1; border-radius: 9px;
}
/* Entrata/uscita e progetto+modalità+rimuovi vanno a capo come DUE blocchi
   interi, mai un singolo elemento isolato (es. la sola "×") — vale su
   ogni dispositivo, non solo touch: con più select sulla stessa riga
   (progetto + modalità di lavoro) un turno può eccedere la larghezza
   minima della colonna Turni anche su desktop/laptop, e senza poter
   andare a capo trabocca sopra la colonna Ore. flex-wrap qui non altera
   il layout quando il contenuto entra in una riga sola — interviene solo
   quando altrimenti trabocherebbe. */
.ff-turno-time, .ff-turno-meta { display: inline-flex; align-items: center; gap: 5px; }
.ff-row-turni { min-width: 0; }
.ff-time-select {
  width: 80px; border: none; background: transparent; font-size: 13px;
  padding: 3px 2px; color: #2c2621; outline: none; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.ff-progetto-select {
  max-width: 130px; border: none; border-left: 1px solid #e9dfd0; background: transparent;
  font-size: 12px; padding: 3px 4px 3px 8px; margin-left: 2px; color: #8a6a4a; outline: none;
  cursor: pointer; text-overflow: ellipsis;
}
.ff-modalita-btn {
  border: 1px solid #d7e6dc; background: transparent; border-radius: 6px;
  font-size: 10.5px; color: #6b8f7a; padding: 2px 6px; margin-left: 2px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
}
.ff-modalita-btn:hover { border-color: #6b8f7a; background: #f0f7f2; }
.ff-turno-arrow { color: #c3b49c; font-size: 12px; }
.ff-turno-remove {
  border: none; background: transparent; color: #c9a58f; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 3px;
}
.ff-turno-remove:hover { color: #bc6a43; }
.ff-turno-add {
  width: 26px; height: 26px; border: 1px dashed #d9c7ac; background: transparent;
  border-radius: 8px; color: #a3745a; cursor: pointer; font-size: 15px; line-height: 1;
}
.ff-turno-add:hover { border-color: #bc6a43; color: #bc6a43; background: #fdf6ee; }

.ff-giust-select {
  flex: 1; min-width: 0; border: 1px solid #e6d8c1; background: #fffdfa;
  border-radius: 8px; padding: 7px 8px; font-size: 12.5px; color: #2c2621; cursor: pointer; outline: none;
}
.ff-gh {
  width: 46px; border: 1px solid #e6d8c1; background: #fffdfa; border-radius: 8px;
  padding: 6px 5px; font-size: 12.5px; text-align: center; color: #2c2621; outline: none;
}
.ff-protocollo {
  width: 130px; border: 1px solid #e6d8c1; background: #fffdfa; border-radius: 8px;
  padding: 6px 8px; font-size: 12.5px; color: #2c2621; outline: none;
}
/* sidebar */
.ff-sidebar-hero { background: #bc6a43; color: #fff5ec; border-radius: 16px; padding: 20px; }
.ff-sidebar-hero .value {
  font-family: "Bitter", serif; font-size: 34px; font-weight: 700; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.ff-btn {
  padding: 11px 20px; border-radius: 11px; border: 1px solid; font-weight: 600;
  font-size: 13.5px; cursor: pointer;
}

/* trail */
.ff-trail-dot {
  width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fffdfa;
}
.ff-trail-line { width: 2px; flex: 1; background: #eee2d1; margin-top: 2px; }

/* confirm modal */
.ff-modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(44,38,33,0.35);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.ff-modal-backdrop.ff-open { display: flex; }
.ff-modal {
  background: #fffdfa; border: 1px solid #e6d8c1; border-radius: 16px;
  max-width: 420px; width: 100%; padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(44,38,33,0.28);
  animation: ffModalIn 0.15s ease;
}
.ff-modal-message { font-size: 13.5px; line-height: 1.5; color: #3a332c; margin: 0 0 20px; }
.ff-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes ffModalIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* toast */
.ff-toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 50; transform: translateX(-50%);
  background: #2c2621; color: #fff5ec; padding: 12px 22px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500; box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  animation: ffToast 10s ease forwards;
}

/* login screen */
.ff-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px;
  background: radial-gradient(120% 120% at 15% 0%, #f6efe1 0%, #ece0cd 55%, #e6d8c1 100%);
}
.ff-login-card {
  width: 100%; max-width: 940px; min-width: 0; display: grid; grid-template-columns: 1.1fr 0.9fr;
  border-radius: 22px; overflow: hidden; box-shadow: 0 24px 70px rgba(70,45,20,0.18);
  border: 1px solid #e6d8c1; background: #fffdfa;
}
.ff-login-brand {
  padding: 52px 48px; min-width: 0; background: linear-gradient(160deg, #bc6a43 0%, #9a4f2c 100%);
  color: #fff5ec; display: flex; flex-direction: column; gap: 26px;
}
.ff-login-form { padding: 52px 44px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ff-google-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 15px; border: 1px solid #e9dfd0; background: #fffdfa; border-radius: 13px;
  cursor: pointer; text-decoration: none; color: inherit;
}
.ff-google-btn:hover { border-color: #bc6a43; background: #fdf6ee; }

/* paired form fields — wrapped so they can stack on narrow screens */
.ff-field-row { display: flex; gap: 12px; }

@media (max-width: 760px) {
  .ff-login-wrap { padding: 16px; }
  .ff-login-card { grid-template-columns: 1fr; }
  .ff-login-brand { padding: 32px 26px; gap: 20px; }
  .ff-login-form { padding: 32px 26px; }
}

@media (max-width: 860px) {
  .ff-sheet-layout { grid-template-columns: 1fr; }
  .ff-sheet-sidebar { position: static; }
}

@media (max-width: 720px) {
  .ff-header { padding: 10px 14px; }
  .ff-header-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .ff-header-divider { display: none; }
  .ff-field-row { flex-wrap: wrap; }

  .ff-hamburger { display: flex; }
  .ff-header-nav {
    display: none;
    position: absolute; top: 100%; right: 14px; margin-top: 8px;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #fffdfa; border: 1px solid #e6d8c1; border-radius: 12px;
    padding: 8px; min-width: 190px; box-shadow: 0 14px 34px rgba(44,38,33,0.16);
    z-index: 30;
  }
  .ff-header-nav.ff-open { display: flex; }
  .ff-header-nav a { padding: 10px 12px; border-radius: 8px; }
  .ff-header-nav a:hover { background: #f7f0e5; }

  /* "Scarica" dentro l'hamburger: sottomenu ad accordion, inline sotto la
     voce, invece del flyout assoluto usato in versione desktop. */
  .ff-nav-dropdown { width: 100%; }
  .ff-nav-dropdown-btn { width: 100%; padding: 10px 12px; border-radius: 8px; justify-content: space-between; }
  .ff-nav-dropdown-btn:hover { background: #f7f0e5; }
  .ff-header-nav .ff-export-menu {
    display: none; position: static; margin-top: 0; padding: 0 0 4px 14px;
    min-width: 0; border: none; box-shadow: none; background: transparent;
  }
  .ff-header-nav .ff-export-menu.ff-open { display: flex; }
  .ff-header-nav .ff-export-menu a { padding: 8px 12px; font-size: 12.5px; }
}
