:root {
  --ink: #1d1d1f;
  --text: #26262a;
  --muted: #86868c;
  --line: #ececef;
  --line2: #dcdce1;
  --soft: #f5f5f7;
  --bg: #fbfbfc;
  --pink: #eb2882;
  --blue: #008cff;
  --green: #1f9d55;
  --red: #e0245e;
  --yellow: #f5dc00;
  --grad: linear-gradient(90deg, #eb2882, #a046a0, #416ee6, #008cff, #1ea89c, #55be00, #f5dc00);
  --radius: 14px;
  font-size: 15px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); letter-spacing: -0.015em; font-weight: 700; }
h2 { font-size: 1.05rem; }
a { color: inherit; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 26px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); z-index: 50;
}
.topbar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad); }
.topbar img { height: 26px; cursor: pointer; display: block; }
.topbar nav { display: flex; gap: 2px; flex: 1; }
.topbar nav a {
  text-decoration: none; color: var(--muted); font-weight: 500;
  padding: 7px 14px; border-radius: 999px; font-size: .95rem;
}
.topbar nav a:hover { color: var(--ink); background: var(--soft); }
.topbar nav a.active { color: var(--ink); background: var(--soft); font-weight: 700; }
.savestate { font-size: .8rem; color: var(--muted); min-width: 90px; text-align: right; }
.savestate.saving { color: var(--blue); }
.whoami { font-size: .85rem; color: var(--muted); }
.demobadge {
  font-size: .66rem; font-weight: 700; letter-spacing: .12em; color: var(--muted);
  border: 1px solid var(--line2); border-radius: 999px; padding: 2px 9px;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 36px 32px 60px; }

/* ---------- buttons ---------- */
button, .btn {
  font-family: inherit; font-size: .88rem; font-weight: 600;
  border: 1px solid var(--line2); background: #fff; color: var(--ink);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover, .btn:hover { border-color: var(--ink); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button.primary, .btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.primary:hover, .btn.primary:hover { background: #000; }
button.mini {
  border: none; padding: 4px 8px; font-size: .84rem; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 500;
}
button.mini:hover { background: var(--soft); color: var(--ink); }
button.mini.del:hover { background: #fde8ef; color: var(--red); }

/* ---------- inputs ---------- */
input, select, textarea {
  font-family: inherit; font-size: .92rem; color: var(--text);
  border: 1px solid var(--line2); border-radius: 10px;
  padding: 8px 11px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 140, 255, .14); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: auto; accent-color: var(--ink); }
input[type=color] { width: 44px; height: 36px; padding: 3px; cursor: pointer; }
textarea { resize: vertical; }
label { font-size: .72rem; font-weight: 600; color: var(--muted); display: block; margin: 0 0 5px 2px; letter-spacing: .02em; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 34px; position: relative;
}
.login::before { content: ''; position: fixed; left: 0; right: 0; top: 0; height: 4px; background: var(--grad); }
.login img { height: 44px; }
.login form { display: flex; flex-direction: column; gap: 12px; width: 320px; }
.login .err { color: var(--red); font-size: .85rem; text-align: center; min-height: 1.2em; }

/* ---------- page head ---------- */
.pagehead { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; flex: 1; font-size: 1.8rem; }

/* ---------- list ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 340px; flex: 1 1 240px; }
.toolbar select { width: auto; }
.toolbar .count { color: var(--muted); font-size: .85rem; margin-left: auto; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.seg button { border: none; background: transparent; color: var(--muted); padding: 6px 14px; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.table-scroll { overflow-x: auto; max-width: 100%; }
.list-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.list td { overflow-wrap: anywhere; }
table.list th.c-title { width: 19%; }
table.list th.c-type { width: 11%; }
table.list th.c-client { width: 13%; }
table.list th.c-subj { width: 11%; }
table.list th.c-code { width: 8%; }
table.list th.c-date { width: 9%; }
table.list td.c-date { white-space: nowrap; overflow-wrap: normal; }
table.list th.c-money { width: 12%; text-align: right; }
table.list th.c-acts { width: 132px; }
table.list td.num { font-size: .9rem; overflow-wrap: normal; white-space: normal; padding-left: 4px; }
.firmfilter { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.firmfilter .sheettab { padding: 6px 14px; font-size: .85rem; }
.fcount { font-weight: 500; opacity: .6; margin-left: 2px; }
table.list th {
  text-align: left; font-size: .72rem; font-weight: 600; letter-spacing: .03em;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff;
}
table.list td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { padding-left: 10px; padding-right: 10px; }
table.list .typebadge { font-size: .62rem; padding: 3px 8px; white-space: normal; line-height: 1.3; border-radius: 8px; }
table.list tr:last-child td { border-bottom: none; }
table.list tr.row { cursor: pointer; }
table.list tr.row:hover { background: #fafafb; }
table.list .title { font-weight: 600; color: var(--ink); }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list td.subjcol, table.list td.muted { color: var(--muted); font-size: .88rem; }
table.list .acts { white-space: nowrap; text-align: right; padding-left: 4px; }
table.list .acts button.mini { padding: 4px 3px; }
.profit-pos { color: var(--green); font-weight: 600; }
.profit-neg { color: var(--red); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 80px 0; }
.sheetcount { font-weight: 500; font-size: .72rem; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 2px 8px; margin-left: 6px; white-space: nowrap; }
.typebadge { display: inline-block; font-size: .66rem; font-weight: 700; letter-spacing: .05em; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }

/* ---------- budget head + tabs ---------- */
.bhead { margin-bottom: 26px; }
.crumb { font-size: .85rem; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--ink); }
.titlerow { display: flex; align-items: center; gap: 12px; margin: 8px 0 18px; }
.titlerow h1 { margin: 0; font-size: 1.7rem; }
.titlerow input.title { border: 1px solid transparent; font-size: 1.7rem; font-weight: 700; color: var(--ink); padding: 2px 8px; margin-left: -9px; letter-spacing: -.015em; background: transparent; }
.titlerow input.title:hover { border-color: var(--line2); }
.tabsrow { display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.btabs { display: flex; gap: 4px; flex: 1; }
.btabs a {
  text-decoration: none; padding: 10px 16px; color: var(--muted); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center;
}
.btabs a .n { font-size: .72rem; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.btabs a:hover { color: var(--ink); }
.btabs a.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.btabs a.active .n { background: var(--ink); color: #fff; }
.tabacts { display: flex; gap: 8px; padding-bottom: 8px; }

/* ---------- cards ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 22px;
}
.card h2 { margin: 0 0 14px; }
.card.accented { border-top: 3px solid var(--accent, var(--line)); }
.headgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.headgrid .span2 { grid-column: span 2; }
.headgrid .span3 { grid-column: span 3; }
.headgrid .span6 { grid-column: span 6; }
.doclogo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 20px; }
.logoblock { display: flex; align-items: center; gap: 24px; }
.doclogo img { height: 44px; max-width: 200px; object-fit: contain; }
.subjpick select { width: auto; min-width: 240px; font-weight: 600; }
.doclogo .doctitlewrap { text-align: right; }
.doclogo input.doctitle {
  border: none; border-bottom: 1px dashed var(--line2); border-radius: 0; font-size: 1.35rem; font-weight: 700;
  text-align: right; padding: 4px 6px; letter-spacing: .02em; color: var(--ink);
}
.doclogo input.doctitle:focus { box-shadow: none; border-bottom-color: var(--blue); }
.doclogo .hint { display: block; font-size: .72rem; color: var(--muted); margin-top: 3px; }
.sharing { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.sharechips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line2);
  border-radius: 999px; padding: 6px 14px; font-size: .86rem; font-weight: 500;
  letter-spacing: 0; color: var(--text); margin: 0; cursor: pointer; background: #fff;
}
.chip:hover { border-color: var(--ink); }

/* ---------- souhrn sekcí ---------- */
.secsum { max-width: 640px; }
table.secsumtab { width: 100%; border-collapse: collapse; }
table.secsumtab td { padding: 8px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.secsumtab td.l { width: 34px; font-weight: 700; color: var(--muted); }
table.secsumtab td.r { text-align: right; white-space: nowrap; }
table.secsumtab tr.grp td { font-size: .75rem; font-weight: 600; letter-spacing: .03em; color: var(--muted); padding-top: 14px; }
table.secsumtab tr.tot td { font-weight: 700; color: var(--ink); border-bottom: none; }
table.secsumtab tr.tot:first-of-type td, table.secsumtab tr.tot1 td { border-top: 1px solid var(--line2); }

/* ---------- sheets (dílčí části) ---------- */
.sheettabs { display: flex; gap: 6px; align-items: center; margin: 4px 0 18px; flex-wrap: wrap; }
.sheettab { padding: 7px 16px; }
.sheettab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.sheetops { margin-left: auto; display: flex; gap: 2px; }
.sheetlabel { margin: 28px 0 12px; font-size: 1.2rem; padding-bottom: 8px; border-bottom: 1px solid var(--line2); }

/* ---------- sections ---------- */
.section { margin-bottom: 28px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 12px; }
.sechead { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.secletter {
  width: 26px; height: 26px; border-radius: 8px; background: var(--soft); color: var(--ink);
  font-weight: 700; font-size: .82rem; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.sechead input.secname, .sechead .secname {
  border: 1px solid transparent; font-weight: 700; font-size: 1.08rem; padding: 4px 6px; background: transparent; color: var(--ink);
}
.sechead input.secname:hover { border-color: var(--line2); }
.sechead .secbtns { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.section:hover .sechead .secbtns, .sechead .secbtns:focus-within { opacity: 1; }

table.items { width: 100%; border-collapse: collapse; }
table.items th {
  font-size: .7rem; font-weight: 600; letter-spacing: .03em; color: var(--muted);
  text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.items th.r, table.items td.r { text-align: right; }
table.items th.c, table.items td.c { text-align: center; }
table.items td { padding: 3px 3px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.items td.comp { font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 8px; font-size: .92rem; }
table.items input, table.items select { border-color: transparent; background: transparent; }
table.items input:hover, table.items select:hover { border-color: var(--line2); background: #fff; }
table.items input:focus, table.items select:focus { background: #fff; }
table.items select { width: auto; padding: 6px 4px; }
table.items .rowbtns { display: flex; gap: 0; opacity: 0; }
table.items tr:hover .rowbtns, table.items .rowbtns:focus-within { opacity: 1; }
table.items tfoot td { font-weight: 700; border-bottom: none; padding: 10px 6px 4px; color: var(--ink); }
table.items tr.changed td { background: #fff9db; }
.secfoot { display: flex; gap: 10px; margin-top: 8px; align-items: center; }
.addpos { max-width: 280px; width: auto; }
.muted { color: var(--muted); }

/* ---------- summary ---------- */
.feenote { font-size: .8rem; color: var(--muted); margin: 6px 2px; }
.summary {
  margin-left: auto; max-width: 450px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px;
}
.summary .row { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; font-variant-numeric: tabular-nums; }
.summary .row.sub { color: var(--muted); font-size: .88rem; }
.summary .row.strong { font-weight: 700; color: var(--ink); }
.summary .row.total {
  font-weight: 700; font-size: 1.2rem; color: var(--ink); border-top: 1px solid var(--line2);
  margin-top: 10px; padding-top: 14px;
}
.summary .row.total .val { background: var(--soft); padding: 2px 10px; border-radius: 8px; }
.sumgrid { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.sumgrid .summary { margin-left: 0; flex: 1 1 380px; }

/* ---------- vyúčtování pro klienta / interní ---------- */
.intro { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; color: var(--muted); font-size: .88rem; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.intro .chip { font-size: .82rem; }
.int-item { font-weight: 600; color: var(--ink); }
.costrow td { background: var(--soft); font-size: .88rem; border-bottom: 1px solid #fff; }
.costrow td:first-child { padding-left: 30px; }
.costrow input, .costrow select { font-size: .88rem; }
.costrow .costdesc { display: flex; gap: 6px; }
.warnbadge { display: inline-block; background: #fff4bf; border-radius: 999px; padding: 1px 8px; font-size: .7rem; font-weight: 600; margin-left: 8px; color: #7a6400; }
table.acc { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.acc th { font-size: .7rem; font-weight: 600; color: var(--muted); text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.acc th:first-child, table.acc td:first-child { text-align: left; }
table.acc td { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.acc tr.strong td { font-weight: 700; color: var(--ink); border-bottom: none; }
table.items.shsum { margin-bottom: 24px; }

/* ---------- settings ---------- */
.setgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.setgrid .full { grid-column: 1 / -1; }
table.positions { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.positions th { text-align: left; font-size: .7rem; font-weight: 600; color: var(--muted); padding: 4px; }
table.positions td { padding: 3px; }
table.positions td.price { width: 140px; }
table.positions td.unit { width: 100px; }
table.positions td.x { width: 44px; }
.firmtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.firmtabs button img { height: 16px; max-width: 60px; object-fit: contain; }
.firmgrid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 26px; }
.firmgrid h3 { font-size: .95rem; margin: 22px 0 8px; }
.colorrow { display: flex; gap: 8px; align-items: center; }
.colorrow input[type=text] { width: 110px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.logoedit { display: flex; gap: 16px; align-items: center; }
.logoedit img { height: 48px; max-width: 200px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.brandprev { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; font-size: .82rem; position: sticky; top: 80px; }
.brandprev .bp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.brandprev .bp-head img { height: 30px; max-width: 150px; object-fit: contain; }
.brandprev .bp-head b { font-size: 1rem; }
.brandprev .bp-th, .brandprev .bp-sec, .brandprev .bp-row, .brandprev .bp-fee { display: flex; justify-content: space-between; padding: 6px 8px; }
.brandprev .bp-th { color: #fff; font-weight: 700; font-size: .72rem; }
.brandprev .bp-sec, .brandprev .bp-fee { font-weight: 700; }
.brandprev .bp-row { border-bottom: 1px solid var(--line); }
.brandprev .bp-fee { margin-top: 10px; }
.brandprev .bp-cap { font-size: .7rem; color: var(--muted); margin-top: 10px; }
.chipline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#qr2fa { margin: 10px 0; }
#qr2fa img, #qr2fa canvas { border: 1px solid var(--line); padding: 10px; background: #fff; border-radius: 10px; }

/* ---------- print view ---------- */
.printbar { display: flex; gap: 10px; margin-bottom: 24px; align-items: center; flex-wrap: wrap; }
.sheet {
  max-width: 900px; margin: 0 auto; background: #fff; font-size: .82rem; padding: 40px;
  border: 1px solid var(--line); border-radius: var(--radius); color: #111;
}
.sheet .p-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.sheet .p-head img { height: 46px; max-width: 240px; object-fit: contain; }
.sheet .p-head h1 { margin: 0; font-size: 1.35rem; color: #111; letter-spacing: .02em; }
.sheet table.meta { width: 100%; border-collapse: collapse; margin-bottom: 26px; }
.sheet table.meta td { border: 1px solid #c8c8cc; padding: 6px 10px; vertical-align: top; }
.sheet table.meta td.k { width: 32%; font-weight: 700; background: #f4f4f4; }
.sheet table.ptab { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.sheet table.ptab th { background: var(--p-head, #58585a); color: #fff; font-size: .72rem; padding: 5px 8px; text-align: right; }
.sheet table.ptab th:first-child { text-align: left; }
.sheet table.ptab td { padding: 5px 8px; border-bottom: 1px solid #e6e6e8; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet table.ptab td:first-child { text-align: left; white-space: normal; }
.sheet table.ptab tr.secname td { background: var(--p-sec, #f6d9db); font-weight: 700; text-align: left; }
.sheet table.ptab tr.sectotal td { font-weight: 700; border-bottom: 2px solid #111; }
.sheet table.psum { max-width: 430px; margin-bottom: 26px; }
.sheet table.psum td:first-child, .sheet table.psum th:first-child { text-align: left; }
.sheet .psheethead { background: var(--p-head, #58585a); color: #fff; font-weight: 700; font-size: .95rem; padding: 7px 10px; margin: 24px 0 10px; }
.sheet .feerow { display: flex; justify-content: space-between; background: var(--p-sec, #f6d9db); font-weight: 700; padding: 7px 10px; margin: 18px 0; }
.sheet .pfeenote { margin: -12px 0 18px; font-size: .68rem; }
.sheet .p-summary { margin-left: auto; width: 340px; margin-bottom: 30px; }
.sheet .p-summary .row { display: flex; justify-content: space-between; padding: 3px 0; font-variant-numeric: tabular-nums; }
.sheet .p-summary .row.total { font-weight: 700; font-size: 1rem; border-top: 2px solid #111; margin-top: 6px; padding-top: 8px; }
.sheet .clause { font-size: .68rem; color: #333; margin: 22px 0 14px; }
.sheet .signs { display: flex; gap: 60px; margin: 34px 0 40px; }
.sheet .signs .s { width: 260px; }
.sheet .signs .line { border-top: 1px dotted #555; margin-top: 44px; padding-top: 5px; font-size: .75rem; }
.sheet .fincond { white-space: pre-wrap; margin: 14px 0; }
.sheet .fincond h3 { font-size: .9rem; margin: 0 0 6px; }
.sheet .confid { font-size: .62rem; color: #777; border-top: 1px solid #e6e6e8; padding-top: 10px; }

@media print {
  body { background: #fff; }
  .topbar, .printbar, .bhead, .no-print { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .sheet { font-size: 9.2pt; max-width: none; border: none; padding: 0; border-radius: 0; }
  .sheet table.ptab th, .sheet .psheethead { background: var(--p-head, #58585a) !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet table.ptab tr.secname td, .sheet .feerow { background: var(--p-sec, #f6d9db) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet table.meta td.k { background: #f4f4f4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .section, table.ptab tr { break-inside: avoid; }
  .section { border: none; padding: 0; }
  .internal .print-only { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
  .internal .print-only img { height: 40px; }
  .internal .print-only .r { text-align: right; }
  .internal .print-only h1 { margin: 0 0 4px; font-size: 1.4rem; }
  .internal { font-size: 9.5pt; }
  .internal table.items th:last-child, .internal table.items td:last-child { display: none; }
  .internal .costrow td { background: #f4f4f4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .internal input, .internal select { border: none !important; background: transparent !important; padding: 2px 4px; font-size: inherit; appearance: none; }
  .internal input::placeholder { color: transparent; }
  .internal .summary, .internal .card { break-inside: avoid; border: 1px solid #ccc; }
}
.print-only { display: none; }
@page { size: A4; margin: 14mm 12mm; }

@media (max-width: 1380px) { table.list .c-code, table.list .c-incl { display: none; } }
@media (max-width: 1150px) { table.list .c-type, table.list .c-date { display: none; } }
@media (max-width: 900px) {
  table.list .c-subj, table.list .c-profit { display: none; }
  .headgrid { grid-template-columns: 1fr 1fr; }
  .headgrid .span2, .headgrid .span3, .headgrid .span6 { grid-column: span 2; }
  .setgrid, .firmgrid { grid-template-columns: 1fr; }
  .wrap { padding: 18px 14px 40px; }
  .topbar { padding: 12px 14px; gap: 12px; }
  .doclogo { flex-direction: column; align-items: flex-start; }
  table.items { font-size: .85rem; }
  .table-scroll { overflow-x: auto; }
}

/* ---------- přístupy a skupiny ---------- */
.accesshead { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 12px; }
.accrow { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.acclabel { width: 130px; flex: none; font-size: .78rem; color: var(--muted); padding-top: 8px; }
.chip.on { border-color: var(--ink); background: var(--soft); }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.grp { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.grphead { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.grphead input { font-weight: 700; border-color: transparent; padding: 4px 6px; }
.grphead input:hover { border-color: var(--line2); }
@media (max-width: 900px) { .accrow { flex-direction: column; gap: 6px; } .acclabel { padding-top: 0; } }
