:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #2f343b;
  --muted: #6a7380;
  --accent: #b31a34;
  --border: #e4e7ec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(245, 246, 248, 0.82), rgba(245, 246, 248, 0.9)),
    url('/static/sfondo-sito.jpg') left top / auto repeat fixed;
  font-family: Arial, Helvetica, sans-serif;
}

.container { width: min(1100px, 94%); margin: 0 auto; }

.site-header { background: #fff; min-height: 88px; display: grid; align-items: center; }
.site-header.with-border { border-bottom: 1px solid var(--border); }

.head-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.head-actions { display: flex; gap: 10px; }
.brand-logo { width: clamp(180px, 32vw, 280px); height: auto; display: block; }

.page-wrap {
  min-height: calc(100vh - 88px);
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.login-card {
  width: min(520px, 94%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 6px;
  padding: 30px;
  box-shadow: 0 8px 18px rgba(18, 21, 26, 0.06);
}

h1 { margin: 0 0 10px; font-size: 28px; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 22px; }
h3 { margin: 6px 0 8px; font-size: 20px; }

.lead { margin: 0 0 18px; color: var(--muted); }

.login-form,
.admin-form-grid {
  display: grid;
  gap: 10px;
}

label { font-weight: 700; font-size: 14px; }

input[type='password'],
input[type='text'],
input[type='email'],
input[type='tel'],
textarea {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cfd5dd;
  border-radius: 4px;
  font-size: 16px;
  background: #fff;
}

textarea { min-height: 90px; resize: vertical; }

input:focus,
textarea:focus {
  outline: 2px solid #d87b8a;
  outline-offset: 1px;
}

button,
.logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  padding: 10px 14px;
  cursor: pointer;
}

button.danger { background: #8f1025; }
.logout.secondary { background: #596273; }
button:hover,
.logout:hover { filter: brightness(0.95); }

.error { margin-top: 12px; color: #9c1028; font-weight: 600; }
.success { margin-top: 12px; color: #0e6b3c; font-weight: 600; }

.content-grid {
  padding: 24px 0 32px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.content-grid.one-col { grid-template-columns: 1fr; }

.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 6px;
  padding: 18px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.link-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 6px 14px rgba(18, 21, 26, 0.05);
  display: grid;
  gap: 8px;
}

.link-card p { margin: 0 0 10px; color: var(--muted); }


.admin-card { align-content: start; }
.admin-form-grid.compact { gap: 8px; }
.inline-form { margin: 0; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.ticket-form {
  max-width: 720px;
}

.ticket-list {
  display: grid;
  gap: 14px;
}

.ticket-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.ticket-card p {
  margin: 0;
  color: var(--ink);
}

.ticket-meta {
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.94);
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  max-width: 360px;
  word-break: break-word;
}

.admin-table th {
  background: #f2f3f5;
  color: var(--ink);
}

.file-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.file-list a { color: #1d3658; text-decoration-thickness: 2px; }

@media (max-width: 700px) {
  .site-header { min-height: 78px; }
  h1 { font-size: 24px; }
  .head-actions { width: 100%; justify-content: flex-end; }
  .section-head { display: grid; }
}

.link-url {
  margin: 0;
  color: #1d3658;
  word-break: break-word;
  font-size: 14px;
}
