/* Producepak Tickets */
:root {
  --ink: #23272a; --ink2: #545454; --muted: #7c8287; --line: #e3e6e3; --line2: #eef0ee;
  --bg: #f5f6f3; --card: #ffffff; --orange: #F28C28; --orange-d: #d9731a; --orange-l: #fff3e6;
  --green: #3FA34D; --green-d: #2E7D3A; --green-l: #eaf6ec; --red: #c62828; --red-l: #fdecec;
  --blue: #1E88E5; --blue-l: #e8f2fd; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --r: 10px; --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: #1f6fb8; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 14px; margin: 0 0 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink2); }
code { font-family: var(--mono); font-size: 12.5px; background: #f1f2ef; padding: 1px 5px; border-radius: 4px; }
pre { background: #1f2326; color: #e9ecef; padding: 12px 14px; border-radius: 8px; overflow: auto; }
pre code { background: none; color: inherit; padding: 0; }
.muted { color: var(--muted); }
.sub { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; display: block; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.overdue { color: var(--red); font-weight: 600; }
.hot { color: var(--orange-d); font-weight: 600; }

/* top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1400px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green-d);
  border-left: 1px solid var(--line); padding-left: 10px; }
.mainnav { display: flex; align-items: center; gap: 4px; }
.mainnav > a, .mainnav summary { padding: 7px 10px; border-radius: 7px; color: var(--ink2); font-weight: 550; cursor: pointer; }
.mainnav > a:hover, .mainnav summary:hover { background: var(--line2); text-decoration: none; }
.mainnav > a.on { color: var(--ink); background: var(--orange-l); }
.search { flex: 1; max-width: 420px; margin-left: auto; }
.search input { width: 100%; }
.dd { position: relative; }
.dd summary { list-style: none; user-select: none; }
.dd summary::-webkit-details-marker { display: none; }
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; z-index: 30; max-height: 70vh; overflow: auto; }
.dd-menu.right { left: auto; right: 0; min-width: 180px; }
.dd-menu a, .dd-menu .linkbtn { display: block; padding: 7px 10px; border-radius: 6px; color: var(--ink); width: 100%; text-align: left; }
.dd-menu a:hover, .dd-menu .linkbtn:hover { background: var(--line2); text-decoration: none; }
.dd-sep { border-top: 1px solid var(--line); margin-top: 4px; }
.dd-empty { display: block; padding: 7px 10px; }
.user summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px; border-radius: 20px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.uname { font-weight: 550; color: var(--ink2); }
.key { font-family: var(--mono); font-size: 11.5px; font-weight: 700; background: var(--green-l); color: var(--green-d);
  padding: 1px 6px; border-radius: 5px; letter-spacing: .02em; }

/* project bar */
.projbar { background: #fff; border-bottom: 1px solid var(--line); }
.projbar-in { max-width: 1400px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px; min-height: 48px; flex-wrap: wrap; }
.projtitle { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.projtitle a { color: var(--ink); }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tabs a { padding: 13px 12px 11px; color: var(--ink2); font-weight: 550; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--orange); }
.subtabs { display: flex; gap: 6px; margin: -6px 0 16px; flex-wrap: wrap; }
.subtabs a { padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--ink2); font-weight: 550; }
.subtabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* layout */
.main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 40px; }
.main.wide { max-width: 1400px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cardhead h2 { margin-bottom: 10px; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.foot { max-width: 1400px; margin: 0 auto; padding: 18px 16px 30px; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 10px; }
.foot img { opacity: .6; height: 18px; width: auto; }
.lead { font-size: 15px; color: var(--ink2); margin: -6px 0 14px; }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--green-l); border-color: #bfe3c5; color: #1d5b29; }
.flash.err { background: var(--red-l); border-color: #f3c3c3; color: #8b1c1c; }
.flash.info { background: var(--blue-l); border-color: #c4dcf6; color: #164c84; }
.tokenval { font-size: 13px; user-select: all; word-break: break-all; }

/* forms */
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cfd4cf; border-radius: 7px; padding: 7px 9px; background: #fff; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(242,140,40,.35); border-color: var(--orange); }
textarea { width: 100%; resize: vertical; min-height: 60px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); vertical-align: -3px; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--ink2); }
label > input:not([type=checkbox]), label > select, label > textarea { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
label.check { font-weight: 450; display: flex; gap: 8px; align-items: center; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; display: grid; gap: 8px; }
legend { font-weight: 650; font-size: 13px; color: var(--ink2); padding: 0 4px; }
.form.stack { display: grid; gap: 12px; }
.form.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form .full { grid-column: 1 / -1; }
.form.row, .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.formactions { display: flex; gap: 14px; align-items: center; }
.inline { display: inline; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.inline-field input { width: 80px; margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 7px 14px;
  border-radius: 8px; border: 1px solid #cfd4cf; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f4f5f2; text-decoration: none; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-d); border-color: var(--orange-d); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: #1f6fb8; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger, .danger { color: var(--red); }

/* filters & tables */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; margin-bottom: 12px; }
.filters label { font-size: 12px; }
.filters label > select, .filters label > input { margin-top: 3px; min-width: 120px; }
.filters .grow { flex: 1; min-width: 200px; }
.reportbar { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; font-size: 13px; }
.reportbar a.saved { color: var(--orange-d); font-weight: 600; }
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.card .tablewrap { border: 0; border-radius: 0; margin: 0 -16px; }
table { border-collapse: collapse; width: 100%; }
table.tickets th, table.tickets td { padding: 9px 12px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: top; }
table.tickets th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: #fafbf9; white-space: nowrap; }
table.tickets th a { color: inherit; }
table.tickets th a.sorted::after { content: " ▾"; }
table.tickets th a.sorted.dir-asc::after { content: " ▴"; }
table.tickets tr:hover td { background: #fcfcfa; }
table.tickets tr.grp th { background: var(--line2); color: var(--ink2); text-transform: none; font-size: 13px; letter-spacing: 0; }
table.tickets tr.disabled td { opacity: .55; }
td.num { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
td.sum a { color: var(--ink); font-weight: 550; }
.tablefoot { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 10px 2px; color: var(--muted); font-size: 13px; }
.savereport summary { cursor: pointer; color: #1f6fb8; }
.savereport form { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.savedlist { margin-top: 8px; display: grid; gap: 4px; }
.empty { background: #fff; border: 1px dashed #cfd4cf; border-radius: var(--r); padding: 26px; text-align: center; color: var(--muted); }
.empty-state { text-align: center; padding: 50px 10px; }
table.mini td { padding: 5px 4px; border-bottom: 1px solid var(--line2); vertical-align: top; font-size: 13px; }
table.mini tr.desc td { color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line2); padding-top: 0; }

/* pills */
.pill, .prio, .tag { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 20px; white-space: nowrap; line-height: 1.5; }
.st-new { background: #e8f2fd; color: #165fa8; }
.st-unaccepted, .st-reassigned { background: #f3eafd; color: #6b2fae; }
.st-reopened { background: #fdecec; color: #a32020; }
.st-accepted { background: #fff3e6; color: #a55410; }
.st-resolved { background: var(--green-l); color: #1d6b2a; }
.st-closed { background: #eceeec; color: #5d6266; }
.pill.res { background: #eceeec; color: #3d4246; }
.prio { padding-left: 0; padding-right: 0; font-weight: 600; }
.prio::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; background: #b6bcb6; }
.pr-5::before, .bf.pr-5 { background: #c62828; } .pr-4::before, .bf.pr-4 { background: #F28C28; }
.pr-3::before, .bf.pr-3 { background: #3FA34D; } .pr-2::before, .bf.pr-2 { background: #7fb7e6; } .pr-1::before, .bf.pr-1 { background: #b6bcb6; }
.tag { background: #eceeec; color: #4a4f53; font-size: 11px; padding: 1px 7px; }
.tag.internal { background: #fff3c4; color: #7a5a00; }

/* ticket page */
.ticket-head { margin-bottom: 14px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.ticket-head h1 { font-size: 24px; }
.tnum { font-family: var(--mono); color: var(--muted); font-weight: 600; font-size: .8em; margin-right: 4px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.md { overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--line); color: var(--ink2); }
.md h3, .md h4, .md h5 { margin: 12px 0 6px; font-size: 15px; }
.desc { font-size: 15px; }
.resnote { margin-top: 12px; padding: 10px 12px; background: var(--green-l); border-radius: 8px; }
.resnote .md, .resnote p { display: inline; }
.files { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.files li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 10px; background: #fafbf9; border: 1px solid var(--line2); border-radius: 7px; }
.files li::before { content: "📎"; }
.thumb { max-height: 70px; max-width: 140px; border-radius: 4px; border: 1px solid var(--line); display: block; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tl-comment { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.tl-comment.internal { background: #fffbea; border-color: #f1e3a6; }
.tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.tl-at { margin-left: auto; color: var(--muted); font-size: 12px; }
.tl-change { font-size: 13px; color: var(--ink2); padding: 2px 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.tl-who { font-weight: 650; }
.chg s { color: var(--muted); }
.commits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.workflow form { margin-bottom: 8px; }
.stack { display: grid; gap: 8px; }
.resolve > summary, .edit > summary { list-style: none; margin-bottom: 8px; }
.resolve > summary::-webkit-details-marker, .edit > summary::-webkit-details-marker { display: none; }
.props dl, dl.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 7px 10px; margin: 0 0 12px; font-size: 13px; }
.props dt, dl.kv dt { color: var(--muted); }
.props dd, dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { text-align: right; padding: 0 4px; }

/* dashboard */
.projlist, .plain, .activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.projlist a { font-weight: 600; }
.activity li { font-size: 13px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; min-width: 130px; box-shadow: var(--shadow); color: var(--ink); }
.stat:hover { text-decoration: none; border-color: var(--orange); }
.stat b { display: block; font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 64px 1fr 32px; gap: 8px; align-items: center; color: var(--ink); font-size: 13px; }
.bar:hover { text-decoration: none; }
.bt { height: 10px; background: var(--line2); border-radius: 5px; overflow: hidden; }
.bf { display: block; height: 100%; border-radius: 5px; }
.bn { text-align: right; font-weight: 650; }
.prog { display: block; height: 6px; background: var(--line2); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.prog.big { height: 10px; margin: 10px 0 6px; }
.prog span { display: block; height: 100%; background: var(--green); }
.ms a { font-weight: 600; }
.ms .sub { display: block; }
.mslist { display: grid; gap: 0; }
.ms-card.done { opacity: .7; }
.ms-card h2 { text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--ink); display: flex; gap: 8px; align-items: center; }
ul.status { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 13px; }
ul.status li::before { content: "●"; margin-right: 8px; }
ul.status li.ok::before { color: var(--green); } ul.status li.bad::before { color: var(--red); }

/* bare (login/setup) */
body.bare { background: linear-gradient(160deg, #fff7ee 0%, #f2f7f1 100%); min-height: 100vh; }
.bare-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.bare-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px 26px;
  box-shadow: 0 20px 50px rgba(0,0,0,.08); }
.bare-card h1 { font-size: 18px; margin-bottom: 14px; }
.bare-logo { display: block; margin: 0 auto 4px; height: 44px; width: auto; }
.bare-label { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--green-d); margin-bottom: 22px; }

@media (max-width: 1000px) {
  .dash, .ticket-grid { grid-template-columns: minmax(0, 1fr); }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .topbar-in { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 8px 12px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .brand img { height: 26px; }
  .uname { display: none; }
  .user { margin-left: auto; }
  .hide-sm { display: none; }
  .form.grid { grid-template-columns: minmax(0, 1fr); }
  .filters label { flex: 1 1 140px; }
  .filters label > select, .filters label > input { min-width: 0; width: 100%; }
  .main { padding-top: 16px; }
  .ticket-head h1 { font-size: 20px; }
  .projbar-in { gap: 4px 16px; padding-top: 6px; }
}
@media (max-width: 1100px) {
  .brand-label { display: none; }
}

/* drop zone */
.lbl { display: block; font-weight: 600; font-size: 13px; color: var(--ink2); margin-bottom: 4px; }
.dropzone { border: 2px dashed #cfd4cf; border-radius: 9px; padding: 12px; background: #fafbf9; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--orange); background: var(--orange-l); }
.dropzone input[type=file] { border: 0; padding: 0; background: none; }
.dz-hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.dz-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.dz-list li.toobig { color: var(--red); }
.wf > summary { list-style: none; margin-bottom: 8px; }
.wf > summary::-webkit-details-marker { display: none; }
.wfhint { margin: -4px 0 10px; }
.btn.danger-btn { color: var(--red); border-color: #f0b8b8; }
.btn.danger-btn:hover { background: var(--red-l); }
.revform { margin: 4px 0 12px; flex-wrap: nowrap; }
.revform input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; }
.watchform { margin-top: 10px; }
.bar.wide-l { grid-template-columns: 110px 1fr 48px; }
.bar.wide-l .bf { background: var(--green); }
.bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-reopened { background: #fdecec; color: #a32020; }
.st-resolved { background: #fff3e6; color: #a55410; }

/* full-page edit */
textarea.bigtext { min-height: 360px; font-size: 15px; line-height: 1.55; }
.mono { font-family: var(--mono); }
.titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.titlerow .btn { flex: none; margin-top: 2px; }
