/* Argos — stile minimale, leggibile, niente framework. */
:root {
  --bg: #0f1419;
  --panel: #1a2129;
  --panel-2: #222c36;
  --border: #2e3a46;
  --text: #e6edf3;
  --muted: #9aa7b3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout con sidebar laterale */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { font-weight: 700; font-size: 1.5rem; color: var(--text); margin-bottom: 1.5rem; padding: 0 0.5rem; }
.sidebar .brand span { color: var(--accent); }
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.sidebar nav a {
  color: var(--muted); padding: 0.55rem 0.75rem; border-radius: 6px; font-size: 0.95rem;
}
.sidebar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.sidebar-user { border-top: 1px solid var(--border); padding-top: 1rem; font-size: 0.85rem; }
.sidebar-user .email { color: var(--text); word-break: break-all; }
.sidebar-user .role {
  display: inline-block; margin: 0.35rem 0 0.6rem; padding: 0.1rem 0.5rem;
  background: var(--panel-2); border-radius: 999px; font-size: 0.72rem; color: var(--muted);
}
.content { flex: 1; padding: 2rem 2.5rem; max-width: 1100px; }

.container { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }

/* Tab bar (aree admin) */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tabs .tab {
  padding: 0.55rem 1rem; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--text); text-decoration: none; }
.tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* Sezione/etichetta nella sidebar */
.sidebar .nav-section {
  margin-top: 1rem; padding: 0.4rem 0.75rem 0.2rem; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); opacity: 0.7;
}

/* Treenotes: stili in design-system.css (.tn-app, .tn-side, .tn-resizer, .tn-main). */

/* Modale riutilizzabile */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 1rem; z-index: 1000; overflow-y: auto;
}
.modal-dialog {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.field-error { display: block; color: #fca5a5; font-size: 0.8rem; margin-top: 0.25rem; }

/* Toast */
#toast-root { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 1100; }
.toast {
  padding: 0.75rem 1.1rem; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 0.92rem; margin-top: 0.5rem;
}
.toast.ok { background: #14432a; color: #86efac; border: 1px solid #1f5a3a; }
.toast.error { background: #3a2222; color: #fca5a5; border: 1px solid #5a3333; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 1.5rem; }
  .tn-layout { flex-direction: column; }
  .tn-explorer { width: auto; }
}
h1 { font-size: 1.5rem; margin: 0 0 1.5rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 1rem; color: var(--text); }

/* Cards / metrics */
.grid { display: grid; gap: 1rem; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}
.metric .value { font-size: 2rem; font-weight: 700; }
.metric .label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
th { background: var(--panel-2); color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--panel-2); }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.aperto, .badge.da_fare { background: #1e3a5f; color: #93c5fd; }
.badge.in_lavorazione, .badge.in_corso { background: #4a3a0f; color: #fcd34d; }
.badge.in_attesa, .badge.attesa_approvazione { background: #3a2f4a; color: #c4b5fd; }
.badge.risolto, .badge.fatto { background: #14432a; color: #86efac; }
.badge.chiuso, .badge.respinto { background: #3a2222; color: #fca5a5; }
.badge.bassa { background: var(--panel-2); color: var(--muted); }
.badge.media { background: #1e3a5f; color: #93c5fd; }
.badge.alta { background: #4a3a0f; color: #fcd34d; }
.badge.urgente { background: #3a2222; color: #fca5a5; }

/* Forms */
form .field { margin-bottom: 1rem; }
label { display: block; margin-bottom: 0.3rem; color: var(--muted); font-size: 0.85rem; }
input, select, textarea {
  width: 100%; padding: 0.55rem 0.7rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 0.95rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-block; padding: 0.55rem 1.1rem; background: var(--accent);
  color: #fff; border: none; border-radius: 6px; font-size: 0.95rem; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.secondary { background: var(--panel-2); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.row { display: flex; gap: 1rem; align-items: flex-end; }
.row > * { flex: 1; }
.muted { color: var(--muted); }
.right { text-align: right; }
.flash { padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash.error { background: #3a2222; color: #fca5a5; border: 1px solid #5a3333; }
.flash.ok { background: #14432a; color: #86efac; border: 1px solid #1f5a3a; }

/* Login */
.login-wrap { max-width: 360px; margin: 8vh auto; }
.login-wrap .brand { text-align: center; font-size: 2rem; font-weight: 700; margin-bottom: 1.5rem; }
.login-wrap .brand span { color: var(--accent); }
