/* ==========================================================================
   FR SERVICE — app.css : auth, dashboard utente, pannello admin
   ========================================================================== */

/* ---- Auth (login / registrazione) ---- */
.auth-wrap {
  min-height: calc(100vh - 70px);
  display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(47,128,237,.18), transparent 60%),
    linear-gradient(160deg, var(--navy-900), var(--navy-700));
  padding: 48px 20px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: 18px; padding: 34px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: .95rem; }
.auth-switch { text-align: center; margin-top: 18px; font-size: .92rem; color: var(--muted); }
.alert { padding: 11px 14px; border-radius: 9px; font-size: .9rem; margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert.err { background: #fdecec; color: #b3261e; border: 1px solid #f6caca; }
.alert.ok  { background: #e9f7ef; color: #1d7a46; border: 1px solid #c2e8d2; }

/* ---- App shell (dashboard / admin) ---- */
.app-topbar {
  background: var(--navy-900); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; height: 64px; position: sticky; top: 0; z-index: 40;
}
.app-topbar .brand .bt strong { color: #fff; }
.app-topbar .right { display: flex; align-items: center; gap: 14px; font-size: .9rem; }
.app-topbar .right .who { color: #b9c8de; }
.app-topbar .right .who b { color: #fff; }

.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 64px); }
.app-side { background: #fff; border-right: 1px solid var(--line); padding: 22px 14px; }
.app-side a, .app-side button.navlink {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-radius: 9px; color: var(--ink);
  font-weight: 600; font-size: .94rem; border: 0; background: none;
  cursor: pointer; text-align: left; margin-bottom: 2px;
}
.app-side a:hover, .app-side button.navlink:hover { background: var(--bg-soft2); text-decoration: none; }
.app-side .navlink.active { background: var(--accent); color: #fff; }
.app-main { padding: 30px 34px; background: var(--bg-soft); }
.app-main h1 { font-size: 1.6rem; }
.page-title { margin-bottom: 6px; }
.page-sub { color: var(--muted); margin-bottom: 26px; }

/* ---- Stat cards ---- */
.kpi { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 30px; }
.kpi .box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow-sm); }
.kpi .box strong { display: block; font-size: 2rem; color: var(--navy-900); }
.kpi .box span { color: var(--muted); font-size: .86rem; }

/* ---- Panels ---- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.panel h2 { font-size: 1.2rem; margin-bottom: 4px; }
.panel .hint { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table tr:hover td { background: var(--bg-soft); }
.table .muted { color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* ---- Badges ---- */
.badge2 { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.badge2.nuova { background: #e7f0fe; color: #1f6fd6; }
.badge2.lavorazione { background: #fff3e0; color: #b9740f; }
.badge2.completata { background: #e9f7ef; color: #1d7a46; }
.badge2.user { background: #eef1f6; color: #50607a; }
.badge2.admin { background: #efe7fb; color: #6b34c9; }
.badge2.attivo { background: #e9f7ef; color: #1d7a46; }
.badge2.bloccato { background: #fdecec; color: #b3261e; }
.badge2.tipo { background: #e8f4f2; color: #1c7a6a; }

/* ---- Small buttons / actions ---- */
.btn-sm { padding: 7px 13px; font-size: .82rem; border-radius: 8px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn-sm:hover { background: var(--bg-soft2); }
.btn-sm.danger { color: #b3261e; border-color: #f3c9c9; }
.btn-sm.danger:hover { background: #fdecec; }
.btn-sm.pri { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-sm.pri:hover { background: #1f6fd6; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Tabs (admin) ---- */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- Content editor (admin) ---- */
.editor-grid { display: grid; gap: 16px; }
.editor-grid .field { margin: 0; }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---- Upload box ---- */
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 26px; text-align: center; background: var(--bg-soft); color: var(--muted); }
.dropzone strong { color: var(--navy-900); }

/* ---- Modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,22,40,.55); display: none; place-items: center; z-index: 100; padding: 20px; }
.modal-bg.show { display: grid; }
.modal { background: #fff; border-radius: 16px; padding: 28px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); }
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-side { display: flex; flex-wrap: wrap; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .app-side a, .app-side button.navlink { width: auto; margin: 0; }
  .app-main { padding: 22px 18px; }
  .kpi { grid-template-columns: 1fr 1fr; }
}
