:root {
  --bg: #eef3fb;
  --card: #ffffff;
  --ink: #1d2b4f;
  --muted: #64708a;
  --line: #dde4f0;
  --blue: #2f6fed;
  --blue-d: #1f55c4;
  --orange: #ff8a3d;
  --green: #17a673;
  --red: #d64545;
  --yellow: #ffd23f;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
a { color: var(--blue); }

/* ---------- górny pasek ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: var(--ink); color: #fff;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--orange);
  display: grid; place-items: center; font: 800 15px/1 Consolas, monospace; color: #fff;
}
.brand span.k { color: var(--yellow); }
.topbar .who { font-size: 14px; color: #c8d2e6; }
.topbar .who a { color: #fff; margin-left: 12px; }

/* ---------- układ ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.narrow { max-width: 560px; }
h1 { font-size: 28px; margin: 0 0 6px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 24px; }
.card { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: 0 2px 8px rgba(29,43,79,.07); margin-bottom: 18px; }

/* ---------- logowanie ucznia ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.steps span { padding: 4px 12px; border-radius: 99px; background: #dfe7f6; color: var(--muted); font-size: 14px; font-weight: 600; }
.steps span.on { background: var(--blue); color: #fff; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 72px; padding: 12px; border-radius: var(--radius);
  background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px;
  border: 2px solid transparent; box-shadow: 0 2px 6px rgba(29,43,79,.08);
  transition: transform .08s, border-color .15s;
}
.tile:hover { border-color: var(--blue); transform: translateY(-2px); }
.tile.cls { font-size: 26px; min-height: 96px; }
.tile.name { font-size: 16px; flex-direction: column; }
.tile.name small { font-weight: 400; color: var(--muted); }

.pinbox { text-align: center; }
.pinbox .who { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 22px; }
.dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--blue); }
.dots i.full { background: var(--blue); }
.keypad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; justify-content: center; }
.keypad button {
  height: 72px; border-radius: 16px; border: 0; background: #e6edfb; color: var(--ink);
  font-family: inherit; font-size: 28px; font-weight: 700; line-height: 1; cursor: pointer; transition: background .1s;
}
.keypad button:hover { background: #d3e0fa; }
.keypad button:active { background: var(--blue); color: #fff; }
.keypad button.wide { font-size: 16px; }

/* ---------- komunikaty ---------- */
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.msg.ok { background: #e3f6ee; color: #0f7a54; }
.msg.err { background: #fde8e8; color: #a52c2c; }
.msg.info { background: #e8effd; color: #234a9e; }

/* ---------- formularze ---------- */
label { display: block; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; color: var(--ink); background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); }
textarea { min-height: 150px; font-family: Consolas, monospace; font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 0;
  background: var(--blue); color: #fff; font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--blue-d); }
.btn.orange { background: var(--orange); } .btn.orange:hover { background: #ec7425; }
.btn.green { background: var(--green); }
.btn.gray { background: #e6ebf3; color: var(--ink); } .btn.gray:hover { background: #d6deeb; }
.btn.red { background: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mt { margin-top: 14px; }

/* ---------- tabele ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
td .pin { font: 700 16px Consolas, monospace; letter-spacing: 2px; }
td form { display: inline; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #e6ebf3; color: var(--muted); }
.badge.red { background: #fde8e8; color: var(--red); }
.grid2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.classlist a.tile { justify-content: space-between; font-size: 18px; }
.classlist a.tile small { color: var(--muted); font-weight: 400; font-size: 14px; }
.foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 30px; }

/* ---------- wydruk ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pincard { border: 2px dashed #9aa6bf; border-radius: 10px; padding: 12px; page-break-inside: avoid; }
.pincard b { font-size: 17px; display: block; }
.pincard .pin { font: 800 26px Consolas, monospace; letter-spacing: 6px; color: var(--blue); }
.pincard small { color: var(--muted); display: block; }
@media print {
  .noprint { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
}
@media (max-width: 600px) {
  .keypad { grid-template-columns: repeat(3, 72px); }
  .cards { grid-template-columns: 1fr 1fr; }
}

/* ---------- postępy ucznia ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 99px; background: #dfe7f6; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.chip.on { background: var(--blue); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 12px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 2px 8px rgba(29,43,79,.07); }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat b { display: block; font-size: 26px; line-height: 1.2; margin: 2px 0; }
.stat small { color: var(--muted); font-size: 12px; }
.good { color: var(--green); } .mid { color: #c98a00; } .bad { color: var(--red); }
.mix { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: #e6ebf3; }
.mix i, .legend i { display: block; height: 100%; }
.typed { background: var(--green); } .auto { background: var(--blue); } .own { background: #9b8cff; } .pasted { background: var(--red); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.timeline { max-height: 640px; overflow: auto; }
.tday { font-weight: 700; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; margin: 14px 0 6px; }
.tday:first-child { margin-top: 0; }
.tev { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; margin-bottom: 6px; background: #f5f7fb; font-size: 14px; }
.tev .ti { font-size: 18px; line-height: 1.2; }
.tev .tf { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.tev.paste { background: #fde8e8; } .tev.away { background: #fff6e0; } .tev.upl { background: #fdeee0; } .tev.own { background: #efeaff; }
.tev details summary { cursor: pointer; color: var(--blue); font-size: 13px; margin-top: 4px; }
.tev pre { white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; background: #1e1e1e; color: #d4d4d4; padding: 10px; border-radius: 8px; font-size: 12.5px; margin: 6px 0 0; }
.flist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fbtn { border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--ink); }
.fbtn small { color: var(--muted); }
.fbtn.on { border-color: var(--blue); background: #e8effd; }
.ptools { gap: 8px; }
.pinfo { margin: 8px 0 4px; font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ponly { font-weight: 400; font-size: 13px; display: flex; align-items: center; gap: 6px; margin: 4px 0 6px; }
pre.code { background: #1e1e1e; color: #d4d4d4; border-radius: 10px; padding: 10px 0; font: 13px/1.5 Consolas, monospace; max-height: 520px; overflow: auto; margin: 0; }
pre.code span { display: block; padding: 0 12px; white-space: pre; min-height: 1.5em; }
pre.code span.add { background: rgba(23,166,115,.28); }
pre.code span.del { background: rgba(214,69,69,.28); text-decoration: line-through; color: #f0a0a0; }
.selfp { font-weight: 700; }

/* ---------- zadania ---------- */
.newtask { margin-top: 14px; }
.newtask > summary { list-style: none; display: inline-flex; }
.newtask > summary::-webkit-details-marker { display: none; }
.newtask[open] > summary { background: #e6ebf3; color: var(--ink); }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; background: #f5f7fb; border-radius: 10px; padding: 10px 12px; }
.pick label, label.pickall { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; font-size: 14px; cursor: pointer; }
.pick .pickall { grid-column: 1 / -1; font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
label.pickall { margin-top: 10px; }
input[type=file] { font: inherit; font-size: 14px; }
.tev.sql { background: #eaf5ff; }
.tev pre.sqlq { white-space: pre-wrap; word-break: break-word; background: #1e1e1e; color: #9cdcfe; padding: 6px 10px; border-radius: 6px; font-size: 12.5px; margin: 6px 0 0; max-height: 180px; overflow: auto; }
.badge.good { background: #e3f6ee; color: #0f7a54; }

/* ---------- aktywność uczniów: ukryta, dopóki nauczyciel jej nie włączy ---------- */
#tUczniowie .col-akt { display: none; }
#tUczniowie.show-akt .col-akt { display: table-cell; }
.aktswitch { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; font-weight: 600; font-size: 14px; cursor: pointer; user-select: none; }
.aktswitch small { color: var(--muted); font-weight: 400; }
.aktswitch input { width: 16px; height: 16px; }

/* ---------- KotPracownia: kot ---------- */
.brand .logo { background: none; width: 34px; height: 34px; display: block; }
.brand .logo svg { display: block; width: 34px; height: 34px; }
.brand .logo svg .oczy, .kot-welcome svg .oczy { transform-origin: 32px 33px; animation: kot-mruga 5s infinite; }
@keyframes kot-mruga { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.kot-welcome { display: flex; align-items: center; gap: 16px; }
.kot-welcome svg { flex: none; border-radius: 18px; box-shadow: 0 6px 16px rgba(255,138,61,.35); animation: kot-kiwa 3.5s ease-in-out infinite; }
@keyframes kot-kiwa { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.kot-welcome h1 { margin: 0; }
body {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%231d2b4f' fill-opacity='.045'%3E%3Cg transform='translate(22 26) rotate(-20)'%3E%3Cellipse cx='0' cy='8' rx='7' ry='6'/%3E%3Ccircle cx='-7' cy='-2' r='2.6'/%3E%3Ccircle cx='-2.5' cy='-6' r='2.6'/%3E%3Ccircle cx='2.5' cy='-6' r='2.6'/%3E%3Ccircle cx='7' cy='-2' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(84 82) rotate(18)'%3E%3Cellipse cx='0' cy='8' rx='7' ry='6'/%3E%3Ccircle cx='-7' cy='-2' r='2.6'/%3E%3Ccircle cx='-2.5' cy='-6' r='2.6'/%3E%3Ccircle cx='2.5' cy='-6' r='2.6'/%3E%3Ccircle cx='7' cy='-2' r='2.6'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
@media print { body { background-image: none; } }
.brand .k { color: var(--yellow); }
