:root {
  --bg: #f5f6f8; --card: #fff; --line: #dfe3e8; --text: #1d2733; --muted: #6a7686;
  --brand: #1f5fbf; --brand-d: #174b97; --ok: #1e8a4c; --warn: #c27a00; --bad: #c0392b;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 52px; background: #14233a; color: #fff; position: sticky; top: 0; z-index: 5; }
.topbar a { color: #cfd9e8; }
.topbar a.active, .topbar a:hover { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 700; color: #fff; margin-right: 8px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: #9fb1c9; font-size: 13px; }
main { max-width: 1200px; margin: 0 auto; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fff; color: var(--text); max-width: 100%;
}
textarea { width: 100%; min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec0f5; border-color: var(--brand); }
button, .btn { display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 12px; cursor: pointer; color: var(--text); }
button:hover, .btn:hover { background: #eef1f5; text-decoration: none; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-d); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; cursor: default; }
th.sortable { cursor: pointer; }
tr.row:hover { background: #f0f4fa; cursor: pointer; }
.key { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; white-space: nowrap; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #e7ebf0; color: #3b4859; white-space: nowrap; }
.s-new { background: #e1ecfb; color: #1b4f9c; }
.s-accepted { background: #e6e1fa; color: #4b3a99; }
.s-in_progress { background: #fff0cc; color: #8a5a00; }
.s-testing { background: #ffe3d1; color: #9a4310; }
.s-done { background: #d9f2e3; color: #17683a; }
.s-rejected, .s-duplicate { background: #e9e9ea; color: #5b5f66; }
.p-urgent { background: #fbdcd8; color: #962b1f; }
.p-high { background: #ffe6cf; color: #9a4a08; }
.p-low { background: #eef0f2; color: #6a7686; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); margin: 8px 0; }
.ok { color: var(--ok); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field { flex: 1 1 180px; }
.form-row .field select, .form-row .field input { width: 100%; }
.field input[type=text], .field input[type=email], .field input[type=password], .field select { width: 100%; }
.meta dt { color: var(--muted); font-size: 12px; margin-top: 10px; }
.meta dd { margin: 2px 0 0; }
.meta select { width: 100%; }
.desc { white-space: pre-wrap; word-wrap: break-word; }
.comment { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.comment .head { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.timeline .when { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #eef1f5; border-radius: 10px; padding: 1px 9px; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eaedf1; border-radius: var(--radius); padding: 8px; min-height: 120px; }
.col h3 { font-size: 13px; margin: 2px 4px 8px; display: flex; justify-content: space-between; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; display: block; color: var(--text); }
.tcard:hover { border-color: var(--brand); text-decoration: none; }
.tcard .title { margin: 3px 0 5px; }
.login { max-width: 360px; margin: 12vh auto; }
.attach { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.thumb { max-width: 100%; max-height: 220px; border: 1px solid var(--line); border-radius: 6px; margin: 4px 0; display: block; }
.dialog-bg { position: fixed; inset: 0; background: rgba(15, 25, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 20; }
.dialog { background: #fff; border-radius: var(--radius); padding: 18px; width: min(460px, 92vw); }
.dialog h3 { margin: 0 0 10px; }
.dialog .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.toast { position: fixed; bottom: 18px; right: 18px; background: #14233a; color: #fff; padding: 9px 14px; border-radius: 6px; z-index: 30; }

.codes { background: #f0f2f5; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; font-size: 15px; letter-spacing: .04em; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; word-break: break-all; }

.comment.internal { background: #fff8e1; border-color: #e8d27a; }
.hint-box { background: #eef4ff; border: 1px solid #c9dbf7; border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; }

.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0; }
.form-row .field .check input, .check input { width: auto; }
.check, .field label.check { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; margin: 0; cursor: pointer; }

/* ---------- Mobil / keskeny képernyő ---------- */
.topbar .brk { display: none; }
@media (max-width: 860px) {
  .grid2 { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  .grid2 > div { display: contents; }
  .grid2 .o-head { order: 1; } .grid2 .o-side { order: 2; } .grid2 .o-atts { order: 3; }
  .grid2 .o-links { order: 4; } .grid2 .o-comments { order: 5; } .grid2 .o-hist { order: 6; }
  .grid2 .o-atts, .grid2 .o-links, .grid2 .o-comments, .grid2 .o-hist { margin-top: 0 !important; }
  main { padding: 12px; }
}
@media (max-width: 700px) {
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; }
  button, .btn { min-height: 40px; padding: 8px 14px; }
  .toolbar > input[type=search], .toolbar > input[type=text] { flex: 1 1 160px; min-width: 0; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 6px 12px; position: static; align-items: center; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar .brand { order: 1; margin-right: 0; flex: 0 0 auto; }
  .topbar .spacer { order: 2; flex: 1 1 0; }
  .topbar .who { order: 3; flex: 0 1 auto; min-width: 0; max-width: 36vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar button { order: 4; flex: 0 0 auto; min-height: 34px; padding: 4px 10px; }
  .topbar .brk { display: block; order: 5; flex-basis: 100%; height: 0; }
  .topbar a:not(.who) { order: 6; padding: 4px 0; }
  /* ticketlista: kártyák */
  table.tickets, table.tickets tbody { display: block; width: 100%; }
  table.tickets thead { display: none; }
  table.tickets tr.row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.tickets td { display: block; padding: 0; border: 0; }
  table.tickets .c-key { order: 1; }
  table.tickets .c-status { order: 2; }
  table.tickets .c-prio { order: 3; margin-left: auto; }
  table.tickets .c-title { order: 4; flex: 1 0 100%; font-weight: 500; }
  table.tickets .c-type, table.tickets .c-org, table.tickets .c-assignee, table.tickets .c-date { order: 5; font-size: 12px; color: var(--muted); }
  table.tickets .c-empty, table.tickets .empty { display: none; }
  /* egyéb (admin) táblák: vízszintes görgetés */
  table:not(.tickets) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dialog { max-width: 96vw; }
  .pager { flex-wrap: wrap; }
}

ul.plain { list-style: none; padding: 0; margin: 8px 0; }
