/* Komunikator */
:root {
  --bg: #f4f6f9; --card: #fff; --line: #e1e5eb; --text: #1f2933; --muted: #6b7785;
  --accent: #1c6dd0; --accent-d: #1557a8; --bad: #c92a2a; --ok: #2b8a3e; --warn: #e67700;
  --in: #fff; --out: #e7f1ff; --sys: #fff8e1;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; margin-top: 1.2em; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #c6ccd4; border-radius: 6px; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3f5; outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }
label { display: block; margin: 0 0 10px; font-weight: 500; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 7px; font-weight: 400; margin: 4px 0; }
label.check input { margin: 0; }
pre.code, code { font-family: Consolas, "SF Mono", monospace; background: #eef1f5; border-radius: 5px; }
code { padding: 1px 5px; }
pre.code { padding: 10px 12px; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; }
.bad-text { color: var(--bad); } .ok-text { color: var(--ok); }
.btn { display: inline-block; padding: 7px 14px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; font-weight: 500; }
.btn:hover { background: var(--accent-d); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.secondary:hover { background: #eef5ff; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn-link { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
form.inline { display: inline; }
.err, .ok { padding: 10px 12px; border-radius: 6px; margin: 0 0 12px; }
.err { background: #fff0f0; border: 1px solid #f3c1c1; color: #8a1c1c; }
.ok { background: #ebfbee; border: 1px solid #b2f2bb; color: #1b5e20; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #e9ecef; font-size: 12px; }
.pill.ok { background: #d3f9d8; color: #1b5e20; padding: 1px 8px; border: 0; margin: 0; }
.pill.bad { background: #ffe3e3; color: #8a1c1c; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 0 0 16px; }
.card.inner { background: #f8fafc; margin-top: 10px; }
.card.narrow { max-width: 460px; }

/* strony proste (logowanie, instalator) */
.page-plain { display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; min-height: 100%; }
.page-plain .login { width: 100%; max-width: 380px; margin-top: 8vh; }
.page-plain .install { width: 100%; max-width: 780px; }
.page-plain h1 { font-size: 1.5rem; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 3px 0 3px 24px; position: relative; }
.checks li::before { position: absolute; left: 0; font-weight: 700; }
.checks li.ok { background: none; border: 0; padding: 3px 0 3px 24px; margin: 0; color: inherit; }
.checks li.ok::before { content: "✔"; color: var(--ok); }
.checks li.bad::before { content: "✘"; color: var(--bad); }
.checks li.warn::before { content: "!"; color: var(--warn); }
.ok-card { border-color: #b2f2bb; }

/* pasek górny */
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 48px; background: #1f2933; color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 15px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #cbd2d9; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.topbar nav a.on, .topbar nav a:hover { background: #323f4b; color: #fff; }
.topbar .logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.topbar .who { color: #cbd2d9; font-size: 13px; }
.topbar .btn-link { color: #fff; }

/* konfiguracja */
.page { max-width: 1150px; margin: 0 auto; padding: 18px 16px 40px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-color: var(--accent); font-weight: 600; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.row-between h2 { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tbl.small td { font-size: 12.5px; }
.tbl tr.lvl-error td { color: var(--bad); } .tbl tr.lvl-warning td { color: var(--warn); }
.w-num { width: 80px !important; }
details.help, details.danger { margin: 10px 0 16px; }
details summary { cursor: pointer; color: var(--accent); }
details.danger summary { color: var(--bad); margin-top: 16px; }
details.danger input[name=confirm] { width: 120px !important; display: inline-block; }
.access-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.access-grid.disabled { opacity: .45; }
.access-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0; }
.access-box legend { font-weight: 600; padding: 0 4px; }
.acc-list { margin: 6px 0 8px 22px; }
.acc-list.disabled { opacity: .45; }
.code-big { font: 700 22px Consolas, monospace; letter-spacing: 2px; background: #eef1f5; padding: 2px 10px; border-radius: 6px; }

/* skrzynka */
.inbox { display: grid; grid-template-columns: 230px minmax(320px, 420px) 1fr; height: calc(100vh - 48px); }
.side { background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; }
.side-block { margin-bottom: 16px; }
.side-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.labels { list-style: none; margin: 0; padding: 0; }
.labels li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.labels li:hover { background: #f1f3f5; }
.labels li.on { background: #e7f1ff; font-weight: 600; }
.labels .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.labels .cnt { margin-left: auto; font-size: 12px; color: var(--muted); }
.labels .cnt.hot { background: var(--bad); color: #fff; border-radius: 9px; padding: 0 7px; font-weight: 700; }
.kinds label.check { margin: 2px 0; }
.sync .btn { margin-top: 6px; }
.list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-width: 0; background: #fafbfc; }
.list-tools { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); background: #fff; }
.list-tools select { width: auto; }
.list { flex: 1; overflow-y: auto; }
.row { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; background: #fff; }
.row:hover { background: #f6f9fc; }
.row.on { background: #e7f1ff; box-shadow: inset 3px 0 0 var(--accent); }
.row.unread .who { font-weight: 700; }
.row-top { display: flex; justify-content: space-between; gap: 8px; }
.row .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-mid { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 3px 0; font-size: 11.5px; }
.row .src { color: var(--muted); }
.row-sub { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-prev { font-size: 12.5px; color: #52606d; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lbl { color: #fff; border-radius: 4px; padding: 0 6px; font-size: 11.5px; }
.kind { border-radius: 4px; padding: 0 6px; font-size: 11.5px; background: #e9ecef; color: #343a40; }
.kind-problem { background: #fff3bf; color: #7a5b00; }
.kind-discussion { background: #ffe8cc; color: #8a4b00; }
.kind-complaint { background: #ffe3e3; color: #8a1c1c; }
.kind-empik { background: #e5dbff; color: #4b2a99; }
.kind-email { background: #d3f9d8; color: #1b5e20; }
.deadline { font-size: 11.5px; color: var(--muted); }
.deadline.soon { color: var(--bad); font-weight: 700; }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 6px; border-top: 1px solid var(--line); background: #fff; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 2px 10px; cursor: pointer; }
.empty { padding: 30px 16px; text-align: center; }
.conv-pane { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.conv-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.conv-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.conv-actions label { margin: 0; display: flex; align-items: center; gap: 6px; }
.conv-actions select { width: auto; padding: 3px 6px; }
.back { display: none; }
.info { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.info dt { color: var(--muted); } .info dd { margin: 0; white-space: pre-wrap; }
.msgs { flex: 1; overflow-y: auto; padding: 14px; }
.msg { max-width: 78%; margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--in); }
.msg.out { margin-left: auto; background: var(--out); border-color: #c5dcfa; }
.msg.sys { margin: 0 auto 12px; background: var(--sys); border-color: #ffe08a; }
.msg.pending { opacity: .8; }
.msg-meta { font-size: 12px; margin-bottom: 4px; }
.msg-body { overflow-wrap: anywhere; }
.msg-body img { max-width: 100%; height: auto; }
.msg-body p { margin: 0 0 .5em; }
.msg-body blockquote { border-left: 3px solid #ced4da; margin: 4px 0; padding-left: 8px; color: var(--muted); }
.atts { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; }
.claim { margin: 0 14px 8px; background: #fff; border: 1px solid #f3c1c1; border-radius: 8px; padding: 8px 12px; }
.claim form { display: grid; gap: 6px; margin-top: 8px; }
.claim select, .w-amount { width: auto !important; }
.reply { background: #fff; border-top: 1px solid var(--line); padding: 10px 14px; }
.reply textarea { min-height: 80px; }
.reply-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.reply-bar select { width: auto; }
.reply-bar .grow { flex: 1; }
.file-btn { margin: 0; cursor: pointer; color: var(--accent); font-weight: 500; }
.file-btn input { display: none; }
.readonly { padding: 10px 14px; background: #fff; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 16px; bottom: 16px; background: #1f2933; color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; max-width: 420px; transition: opacity .5s; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.toast.err { background: var(--bad); }
.toast.hide { opacity: 0; }

@media (max-width: 1000px) {
  .inbox { grid-template-columns: 1fr; }
  .side { display: none; }
  .conv-pane { display: none; }
  body.show-conv .list-pane { display: none; }
  body.show-conv .conv-pane { display: flex; }
  .back { display: inline; }
  .msg { max-width: 92%; }
}
@media (max-width: 1000px) and (min-width: 700px) {
  .inbox { grid-template-columns: 200px 1fr; }
  .side { display: block; }
}

/* dokumentacja */
.help-page ul, .help-page ol { padding-left: 22px; margin: 0 0 8px; }
.help-page li { margin: 3px 0; }
.toc { line-height: 2; }
