/* =====================================================================
   KRONOS — design system
   Ispirazione: pannelli di strumentazione / console operative (NOC),
   coerente col mestiere di chi usa l'app (tecnici IT, monitoraggio
   infrastrutture). Numeri e dati in monospace come su uno strumento
   di misura; il quadrante concentrico nel logo richiama i tre
   coefficienti di maggiorazione (diurno/notturno/weekend).
   ===================================================================== */

:root {
  --ink: #0A1622;
  --ink-deep: #070F18;
  --panel: #102232;
  --panel-raised: #16293C;
  --panel-hover: #1B3145;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.16);

  --text: #EAF1F7;
  --text-dim: #8CA3B8;
  --text-faint: #5A7086;

  --amber: #E3A542;
  --amber-soft: rgba(227,165,66,.14);
  --cyan: #4FC3D9;
  --cyan-soft: rgba(79,195,217,.14);
  --violet: #9B8AE0;
  --violet-soft: rgba(155,138,224,.16);
  --green: #57C08A;
  --green-soft: rgba(87,192,138,.14);
  --red: #E2685C;
  --red-soft: rgba(226,104,92,.14);

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.02) inset;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  font-family: var(--font-body);
  background: var(--ink);
  color: var(--text);
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
h1 { font-size: 1.55rem; margin-bottom: 6px; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 600; }

/* ---------------------------------------------------------------------
   APP SHELL — sidebar + content
   --------------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--ink-deep);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
.mark-ring { fill: none; stroke-width: 2.6; }
.mark-ring-1 { stroke: rgba(255,255,255,.10); }
.mark-ring-2 { stroke: var(--amber); }
.mark-ring-3 { stroke: var(--cyan); }
.mark-ring-4 { stroke: var(--violet); }
.mark-hub { fill: var(--ink-deep); stroke: var(--text); stroke-width: 1.4; }
.mark-hand-hour, .mark-hand-min { stroke: var(--text); stroke-width: 1.6; stroke-linecap: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .04em; color: var(--text); }
.brand-text span { font-size: .68rem; letter-spacing: .14em; color: var(--text-faint); text-transform: uppercase; margin-top: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-group { margin-bottom: 6px; }
.nav-group + .nav-group { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.nav-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-faint);
  padding: 4px 10px 8px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: var(--panel-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--amber-soft); color: var(--amber); }
.nav-item.active .nav-icon { stroke: var(--amber); }
.nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel-raised); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: .78rem; font-weight: 600; color: var(--amber);
  flex-shrink: 0;
}
.user-meta { min-width: 0; }
.u-name { font-size: .82rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-role { font-size: .7rem; color: var(--text-faint); }
.logout-link { color: var(--text-faint); display: flex; padding: 6px; border-radius: var(--radius-sm); flex-shrink: 0; }
.logout-link:hover { background: var(--panel-hover); color: var(--red); }
.logout-link .nav-icon { width: 17px; height: 17px; }

.content { flex: 1; min-width: 0; }
.page { max-width: 1320px; margin: 0 auto; padding: 32px 36px 60px; }

/* guest (login) shell */
.guest-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(227,165,66,.06), transparent 40%),
    radial-gradient(circle at 80% 75%, rgba(79,195,217,.06), transparent 40%),
    var(--ink);
  padding: 24px;
}

/* ---------------------------------------------------------------------
   CARDS
   --------------------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

/* ---------------------------------------------------------------------
   TABLES
   --------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th {
  font-family: var(--font-body);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid var(--line-strong);
}
tbody tr { transition: background .1s ease; }
tbody tr:hover td { background: var(--panel-hover); }
td { color: var(--text-dim); }
td:first-child { color: var(--text); }

/* colonne numeriche / dati misurabili in monospace, allineate a destra */
table .num, td.num, th.num { font-family: var(--font-mono); text-align: right; color: var(--text); }

/* ---------------------------------------------------------------------
   BADGES
   --------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.badge-diurno   { background: var(--amber-soft);  color: var(--amber); }
.badge-notturno { background: var(--cyan-soft);   color: var(--cyan); }
.badge-weekend  { background: var(--violet-soft); color: var(--violet); }

/* ---------------------------------------------------------------------
   BUTTONS
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-raised);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  font-family: var(--font-body);
  transition: background .12s ease, border-color .12s ease, transform .05s ease;
}
.btn:hover { background: var(--panel-hover); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-gold { background: var(--amber); border-color: var(--amber); color: #2B1B04; font-weight: 600; }
.btn-gold:hover { background: #EFB55C; }
.btn-danger { background: var(--red-soft); border-color: rgba(226,104,92,.35); color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: .78rem; }

/* ---------------------------------------------------------------------
   FORMS
   --------------------------------------------------------------------- */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: .8rem;
  color: var(--text-dim);
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .88rem;
  color: var(--text);
}
.form-row input[type="text"], .form-row input[type="date"], .form-row input[type="time"], .form-row input[type="email"] {
  font-family: var(--font-mono);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.form-row input::placeholder { color: var(--text-faint); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-card .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 600; }
.stat-card .value { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500; color: var(--text); margin-top: 4px; }

.alert { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .87rem; border: 1px solid; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: rgba(87,192,138,.3); }
.alert-error { background: var(--red-soft); color: var(--red); border-color: rgba(226,104,92,.3); }

.filters { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------------------------------------------------------------------
   LOGIN
   --------------------------------------------------------------------- */
.login-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 38px 34px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.login-mark { width: 56px; height: 56px; margin: 0 auto 18px; display: block; }
.login-card h2 {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.login-sub {
  text-align: center;
  color: var(--text-faint);
  font-size: .78rem;
  letter-spacing: .04em;
  margin: 0 0 26px;
  text-transform: uppercase;
}

@media print {
  .no-print { display: none !important; }
  html { color-scheme: light; }
  body { background: #fff !important; color: #1a2733 !important; font-size: 12px; }
  .content { margin: 0; }
  .page { max-width: 100%; padding: 0; }
  .card { background: #fff !important; border: 1px solid #d7dee5 !important; box-shadow: none !important; color: #1a2733; }
  h1, h2, h3, .stat-card .value, td:first-child { color: #12222f !important; }
  td, th { color: #223 !important; }
  th { color: #55606b !important; border-bottom-color: #c9d2da !important; }
  a { color: #12222f !important; }
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .brand { border-right: 1px solid var(--line); border-bottom: none; }
  .nav { display: flex; flex-wrap: wrap; padding: 10px; }
  .nav-group { display: flex; flex-wrap: wrap; margin: 0; }
  .nav-group + .nav-group { border-top: none; border-left: 1px solid var(--line); margin-left: 8px; padding-left: 8px; padding-top: 0; }
  .nav-label { display: none; }
  .nav-item span { display: none; }
  .sidebar-foot { display: none; }
  .page { padding: 20px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
