/* ==========================================================================
   Tracker — visual design following the Atlassian Design System (modern Jira)
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-sunken: #f7f8f9;
  --surface-hovered: #f1f2f4;
  --surface-pressed: #dcdfe4;
  /* text */
  --text: #172b4d;
  --text-subtle: #44546f;
  --text-subtlest: #626f86;
  --text-disabled: #8993a5;
  /* borders */
  --border: #dcdfe4;
  --border-input: #8590a2;
  /* brand */
  --brand: #0c66e4;
  --brand-hovered: #0055cc;
  --brand-pressed: #09326c;
  --selected-bg: #e9f2ff;
  --selected-text: #0c66e4;
  /* semantic */
  --danger: #c9372c;
  --danger-hovered: #ae2a19;
  --danger-bg: #ffeceb;
  --success: #216e4e;
  --success-bg: #dcfff1;
  --neutral-subtle: rgba(9, 30, 66, 0.06);
  --neutral-subtle-hovered: rgba(9, 30, 66, 0.14);
  /* elevation */
  --shadow-raised: 0 1px 1px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
  --shadow-overlay: 0 8px 12px rgba(9, 30, 66, 0.15), 0 0 1px rgba(9, 30, 66, 0.31);
  --shadow-modal: 0 8px 28px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
  /* metrics */
  --radius: 3px;
  --radius-lg: 8px;
  --sidebar-w: 240px;
  --topnav-h: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }

::selection { background: #cce0ff; }

/* Subtle Atlassian-style scrollbars */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(9, 30, 66, 0.18); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(9, 30, 66, 0.32); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------- App shell ---------------- */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.app-body { flex: 1; display: flex; min-height: 0; }

/* ---------------- Global top nav ---------------- */
.topnav {
  height: var(--topnav-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.topnav .brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  color: var(--text); padding-right: 12px; user-select: none;
}
.brand .logo {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, #1868db, #0c66e4);
  border-radius: 6px;
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 14px;
  box-shadow: 0 1px 2px rgba(9, 30, 66, 0.2);
}
.topnav-search { flex: 1; display: flex; justify-content: center; padding: 0 16px; }
.search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0 10px; height: 32px;
  background: var(--surface);
  width: 100%; max-width: 460px;
  color: var(--text-subtlest);
  transition: border-color .15s, box-shadow .15s, background .1s, max-width .2s ease;
}
.search:hover { background: var(--surface-sunken); }
.search:focus-within {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
  max-width: 560px;
}
.search svg { flex-shrink: 0; }
.search input {
  border: none; outline: none; flex: 1; font-size: 14px; background: none;
  color: var(--text); font-family: inherit; min-width: 0;
}
.search input::placeholder { color: var(--text-subtlest); }

.topnav-actions { display: flex; align-items: center; gap: 8px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: var(--neutral-subtle);
  color: var(--text); height: 32px; padding: 0 12px; border-radius: var(--radius);
  font-weight: 500; font-size: 14px; line-height: 1;
  transition: background .1s ease;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--neutral-subtle-hovered); }
.btn:active { background: var(--surface-pressed); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hovered); }
.btn.primary:active { background: var(--brand-pressed); }
.btn.subtle { background: none; color: var(--text-subtle); }
.btn.subtle:hover { background: var(--neutral-subtle); color: var(--text); }
.btn.danger { background: none; color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); color: var(--danger-hovered); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .tab:focus-visible, .project-item:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: 8px;
}

.side-section { padding: 8px; }
.side-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-subtlest); font-weight: 600; padding: 6px 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.side-label button {
  border: none; background: none; color: var(--text-subtlest);
  font-size: 16px; line-height: 1; width: 22px; height: 22px; border-radius: var(--radius);
  display: grid; place-items: center; padding: 0;
}
.side-label button:hover { background: var(--neutral-subtle); color: var(--text); }

.project-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  color: var(--text-subtle); border: none; background: none; width: 100%; text-align: left;
  font-size: 14px; font-weight: 500;
  transition: background .1s ease;
  position: relative;
}
.project-item:hover { background: var(--neutral-subtle); color: var(--text); }
.project-item.active {
  background: var(--selected-bg); color: var(--selected-text); font-weight: 600;
}
.project-item.active::before {
  content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 2px 2px 0; background: var(--brand);
}
.project-avatar {
  width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
  display: grid; place-items: center; color: white; font-weight: 700; font-size: 10px;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.08);
}
.project-item .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ---------------- Page header ---------------- */
.page-head {
  flex-shrink: 0;
  padding: 16px 24px 0;
  background: var(--surface);
}
.crumbs {
  font-size: 12px; color: var(--text-subtlest); font-weight: 500;
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
}
.crumbs .sep { color: var(--text-disabled); }
.page-head-row { display: flex; align-items: center; gap: 12px; }
.page-title {
  font-size: 24px; font-weight: 600; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spacer { flex: 1; }

/* Jira-style underline tabs */
.tabs { display: flex; gap: 16px; margin-top: 4px; }
.tab {
  border: none; background: none; padding: 8px 2px;
  color: var(--text-subtle); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; border-radius: 0;
  transition: color .1s ease;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------------- Boards bar ---------------- */
.boards-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 24px 0; background: var(--surface);
}
.boards-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-subtlest); font-weight: 600; margin-right: 4px;
}
.board-tab {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: var(--neutral-subtle);
  color: var(--text-subtle); height: 28px; padding: 0 12px; border-radius: 14px;
  font-weight: 500; font-size: 13px;
  transition: background .1s ease;
}
.board-tab:hover { background: var(--neutral-subtle-hovered); color: var(--text); }
.board-tab.active {
  background: var(--selected-bg); color: var(--selected-text); font-weight: 600;
}
.board-tab.add { background: none; color: var(--text-subtlest); }
.board-tab.add:hover { background: var(--neutral-subtle); color: var(--text); }
.board-x {
  font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 3px;
  color: inherit; opacity: .7;
}
.board-x:hover { background: var(--danger-bg); color: var(--danger); opacity: 1; }
.board-input {
  border: 2px solid var(--brand); border-radius: 14px; outline: none;
  padding: 0 12px; height: 28px; font-size: 13px; font-family: inherit; width: 150px;
}

/* ---------------- Toolbar (filters) ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--surface);
}
.avatar-row { display: flex; }
.avatar-row .avatar {
  margin-left: -4px; border: 2px solid var(--surface);
  transition: transform .1s ease;
}
.avatar-row .avatar:first-child { margin-left: 0; }
.avatar-row .avatar:hover { transform: translateY(-2px); }
.avatar.btn-avatar { cursor: pointer; }
.avatar.btn-avatar.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
select.filter {
  border: 1px solid var(--border); border-radius: var(--radius);
  height: 32px; padding: 0 8px; font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text-subtle); font-weight: 500;
}
select.filter:hover { background: var(--surface-sunken); }
select.filter:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

/* ---------------- Board ---------------- */
.board {
  flex: 1; overflow-x: auto; overflow-y: hidden;
  display: flex; gap: 8px; padding: 8px 24px 20px; align-items: flex-start;
  background: var(--surface);
}
.column {
  background: var(--surface-sunken); border-radius: var(--radius-lg);
  width: 270px; flex-shrink: 0;
  max-height: 100%; display: flex; flex-direction: column;
  transition: background .15s ease;
}
.column.drag-over {
  background: var(--selected-bg);
  box-shadow: inset 0 0 0 2px var(--brand);
}
.column-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 8px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtlest);
}
.column-head .count {
  color: var(--text-subtlest); font-size: 12px; font-weight: 600;
  text-transform: none;
}
.column-body { overflow-y: auto; padding: 2px 8px 8px; flex: 1; min-height: 44px; }

.card {
  background: var(--surface); border-radius: 6px; padding: 10px 12px 8px;
  box-shadow: var(--shadow-raised); margin-bottom: 6px; cursor: pointer;
  transition: box-shadow .15s ease, background .1s ease;
}
.card:hover { background: #fafbfc; box-shadow: var(--shadow-overlay); }
.card.dragging { opacity: .35; transform: rotate(2deg); }
.card-title { font-size: 14px; line-height: 1.4; margin-bottom: 8px; color: var(--text); }
.card-meta { display: flex; align-items: center; gap: 6px; }
.card-meta .key { font-size: 12px; color: var(--text-subtlest); font-weight: 600; }
.card-meta .spacer { flex: 1; }

/* ---------------- Backlog / list ---------------- */
.list-wrap { flex: 1; overflow: auto; padding: 8px 24px 24px; }
table.issues {
  width: 100%; border-collapse: collapse; background: var(--surface);
}
table.issues th {
  text-align: left; font-size: 12px;
  color: var(--text-subtlest); font-weight: 600;
  padding: 8px 10px; border-bottom: 2px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
table.issues td {
  padding: 8px 10px; border-bottom: 1px solid var(--surface-hovered); font-size: 14px;
}
table.issues tbody tr { transition: background .08s ease; }
table.issues tbody tr:hover { background: var(--surface-sunken); cursor: pointer; }
.cell-key { font-weight: 600; color: var(--text-subtlest); white-space: nowrap; font-size: 13px; }

/* ---------------- Lozenges (status), icons, avatars ---------------- */
.lozenge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
  line-height: 1.45;
}

.type-icon {
  width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0;
  display: inline-grid; place-items: center;
}
.type-icon svg { display: block; }
.prio-icon { display: inline-grid; place-items: center; flex-shrink: 0; }
.prio-icon svg { display: block; }

.avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: white; font-weight: 600; font-size: 10px;
  letter-spacing: .02em; user-select: none;
  box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.1);
}
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.points {
  background: var(--neutral-subtle); color: var(--text-subtle); border-radius: 10px;
  padding: 1px 8px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center;
}

/* ---------------- Modal ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(9, 30, 66, 0.54);
  display: grid; place-items: center; z-index: 100; padding: 24px;
  animation: overlay-in .15s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal);
  width: 100%; max-width: 840px; max-height: 90vh; overflow: auto;
  animation: modal-in .18s cubic-bezier(0.2, 0, 0, 1);
}
.modal.issue-modal {
  width: min(96vw, 1320px); max-width: 1320px; height: 94vh; max-height: 94vh;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.modal.sm { max-width: 500px; }
.modal-head {
  display: flex; align-items: center; gap: 8px; padding: 16px 24px 12px;
  position: sticky; top: 0; background: var(--surface); z-index: 5;
}
.modal-head .title { font-size: 16px; font-weight: 600; }
.modal-head .spacer { flex: 1; }
.modal-head .close {
  border: none; background: none; font-size: 20px; color: var(--text-subtle);
  line-height: 1; width: 32px; height: 32px; border-radius: var(--radius);
  display: grid; place-items: center;
}
.modal-head .close:hover { background: var(--neutral-subtle); color: var(--text); }
.modal-body { padding: 4px 24px 24px; }

.issue-modal .modal-head { padding: 18px 32px 14px; }
.issue-modal .modal-body { padding: 8px 32px 36px; }
.issue-detail { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 40px; }
/* let the editor column shrink instead of blowing out the grid width */
.issue-detail > * { min-width: 0; }
@media (max-width: 900px) {
  .overlay { padding: 12px; }
  .modal.issue-modal { width: 100%; height: 96vh; max-height: 96vh; }
  .issue-modal .modal-head { padding: 14px 18px 10px; }
  .issue-modal .modal-body { padding: 6px 18px 24px; }
  .issue-detail { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
.detail-title {
  font-size: 30px; font-weight: 600; width: 100%; border: 2px solid transparent;
  border-radius: var(--radius); padding: 4px 6px; margin: -4px -6px 12px; resize: none;
  font-family: inherit; color: var(--text); line-height: 1.25; letter-spacing: -0.01em;
  background: none;
}
.detail-title:hover { background: var(--neutral-subtle); }
.detail-title:focus { background: var(--surface); border-color: var(--brand); outline: none; }
.detail-title.static.editable { cursor: text; }
.detail-title.static:not(.editable):hover { background: none; }

.field-label {
  font-size: 12px; font-weight: 600; color: var(--text-subtle); margin: 16px 0 6px;
}
.field-label-row { display: flex; align-items: flex-end; gap: 8px; }
.field-label-row .field-label { flex: 1; }
.field-label-row .btn { margin-bottom: 2px; }
.issue-description-view {
  min-height: 96px; margin: 0 -12px; padding: 12px;
  border: 2px solid transparent; border-radius: 6px;
}
.issue-description-view.editable { cursor: text; }
.issue-description-view.editable:hover {
  background: var(--neutral-subtle); border-color: var(--border);
}
.issue-description-view.editable:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.description-editor-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.desc-box {
  width: 100%; min-height: 90px; border: 1px solid var(--border-input);
  border-radius: var(--radius); padding: 10px; font-family: inherit; font-size: 14px;
  resize: vertical; color: var(--text);
}
.desc-box:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

/* Issue detail side panel — Jira "Details" card */
.side-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 0 0 6px; overflow: hidden;
}
.side-panel-title {
  font-size: 12px; font-weight: 600; color: var(--text-subtle);
  padding: 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.side-row { padding: 5px 14px; margin: 0; }
.side-row label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-subtlest);
  margin-bottom: 2px;
}
.side-row select, .side-row input {
  width: 100%; border: 1px solid transparent; border-radius: var(--radius);
  height: 32px; padding: 0 6px; font-size: 14px; font-family: inherit;
  background: none; color: var(--text); font-weight: 500;
  transition: background .1s ease;
}
.side-row select:hover:not(:disabled), .side-row input:hover:not(:disabled) {
  background: var(--neutral-subtle);
}
.side-row select:focus, .side-row input:focus {
  outline: none; background: var(--surface);
  border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand);
}
.side-row select:disabled, .side-row input:disabled { color: var(--text-subtle); opacity: 1; }

/* comments */
.comment { display: flex; gap: 10px; margin-bottom: 16px; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-meta { font-size: 13px; margin-bottom: 3px; }
.comment .c-meta b { font-weight: 600; color: var(--text); }
.comment .c-meta .time { color: var(--text-subtlest); margin-left: 8px; font-size: 12px; }
.comment .c-text { font-size: 14px; line-height: 1.45; }
.comment-form { display: flex; gap: 10px; margin-top: 14px; }
.comment-form .desc-box { min-height: 60px; }

.activity-item {
  font-size: 13px; color: var(--text-subtle); padding: 8px 0;
  border-bottom: 1px solid var(--surface-hovered);
}
.activity-item:last-child { border-bottom: none; }
.activity-item b { color: var(--text); font-weight: 600; }

/* form rows */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-subtle);
  margin-bottom: 4px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%; border: 1px solid var(--border-input); border-radius: var(--radius);
  padding: 8px; font-size: 14px; font-family: inherit; background: var(--surface);
  color: var(--text);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------------- WYSIWYG markdown editor ---------------- */
.rte { min-width: 0; max-width: 100%;
  border: 1px solid var(--border-input); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
  transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand); }
.rte-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 4px 6px; background: var(--surface);
  border-bottom: 1px solid var(--border); }
.rte-btn { min-width: 28px; height: 28px; padding: 0 6px; border: none;
  background: none; border-radius: var(--radius); color: var(--text-subtle);
  font-size: 14px; font-weight: 600; line-height: 1; display: inline-grid;
  place-items: center; }
.rte-btn.wide { font-size: 12px; }
.rte-btn:hover { background: var(--neutral-subtle); color: var(--text); }
.rte-btn:active { background: var(--selected-bg); color: var(--selected-text); }
.rte-sep { width: 1px; align-self: stretch; margin: 5px 4px;
  background: var(--border); }
.rte-hint { margin-left: auto; padding-right: 6px; font-size: 11px;
  color: var(--text-disabled); }
.rte-content { padding: 10px 12px; font-size: 14px; outline: none;
  overflow-y: auto; max-height: 360px; }
.rte-content[data-empty="true"]::before {
  content: attr(data-placeholder); color: var(--text-disabled);
  pointer-events: none; }
.rte-content:focus { outline: none; }

/* ---------------- Rendered markdown ---------------- */
.markdown { font-size: 14px; line-height: 1.55; color: var(--text);
  word-wrap: break-word; }
.markdown > *:first-child { margin-top: 0; }
.markdown > *:last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  margin: 16px 0 8px; line-height: 1.3; font-weight: 600; }
.markdown h1 { font-size: 20px; }
.markdown h2 { font-size: 17px; }
.markdown h3 { font-size: 15px; }
.markdown h4 { font-size: 14px; }
.markdown p { margin: 8px 0; }
.markdown ul, .markdown ol { margin: 8px 0; padding-left: 22px; }
.markdown li { margin: 3px 0; }
.markdown li > input[type="checkbox"] { margin-right: 6px; }
.markdown a { color: var(--brand); text-decoration: none; }
.markdown a:hover { text-decoration: underline; }
.markdown code { background: var(--surface-hovered); border-radius: 3px; padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 12.5px; color: var(--text-subtle); }
.markdown pre { background: var(--surface-sunken); border-radius: var(--radius-lg);
  padding: 12px 14px; overflow: auto; margin: 10px 0;
  border: 1px solid var(--surface-hovered); }
.markdown pre code { background: none; padding: 0; font-size: 12.5px; }
.markdown blockquote { margin: 10px 0; padding: 4px 14px; color: var(--text-subtle);
  border-left: 2px solid var(--border); }
.markdown table { border-collapse: collapse; margin: 10px 0; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 6px 10px;
  font-size: 13px; }
.markdown th { background: var(--surface-sunken); }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.markdown img { max-width: 100%; border-radius: 6px; }
.markdown-block > *:first-child { margin-top: 0; }
.markdown-block > *:last-child { margin-bottom: 0; }
.cap-video {
  display: block; width: 100%; max-width: 800px; margin: 12px 0;
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: 0 1px 2px rgba(9, 30, 66, 0.12);
}
.cap-video-frame {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9;
  overflow: hidden; background: #091e42;
}
.cap-video-frame iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.cap-video-caption {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px; color: var(--text-subtlest); font-size: 12px;
}
.cap-video-caption a { color: var(--brand); font-weight: 600; text-decoration: none; }
.cap-video-caption a:hover { text-decoration: underline; }
.cap-video-editor { margin: 4px 0 8px; user-select: none; }
.cap-video-editor + br { display: block; content: ""; margin-top: 4px; }
.md-empty { color: var(--text-disabled); font-size: 14px; font-style: italic; }
.c-text .markdown { font-size: 14px; }
.issue-modal .field-label { font-size: 13px; }
.issue-modal .markdown { font-size: 16px; line-height: 1.65; }
.issue-modal .comment .c-meta { font-size: 14px; }
.issue-modal .comment .c-meta .time { font-size: 13px; }
.issue-modal .c-text .markdown { font-size: 16px; }
.issue-modal .side-panel-title { font-size: 13px; padding: 12px 16px; }
.issue-modal .side-row { padding: 7px 16px; }
.issue-modal .side-row label { font-size: 13px; }
.issue-modal .side-row select,
.issue-modal .side-row input { height: 36px; font-size: 15px; }
.issue-modal .rte-content { font-size: 16px; line-height: 1.6; }

/* ---------------- Login ---------------- */
.login-wrap {
  display: grid; place-items: center; height: 100vh;
  background: linear-gradient(160deg, #ffffff 0%, #f0f4fb 55%, #e9f2ff 100%);
}
.login-card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal); padding: 36px 34px 30px; width: 368px;
}
.login-card .brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 20px; letter-spacing: -0.01em;
}
.login-card .brand .logo { width: 32px; height: 32px; font-size: 18px; border-radius: 8px; }
.login-sub {
  text-align: center; color: var(--text-subtlest); font-size: 13px;
  margin: 6px 0 22px;
}
.login-err {
  background: var(--danger-bg); color: var(--danger); border-radius: var(--radius);
  padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}
.ok-note {
  background: var(--success-bg); color: var(--success); border-radius: var(--radius);
  padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}
.login-divider {
  display: flex; align-items: center; gap: 10px; margin: 14px 0;
  color: var(--text-disabled); font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.btn.ms-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; text-decoration: none; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-subtle); height: 36px;
}
.btn.ms-btn:hover { background: var(--surface-sunken); color: var(--text); }

/* ---------------- User menu ---------------- */
.user-menu { position: relative; margin-left: 4px; }
.user-menu .avatar { cursor: pointer; width: 28px; height: 28px; font-size: 11px; }
.user-menu .avatar:hover { box-shadow: 0 0 0 2px var(--selected-bg), 0 0 0 3px var(--brand); }
.menu-backdrop { position: fixed; inset: 0; z-index: 190; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 200;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay); min-width: 220px; padding: 6px;
  animation: modal-in .12s ease;
}
.menu-head { padding: 8px 10px 10px; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 8px 10px; border-radius: var(--radius); font-size: 14px; color: var(--text);
}
.menu-item:hover { background: var(--neutral-subtle); }

/* ---------------- Members / people rows ---------------- */
.member-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--surface-hovered);
}
.member-row:last-of-type { border-bottom: none; }
.member-row .member-name { flex: 1; font-weight: 600; font-size: 14px; min-width: 0; }
.member-row .member-name .tag-sub { font-weight: 400; }
.member-row.add { border-bottom: none; margin-top: 8px; }
.member-row.inactive .member-name, .member-row.inactive .avatar { opacity: .45; }
.role-chip {
  background: var(--neutral-subtle); color: var(--text-subtle); border-radius: 3px;
  padding: 2px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; white-space: nowrap;
}

.detail-title.static { border: none; margin: 0 0 12px; padding: 0; background: none; }

.empty { text-align: center; color: var(--text-subtlest); padding: 64px 20px; }
.empty .big { font-size: 40px; margin-bottom: 12px; }

.loading { display: grid; place-items: center; height: 100vh; color: var(--text-subtlest); }
.tag-sub { font-size: 12px; color: var(--text-subtlest); }
.section-title { font-size: 15px; font-weight: 600; margin: 4px 0 12px; }
.inline-link { color: var(--brand); cursor: pointer; }
.inline-link:hover { text-decoration: underline; }

/* ======================= Helpdesk ======================= */
.module-tabs { display: flex; gap: 2px; margin-left: 18px; }
.module-tab {
  border: none; background: transparent; color: #44546f; font: inherit;
  font-weight: 500; padding: 6px 12px; border-radius: 4px; cursor: pointer;
}
.module-tab:hover { background: rgba(9, 30, 66, 0.06); }
.module-tab.active {
  background: #e9f2ff; color: #0052cc; font-weight: 600;
}

.hd-search { max-width: 320px; }

.note-chip {
  background: #fff0b3; color: #7f5f01; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
}
.role-chip {
  background: #e9f2ff; color: #0055cc; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
}
.via-chip {
  background: #f1f2f4; color: #626f86; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px; white-space: nowrap;
}
.via-chip.esc { background: #ffeceb; color: #ae2a19; }

/* --- queue table: two-line inbox rows with a status color edge --- */
.hd-table { padding-top: 12px; }
.ticket-list { min-width: 760px; table-layout: fixed; }
table.issues.ticket-list th {
  padding: 11px 14px; background: var(--surface-sunken);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 12px; letter-spacing: .02em;
}
table.issues.ticket-list td {
  height: 70px; padding: 12px 14px; vertical-align: middle;
  border-bottom-color: var(--border);
}
.ticket-list th:first-child, .ticket-list td:first-child { padding-left: 18px; }
.ticket-list th:last-child, .ticket-list td:last-child { padding-right: 18px; }
.hd-row { cursor: pointer; }
.hd-row:hover { background: var(--selected-bg) !important; }
.hd-row:focus-within { outline: 2px solid var(--brand); outline-offset: -2px; }
.hd-row .hd-main { min-width: 0; }
.hd-row-subject {
  min-width: 0; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; margin-bottom: 6px;
}
.hd-row-subject > span:last-child {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hd-row-sub {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; font-size: 13px; color: #626f86;
}
.hd-row-avatar { width: 20px; height: 20px; font-size: 9px; }
.ticket-list .tag-sub { font-size: 13px; }

@media (max-width: 900px) {
  .hd-table { padding-left: 16px; padding-right: 16px; }
  .ticket-list { min-width: 620px; }
  .ticket-list th:nth-child(2), .ticket-list td:nth-child(2) { display: none; }
}

/* --- ticket workspace modal: conversation left, properties rail right --- */
.hd-modal {
  width: min(96vw, 1320px); max-width: 1320px; height: 94vh; max-height: 94vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.hd-head {
  padding: 12px 20px 12px; border-bottom: 1px solid #dfe1e6; flex-shrink: 0;
}
.hd-head-row { display: flex; align-items: center; gap: 8px; }
.hd-key {
  font-weight: 700; font-size: 13px; color: #626f86; letter-spacing: .02em;
}
.hd-subject {
  font-size: 24px; font-weight: 600; line-height: 1.25; margin: 8px 0 6px;
  letter-spacing: -0.01em;
}
.hd-meta-line {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 14px; color: #626f86;
}
.hd-meta-line b { color: #172b4d; }
.hd-email { color: #8590a2; }
.hd-dot { color: #c1c7d0; }

.hd-body { flex: 1; display: flex; min-height: 0; }
.hd-convo {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: #f7f8f9;
}
.hd-thread { flex: 1; overflow-y: auto; padding: 16px 20px 8px; }
.hd-rail {
  width: 320px; flex-shrink: 0; border-left: 1px solid #dfe1e6;
  overflow-y: auto; padding: 6px 16px 16px; background: #fff;
}
.hd-rail-title {
  font-size: 11px; font-weight: 700; color: #626f86; text-transform: uppercase;
  letter-spacing: .04em; margin: 14px 0 6px;
}
.hd-rail .side-row { padding: 3px 0; }

/* conversation cards, email-thread style */
.hd-msg {
  background: #fff; border: 1px solid #dfe1e6; border-radius: 8px;
  margin-bottom: 12px; box-shadow: 0 1px 1px rgba(9, 30, 66, 0.06);
}
.hd-msg.requester { border-left: 3px solid #0055cc; }
.hd-msg.agent { border-left: 3px solid #36b37e; }
.hd-msg.internal {
  background: #fffbe6; border-color: #f0e0a0; border-left: 3px solid #e2b203;
}
.hd-msg-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px 0;
  font-size: 14px;
}
.hd-msg-who { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.hd-msg-who b { font-weight: 600; }
.hd-msg-time {
  margin-left: auto; color: #8590a2; font-size: 12px; white-space: nowrap;
}
.hd-msg-body { padding: 8px 18px 16px 50px; font-size: 16px; }
.hd-msg-atts { padding: 0 14px 10px 46px; }
.hd-modal .markdown { font-size: 16px; line-height: 1.65; }
.hd-modal .rte-content { font-size: 15px; line-height: 1.6; }
.hd-modal .side-row label { font-size: 13px; }
.hd-modal .side-row select,
.hd-modal .side-row input { height: 36px; font-size: 15px; }

@media (max-width: 900px) {
  .hd-modal { width: 100%; height: 96vh; max-height: 96vh; }
  .hd-rail { width: 270px; }
}

.hd-event {
  display: flex; align-items: center; gap: 10px; margin: 14px 0;
}
.hd-event-line { flex: 1; height: 1px; background: #dfe1e6; }
.hd-event-text {
  font-size: 12px; color: #8590a2; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 80%;
}

/* docked composer */
.hd-composer {
  flex-shrink: 0; border-top: 1px solid #dfe1e6; background: #fff;
  padding: 10px 16px 14px;
}
.hd-composer.internal { background: #fffbe6; }
.hd-composer-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.hd-composer-tabs .tab { padding: 4px 10px; font-size: 12.5px; }
.hd-composer .rte-surface, .hd-composer [contenteditable] { background: #fff; }

.escalation-banner {
  background: #ffeceb; border: 1px solid #ffd5d2; color: #601e16;
  border-radius: 6px; padding: 8px 12px; margin-top: 10px; font-size: 13px;
}

.att-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f7f8f9; border: 1px solid #dfe1e6; border-radius: 12px;
  padding: 2px 10px; font-size: 12.5px; margin: 2px 4px 2px 0;
}
.att-chip a { color: #0052cc; text-decoration: none; }
.att-chip a:hover { text-decoration: underline; }
.att-row { display: flex; flex-wrap: wrap; margin-top: 6px; gap: 2px; }

.follower-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; padding: 4px 6px; border-radius: 4px;
}
.follower-row:hover { background: #f7f8f9; }
.follower-input {
  flex: 1; min-width: 0; border: 1px solid #dfe1e6; border-radius: 4px;
  padding: 5px 8px; font: inherit; font-size: 13px;
}
.follower-input:focus { outline: none; border-color: #0052cc; }

/* --- requester portal --- */
.portal {
  flex: 1; overflow-y: auto; width: 100%; max-width: 720px;
  margin: 0 auto; padding: 28px 20px 60px;
}
.portal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px;
}
.portal-title { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.portal-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid #dfe1e6; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 10px; cursor: pointer;
  box-shadow: 0 1px 1px rgba(9, 30, 66, 0.06);
}
.portal-row:hover { background: #f7f8f9; }
.portal-row-subject { font-weight: 600; margin-bottom: 2px; }
.portal-ticket { padding-bottom: 40px; }
.portal-composer {
  border: 1px solid #dfe1e6; border-radius: 8px; margin-top: 4px;
}
.app .portal { background: none; }
