@import url("fulgard-tokens.css");

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

html { font-size: 16px; }

body.fg-app {
  margin: 0;
  min-height: 100vh;
  color: var(--fg-text);
  background: var(--fg-page);
  font-family: var(--fg-font);
  font-size: 0.875rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--fg-yellow);
  outline-offset: 2px;
}

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

button, .fg-btn { font: inherit; }

.fg-skip {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 100;
  background: var(--fg-surface);
  color: var(--fg-text);
  padding: 8px 12px;
  border-radius: var(--fg-radius);
}
.fg-skip:focus { top: 8px; }

.fg-shell {
  display: grid;
  grid-template-columns: var(--fg-sidebar-w) 1fr;
  min-height: 100vh;
}

.fg-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: var(--fg-black);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow: auto;
}

.fg-brand,
.fg-area-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  row-gap: 0.15rem;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 4px 8px 18px;
  margin: 0;
  text-decoration: none;
  color: #fff;
  line-height: 1;
}

.fg-brand-mark {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: block;
  height: 42px;
  width: auto;
  align-self: center;
}

.fg-brand-wordmark {
  grid-column: 2;
  grid-row: 1;
  display: block;
  height: 22.5px;
  width: auto;
  max-width: 100%;
  align-self: end;
}

.fg-brand-area {
  grid-column: 2;
  grid-row: 2;
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg-yellow);
  white-space: nowrap;
  line-height: 1.1;
  align-self: start;
}

.fg-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.fg-nav-label {
  margin: 12px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.fg-nav a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.8125rem;
  font-weight: 500;
}

.fg-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.fg-nav a[aria-current="page"] {
  background: rgba(219, 245, 8, 0.16);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--fg-yellow);
}

.fg-sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.fg-sidebar-foot a {
  display: block;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
}

.fg-sidebar-foot a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.fg-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.fg-upperbar {
  height: var(--fg-upperbar-h);
  background: var(--fg-upperbar);
  color: #f5f6f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.fg-upperbar-context {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  font-size: 13px;
}

.fg-upperbar-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 13px;
  color: rgba(245, 246, 247, 0.85);
}

.fg-upperbar-meta a {
  color: #fff;
  font-weight: 600;
}

.fg-menu-toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #fff;
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.fg-cti {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  padding: 0.55rem 1.25rem;
  background: var(--fg-surface);
  border-bottom: 1px solid var(--fg-border);
  position: sticky;
  top: var(--fg-upperbar-h);
  z-index: 25;
}

.fg-cti-state {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fg-cti-select {
  height: 34px;
  border: 1px solid var(--fg-border);
  border-radius: 6px;
  background: var(--fg-surface);
  padding: 0 0.55rem;
  color: var(--fg-text);
  font: inherit;
  font-weight: 600;
}

.fg-cti-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 4.5rem;
}

.fg-cti-queue {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
}

.fg-cti-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
}

.fg-cti-controls .fg-btn {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  font-size: 12px;
}

.fg-cti-controls .fg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fg-page-chrome {
  background: var(--fg-page);
}

.fg-hero {
  background: var(--fg-hero);
  color: #f5f6f7;
  padding: 1.15rem 1.25rem 1.05rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.fg-hero-kicker {
  margin: 0 0 0.25rem;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-yellow);
}

.fg-hero h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.fg-hero p {
  margin: 0.35rem 0 0;
  max-width: 44rem;
  color: rgba(245, 246, 247, 0.78);
  font-size: 13px;
}

.fg-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.fg-tabs {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  padding: 0 1.25rem;
  background: var(--fg-surface);
  border-bottom: 1px solid var(--fg-border);
}

.fg-tabs a,
.fg-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.75rem 0.9rem;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.fg-tabs a:hover,
.fg-tabs button:hover { color: var(--fg-text); }

.fg-tabs a[aria-current="page"],
.fg-tabs button[aria-selected="true"] {
  color: var(--fg-text);
  border-bottom-color: var(--fg-yellow);
}

.fg-content {
  padding: 1.15rem 1.25rem 1.5rem;
  flex: 1;
}

.fg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.fg-toolbar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.fg-toolbar p {
  margin: 0.15rem 0 0;
  color: var(--fg-muted);
  font-size: 12px;
}

.fg-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.5rem 0.9rem;
  border-radius: var(--fg-radius);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}

.fg-btn-primary {
  background: var(--fg-yellow);
  color: var(--fg-black);
}

.fg-btn-primary:hover:not(:disabled) { filter: brightness(0.97); }

.fg-btn-secondary {
  background: var(--fg-surface);
  border-color: var(--fg-border);
  color: var(--fg-text);
}

.fg-btn-secondary:hover:not(:disabled) { background: #f7f8f9; }

.fg-btn-danger {
  background: var(--fg-danger-bg);
  color: var(--fg-danger-text);
  border-color: transparent;
}

.fg-hero .fg-btn-secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.fg-hero .fg-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.fg-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 12px;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.fg-pill-success { background: var(--fg-success-bg); color: var(--fg-success-text); }
.fg-pill-warning { background: var(--fg-warning-bg); color: var(--fg-warning-text); }
.fg-pill-danger { background: var(--fg-danger-bg); color: var(--fg-danger-text); }
.fg-pill-neutral { background: var(--fg-neutral-bg); color: var(--fg-neutral-text); }

.fg-panel {
  background: var(--fg-surface);
  border: 1px solid var(--fg-border);
  border-radius: var(--fg-radius);
  box-shadow: var(--fg-shadow);
  padding: 1rem 1.1rem;
}

.fg-panel h3 {
  margin: 0 0 0.55rem;
  font-size: 14px;
  font-weight: 600;
}

.fg-panel p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 13px;
}

.fg-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.fg-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fg-stat strong {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.fg-stat span {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
}

.fg-table-wrap {
  overflow-x: auto;
  background: var(--fg-surface);
  border: 1px solid var(--fg-border);
  border-radius: var(--fg-radius);
  box-shadow: var(--fg-shadow);
}

.fg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fg-table th,
.fg-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--fg-border);
  text-align: left;
  vertical-align: middle;
}

.fg-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  background: #f7f8f9;
  white-space: nowrap;
}

.fg-table tr:last-child td { border-bottom: 0; }

.fg-table a {
  color: var(--fg-text);
  font-weight: 600;
  text-decoration: none;
}

.fg-table a:hover {
  text-decoration: underline;
  text-decoration-color: var(--fg-yellow);
  text-underline-offset: 3px;
}

.fg-table .fg-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fg-table .fg-btn {
  min-height: 30px;
  padding: 0.25rem 0.55rem;
  font-size: 12px;
}

.fg-muted { color: var(--fg-muted); }

.fg-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  max-width: min(360px, calc(100vw - 2rem));
  background: var(--fg-black);
  color: #fff;
  padding: 0.85rem 1rem;
  border-radius: var(--fg-radius);
  box-shadow: 0 8px 24px rgba(23, 23, 23, 0.2);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fg-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Workspace 3-col */
.fg-workspace-grid {
  display: grid;
  grid-template-columns: minmax(220px, 25%) minmax(0, 45%) minmax(240px, 30%);
  gap: 0.75rem;
  min-height: calc(100vh - 220px);
}

.fg-ws-col {
  background: var(--fg-surface);
  border: 1px solid var(--fg-border);
  border-radius: var(--fg-radius);
  box-shadow: var(--fg-shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.fg-ws-head {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--fg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fg-ws-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.fg-ws-body {
  padding: 0.75rem 0.9rem;
  overflow: auto;
  flex: 1;
}

.fg-roster-item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid var(--fg-border);
  background: var(--fg-page);
  border-radius: 6px;
  padding: 0.65rem 0.7rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  color: inherit;
}

.fg-roster-item:hover { border-color: #c9ced3; }

.fg-roster-item.is-active {
  border-color: var(--fg-black);
  box-shadow: inset 3px 0 0 var(--fg-yellow);
  background: #fff;
}

.fg-roster-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 0.15rem;
}

.fg-roster-item span {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
}

.fg-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.fg-meta-grid dt {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fg-meta-grid dd {
  margin: 0.15rem 0 0;
  font-size: 13px;
  font-weight: 600;
}

.fg-suite-cards {
  display: grid;
  gap: 0.5rem;
}

.fg-suite-card {
  border: 1px solid var(--fg-border);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  background: var(--fg-page);
  display: grid;
  gap: 0.35rem;
}

.fg-suite-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fg-suite-card strong { font-size: 13px; }

.fg-suite-card p {
  margin: 0;
  font-size: 12px;
  color: var(--fg-muted);
}

.fg-suite-card .fg-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.fg-suite-card .fg-btn {
  min-height: 28px;
  padding: 0.2rem 0.5rem;
  font-size: 11px;
}

.fg-script-list {
  margin: 0 0 0.85rem;
  padding-left: 1.1rem;
  color: var(--fg-text);
  font-size: 13px;
}

.fg-script-list li { margin-bottom: 0.35rem; }

.fg-disp-list {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.fg-disp-item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid var(--fg-border);
  background: #fff;
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 12px;
}

.fg-disp-item:hover { background: #f7f8f9; }

.fg-disp-item.is-selected {
  border-color: var(--fg-black);
  box-shadow: inset 3px 0 0 var(--fg-yellow);
}

.fg-notes {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--fg-border);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  resize: vertical;
  margin-bottom: 0.65rem;
}

.fg-post-actions {
  display: grid;
  gap: 0.4rem;
}

.fg-empty {
  border: 1px dashed var(--fg-border);
  border-radius: var(--fg-radius);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--fg-muted);
  background: var(--fg-surface);
}

.fg-section-title {
  margin: 0.85rem 0 0.45rem;
  font-size: 13px;
  font-weight: 700;
}

.fg-indicazioni {
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
  font-size: 13px;
}

.fg-indicazioni li { margin-bottom: 0.35rem; }

.fg-script-rich { list-style: none; padding-left: 0; }
.fg-script-rich li {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
  align-items: flex-start;
}
.fg-step-num {
  flex: 0 0 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--fg-yellow);
  color: var(--fg-black);
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.fg-alert-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.fg-assign-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--fg-surface);
  border: 1px solid var(--fg-border);
  border-left: 3px solid var(--fg-yellow);
  border-radius: var(--fg-radius);
  box-shadow: var(--fg-shadow);
  font-size: 13px;
}

.fg-tabs-inline {
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
}

.fg-tabs-inline button {
  padding: 0.45rem 0.55rem;
  font-size: 12px;
}

.fg-call-summary-mini {
  display: grid;
  gap: 0.25rem;
  margin: 0.55rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  background: var(--fg-page);
  border: 1px solid var(--fg-border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-muted);
}

.fg-table tr.is-danger td { background: #fff7f7; }
.fg-table tr.is-warn td { background: #fffaf0; }
.fg-table tr.is-ceased td {
  background: var(--fg-neutral-bg);
  color: var(--fg-muted);
  text-decoration: line-through;
}
.fg-table tr.is-ceased td:last-child { text-decoration: none; }

.fg-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 23, 0.45);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.fg-modal {
  width: min(640px, 100%);
  max-height: min(90vh, 820px);
  overflow: auto;
  background: var(--fg-surface);
  border: 1px solid var(--fg-border);
  border-radius: var(--fg-radius);
  box-shadow: 0 12px 32px rgba(23, 23, 23, 0.18);
  display: flex;
  flex-direction: column;
}

.fg-modal-head,
.fg-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--fg-border);
}

.fg-modal-foot {
  border-bottom: 0;
  border-top: 1px solid var(--fg-border);
  justify-content: flex-end;
}

.fg-modal-head h2 {
  margin: 0;
  font-size: 16px;
}

.fg-modal-body {
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.fg-field {
  display: grid;
  gap: 0.3rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

.fg-field input,
.fg-field textarea {
  width: 100%;
  border: 1px solid var(--fg-border);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-weight: 400;
  color: var(--fg-text);
  background: #fff;
}

.fg-field textarea {
  resize: vertical;
  min-height: 220px;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .fg-workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .fg-shell { grid-template-columns: 1fr; }
  .fg-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--fg-sidebar-w);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .fg-shell.is-nav-open .fg-sidebar { transform: translateX(0); }
  .fg-menu-toggle { display: inline-flex; }
  .fg-cti-controls { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
