:root {
  --navy: #1f3864; --navy-2: #2b4a80; --ink: #1c2330; --muted: #5f6b7a; --line: #dde3ea; --bg: #f4f6f9;
  --card: #fff; --accent: #2e75b6;
  --red: #d62828; --red-bg: #fde8e8; --orange: #e07b00; --orange-bg: #fff1dc; --green: #1e8a3a; --green-bg: #e3f5e8;
  --yellow: #8a6d00; --yellow-bg: #fff8c9; --grey: #6b7280; --grey-bg: #eceef1;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* header */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.top-in { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 1.25rem; padding: 0 16px; height: 56px; }
.brand { display: flex; align-items: baseline; gap: .55rem; color: #fff; font-weight: 800; letter-spacing: .04em; font-size: 1.15rem; white-space: nowrap; }
.brand small { font-weight: 500; letter-spacing: 0; opacity: .75; font-size: .82rem; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { color: #dbe4f3; padding: .45rem .7rem; border-radius: 7px; font-weight: 500; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.user { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: #dbe4f3; white-space: nowrap; }
.user a { color: #dbe4f3; }
.user form { margin: 0; }
.linkbtn { background: none; border: 0; color: #dbe4f3; cursor: pointer; font: inherit; padding: .3rem .4rem; }
.linkbtn:hover { color: #fff; text-decoration: underline; }

main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 90px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.crumbs a { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .5rem .85rem; border-radius: 8px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f1f4f8; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--red); border-color: #f2c4c4; }
.btn.small { padding: .3rem .6rem; font-size: .82rem; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 0 0 .25rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid #c9d2dd; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0ea; border-color: var(--accent); }
textarea { min-height: 70px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.field.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--ink); font-size: .92rem; }
.check input { width: 18px; height: 18px; }
.formbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 16px; align-items: center; }
.formbar .spacer { flex: 1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 14px 0 0; }
legend { font-weight: 700; padding: 0 .4rem; }

/* filters */
.fsum { display: none; list-style: none; margin-bottom: 10px; }
.fsum::-webkit-details-marker { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filters .f { min-width: 150px; flex: 1 1 150px; }
.filters .f.q { flex: 2 1 220px; }
.filters .btn { height: 40px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); color: var(--ink); display: block; border-left: 5px solid var(--grey); }
.tile:hover { text-decoration: none; border-color: #b9c6d6; }
.tile b { display: block; font-size: 1.5rem; line-height: 1.1; }
.tile span { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tile.overdue { border-left-color: var(--red); } .tile.overdue b { color: var(--red); }
.tile.soon { border-left-color: var(--orange); } .tile.soon b { color: var(--orange); }
.tile.ok { border-left-color: var(--green); } .tile.ok b { color: var(--green); }
.tile.missing { border-left-color: #d4b100; }
.tile.on { outline: 2px solid var(--accent); }

/* status badges */
.st { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.st-overdue { background: var(--red-bg); color: var(--red); }
.st-soon { background: var(--orange-bg); color: var(--orange); }
.st-ok { background: var(--green-bg); color: var(--green); }
.st-missing { background: var(--yellow-bg); color: var(--yellow); }
.st-mimo, .st-na { background: var(--grey-bg); color: var(--grey); }
.st.big { font-size: .95rem; padding: .35rem .9rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--grey); }
.dot.overdue { background: var(--red); } .dot.soon { background: var(--orange); } .dot.ok { background: var(--green); } .dot.missing { background: #e0bf00; }

/* tables */
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.t { border-collapse: collapse; width: 100%; font-size: .9rem; }
.t th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f7f9fb; padding: .6rem .7rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; white-space: nowrap; }
.t td { padding: .55rem .7rem; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr:hover td { background: #fafcff; }
.t td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.t .sub { color: var(--muted); font-size: .82rem; }
.code { display: inline-block; min-width: 2.2rem; text-align: center; font-weight: 700; font-size: .78rem; background: #eef3fa; color: var(--navy); border-radius: 6px; padding: .12rem .35rem; }
.rowlink { color: var(--ink); font-weight: 600; }

/* device card */
.devhead { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: space-between; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; font-size: .92rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.act { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fff; border-top: 4px solid var(--grey); }
.act.overdue { border-top-color: var(--red); } .act.soon { border-top-color: var(--orange); } .act.ok { border-top-color: var(--green); } .act.missing { border-top-color: #e0bf00; }
.act .nm { font-weight: 700; } .act .when { font-size: 1.25rem; font-weight: 700; margin: .35rem 0 .1rem; font-variant-numeric: tabular-nums; }
.act .meta { font-size: .82rem; color: var(--muted); }
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf0f4; }
.docs li:last-child { border-bottom: 0; }
.docs .ic { width: 38px; height: 38px; border-radius: 8px; background: #eef3fa; color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: .7rem; flex: 0 0 auto; }
.docs .ic.pdf { background: #fde8e8; color: var(--red); }
.docs .txt { flex: 1; min-width: 0; }
.docs .txt a { font-weight: 600; overflow-wrap: anywhere; }
.viewer { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal .dh { background: #f7f9fb; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: .4rem .5rem; }
.cal .day { background: #fff; min-height: 110px; padding: .35rem .4rem; font-size: .8rem; }
.cal .day.out { background: #fafbfc; color: #a0a8b3; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .num { font-weight: 700; font-size: .82rem; margin-bottom: .2rem; }
.cal .ev { display: block; padding: .12rem .35rem; border-radius: 5px; margin-bottom: 2px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--grey); background: #f4f6f9; }
.cal .ev.overdue { border-left-color: var(--red); background: var(--red-bg); }
.cal .ev.soon { border-left-color: var(--orange); background: var(--orange-bg); }
.cal .ev.ok { border-left-color: var(--green); background: var(--green-bg); }
.cal .more { color: var(--muted); font-size: .75rem; }
.callist { display: none; }

/* flash */
.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 12px; font-weight: 500; }
.flash.ok { background: var(--green-bg); color: #145c27; }
.flash.error { background: var(--red-bg); color: #8f1b1b; }
.flash.info { background: #e8f1fb; color: #1d4f85; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #1f3864 0%, #2b4a80 55%, #3a5f9e 100%); }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .brand { color: var(--navy); font-size: 1.6rem; display: block; margin-bottom: .1rem; }

/* bottom nav (mobile) */
.bnav { display: none; }

/* bulk bar */
.bulkbar { position: sticky; bottom: 0; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: var(--radius); margin-top: 10px; display: none; align-items: center; gap: 12px; }
.bulkbar.show { display: flex; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.pill { display: inline-block; background: #eef3fa; color: var(--navy); border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600; }

/* skupiny VTZ */
.gi { display: inline-block; vertical-align: -3px; flex: 0 0 auto; }
.gtabs { display: flex; gap: 8px; margin: 0 0 14px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.gtab { --g: var(--navy); --gb: #eef3fa; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .9rem; white-space: nowrap; box-shadow: var(--shadow); }
.gtab:hover { text-decoration: none; border-color: var(--g); }
.gtab b { font-weight: 700; color: var(--muted); font-size: .82rem; }
.gtab i { font-style: normal; background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 1px 7px; }
.gtab.on { background: var(--gb); border-color: var(--g); box-shadow: inset 0 -3px 0 var(--g); }
.gtab.on b { color: var(--g); }
.gchip { --g: var(--grey); --gb: var(--grey-bg); display: inline-flex; align-items: center; gap: 5px; background: var(--gb); color: var(--g); border-radius: 999px; padding: .12rem .55rem .12rem .45rem; font-size: .76rem; font-weight: 700; white-space: nowrap; }
tr.gr > td:first-child { box-shadow: inset 4px 0 0 var(--g); }
.ghead { display: flex; align-items: center; gap: 10px; margin: 1.6rem 0 .6rem; padding: 8px 12px; border-radius: 10px; background: var(--gb); border-left: 5px solid var(--g); }
.ghead h2 { margin: 0; color: var(--g); font-size: 1.05rem; }
.ghead .sub { color: var(--muted); font-size: .85rem; }
.devband { height: 6px; border-radius: 6px; background: var(--g); margin: -4px 0 14px; opacity: .9; }
.cal .ev .gi { vertical-align: -2px; }

/* mobile */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .nav { display: none; }
  .user .uname { display: none; }
  .top-in { height: 52px; }
  main { padding: 14px 12px 96px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles .tile.hide-m { display: none; }
  .kv { grid-template-columns: 120px minmax(0, 1fr); }
  .bnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bnav a { flex: 1; text-align: center; padding: 8px 0 7px; font-size: .72rem; color: var(--muted); font-weight: 600; }
  .bnav a svg { display: block; margin: 0 auto 2px; width: 22px; height: 22px; }
  .bnav a.on { color: var(--navy); }
  /* tabuľka termínov ako karty */
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line); position: relative; }
  table.t.cards tr.gr { box-shadow: inset 4px 0 0 var(--g); }
  table.t.cards tr.gr > td:first-child { box-shadow: none; }
  table.t.cards td { border: 0; padding: 1px 0; }
  table.t.cards td.hide-m { display: none; }
  table.t.cards td.stc { position: absolute; right: 12px; top: 10px; width: auto; }
  table.t.cards td.first { padding-right: 110px; }
  .tablewrap { overflow: visible; }
  .cal { display: none; }
  .callist { display: block; }
  .viewer { height: 70vh; }
  .filters .f { flex: 1 1 45%; min-width: 0; }
  .head h1 { font-size: 1.25rem; }
  .fsum { display: inline-flex; }
  .tile { padding: 8px 10px; }
  .tile b { font-size: 1.25rem; }
  .tile span { font-size: .66rem; letter-spacing: 0; }
}
@media print {
  .top, .bnav, .noprint, .flash { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
}

a.clip { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 1px 6px; border-radius: 10px;
  background: #eef2f7; color: #475569; font-size: .78rem; font-weight: 600; text-decoration: none; vertical-align: middle;
  position: relative; z-index: 2; }
a.clip:hover { background: #dbe4f0; color: #1f3864; }
@media print { a.clip { background: none; } }

.hchips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 12px; }
.hchip { padding: 5px 12px; border-radius: 16px; border: 1px solid #d5dce6; background: #fff; color: #334155;
  font-size: .85rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.hchip:hover { border-color: #1f3864; }
.hchip.on { background: #1f3864; border-color: #1f3864; color: #fff; }

.pfoot { margin: 32px 0 8px; text-align: center; font-size: .8rem; }
.pfoot a { color: #64748b; }
