:root {
  --ff-bg: #020617;
  --ff-bg-soft: #0b1220;
  --ff-card: #020617;
  --ff-card-soft: #020617;
  --ff-accent: #22c55e;
  --ff-accent-soft: rgba(34, 197, 94, 0.14);
  --ff-accent-strong: #16a34a;
  --ff-warn: #f97316;
  --ff-text: #e5e7eb;
  --ff-muted: #9ca3af;
  --ff-border: rgba(148, 163, 184, 0.4);
  --ff-radius-lg: 1.25rem;
  --ff-radius-md: 0.75rem;
  --ff-shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.65);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.12), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(254, 202, 202, 0.08), transparent 55%),
    radial-gradient(circle at 100% 0, rgba(52, 211, 153, 0.12), transparent 50%),
    var(--ff-bg);
  color: var(--ff-text);
}

.ff-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ff-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.95), rgba(8, 47, 73, 0.9));
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.ff-topbar-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ff-brand {
  font-size: 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}

.ff-brand-sub {
  font-size: 0.75rem;
  color: var(--ff-muted);
}

.ff-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.45);
  font-size: 0.7rem;
}

.ff-status-pill .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
}

.ff-status-pill.offline .dot {
  background: #f97316;
  box-shadow: 0 0 12px rgba(248, 113, 38, 0.8);
}

.ff-status-pill .label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Layout */
.ff-main {
  flex: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.ff-main-narrow {
  max-width: 720px;
}

.ff-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.9rem 1.25rem 1.1rem;
  font-size: 0.78rem;
  color: var(--ff-muted);
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 1120px;
  margin: 0 auto;
}

.ff-footer a {
  color: inherit;
  text-decoration: none;
}

.ff-footer a:hover {
  text-decoration: underline;
}

.ff-footer-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Sections */
.ff-section {
  margin-bottom: 2.25rem;
}

.ff-h1 {
  font-size: 1.45rem;
  margin: 0 0 0.4rem;
}

.ff-h2 {
  font-size: 1.1rem;
  margin: 0 0 0.6rem;
}

.ff-h3 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
}

.ff-subtitle {
  margin: 0 0 1.1rem;
  font-size: 0.86rem;
  color: var(--ff-muted);
}

/* Grid */
.ff-grid {
  display: grid;
  gap: 0.9rem;
}

.ff-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.ff-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.1fr) minmax(0, 1.1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .ff-report-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Cards */
.ff-card {
  background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.12), transparent 52%),
              radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.14), transparent 50%),
              rgba(15, 23, 42, 0.96);
  border-radius: var(--ff-radius-lg);
  padding: 0.95rem 1.05rem;
  box-shadow: var(--ff-shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
  overflow: hidden;
}

.ff-card.metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ff-card-label {
  font-size: 0.8rem;
  color: var(--ff-muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.ff-card-value {
  font-size: 1.5rem;
  font-weight: 650;
}

.ff-card-foot {
  font-size: 0.75rem;
  color: var(--ff-muted);
}

.ff-card.action {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out, border-color 0.16s;
}

.ff-card.action:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.9);
  border-color: rgba(56, 189, 248, 0.7);
}

.ff-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.ff-card-text {
  font-size: 0.8rem;
  color: var(--ff-muted);
  margin: 0;
}

/* Icon circle */
.ff-icon-circle {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.4rem;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4), transparent 70%);
  font-size: 1.2rem;
}

/* Back link */
.ff-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--ff-muted);
}

.ff-back-link:hover {
  color: var(--ff-text);
}

/* Forms */
.ff-form {
  background: rgba(15, 23, 42, 0.94);
  border-radius: var(--ff-radius-lg);
  padding: 1.1rem 1rem 1.25rem;
  border: 1px solid var(--ff-border);
  box-shadow: var(--ff-shadow-soft);
}

.ff-field {
  margin-bottom: 0.85rem;
}

.ff-field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ff-muted);
  margin-bottom: 0.2rem;
}

.ff-field input,
.ff-field select,
.ff-field textarea {
  width: 100%;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.96);
  color: var(--ff-text);
  padding: 0.5rem 0.75rem;
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s;
}

.ff-field textarea {
  min-height: 120px;
  resize: vertical;
}

.ff-field input:focus,
.ff-field select:focus,
.ff-field textarea:focus {
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.7);
  background: #020617;
}

.ff-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

/* Chips */
.ff-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ff-chip-check {
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  cursor: pointer;
  background: rgba(15, 23, 42, 0.9);
}

.ff-chip-check input {
  display: none;
}

.ff-chip-check span {
  position: relative;
  padding-left: 1.1rem;
}

.ff-chip-check span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
}

.ff-chip-check input:checked + span {
  background: transparent;
}

.ff-chip-check input:checked + span::before {
  background: var(--ff-accent);
  border-color: transparent;
  box-shadow: 0 0 0 3px var(--ff-accent-soft);
}

/* Buttons */
.ff-btn {
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: transparent;
  color: var(--ff-text);
}

.ff-btn.primary {
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.7), transparent 60%),
              linear-gradient(135deg, #22c55e, #22d3ee);
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: 0 16px 40px rgba(34, 197, 94, 0.5);
}

.ff-btn.primary:hover {
  filter: brightness(1.05);
}

.ff-btn.ghost {
  border-color: rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
}

.ff-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* Lists */
.ff-list {
  border-radius: var(--ff-radius-lg);
  border: 1px solid var(--ff-border);
  background: rgba(15, 23, 42, 0.92);
  padding: 0.5rem 0.2rem;
  max-height: 360px;
  overflow: auto;
  font-size: 0.8rem;
}

.ff-list.small {
  max-height: 260px;
}

.ff-list-item {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px dashed rgba(55, 65, 81, 0.85);
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.ff-list-item:last-child {
  border-bottom: none;
}

.ff-list-title {
  font-weight: 500;
}

.ff-list-meta {
  font-size: 0.73rem;
  color: var(--ff-muted);
}

/* Toast */
.ff-toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #0f172a;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  border: 1px solid rgba(34, 197, 94, 0.8);
  color: var(--ff-text);
  font-size: 0.8rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
  opacity: 0;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  z-index: 50;
}

.ff-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Spacing utilities */
.mt-lg { margin-top: 1.3rem; }
.mt-xl { margin-top: 2rem; }

@media (max-width: 600px) {
  .ff-main {
    padding-inline: 0.9rem;
  }

  .ff-card {
    border-radius: 1rem;
  }

  .ff-footer {
    flex-direction: column;
    align-items: flex-start;
    padding-inline: 0.9rem;
  }
}
