/* Accensione · Mechit — tema scuro, accento lime */
:root {
  --bg: #0a0a0a;
  --bg-2: #101010;
  --surface: #161616;
  --surface-2: #1d1d1d;
  --surface-3: #262626;
  --line: #2a2a2a;
  --line-2: #363636;
  --txt: #f0f0f0;
  --txt-2: #c4c4c4;
  --muted: #8a8a8a;
  --accent: #ccff00;
  --accent-2: #99cc00;
  --accent-ink: #101400;
  --danger: #ff5a5a;
  --ok: #3ddc84;
  --warn: #ffb84d;
  --info: #2a6cff;
  --event: #c084fc;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 10px 40px rgba(0,0,0,.55);
  --sidebar-w: 232px;
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--txt); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

.login-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(ellipse at 50% 20%, #171c05 0%, var(--bg) 60%); }
.login-wrap { position: relative; width: 100%; max-width: 420px; padding: 24px; }
.login-glow { position: absolute; inset: -80px; background: radial-gradient(circle at 50% 30%, rgba(204,255,0,.12), transparent 60%); filter: blur(30px); pointer-events: none; }
.login-card {
  position: relative; background: rgba(22,22,22,.92); border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px 28px;
  box-shadow: var(--shadow);
}
.login-logo { height: 26px; display: block; margin: 0 auto 22px; }
.login-card h1 { margin: 0; text-align: center; font-size: 1.55rem; letter-spacing: .04em; font-weight: 800; }
.login-card h1 span { color: var(--accent); font-weight: 600; letter-spacing: 0; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 28px; font-size: .92rem; }
.login-error { background: rgba(255,90,90,.12); border: 1px solid rgba(255,90,90,.4); color: #ffb3b3; border-radius: var(--radius-s); padding: 10px 12px; margin: 4px 0 14px; font-size: .9rem; }
.login-foot { text-align: center; color: var(--muted); font-size: .8rem; margin: 18px 0 0; }
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 92px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; cursor: pointer; color: var(--muted); font-size: .78rem; font-weight: 700; padding: 6px 8px; }

.field { display: block; margin-bottom: 14px; }
.field > span, .field-label { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.field input, .field select, .field textarea, .input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 11px 13px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(204,255,0,.12); }
.field textarea { min-height: 72px; resize: vertical; }
.hint { color: var(--muted); font-size: .82rem; margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkline { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: .92rem; }
.checkline input { accent-color: #99cc00; width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--txt);
  padding: 9px 14px; border-radius: var(--radius-s); font-weight: 650; font-size: .9rem;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 800; }
.btn.primary:hover { background: #d8ff33; }
.btn.danger { background: rgba(255,90,90,.12); border-color: rgba(255,90,90,.45); color: #ff9c9c; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--txt-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--txt); }
.btn.small { padding: 6px 10px; font-size: .8rem; }
.btn.big { width: 100%; padding: 13px; font-size: 1rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.btn-row.between { justify-content: space-between; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand img { height: 18px; }
.brand span { color: var(--accent); font-weight: 800; letter-spacing: .12em; font-size: .78rem; }
.clock { margin: -6px 8px 0; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .bottom-nav a {
  display: flex; align-items: center; padding: 10px 12px; border-radius: 11px; color: var(--txt-2); font-weight: 650; font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); color: var(--txt); }
.nav a.active, .bottom-nav a.active { background: var(--accent); color: var(--accent-ink); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.user-meta { display: flex; flex-direction: column; }
.user-meta b { font-size: .92rem; }
.user-meta small { color: var(--muted); }
.main { padding: 28px clamp(16px, 3vw, 36px) 48px; max-width: 1100px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.top h1 { margin: 0 0 4px; font-size: 1.6rem; letter-spacing: -.02em; }
.top p { margin: 0; color: var(--muted); max-width: 62ch; }

.banner { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.banner.warn { background: rgba(255,184,77,.1); border: 1px solid rgba(255,184,77,.35); }
.banner.ok { background: rgba(61,220,132,.08); border: 1px solid rgba(61,220,132,.3); }
.banner.info { background: rgba(192,132,252,.1); border: 1px solid rgba(192,132,252,.35); }
.callout { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; color: var(--txt-2); }

.cards { display: grid; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 16px 14px;
}
.card h2, .card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card .sub { color: var(--muted); font-size: .86rem; margin-bottom: 10px; }
.card.off { opacity: .72; }
.room { margin-bottom: 22px; }
.room-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 8px; }
.room-head h2 { margin: 0; font-size: 1.15rem; }
.machine {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.machine .mac { color: var(--muted); font-size: .82rem; }
.machine .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .03em; }
.badge.ok { background: var(--accent); color: var(--accent-ink); }
.badge.off { background: #2a2a2a; color: var(--muted); }
.badge.event { background: #3b2460; color: #efe6ff; }
.badge.warn { background: #5a3d12; color: #ffe7c2; }
.badge.err { background: #5a2222; color: #ffd0d0; }
.badge.info { background: #1c2d58; color: #d6e2ff; }

.week { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 16px; }
.week-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.week-row b { font-size: .86rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #24280f; color: var(--accent); border-radius: 999px; padding: 3px 4px 3px 10px; font-weight: 700; font-size: .82rem; }
.chip button { border: 0; background: transparent; color: var(--txt); cursor: pointer; padding: 0 6px; font-size: 1rem; line-height: 1; }
.add-time { display: flex; gap: 6px; }
.add-time input { width: 118px; padding: 7px 8px; }

.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pick { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.pick legend { font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }

.month-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 10px; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow { text-align: center; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.day {
  min-height: 78px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; text-align: left; cursor: pointer; color: inherit;
}
.day:hover { border-color: #555; }
.day .n { font-weight: 800; font-size: .82rem; }
.day.out { opacity: .38; }
.day.today { border-color: var(--accent); }
.day.has { background: #1a2208; }
.day.event { background: #241833; }
.marks { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.marks i { font-style: normal; font-size: .68rem; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 28px 8px; color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: grid; place-items: center; z-index: 40; padding: 18px; }
.modal { width: min(560px, 100%); max-height: min(86vh, 760px); overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 12px; font-size: 1.2rem; }
.secret {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; word-break: break-all;
  font-family: ui-monospace, monospace; font-size: .85rem; margin: 8px 0 12px;
}
pre.config { background: var(--bg); border-radius: 10px; padding: 12px; overflow: auto; font-size: .8rem; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: #222; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 320px; }
.toast.err { border-color: rgba(255,90,90,.5); }
.toast.ok { border-color: rgba(204,255,0,.4); }

.form-error { background: rgba(255,90,90,.12); border: 1px solid rgba(255,90,90,.4); color: #ffb3b3; border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; }

.bottom-nav { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: #101010; border-top: 1px solid var(--line); overflow-x: auto;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { flex: 1 0 auto; justify-content: center; font-size: .78rem; padding: 12px 10px; border-radius: 0; }
  .main { padding-bottom: 92px; }
  .grid-2, .week-row, .machine { grid-template-columns: 1fr; }
  .day { min-height: 52px; }
  .marks { display: none; }
  .top { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
