/* Modulizer — stile condiviso */
:root {
  --bg: #0f172a;
  --bg-grad-1: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-ink: #ffffff;
  --soft: #f1f5f9;
  --ok: #16a34a;
  --warn: #b45309;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 20px 50px -20px rgba(15, 23, 42, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, .35), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(56, 189, 248, .25), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-grad-1));
  background-attachment: fixed;
  padding: 32px 18px 64px;
  line-height: 1.5;
}

.wrap { max-width: 860px; margin: 0 auto; }

/* Header */
.hero { color: #e2e8f0; text-align: center; margin-bottom: 26px; }
.hero .logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: .3px; font-size: 14px;
  text-transform: uppercase; color: #c7d2fe;
  background: rgba(99,102,241,.18); border: 1px solid rgba(199,210,254,.25);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 { font-size: 30px; margin: 0 0 8px; color: #fff; }
.hero p { margin: 0; color: #94a3b8; font-size: 15px; }
.hero .nav { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
.hero .nav a {
  color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; border: 1px solid transparent;
}
.hero .nav a.active { background: #fff; color: var(--accent); }
.hero .nav a:not(.active):hover { border-color: rgba(203,213,225,.35); color:#fff; }

/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 18px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fbfcfe);
}
.toolbar .grow { flex: 1 1 auto; min-width: 120px; }

.file-info { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.file-info .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.file-info.loaded .dot { background: var(--ok); }
.file-info .name { color: var(--ink); font-weight: 600; word-break: break-all; }

/* Buttons */
.btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 11px 18px; border-radius: 11px;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 8px 18px -8px rgba(79,70,229,.8); }
.btn-primary:hover { box-shadow: 0 10px 22px -8px rgba(79,70,229,.95); }
.btn-ghost { background: var(--soft); color: var(--ink); }
.btn-ghost:hover { background: #e7ebf1; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.hidden-input { display: none; }

/* Body */
.body { padding: 22px; }

.empty {
  text-align: center; color: var(--muted); padding: 46px 20px;
  border: 2px dashed var(--line); border-radius: 14px; background: #fbfcfe;
}
.empty svg { width: 46px; height: 46px; color: #cbd5e1; margin-bottom: 12px; }
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 17px; }
.empty p { margin: 0; font-size: 14px; }

.count {
  font-size: 13px; color: var(--muted); margin: 0 0 16px;
}
.count b { color: var(--accent); }

.fields { display: grid; gap: 14px; }
.field {
  display: grid; grid-template-columns: 230px 1fr; gap: 14px; align-items: start;
}
.field label {
  font-weight: 600; font-size: 14px; padding-top: 10px;
  word-break: break-word;
}
.field label .tag {
  display: block; font-weight: 400; font-size: 11.5px; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 2px;
}
.field textarea {
  width: 100%; resize: vertical; min-height: 44px; font: inherit;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); transition: border .15s, box-shadow .15s;
}
.field textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

.actions { margin-top: 22px; display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #052e1b; border: 1px solid rgba(22,163,74,.5); }
.toast.err { background: #2a0a0a; border: 1px solid rgba(220,38,38,.5); }

footer.note { text-align: center; color: #94a3b8; font-size: 12.5px; margin-top: 24px; }

@media (max-width: 620px) {
  .field { grid-template-columns: 1fr; gap: 6px; }
  .field label { padding-top: 0; }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1; justify-content: center; }
}
