/* === Reset minimale === */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: #1a2744; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Tipografia === */
:root {
  --navy: #1a2744;
  --bordeaux: #8b1a1a;
  --bg: #f7f6f2;
  --card: #fff;
  --border: #e0d8c8;
  --text: #2a2a2a;
  --muted: #777;
  --green: #2e7d32;
  --red: #c62828;
  --yellow: #f9a825;
}
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;600;700&display=swap');

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
h1, h2, h3 { font-family: 'EB Garamond', Georgia, serif; color: var(--navy); }
h1 { font-size: 2rem; margin-bottom: .5em; }
h2 { font-size: 1.4rem; margin: 1em 0 .5em; border-bottom: 1px solid var(--border); padding-bottom: .25em; }
h3 { font-size: 1.15rem; }

/* === Layout === */
.topbar { background: var(--navy); color: #fff; padding: .75rem 1.5rem; }
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar-brand { color: #fff; display: flex; align-items: center; gap: .75rem; font-weight: 600; }
.topbar-brand:hover { text-decoration: none; }
.topbar-user { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }

.layout-with-sidebar { display: flex; max-width: 1200px; margin: 0 auto; min-height: calc(100vh - 60px); }
.sidebar { width: 220px; background: #fff; border-right: 1px solid var(--border); padding: 1rem 0; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar a { padding: .6rem 1.5rem; color: var(--navy); border-left: 3px solid transparent; }
.sidebar a:hover { background: #f0eee5; text-decoration: none; }
.sidebar a.active { background: #f0eee5; border-left-color: var(--bordeaux); font-weight: 600; }

.page { flex: 1; padding: 2rem; max-width: 100%; }
.page-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }

/* === Form === */
form label { display: block; margin-bottom: 1rem; }
form input[type=text], form input[type=email], form input[type=password],
form input[type=date], form input[type=url], form input[type=number], form input[type=search],
form select, form textarea {
  width: 100%; padding: .5rem .75rem; border: 1px solid var(--border);
  border-radius: 4px; font-size: 1rem; background: #fff;
}
form textarea { min-height: 80px; }
form input:focus, form select:focus, form textarea:focus {
  outline: 2px solid var(--navy); outline-offset: -2px;
}
fieldset { border: 1px solid var(--border); padding: 1rem; border-radius: 4px; margin-bottom: 1.5rem; background: var(--card); }
legend { padding: 0 .5rem; font-weight: 600; color: var(--navy); }
.form-grid { max-width: 700px; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }

button, .btn {
  background: var(--navy); color: #fff; border: 0; padding: .55rem 1.25rem;
  border-radius: 4px; font-size: 1rem; cursor: pointer; text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #0f1a2e; text-decoration: none; }
button.danger { background: var(--bordeaux); }
button.danger:hover { background: #6e1414; }
.link-button { background: transparent; color: var(--navy); padding: 0; text-decoration: underline; }
.link-button:hover { background: transparent; }
.link-button.danger { color: var(--bordeaux); }

/* === Tabelle === */
.data-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); }
.data-table th, .data-table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #f0eee5; font-weight: 600; }
.data-table tr:hover { background: #fafaf5; }
.data-table .inline { display: inline; }

/* === Flash / messaggi === */
.flash { padding: .75rem 1rem; margin: 1rem 0; border-radius: 4px; border: 1px solid; }
.flash-success { background: #e8f5e9; border-color: var(--green); color: #1b5e20; }
.flash-error   { background: #ffebee; border-color: var(--red);   color: #b71c1c; }
.flash-warn    { background: #fff8e1; border-color: var(--yellow); color: #ff6f00; }
.flash code    { display: block; margin: .5rem 0; padding: .5rem; background: #fff; word-break: break-all; }

/* === Login page === */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 2rem; }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 2rem; }

/* === Pagina pubblica === */
.page-public { max-width: 900px; margin: 0 auto; padding: 2rem; }
.public-header { text-align: center; padding: 2rem 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.public-header h1 { font-size: 2.4rem; letter-spacing: 1px; }
.public-header .subtitle { font-size: 1.2rem; color: var(--muted); }
.public-header .legal { font-size: .9rem; color: var(--muted); margin-top: .5rem; }
.banner-ad { display: inline-block; background: var(--bordeaux); color: #fff; padding: .5rem 1rem; margin-top: 1rem; font-weight: 600; border-radius: 4px; }
.block { margin: 2rem 0; }
.data-grid { display: grid; grid-template-columns: 220px 1fr; gap: .5rem 1.5rem; }
.data-grid dt { color: var(--muted); }
.data-grid dd { margin: 0; }
.undeclared { color: #aaa; font-style: italic; }
.campaign-card { background: var(--card); border: 1px solid var(--border); padding: 1.5rem; border-radius: 6px; margin-bottom: 1.5rem; }
.public-footer { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); }
.public-footer .disclaimer { margin-bottom: .5rem; }

.actions { display: flex; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }

/* === Status === */
.status-card { padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 6px; margin: 1rem 0; }
.status-green { color: var(--green); font-weight: 600; }
.status-yellow { color: #f57c00; font-weight: 600; }
.status-red { color: var(--red); font-weight: 600; }

/* === Inline form === */
.inline-form { display: flex; gap: .5rem; margin: 1rem 0; }
.inline-form input { flex: 1; }

/* === Responsive === */
@media (max-width: 700px) {
  .layout-with-sidebar { flex-direction: column; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar a { border-left: 0; border-bottom: 3px solid transparent; padding: .5rem .8rem; }
  .sidebar a.active { border-bottom-color: var(--bordeaux); border-left: 0; }
  .data-grid { grid-template-columns: 1fr; gap: .25rem; }
  .data-grid dt { font-weight: 600; margin-top: .5rem; }
  .page { padding: 1rem; }
  .data-table { font-size: .85rem; }
}

/* === Print === */
@media print {
  body { background: #fff; }
  .topbar, .sidebar, .actions, .no-print, button, .btn, form { display: none !important; }
  .page-public { max-width: 100%; padding: 0; }
  .campaign-card { break-inside: avoid; border: 1px solid #ccc; }
  .banner-ad { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  a { color: #000; text-decoration: none; }
  .public-header h1 { font-size: 18pt; }
  .public-header { border-bottom: 2px solid #000; }
}
