/* ============================================================
   Evolve Tools — Nucleo Design System (Made in Evolve)
   Gli stessi token delle mini app: topbar slate-950, superfici
   chiare, accent lime #E5FFAE, flat, 1px border, radii 6/8px.
   ============================================================ */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #020617;
  --muted: #64748b;
  --sb-bg: #ffffff;
  --sb-line: #e2e8f0;
  --sb-text: #334155;
  --sb-muted: #64748b;
  --tb-bg: #020617;
  --tb-text: #ffffff;
  --tb-muted: rgba(255,255,255,.65);
  --accent: #E5FFAE;
  --accent-ink: #1A2800;
  --accent-hover: #D6F299;
  --accent-press: #C2DF80;
  --accent-soft: #F4FFE0;
  --link: #1e3a8a;
  --ok: #16a34a;
  --warn: #ca8a04;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 2px 0 rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: var(--link); }

/* ============ TOPBAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px;
  background: var(--tb-bg); color: var(--tb-text);
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
}
.tb-lockup { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--tb-text); flex: 0 0 auto; }
.tb-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.ws-name { font-weight: 700; font-size: 14px; line-height: 1.1; display: flex; flex-direction: column; color: #fff; }
.ws-name small { font-weight: 400; color: var(--tb-muted); font-size: 10.5px; margin-top: 2px; letter-spacing: .02em; }
.tb-apps { display: flex; align-items: center; gap: 4px; margin-left: 14px; }
.tb-apps a {
  color: var(--tb-muted); text-decoration: none; font-size: 12.5px; font-weight: 500;
  padding: 6px 10px; border-radius: 6px;
}
.tb-apps a:hover { background: rgba(255,255,255,.08); color: #fff; }
.tb-apps a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tb-user { display: flex; align-items: center; gap: 9px; text-decoration: none; padding: 4px 8px 4px 4px; border-radius: 8px; }
.tb-user:hover { background: rgba(255,255,255,0.08); }
.tb-user .user-av { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.tb-user .user-name { display: flex; flex-direction: column; line-height: 1.15; font-size: 12px; font-weight: 600; color: #fff; }
.tb-user .user-name small { font-weight: 400; color: var(--tb-muted); font-size: 10px; }
.tb-link { color: var(--tb-muted); text-decoration: none; font-size: 12.5px; padding: 6px 10px; border-radius: 6px; }
.tb-link:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ============ LAYOUT ============ */
.wrap { max-width: 1120px; margin: 0 auto; padding: 34px 24px 70px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.section-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 30px 0 10px; }

/* ============ CARDS ============ */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.app-card {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.app-card:hover { border-color: var(--line-strong); background: var(--accent-soft); }
.app-card .ac-top { display: flex; align-items: center; gap: 11px; }
.app-card .ac-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--accent);
  color: var(--accent-ink); display: grid; place-items: center; flex: 0 0 auto; }
.app-card .ac-ico svg { width: 18px; height: 18px; }
.app-card h3 { margin: 0; font-size: 15px; font-weight: 700; }
.app-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.app-card .ac-go { margin-top: auto; padding-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--link); }

/* ============ FORMS ============ */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--sb-text); margin-bottom: 12px; }
label small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; font-size: 11.5px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; margin-top: 5px; padding: 8px 10px; font: inherit; font-size: 13px;
  color: var(--text); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 6px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-press); box-shadow: 0 0 0 3px var(--accent-soft); }
.checkline { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; font-weight: 500; margin-bottom: 12px; }
.checkline input { margin-top: 2px; width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 8px 15px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); text-decoration: none;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-press); }
.btn.danger { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.btn.danger:hover { background: #fee2e2; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============ TABLE ============ */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line);
}
table.grid td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid td:last-child { white-space: nowrap; width: 1%; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: var(--panel-2); }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Azioni di riga: restano su una riga sola, allineate a destra. */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.row-actions .btn { white-space: nowrap; }
.btn.icon-only { padding: 5px 7px; line-height: 0; }
.btn.icon-only svg { display: block; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--sb-text);
}
.badge.admin { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.badge.off { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.badge.ok { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }

/* ============ BANNERS ============ */
.banner { padding: 11px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 18px;
  border: 1px solid var(--line-strong); background: var(--panel-2); }
.banner.err { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.banner.ok { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.banner.warn { background: #fefce8; border-color: #fde68a; color: #854d0e; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.55; }

/* ============ LOGIN ============ */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--tb-bg); }
.login-box { width: 100%; max-width: 380px; background: var(--panel);
  border-radius: 12px; padding: 30px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-lockup { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-lockup .tb-logo { width: 36px; height: 36px; font-size: 15px; }
.login-lockup b { font-size: 16px; display: block; }
.login-lockup small { color: var(--muted); font-size: 11.5px; }
.login-box .btn { width: 100%; margin-top: 6px; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 11.5px; text-align: center; line-height: 1.6; }

@media (max-width: 720px) {
  .tb-apps { display: none; }
  .wrap { padding: 22px 16px 60px; }
  .tb-user .user-name { display: none; }
}
