:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-tint: #fbfcff;
  --line: #d9dfe8;
  --line-soft: #edf0f5;
  --text: #1f2633;
  --muted: #676879;
  --muted-2: #8b92a4;
  --blue: #0073ea;
  --blue-soft: #eaf4ff;
  --green: #00a66c;
  --green-soft: #e9f8f2;
  --red: #e2445c;
  --red-soft: #ffecef;
  --yellow: #fdab3d;
  --yellow-soft: #fff5e7;
  --purple: #784bd1;
  --purple-soft: #f2edff;
  --teal: #00c7b7;
  --shadow: 0 18px 48px rgba(31, 38, 51, .08);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(0, 115, 234, .04), transparent 260px),
    var(--bg);
  font-family: "Segoe UI", "Noto Sans Hebrew", Tahoma, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  direction: rtl;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px;
  background: #ffffff;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 4px 4px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 850;
  font-size: 12px;
}

.nav-item {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #435065;
  text-align: right;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-item:hover {
  background: #f2f5fa;
}

.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: inherit;
}

.workspace {
  min-width: 0;
}

.topbar {
  min-height: 66px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  display: grid;
  grid-template-columns: auto minmax(260px, 560px) auto;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.topbar-title small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.searchbox {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
}

.searchbox:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 115, 234, .12);
}

.searchbox span {
  color: var(--muted);
  font-size: 12px;
}

.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  justify-content: end;
}

.logout-form {
  margin: 0;
}

.primary-action,
.ghost-action,
.field-actions button,
.filter-strip button,
.view-tools button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #334155;
  padding: 0 14px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 800;
}

.ghost-action:hover,
.field-actions button:hover,
.filter-strip button:hover,
.view-tools button:hover {
  background: #f4f7fb;
}

.screen {
  display: none;
  padding: 28px 32px 42px;
}

.screen.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 7px;
  font-size: 34px;
  line-height: 1.12;
  font-weight: 850;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.board-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.board-summary span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.board-summary b {
  display: inline;
  color: var(--text);
  font-size: 13px;
  line-height: 1;
}

.board-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 4px 2px 8px;
}

.type-counters {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.counter-card {
  position: relative;
  min-height: 92px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.counter-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: var(--counter-color, var(--blue));
}

.counter-card span,
.counter-card small {
  display: block;
  color: var(--muted);
}

.counter-card strong {
  display: block;
  margin: 5px 0 2px;
  font-size: 30px;
  line-height: 1;
  color: var(--counter-color, var(--blue));
}

.accent-blue { --counter-color: var(--blue); }
.accent-red { --counter-color: var(--red); }
.accent-yellow { --counter-color: var(--yellow); }
.accent-green { --counter-color: var(--green); }
.accent-purple { --counter-color: var(--purple); }

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-strip,
.view-tools {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-strip button.active {
  background: #323338;
  border-color: #323338;
  color: #fff;
}

.view-tools button {
  width: 38px;
  padding: 0;
  font-weight: 850;
}

.board-panel,
.quiet-panel,
.field-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.board-panel {
  overflow-x: auto;
  overflow-y: hidden;
}

.board-panel-head {
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--panel-tint);
}

.board-panel-head strong,
.board-panel-head span {
  display: block;
}

.board-panel-head span {
  color: var(--muted);
  font-size: 13px;
}

#dragHint {
  max-width: 420px;
  text-align: left;
}

.monday-board {
  background: #fff;
}

.board-columns-header {
  display: grid;
  grid-template-columns: 44px minmax(270px, 2fr) 112px minmax(150px, .85fr) 116px 106px 130px 96px;
  align-items: center;
  min-width: 1100px;
  height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: #f6f7fb;
  color: #6b7280;
  font-size: 12px;
  font-weight: 750;
}

.case-group {
  min-width: 1100px;
  border-bottom: 12px solid #fff;
}

.case-group:last-child {
  border-bottom: 0;
}

.group-header {
  width: 100%;
  height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: #323338;
  text-align: right;
}

.group-header:hover {
  background: #f7f8fb;
}

.group-chevron {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #676879;
  font-size: 13px;
  transition: transform .14s ease;
}

.group-color {
  width: 6px;
  height: 25px;
  border-radius: 3px;
  background: var(--blue);
}

.group-color.active { background: var(--green); }
.group-color.waiting { background: var(--purple); }
.group-color.planned { background: var(--yellow); }
.group-color.done { background: var(--teal); }

.group-header strong {
  color: #323338;
  font-size: 15px;
}

.group-header small {
  color: #676879;
  font-weight: 650;
}

.group-meta {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 12px;
}

.case-group.collapsed .group-chevron {
  transform: rotate(90deg);
}

.case-group.collapsed .group-table {
  display: none;
}

.case-group.drop-target .group-header {
  background: var(--blue-soft);
}

.cases-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.cases-table td {
  height: 42px;
  padding: 4px 10px;
  border-bottom: 1px solid #e6e9ef;
  border-left: 1px solid #edf0f5;
  text-align: right;
  vertical-align: middle;
  line-height: 1.15;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cases-table td:nth-child(1) { width: 44px; }
.cases-table td:nth-child(2) { width: 31%; min-width: 270px; }
.cases-table td:nth-child(3) { width: 112px; text-align: center; }
.cases-table td:nth-child(4) { width: 15%; }
.cases-table td:nth-child(5) { width: 116px; text-align: center; }
.cases-table td:nth-child(6) { width: 106px; text-align: center; }
.cases-table td:nth-child(7) { width: 130px; }
.cases-table td:nth-child(8) {
  width: 96px;
  direction: ltr;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cases-table tbody tr {
  transition: background-color .12s ease, opacity .12s ease, transform .12s ease;
}

.cases-table tbody tr:hover td {
  background: #f5f6f8;
}

.cases-table td strong,
.cases-table td small {
  display: inline;
}

.cases-table td small {
  color: var(--muted);
  margin-right: 8px;
  font-size: 12px;
}

.case-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 850;
  direction: ltr;
  display: inline-block;
  margin-left: 8px;
}

.open-ticket-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 4px 8px;
  border: 1px solid #bfd5ed;
  border-radius: 5px;
  color: var(--blue);
  background: #f5faff;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.open-ticket-action:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.drag-column {
  width: 44px;
  text-align: center !important;
}

.drag-handle {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background:
    radial-gradient(circle, #a1a7b3 1.5px, transparent 2px) 7px 6px / 6px 6px,
    radial-gradient(circle, #a1a7b3 1.5px, transparent 2px) 13px 6px / 6px 6px,
    transparent;
  opacity: .62;
  cursor: grab;
}

.drag-handle:hover {
  background-color: var(--blue-soft);
  opacity: 1;
}

.ticket-search-form {
  margin: 0;
}

.search-submit {
  border: 0;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.ticket-filter-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(31, 38, 51, .04);
}

.ticket-filter-strip a,
.ticket-filter-strip select,
.filter-apply {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #334155;
  padding: 0 11px;
  text-decoration: none;
}

.ticket-filter-strip a {
  display: inline-flex;
  align-items: center;
}

.ticket-filter-strip a.active {
  border-color: #323338;
  background: #323338;
  color: #fff;
}

.ticket-filter-strip select:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 115, 234, .12);
}

.filter-apply {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.filter-clear {
  align-self: center;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.table-subtitle {
  margin-inline-start: 8px;
  color: var(--muted);
  font-size: 12px;
}

.ticket-list-table thead th {
  height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line-soft);
  background: #f6f7fb;
  color: #6b7280;
  font-size: 12px;
  font-weight: 750;
  text-align: right;
}

.ticket-list-table th:nth-child(9),
.ticket-list-table td:nth-child(9) {
  width: 104px;
  overflow: visible;
  text-align: center;
}

.ticket-quick-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ticket-quick-actions form {
  margin: 0;
}

.work-icon {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #bfd5ed;
  border-radius: 5px;
  background: #f5faff;
  color: var(--blue);
}

.work-icon:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.work-icon span {
  display: block;
  position: relative;
  width: 10px;
  height: 12px;
}

.work-icon.play span {
  margin-inline-start: 2px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.work-icon.pause {
  border-color: #d9cef0;
  background: #f9f6ff;
  color: var(--purple);
}

.work-icon.pause span {
  background: linear-gradient(90deg, currentColor 0 33%, transparent 33% 66%, currentColor 66%);
}

.work-icon.finish {
  border-color: #a5dbc6;
  background: #f5fbf8;
  color: #008b80;
}

.work-icon.finish span::before,
.work-action-icon.finish::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 1px;
  width: 8px;
  height: 4px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}

.ticket-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}

.ticket-pagination div {
  display: flex;
  gap: 5px;
}

.ticket-pagination a {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #435065;
  text-decoration: none;
}

.ticket-pagination a.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.ticket-pagination a.disabled {
  pointer-events: none;
  opacity: .45;
}

.ticket-empty-state {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.ticket-work-actions {
  display: inline-flex;
  gap: 7px;
}

.ticket-work-actions form {
  margin: 0;
}

.ticket-work-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #334155;
  padding: 0 11px;
  font-weight: 800;
}

.ticket-work-button.start {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.ticket-work-button.pause {
  border-color: #d9cef0;
  background: #f9f6ff;
  color: var(--purple);
}

.ticket-work-button.finish {
  border-color: #a5dbc6;
  background: #f5fbf8;
  color: #008b80;
}

.work-action-icon {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 12px;
}

.work-action-icon.play {
  margin-inline-start: 2px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.work-action-icon.pause {
  background: linear-gradient(90deg, currentColor 0 33%, transparent 33% 66%, currentColor 66%);
}

.activity-session {
  display: inline-flex;
  margin-top: 6px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 800;
}

/* The handle is intentionally small: it reserves a future reorder affordance without competing with ticket actions. */
.ticket-list-table th:nth-child(1),
.ticket-list-table td:nth-child(1) {
  width: 60px;
}

.ticket-list-table thead th {
  text-align: center;
}

.ticket-list-panel {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.ticket-list-table {
  min-width: 1120px;
}

.ticket-list-table .drag-handle {
  position: relative;
  width: 30px;
  height: 30px;
  background: transparent;
}

.ticket-list-table .drag-handle::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #9aa3b1;
  box-shadow:
    6px 0 #9aa3b1,
    12px 0 #9aa3b1,
    0 6px #9aa3b1,
    6px 6px #9aa3b1,
    12px 6px #9aa3b1,
    0 12px #9aa3b1,
    6px 12px #9aa3b1,
    12px 12px #9aa3b1;
}

.ticket-list-table .drag-handle:hover::before,
.ticket-list-table .drag-handle:focus-visible::before {
  background: var(--blue);
  box-shadow:
    6px 0 var(--blue),
    12px 0 var(--blue),
    0 6px var(--blue),
    6px 6px var(--blue),
    12px 6px var(--blue),
    0 12px var(--blue),
    6px 12px var(--blue),
    12px 12px var(--blue);
}

@media (max-width: 720px) {
  .board-list-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .ticket-pagination {
    justify-content: space-between;
    width: 100%;
  }

  .ticket-list-panel {
    margin-inline: -20px;
    width: calc(100% + 40px);
    border-radius: 0;
  }
}

.dragging {
  opacity: .35;
}

.drop-marker td {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.drop-marker div {
  height: 32px;
  margin: 2px 10px;
  border: 1px dashed var(--blue);
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 850;
}

.pill,
.status,
.type-chip,
.person {
  display: inline-flex;
  min-width: 70px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

.pill.high { background: var(--red-soft); color: var(--red); }
.pill.medium { background: var(--yellow-soft); color: #9a5f00; }
.pill.low { background: var(--green-soft); color: var(--green); }

.status.waiting { background: var(--blue-soft); color: var(--blue); }
.status.active { background: var(--green-soft); color: var(--green); }
.status.hold { background: var(--purple-soft); color: var(--purple); }
.status.planned { background: var(--yellow-soft); color: #9a5f00; }
.status.done { background: #e7fbf8; color: #008b80; }

.type-chip.blue { background: var(--blue-soft); color: var(--blue); }
.type-chip.red { background: var(--red-soft); color: var(--red); }
.type-chip.yellow { background: var(--yellow-soft); color: #9a5f00; }
.type-chip.green { background: var(--green-soft); color: var(--green); }
.type-chip.purple { background: var(--purple-soft); color: var(--purple); }

.person {
  justify-content: flex-start;
  min-width: 0;
  max-width: 118px;
  padding: 0 8px;
  background: #f3f5f9;
  color: #384152;
}

.person::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 auto;
}

.person.unassigned::before {
  background: var(--muted-2);
}

.sla-bad {
  color: var(--red);
  font-weight: 850;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 130px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  align-content: center;
  gap: 5px;
}

.metric-card span {
  font-size: 34px;
  font-weight: 850;
  line-height: 1;
}

.metric-card small {
  color: var(--muted);
}

.metric-card.danger span {
  color: var(--red);
}

.quiet-panel,
.field-card {
  padding: 22px;
}

.signal-list,
.task-roadmap {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.signal-list li,
.task-roadmap li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.signal-list li:last-child,
.task-roadmap li:last-child {
  border-bottom: 0;
}

.signal-list strong,
.task-roadmap strong,
.signal-list span,
.task-roadmap span {
  display: block;
}

.signal-list span,
.task-roadmap span {
  color: var(--muted);
  margin-top: 4px;
}

.field-card {
  max-width: 620px;
}

.field-card h2 {
  margin-top: 16px;
  font-size: 34px;
}

.field-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.task-roadmap {
  counter-reset: task;
  max-width: 860px;
}

.task-roadmap li {
  counter-increment: task;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.task-roadmap li::before {
  content: counter(task);
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 850;
}

.side-nav a.nav-item {
  text-decoration: none;
}

.muted-nav {
  color: var(--muted-2);
  cursor: default;
}

.ticket-detail-shell .side-nav {
  z-index: 2;
}

.ticket-topbar {
  grid-template-columns: 1fr auto;
}

.back-to-board {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
}

.back-to-board span {
  font-size: 18px;
  line-height: 1;
}

.ticket-page {
  width: min(1180px, calc(100% - 56px));
  margin: 0 auto;
  padding: 24px 0 46px;
}

.ticket-crumb {
  color: var(--muted);
  font-size: 12px;
}

.ticket-crumb span {
  margin: 0 5px;
  color: var(--muted-2);
}

.ticket-crumb b {
  color: var(--blue);
}

.ticket-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 12px 0 18px;
}

.ticket-page-head h1 {
  max-width: 820px;
}

.ticket-page-head .eyebrow {
  margin: 0 0 4px;
}

.ticket-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ticket-opened {
  padding-top: 9px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.ticket-health-strip {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  margin-bottom: 19px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  overflow: hidden;
}

.ticket-health-strip > div {
  min-height: 69px;
  padding: 12px 15px;
  border-left: 1px solid var(--line);
}

.ticket-health-strip > div:last-child {
  border-left: 0;
}

.ticket-health-strip span,
.ticket-health-strip strong {
  display: block;
}

.ticket-health-strip span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ticket-health-strip strong {
  color: #2e4055;
  font-size: 15px;
}

.ticket-assignee {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
}

.ticket-assignee::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.ticket-assignee.unassigned::before {
  background: var(--muted-2);
}

.ticket-sla strong {
  color: var(--red);
  direction: ltr;
  text-align: right;
}

.ticket-tabs {
  display: flex;
  gap: 22px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
}

.ticket-tab {
  min-height: 42px;
  padding: 0;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.ticket-tab.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, .7fr);
  gap: 30px;
  padding-top: 25px;
}

.ticket-section {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.ticket-section h2,
.ticket-sidebar h2,
.ticket-activity-empty h2 {
  margin: 0 0 11px;
  color: #2c4057;
  font-size: 18px;
}

.ticket-description {
  max-width: 800px;
  color: #42546a;
  font-size: 15px;
  white-space: pre-wrap;
}

.ticket-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.ticket-facts > div {
  min-height: 74px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.ticket-facts dt,
.ticket-properties dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ticket-facts dd,
.ticket-properties dd {
  margin: 0;
  color: #304359;
  font-weight: 750;
}

.ticket-side-section {
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.ticket-properties {
  margin: 0;
}

.ticket-properties > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 35px;
  border-bottom: 1px solid var(--line-soft);
}

.ticket-properties > div:last-child {
  border-bottom: 0;
}

.ticket-properties dt {
  margin: 0;
}

.ticket-properties dd {
  font-size: 13px;
  text-align: left;
}

.ticket-properties .priority-high {
  color: var(--red);
}

.ticket-properties .priority-medium {
  color: #9a5f00;
}

.ticket-properties .priority-low {
  color: var(--green);
}

.ticket-sla-note {
  padding: 12px 13px;
  border-right: 3px solid var(--yellow);
  color: #705313;
  background: var(--yellow-soft);
  font-size: 12px;
}

.ticket-sla-note strong,
.ticket-sla-note span {
  display: block;
}

.ticket-sla-note strong {
  margin-bottom: 2px;
}

.ticket-tab-panel:not(.active) {
  display: none;
}

.ticket-activity-empty {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 720px;
  padding: 25px 0;
}

.ticket-activity-empty p {
  max-width: 580px;
}

.ticket-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.ticket-flash {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #b9dfcf;
  border-radius: 6px;
  color: #176c45;
  background: #effaf4;
  font-size: 13px;
  font-weight: 750;
}

.ticket-title-input,
.ticket-description-input,
.ticket-edit-facts input,
.ticket-edit-facts select,
.ticket-edit-properties select {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: 0;
}

.ticket-title-input {
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.ticket-description-input {
  min-height: 96px;
  padding: 0;
  resize: vertical;
  line-height: 1.7;
}

.ticket-edit-facts select,
.ticket-edit-properties select {
  appearance: none;
  cursor: default;
}

.ticket-page.editing .edit-control {
  border-color: #b9c8d8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 115, 234, .05);
}

.ticket-page.editing .ticket-title-input {
  padding: 3px 7px;
}

.ticket-page.editing .ticket-description-input {
  padding: 8px 10px;
}

.ticket-page.editing .ticket-edit-facts input,
.ticket-page.editing .ticket-edit-facts select,
.ticket-page.editing .ticket-edit-properties select {
  min-height: 34px;
  padding: 4px 8px;
  appearance: auto;
  cursor: pointer;
}

.ticket-edit-button,
.ticket-cancel-button,
.ticket-save-button {
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 850;
}

.ticket-edit-button,
.ticket-cancel-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
}

.ticket-save-button {
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
}

.ticket-save-button:disabled {
  cursor: not-allowed;
  border-color: #b9c8d8;
  background: #b9c8d8;
}

.ticket-create-head {
  margin-bottom: 14px;
}

.ticket-create-intro {
  max-width: 660px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.ticket-validation:empty {
  display: none;
}

.ticket-validation {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #f1c1c7;
  border-radius: 6px;
  color: #a32437;
  background: #fff4f5;
  font-size: 13px;
  font-weight: 750;
}

.ticket-create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, .7fr);
  gap: 30px;
  padding-top: 6px;
}

.ticket-create-main .ticket-section:last-child {
  margin-bottom: 0;
}

.ticket-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ticket-section-head span {
  color: var(--muted-2);
  font-size: 12px;
}

.ticket-form-stack,
.ticket-form-grid {
  display: grid;
  gap: 9px;
}

.ticket-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ticket-form-stack label,
.ticket-form-grid label {
  display: grid;
  gap: 6px;
  color: #31465c;
  font-size: 13px;
  font-weight: 800;
}

.ticket-form-stack input,
.ticket-form-stack textarea,
.ticket-form-stack select,
.ticket-form-grid input,
.ticket-form-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #b9c8d8;
  border-radius: 5px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
  font-weight: 650;
  outline: 0;
}

.ticket-form-stack textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.6;
}

.ticket-form-stack input:focus,
.ticket-form-stack textarea:focus,
.ticket-form-stack select:focus,
.ticket-form-grid input:focus,
.ticket-form-grid select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 115, 234, .11);
}

.ticket-form-full {
  grid-column: 1 / -1;
}

.ticket-form-stack.compact {
  gap: 13px;
}

.ticket-create-summary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 13px;
  border-right: 3px solid var(--blue);
  background: var(--blue-soft);
}

.ticket-create-summary-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: var(--blue);
  background: #fff;
  font-weight: 900;
}

.ticket-create-summary strong {
  color: #24517e;
  font-size: 13px;
}

.ticket-create-summary p {
  margin: 4px 0 11px;
  color: #45627f;
  font-size: 12px;
  line-height: 1.55;
}

.ticket-create-summary dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.ticket-create-summary dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #3d5e7b;
  font-size: 12px;
}

.ticket-create-summary dt,
.ticket-create-summary dd {
  margin: 0;
}

.ticket-create-summary dd {
  color: #254968;
  font-weight: 850;
}

.ticket-activity-layout {
  display: grid;
  grid-template-columns: minmax(250px, .7fr) minmax(0, 1.3fr);
  gap: 32px;
  padding-top: 22px;
}

.ticket-comment-section {
  padding-top: 0;
}

.ticket-comment-form {
  display: grid;
  gap: 10px;
}

.ticket-comment-form textarea {
  min-height: 112px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  background: #fff;
  resize: vertical;
  outline: 0;
}

.ticket-comment-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 115, 234, .1);
}

.ticket-comment-form .ticket-save-button {
  justify-self: start;
}

.ticket-activity-list {
  display: grid;
  gap: 0;
}

.ticket-activity-event {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  padding: 0 0 19px;
}

.ticket-activity-event .activity-mark {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.ticket-activity-event.comment .activity-mark {
  color: #7350a7;
  background: var(--purple-soft);
}

.ticket-activity-event strong,
.ticket-activity-event time {
  display: block;
}

.ticket-activity-event p {
  margin: 3px 0 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.ticket-activity-event time {
  color: var(--muted-2);
  font-size: 11px;
  direction: ltr;
  text-align: right;
}

.activity-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 850;
}

@media (max-width: 980px) {
  .ticket-detail-shell .side-nav {
    display: none;
  }

  .ticket-topbar {
    grid-template-columns: 1fr auto;
  }

  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }

  .ticket-create-grid {
    grid-template-columns: 1fr;
  }

  .ticket-create-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr);
    gap: 14px;
    align-items: start;
  }

  .ticket-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr);
    gap: 14px;
    align-items: start;
  }

  .ticket-side-section {
    margin: 0;
  }
}

@media (max-width: 680px) {
  .ticket-topbar {
    padding: 0 14px;
  }

  .ticket-page {
    width: min(100% - 28px, 1180px);
    padding-top: 18px;
  }

  .ticket-page-head {
    display: block;
  }

  .ticket-page-head h1 {
    font-size: 28px;
  }

  .ticket-opened {
    display: block;
    padding-top: 11px;
  }

  .ticket-health-strip {
    grid-template-columns: 1fr;
  }

  .ticket-health-strip > div {
    min-height: 61px;
    border-bottom: 1px solid var(--line);
    border-left: 0;
  }

  .ticket-health-strip > div:last-child {
    border-bottom: 0;
  }

  .ticket-tabs {
    gap: 17px;
    overflow-x: auto;
  }

  .ticket-tab {
    white-space: nowrap;
  }

  .ticket-detail-grid {
    gap: 20px;
    padding-top: 20px;
  }

  .ticket-facts,
  .ticket-sidebar {
    grid-template-columns: 1fr;
  }

  .ticket-head-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .ticket-activity-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ticket-form-grid,
  .ticket-create-sidebar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1160px) {
  .page-head {
    display: grid;
  }

  .board-summary,
  .type-counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    display: none;
  }

  .nav-item {
    white-space: nowrap;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }
}

@media (max-width: 680px) {
  .screen {
    padding: 20px 14px 30px;
  }

  h1 {
    font-size: 28px;
  }

  .board-summary,
  .type-counters,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .board-toolbar {
    display: grid;
  }
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(0, 115, 234, .09), transparent 360px),
    linear-gradient(90deg, rgba(0, 166, 108, .07), transparent 48%),
    var(--bg);
}

.login-layout {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, .92fr) minmax(420px, 1.08fr);
  gap: 18px;
  align-items: stretch;
}

.login-copy,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.login-copy {
  padding: 28px;
  display: grid;
  align-content: space-between;
  min-height: 640px;
}

.login-logo-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.login-logo-row strong,
.login-logo-row small {
  display: block;
}

.login-logo-row small {
  color: var(--muted);
}

.login-copy h1 {
  max-width: 520px;
  font-size: 42px;
  line-height: 1.08;
  margin-bottom: 12px;
}

.login-proof {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.login-proof span {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
}

.login-proof b {
  display: block;
  color: var(--blue);
  font-size: 20px;
  margin-bottom: 5px;
}

.login-panel {
  padding: 22px;
}

.access-denied-panel {
  width: min(680px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.access-denied-panel h1 {
  margin-top: 10px;
  font-size: 38px;
}

.access-denied-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.access-denied-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.access-denied-actions form {
  margin: 0;
}

.login-panel-head {
  margin-bottom: 16px;
}

.login-panel-head p {
  max-width: none;
}

.login-form {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.login-form label {
  font-weight: 850;
}

.login-form select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  outline: 0;
}

.login-form select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 115, 234, .12);
}

.login-submit {
  min-height: 44px;
}

.validation-summary {
  color: var(--red);
  font-weight: 750;
}

.demo-users {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.demo-user-card {
  min-height: 132px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  text-align: right;
  display: grid;
  gap: 5px;
  align-content: start;
}

.demo-user-card:hover,
.demo-user-card.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.demo-user-card strong,
.demo-user-card small,
.demo-user-card code {
  display: block;
}

.demo-user-card small {
  color: var(--muted);
}

.demo-user-card code {
  direction: ltr;
  text-align: right;
  color: #334155;
  font-size: 12px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 5px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-role {
  justify-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 850;
  background: var(--blue-soft);
  color: var(--blue);
}

.demo-role.admin { background: var(--purple-soft); color: var(--purple); }
.demo-role.dispatcher { background: var(--blue-soft); color: var(--blue); }
.demo-role.technician { background: var(--green-soft); color: var(--green); }
.demo-role.manager { background: var(--yellow-soft); color: #9a5f00; }

@media (max-width: 980px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: auto;
    gap: 28px;
  }
}

@media (max-width: 680px) {
  .login-shell {
    padding: 14px;
  }

  .login-copy h1 {
    font-size: 32px;
  }

  .login-proof,
  .demo-users {
    grid-template-columns: 1fr;
  }
}
