/* Issue Desk: a service-desk queue. Counts strip, filter bar, ticket rows; details, the new-ticket form and Users open in place of the list. */
:root {
  --bg: #f3f5f6; --surface: #ffffff; --surface-2: #e9eef0; --fg: #172328; --muted: #5b6b72; --line: #d4dde1;
  --accent: #0b6e7f; --accent-fg: #ffffff; --accent-soft: #d8edf0;
  --s-open: #1f6fd1; --s-open-bg: #e1ecfb; --s-prog: #9a5b00; --s-prog-bg: #fbeed6;
  --s-wait: #6b4fbf; --s-wait-bg: #ece6fb; --s-done: #2b7a3d; --s-done-bg: #dff1e3;
  --p-urgent: #c4321f; --p-high: #d97a12; --p-normal: #7d8b91; --p-low: #b6c1c5;
  --danger: #b3261e; --ok: #2b7a3d;
  --shadow: 0 10px 40px rgba(16, 32, 38, .18);
  --f-display: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1719; --surface: #162125; --surface-2: #1d2a2f; --fg: #e3ecee; --muted: #93a5ab; --line: #2b3a40;
    --accent: #3fb3c4; --accent-fg: #062126; --accent-soft: #163c43;
    --s-open: #7fb2f3; --s-open-bg: #1a2c45; --s-prog: #f0b552; --s-prog-bg: #3a2c12;
    --s-wait: #b9a5f2; --s-wait-bg: #2c2545; --s-done: #7fcf8f; --s-done-bg: #18321f;
    --p-urgent: #f07563; --p-high: #f0a14a; --p-normal: #7f9196; --p-low: #45565b; --danger: #f2877d; --ok: #7fcf8f;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg); font: 15px/1.5 var(--f-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.fine { font-size: 12px; color: var(--muted); margin: 0; }
.error { color: var(--danger); font-size: 14px; margin: 0; }
.ok { color: var(--ok); font-size: 14px; margin: 0; }
.min0 { min-width: 0; }
.app-name { font-family: var(--f-display); font-weight: 700; font-size: 34px; line-height: 1; margin: 0; letter-spacing: -.01em; }

/* Auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding-block: 32px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px 24px; display: grid; gap: 16px; }
.auth-card .app-name { font-size: 30px; }
.auth-card p { margin: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; justify-self: start; font-size: 14px; text-decoration: underline; }

/* App layout */
.wrap { max-width: 1040px; margin: 0 auto; display: grid; gap: 20px; padding-block: 24px 48px; }
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.brand p { margin: 6px 0 0; font-size: 14px; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.alerts { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.role { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }

.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 14px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.block { width: 100%; padding: 10px 14px; }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.count { padding: 12px 16px; border: 0; border-left: 1px solid var(--line); border-bottom: 3px solid transparent; cursor: pointer; background: none; text-align: left; }
.count:first-child { border-left: 0; }
.count[aria-pressed="true"] { border-bottom-color: var(--accent); background: var(--surface-2); }
.count b { display: block; font-family: var(--f-display); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.d-open { background: var(--s-open); } .d-in_progress { background: var(--s-prog); } .d-waiting { background: var(--s-wait); } .d-resolved { background: var(--s-done); }

.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { flex: 1 1 220px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.list { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.row { display: grid; grid-template-columns: 4px 72px minmax(0, 1fr) auto; gap: 0 14px; align-items: center; padding: 12px 16px 12px 0; border: 0; border-top: 1px solid var(--line); cursor: pointer; background: none; width: 100%; text-align: left; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.stripe { align-self: stretch; border-radius: 0 2px 2px 0; }
.tid { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.row .main { min-width: 0; }
.ttl { font-weight: 600; overflow-wrap: anywhere; display: block; }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.row.done .ttl { color: var(--muted); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st-open { color: var(--s-open); background: var(--s-open-bg); }
.st-in_progress { color: var(--s-prog); background: var(--s-prog-bg); }
.st-waiting { color: var(--s-wait); background: var(--s-wait-bg); }
.st-resolved { color: var(--s-done); background: var(--s-done-bg); }
.pr-urgent { background: var(--p-urgent); } .pr-high { background: var(--p-high); } .pr-normal { background: var(--p-normal); } .pr-low { background: var(--p-low); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-size: 16px; margin-bottom: 4px; }

/* Panels: shown in the page, in place of the list, while open */
.view { display: grid; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.panel header h2 { margin: 0; font-family: var(--f-display); font-size: 22px; line-height: 1.2; text-wrap: balance; overflow-wrap: anywhere; }
.panel .body { padding: 18px 20px 28px; display: grid; gap: 20px; align-content: start; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 6px; padding: 12px 14px; margin: 0; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.status-set { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.status-set button { border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.status-set button[aria-pressed="true"] { border-color: currentColor; font-weight: 600; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.file { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface-2); display: grid; text-decoration: none; color: inherit; cursor: pointer; padding: 0; text-align: left; }
.file .thumb { aspect-ratio: 4 / 3; max-width: 100%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.file img.thumb { width: 100%; object-fit: cover; }
.file .fn { font-size: 12px; padding: 6px 8px; overflow-wrap: anywhere; background: var(--surface); }
.addfiles { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.dropzone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 16px; border: 2px dashed var(--line); border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 14px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
.picked { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.picked:empty { display: none; }
.picked li { display: flex; gap: 10px; align-items: baseline; }
.picked .linklike { font-size: 13px; }

.thread { display: grid; gap: 14px; }
.note .head { font-size: 13px; color: var(--muted); }
.note .head b { color: var(--fg); font-weight: 600; }
.note .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.note.sys .head::before { content: "● "; color: var(--accent); }

.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input:not([type=file]), .field select, .field textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.field textarea { min-height: 120px; resize: vertical; }
.field textarea.short { min-height: 80px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dupes { border: 1px solid var(--s-prog); background: var(--s-prog-bg); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.dupes ul { margin: 6px 0 0; padding-left: 18px; }
.dupes button { background: none; border: 0; padding: 0; color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; text-align: left; font-size: 14px; }
.dupe { color: var(--s-prog); font-weight: 600; }
.newupd { color: var(--accent); font-weight: 700; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.invite { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }

.people { display: grid; gap: 8px; }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.person .nm { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.person .nm small { display: block; color: var(--muted); }
.person select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13px; }
.person label { font-size: 13px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.person.off .nm { color: var(--muted); text-decoration: line-through; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 6px; z-index: 40; font-size: 14px; max-width: calc(100% - 32px); }

