:root {
  --bg: #f4f6f8; --card: #fff; --text: #1f2933; --muted: #6b7280; --line: #e3e8ee;
  --primary: #0f6cbd; --primary-dark: #0b528f; --danger: #c0392b; --ok: #1e8e3e; --warn: #b7791f;
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
nav.side { width: 220px; background: #122b45; color: #dbe4ee; padding: 18px 14px; flex-shrink: 0; }
nav.side .brand { font-weight: 700; font-size: 17px; color: #fff; margin-bottom: 18px; display: block; }
nav.side .brand small { display: block; font-weight: 400; font-size: 12px; color: #9fb3c8; }
nav.side a.item { display: block; padding: 9px 10px; border-radius: 8px; color: #dbe4ee; margin-bottom: 2px; }
nav.side a.item:hover, nav.side a.item.active { background: #1f4468; color: #fff; text-decoration: none; }
nav.side .user { margin-top: 24px; font-size: 12px; color: #9fb3c8; border-top: 1px solid #1f4468; padding-top: 12px; }
nav.side .user form { margin-top: 6px; }
main { flex: 1; padding: 26px 32px; max-width: 1280px; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd2d9; border-radius: 7px; font: inherit; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
button, .btn { display: inline-block; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; cursor: pointer; }
button:hover, .btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--primary); }
.btn.danger, button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover, button.danger:hover { background: #fdf2f1; }
.btn.small, button.small { padding: 4px 9px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #e8f0fe; color: var(--primary-dark); }
.badge.ok { background: #e6f4ea; color: var(--ok); }
.badge.off { background: #f1f3f4; color: var(--muted); }
.badge.danger { background: #fdecea; color: var(--danger); }
.badge.warn { background: #fef5e7; color: var(--warn); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: #e6f4ea; color: #1e4620; border: 1px solid #c8e6c9; }
.flash.error { background: #fdecea; color: #7a1c14; border-color: #f5c6c2; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 8px; align-items: center; }
.inline { display: inline; }
.muted { color: var(--muted); }
pre.prompt { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.45; background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: var(--radius); max-height: 70vh; overflow: auto; }
/* agenda */
.agenda { display: grid; grid-template-columns: 60px repeat(var(--giorni, 5), 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.agenda .head { background: #f8fafc; padding: 8px 6px; font-size: 12px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.agenda .head strong { display: block; font-size: 14px; }
.agenda .col { position: relative; border-left: 1px solid var(--line); height: var(--altezza); background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--ora-px) - 1px), var(--line) calc(var(--ora-px) - 1px), var(--line) var(--ora-px)); }
.agenda .col.chiuso { background: repeating-linear-gradient(45deg, #f4f6f8 0 8px, #fff 8px 16px); }
.agenda .ore { position: relative; height: var(--altezza); }
.agenda .ore span { position: absolute; right: 6px; font-size: 11px; color: var(--muted); transform: translateY(-50%); }
.agenda .app { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.25; overflow: hidden; color: #fff; background: var(--primary); border: 1px solid rgba(0,0,0,.08); }
.agenda .app.voce { background: #1e8e3e; }
.agenda .app.annullato { background: #9aa5b1; text-decoration: line-through; }
.agenda .app small { display: block; opacity: .9; }
.agenda .app:hover { filter: brightness(1.1); text-decoration: none; }
.agenda .libero { position: absolute; left: 3px; right: 3px; border-radius: 4px; }
.agenda .libero:hover { background: rgba(15,108,189,.12); }
.agenda .head.oggi { background: #e6f0fa; color: var(--primary); }
.agenda .head.oggi strong::after { content: " · oggi"; font-weight: 400; font-size: 11px; }
.agenda .col.oggi { background-color: #f3f8fd; }
.agenda .adesso { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 2; pointer-events: none; }
.agenda .adesso::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.login { max-width: 380px; margin: 10vh auto; }
.login h1 { text-align: center; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }
.trascrizione .turno { padding: 6px 10px; border-radius: 8px; margin-bottom: 6px; max-width: 80%; }
.trascrizione .user { background: #e8f0fe; }
.trascrizione .assistant { background: #f1f3f4; margin-left: auto; }
.trascrizione .tool { font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 800px) { .layout { flex-direction: column; } nav.side { width: auto; } main { padding: 16px; } }
