/* Cervello Aurea — implementazione CSS del design system Aurea (i componenti
   sorgente sono React/JSX; qui la stessa spec è tradotta in classi statiche
   per i template Jinja server-side). Vedi "Aurea Design System/" nel repo
   per i sorgenti originali dei componenti e i valori di riferimento. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg-app);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

a { color: var(--link); text-decoration: none; }

h1, h2, h3, p { margin: 0; }

/* --- Banner dev / flash -------------------------------------------- */

.dev-banner {
  background: var(--crimson);
  color: #fff;
  text-align: center;
  padding: var(--space-2);
  font-size: var(--fs-helper);
  font-weight: var(--fw-semibold);
}

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-input);
  margin-bottom: var(--space-4);
  font-size: var(--fs-body);
}
.flash-error { background: var(--crimson-pale); color: var(--crimson); }
.flash-success { background: var(--money-pale); color: var(--money); }

/* --- Layout: app shell ----------------------------------------------- */

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
}
.sidebar-logo img { width: 26px; height: 26px; }
.sidebar-logo span { font-size: 19px; font-weight: var(--fw-bold); color: var(--ink); letter-spacing: -0.01em; }

.sidebar-nav {
  padding: 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-label {
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--tertiary);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: var(--fw-medium);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: background-color .12s ease, color .12s ease;
}
.nav-item:hover { background: var(--bg-app); }
.nav-item.active { background: var(--brand-pale); color: var(--brand-500); font-weight: var(--fw-semibold); }
.nav-item .icon { color: var(--tertiary); display: inline-flex; flex-shrink: 0; }
.nav-item.active .icon { color: var(--brand-500); }

.sidebar-footer { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: var(--fw-semibold); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-signout { font-size: 12px; color: var(--tertiary); }
.user-signout:hover { color: var(--crimson); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 18px var(--content-pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 360px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 9px 12px;
}
.search-box .icon { color: var(--tertiary); }
.search-box input { border: none; outline: none; background: transparent; font-family: var(--font-ui); font-size: 14px; color: var(--ink); width: 100%; }

.content { padding: 32px var(--content-pad-x); max-width: var(--content-max); }
.content-narrow { max-width: 640px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: var(--space-4); }
.page-title { font-size: var(--fs-page-title); font-weight: var(--fw-bold); color: var(--ink); letter-spacing: -0.01em; }
.page-subtitle { margin: 0 0 24px; font-size: 14px; color: var(--muted); }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }
.breadcrumb { font-size: 13px; margin-bottom: var(--space-4); color: var(--muted); }

/* --- Buttons ------------------------------------------------------- */

.btn {
  font-family: var(--font-ui);
  font-weight: var(--fw-semibold);
  font-size: 14px;
  border-radius: var(--radius-input);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  white-space: nowrap;
  padding: 12px 20px;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
  text-decoration: none;
}
.btn-primary { background: var(--brand-500); color: var(--text-on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--bg-card); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-app); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--brand-pale); color: var(--brand-500); }
.btn-danger { background: var(--crimson); color: #fff; }
.btn-danger:hover { background: #c23b3b; }
.btn-sm { font-size: 13px; padding: 8px 14px; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--bg-app); }
.icon-btn-sm { width: 30px; height: 30px; }

/* --- Cards ----------------------------------------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; padding: 0; }
.card-flush .card-header { padding: 20px 24px 0; margin-bottom: 12px; }
.card-title { margin: 0; font-size: var(--fs-card-title); font-weight: var(--fw-semibold); color: var(--ink); }

/* --- Status pill / badge --------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill-won { color: var(--money); background: var(--money-pale); }
.pill-active { color: var(--brand-500); background: var(--brand-pale); }
.pill-pending { color: #8a6300; background: var(--gold-pale); }
.pill-lost { color: var(--muted); background: var(--neutral-pale); }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: var(--fw-semibold); line-height: 1;
  border-radius: var(--radius-pill); padding: 3px 8px; min-width: 20px;
}
.badge-neutral { color: var(--muted); background: var(--neutral-pale); }
.badge-brand { color: var(--brand-500); background: var(--brand-pale); }
.badge-money { color: var(--money); background: var(--money-pale); }

/* --- Avatar ------------------------------------------------------------ */

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-pale); color: var(--brand-500);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-semibold); font-size: 14px; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }

/* --- Money -------------------------------------------------------------- */

.money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--money);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.money-muted { color: var(--muted); }
.money .sym { font-size: 0.78em; opacity: .7; margin-right: 2px; }

/* --- Forms ------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-5); }
.field label {
  font-size: var(--fs-label); font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--tertiary);
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 13px 14px;
  font-size: 14px;
  color: var(--ink);
  font-family: var(--font-ui);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}
.field .helper { font-size: 13px; color: var(--muted); }
form.inline { display: inline; }

/* --- Table -------------------------------------------------------------- */

.table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-card); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 12px 20px;
  font-size: var(--fs-label); font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--tertiary);
  border-bottom: 1px solid var(--border);
}
td { padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--ink); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.muted, .muted { color: var(--muted); font-size: 13px; }
.mono { font-family: var(--font-mono); }
.row-link { display: flex; align-items: center; gap: 10px; }

/* --- Kanban -------------------------------------------------------------- */

.kanban { display: flex; gap: var(--space-4); overflow-x: auto; margin-top: var(--space-6); align-items: flex-start; }
.kanban-col { flex: 0 0 260px; background: var(--bg-app); border-radius: var(--radius-card); padding: 4px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 12px; }
.kanban-col-count { font-size: 13px; color: var(--tertiary); font-family: var(--font-mono); }
.kanban-col-total { padding: 0 12px 8px; font-size: 12px; color: var(--muted); }
.kanban-cards { display: flex; flex-direction: column; gap: 10px; padding: 8px; min-height: 40px; }
.kanban-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px; text-decoration: none; color: inherit; display: block;
  box-shadow: var(--shadow-card); transition: box-shadow .12s ease;
}
.kanban-card:hover { box-shadow: var(--shadow-pop); }
.kanban-card-title { font-size: 15px; font-weight: var(--fw-semibold); color: var(--ink); }
.kanban-card-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.kanban-card-foot { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.kanban-empty { padding: 8px 12px; font-size: 13px; color: var(--tertiary); }

/* --- Login -------------------------------------------------------------- */

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-app); padding: var(--space-4); }
.login-card { width: 100%; max-width: 380px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 40px 32px; text-align: center; }
.login-logo { width: 40px; height: 40px; margin-bottom: 16px; }
.login-card h1 { font-size: 22px; font-weight: var(--fw-bold); color: var(--ink); margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-actions { display: flex; flex-direction: column; gap: 10px; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0; color: var(--tertiary); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
