:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --text: #1f2933;
  --muted: #667085;
  --border: #cbd5df;
  --border-soft: #dde4ec;
  --blue: #2367a4;
  --blue-dark: #194d7b;
  --brand-color: #5bb974;
  --brand-contrast: #102417;
  --green: #2f855a;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 12px 28px rgb(15 23 42 / 10%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.app-mode {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.topbar {
  align-items: center;
  background: #253746;
  border-bottom: 1px solid #172532;
  color: white;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px 18px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 180px;
}

.brand-mark {
  align-items: center;
  background: var(--brand-color);
  border-radius: 6px;
  color: var(--brand-contrast);
  display: inline-flex;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.brand-mark.logo {
  background: transparent;
  border-radius: 0;
}

.brand-mark img {
  display: block;
  height: 34px;
  width: 34px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand span {
  color: #c6d3df;
  font-size: 12px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  position: relative;
}

.topnav {
  display: flex;
  gap: 6px;
  margin-right: auto;
}

.nav-button {
  align-items: center;
  background: #314657;
  border: 1px solid #4b6072;
  border-radius: 6px;
  color: white;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
}

.nav-button.active,
.nav-button:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #253746;
}

.nav-count-badge {
  align-items: center;
  background: #ffffff;
  border-radius: 999px;
  color: #253746;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: center;
  min-width: 20px;
  padding: 1px 6px;
}

.nav-button.active .nav-count-badge,
.nav-button:hover .nav-count-badge {
  background: #253746;
  color: #ffffff;
}

.primary-button,
.ghost-button {
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 34px;
  padding: 7px 12px;
}

.primary-button {
  background: var(--blue);
  color: white;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.ghost-button {
  background: #ffffff;
  border-color: var(--border);
  color: #22313f;
}

.ghost-button:hover {
  background: #f4f7fa;
}

.topbar .ghost-button {
  background: #314657;
  border-color: #4b6072;
  color: white;
}

.topbar .ghost-button:hover {
  background: #3c5366;
}

.profile-menu {
  position: relative;
}

.profile-button {
  align-items: center;
  background: #314657;
  border: 1px solid #4b6072;
  border-radius: 999px;
  color: white;
  display: inline-flex;
  gap: 9px;
  min-height: 38px;
  padding: 4px 10px 4px 4px;
}

.profile-button:hover,
.profile-button[aria-expanded="true"] {
  background: #3c5366;
}

.profile-avatar {
  align-items: center;
  background: #ffffff;
  border-radius: 999px;
  color: #253746;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.profile-label {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.profile-label strong,
.profile-label span {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-label strong {
  font-size: 13px;
}

.profile-label span {
  color: #c6d3df;
  font-size: 11px;
}

.profile-popover {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  display: grid;
  gap: 6px;
  min-width: 220px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
}

.profile-summary {
  border-bottom: 1px solid var(--border-soft);
  display: grid;
  gap: 2px;
  padding: 4px 4px 8px;
}

.profile-summary strong,
.profile-summary span {
  overflow-wrap: anywhere;
}

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

.profile-menu-item {
  background: #ffffff;
  border: 0;
  border-radius: 6px;
  color: #22313f;
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
}

.profile-menu-item:hover {
  background: #f4f7fa;
}

.app-alert {
  align-items: start;
  background: #fff4f4;
  border: 1px solid #f0b6b6;
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #8f1d1d;
  display: flex;
  gap: 10px;
  max-width: min(620px, calc(100vw - 24px));
  padding: 10px 12px;
  position: fixed;
  right: 12px;
  top: 72px;
  z-index: 30;
}

.app-alert-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: inherit;
  display: inline-flex;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  padding: 0;
  width: 24px;
}

.app-alert-close:hover {
  background: rgb(143 29 29 / 10%);
}

.auth-wrap {
  align-items: center;
  display: grid;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 18px;
}

.auth-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  max-width: 420px;
  padding: 18px;
  width: min(420px, calc(100vw - 36px));
}

.auth-panel h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.auth-note {
  color: var(--muted);
  margin: 0;
}

.auth-error {
  background: #fff4f4;
  border: 1px solid #f0b6b6;
  border-radius: 8px;
  color: #8f1d1d;
  margin: 0;
  padding: 10px 12px;
}

.account-summary {
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text);
  display: grid;
  gap: 3px;
  padding: 10px;
}

.account-summary span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.shell {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 10px;
}

.workspace,
.issue-pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

label,
.filter-control label {
  color: #3b4856;
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  min-height: 34px;
  padding: 7px 9px;
  width: 100%;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid #74a9d8;
  outline-offset: 1px;
}

.workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.admin-view {
  display: grid;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.filter-control {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.toolbar-create-button {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  white-space: nowrap;
}

.button-icon {
  align-items: center;
  display: inline-flex;
  font-size: 17px;
  font-weight: 800;
  height: 16px;
  justify-content: center;
  line-height: 1;
  width: 16px;
}

.ticket-layout {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  padding: 10px;
}

.ticket-list-pane,
.ticket-detail-pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.status-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-folder {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  text-align: left;
  white-space: nowrap;
}

.status-folder:hover,
.status-folder:focus-visible {
  background: var(--panel-strong);
  border-color: var(--border-soft);
}

.status-folder.active {
  background: #e9f2fb;
  border-color: #9cc4e7;
  box-shadow: inset 0 0 0 1px #9cc4e7;
  color: var(--blue-dark);
}

.status-folder-label {
  font-size: 13px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-folder-count {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 750;
  min-width: 24px;
  padding: 1px 6px;
  text-align: center;
}

.ticket-list-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.ticket-list-toolbar {
  border-bottom: 1px solid var(--border-soft);
  padding: 10px;
}

.ticket-list-topbar {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.ticket-list-toolbar .filter-control {
  gap: 4px;
}

.ticket-search-control {
  min-width: 0;
}

.ticket-toolbar-actions {
  align-items: center;
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.toolbar-menu {
  position: relative;
}

.toolbar-icon,
.button-icon svg {
  display: block;
  height: 18px;
  width: 18px;
}

.toolbar-icon-button,
.toolbar-menu-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #26384a;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  min-height: 34px;
  position: relative;
}

.toolbar-icon-button {
  padding: 7px;
  width: 36px;
}

.toolbar-menu-button {
  padding: 7px 10px;
  white-space: nowrap;
}

.toolbar-icon-button:hover,
.toolbar-icon-button[aria-expanded="true"],
.toolbar-menu-button:hover,
.toolbar-menu-button[aria-expanded="true"] {
  background: #f4f8fc;
  border-color: #a9bfd3;
}

.toolbar-icon-button.active,
.toolbar-menu-button.active {
  background: #e9f2fb;
  border-color: #9cc4e7;
  color: var(--blue-dark);
}

.toolbar-button-badge {
  align-items: center;
  background: var(--blue);
  border: 2px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  height: 18px;
  justify-content: center;
  min-width: 18px;
  padding: 0 4px;
  position: absolute;
  right: -6px;
  top: -6px;
}

.ticket-toolbar-popover {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  min-width: 260px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 25;
}

.filter-popover {
  min-width: min(320px, calc(100vw - 28px));
}

.filter-popover .status-filter-list {
  flex-wrap: wrap;
  overflow: visible;
}

.sort-popover {
  min-width: 230px;
}

.popover-section {
  display: grid;
  gap: 7px;
}

.popover-section h3,
.popover-section label {
  color: #3b4856;
  font-size: 12px;
  font-weight: 750;
  margin: 0;
}

.checkbox-row {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 8px;
}

.checkbox-row input {
  margin: 0;
  min-height: 0;
  width: auto;
}

.popover-clear-button {
  justify-self: stretch;
}

.sort-menu-list {
  display: grid;
  gap: 2px;
}

.sort-menu-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  min-height: 32px;
  padding: 6px 8px;
  text-align: left;
  width: 100%;
}

.sort-menu-item:hover {
  background: #f3f6f9;
}

.sort-menu-item.active {
  background: #edf6ff;
  color: var(--blue-dark);
  font-weight: 750;
}

.sort-menu-item.active::after {
  content: "✓";
  font-weight: 800;
}

.native-sort-select {
  height: 1px;
  left: 0;
  min-height: 0;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 1px;
}

.issue-list {
  overflow: auto;
}

.issue-row {
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  display: grid;
  gap: 3px 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 92px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.issue-row:hover {
  background: #f8fbfd;
}

.issue-row.active {
  background: #edf6ff;
}

.issue-row.unread .issue-row-title {
  font-weight: 850;
}

.issue-unread-dot {
  background: var(--blue);
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  height: 8px;
  margin-right: 6px;
  width: 8px;
}

.issue-row-product,
.issue-row-time,
.issue-row-title,
.issue-row-summary,
.issue-row-footer {
  min-width: 0;
}

.issue-row-product {
  align-items: center;
  color: var(--blue-dark);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-row-time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.issue-row-title {
  font-size: 14px;
  font-weight: 750;
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-row-summary {
  color: var(--muted);
  font-size: 13px;
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-row-footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 6px;
  grid-column: 1 / -1;
}

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  min-width: 72px;
  padding: 4px 8px;
  text-transform: capitalize;
}

.status-new {
  background: #edf6ff;
  color: var(--blue-dark);
}

.status-assigned {
  background: #fff4db;
  color: #7a4b00;
}

.status-resolved {
  background: #e8f6ee;
  color: var(--green);
}

.status-rejected {
  background: #fff1f0;
  color: var(--red);
}

.priority-urgent,
.priority-high {
  background: #fff1f0;
  color: var(--red);
}

.priority-normal {
  background: #eef2f6;
  color: #3a4a5a;
}

.priority-low {
  background: #eaf7ef;
  color: var(--green);
}

.ticket-detail-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.ticket-detail-form {
  display: grid;
  gap: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

.ticket-detail {
  display: grid;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.detail-header {
  display: grid;
  gap: 10px;
}

.detail-header h3 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}

.detail-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.ticket-conversation-panel {
  align-content: stretch;
  display: grid;
  gap: 16px;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 14px 16px;
}

.ticket-main,
.ticket-side {
  align-content: start;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.ticket-main {
  align-content: stretch;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.ticket-main.conversation-drop-active {
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(35, 103, 164, 0.22);
  outline: 2px dashed #7fb1dc;
  outline-offset: -7px;
}

.ticket-main.conversation-drop-active::before {
  background: rgba(220, 239, 255, 0.76);
  border-radius: 12px;
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 4;
}

.ticket-main.conversation-drop-active::after {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #9cc4e7;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  color: var(--blue-dark);
  content: "Drop files to attach";
  font-size: 13px;
  font-weight: 800;
  left: 50%;
  letter-spacing: 0;
  padding: 9px 14px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.ticket-side {
  background: var(--panel-strong);
  border-left: 1px solid var(--border-soft);
  border-radius: 0;
  gap: 0;
  min-height: 0;
  overflow: auto;
}

.ticket-side input,
.ticket-side select,
.ticket-side textarea {
  min-height: 32px;
  padding: 5px 8px;
}

.ticket-form-field {
  display: grid;
  gap: 6px;
}

.ticket-form-field > span:empty {
  display: none;
}

.ticket-form-field > span {
  color: #3b4856;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.ticket-title-input {
  font-size: 22px;
  font-weight: 750;
  min-height: 44px;
}

.ticket-description-input {
  line-height: 1.55;
  min-height: 150px;
}

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

.ticket-side .detail-controls {
  gap: 8px;
  grid-template-columns: 1fr;
}

.description {
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  min-height: 90px;
  padding: 10px;
  white-space: pre-wrap;
}

.side-section {
  border-bottom: 1px solid var(--border-soft);
  display: grid;
  gap: 6px;
  padding: 8px 10px;
}

.side-section:last-child {
  border-bottom: 0;
}

.section-title {
  color: #3b4856;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.requester-block {
  background: #f8fbff;
  border: 1px solid #c4d9ec;
  border-radius: 6px;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 7px 9px;
}

.requester-block strong,
.requester-block span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.requester-block .badge {
  justify-self: start;
  min-width: 0;
  padding-block: 3px;
}

.comment-list,
.conversation-stream {
  align-content: start;
  background: #f6f8fb;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-auto-rows: max-content;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  padding: 14px 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

@media (prefers-reduced-motion: reduce) {
  .comment-list,
  .conversation-stream {
    scroll-behavior: auto;
  }
}

.message-row {
  display: flex;
  gap: 9px;
  min-width: 0;
  width: 100%;
}

.message-row.from-current {
  justify-content: flex-end;
}

.message-row.from-other {
  justify-content: flex-start;
}

.conversation-unread-divider {
  align-items: center;
  color: #b42318;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 10px;
  grid-template-columns: 1fr auto 1fr;
  letter-spacing: 0.04em;
  margin: 2px 4px;
  text-transform: uppercase;
}

.conversation-unread-divider::before,
.conversation-unread-divider::after {
  background: #e5484d;
  content: "";
  display: block;
  height: 1px;
}

.conversation-unread-divider span {
  background: #fff1f0;
  border: 1px solid #ffcdc7;
  border-radius: 999px;
  line-height: 1;
  padding: 5px 9px;
}

.message-avatar {
  align-items: center;
  background: #dbe5ee;
  border: 1px solid #c9d4df;
  border-radius: 999px;
  color: #334155;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  margin-top: 2px;
  width: 30px;
}

.message-row.from-current .message-avatar {
  background: #d9ecff;
  border-color: #b7d6f0;
  color: var(--blue-dark);
  order: 2;
}

.message-row.message-internal .message-avatar {
  background: #fff0c2;
  border-color: #e6c777;
  color: #7a4b00;
}

.comment,
.message-bubble {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  max-width: min(74%, 720px);
  min-width: 220px;
  padding: 10px 12px;
}

.message-row.from-current .message-bubble {
  background: #eaf4ff;
  border-color: #bdd8f1;
  order: 1;
}

.message-bubble.opening-message {
  background: #ffffff;
  border-color: #9fc7e7;
  box-shadow: inset 3px 0 0 #9fc7e7, 0 4px 12px rgba(15, 23, 42, 0.05);
}

.message-row.message-internal .message-bubble {
  background: #fff8e8;
  border-color: #e6c777;
  box-shadow: inset 3px 0 0 #e1b94e, 0 4px 12px rgba(15, 23, 42, 0.05);
}

.comment-head,
.message-head {
  align-items: start;
  color: var(--muted);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-bottom: 7px;
  min-width: 0;
}

.message-head-main {
  min-width: 0;
}

.comment strong,
.message-head strong {
  color: var(--text);
  display: block;
  font-size: 12px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-time {
  font-size: 12px;
  white-space: nowrap;
}

.message-flag {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  padding: 4px 7px;
}

.internal-flag {
  background: #fff0c2;
  color: #7a4b00;
}

.comment p,
.message-bubble p {
  color: #17212b;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}

.comment-form {
  background: #f8fafc;
  border: 1px solid #cfd9e3;
  border-radius: 12px;
  box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.03);
  display: grid;
  gap: 6px;
  padding: 8px;
}

.comment-form:focus-within {
  border-color: #8bb9df;
  box-shadow: 0 0 0 2px rgba(35, 103, 164, 0.12);
}

.comment-form.attachment-drop-active {
  background: #f1f8ff;
  border-color: #7fb1dc;
  box-shadow: inset 0 0 0 2px rgba(35, 103, 164, 0.18);
  outline: 2px dashed #7fb1dc;
  outline-offset: -7px;
}

.comment-form .ticket-form-field {
  gap: 4px;
}

.comment-form .ticket-form-field > span {
  color: var(--muted);
  font-size: 11px;
  text-transform: none;
}

.comment-form .attachment-field > span {
  display: none;
}

.comment-form .attachment-picker {
  background: transparent;
  border: 0;
  border-radius: 0;
  min-height: 30px;
  padding: 0 1px;
}

.comment-form .attachment-picker.dragging,
.comment-form .attachment-picker:focus-within {
  background: transparent;
  box-shadow: none;
}

.comment-form .attachment-trigger {
  height: 28px;
  width: 28px;
}

.comment-form .attachment-preview {
  max-height: none;
}

.attachment-field {
  gap: 5px;
}

.attachment-input {
  height: 1px;
  left: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 1px;
}

.attachment-picker {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd7e3;
  border-radius: 8px;
  display: flex;
  gap: 6px;
  min-height: 38px;
  min-width: 0;
  overflow: hidden;
  padding: 5px 6px;
  position: relative;
}

.attachment-picker.dragging,
.attachment-picker:focus-within {
  background: #f3f9ff;
  border-color: #7fb1dc;
  box-shadow: 0 0 0 2px rgba(35, 103, 164, 0.1);
}

.attachment-trigger {
  align-items: center;
  background: #f7fafc;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: #22313f;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  padding: 0;
  width: 30px;
}

.attachment-trigger:hover {
  background: #edf4fa;
  border-color: #c5d8e9;
}

.attachment-trigger-icon {
  display: block;
  height: 18px;
  width: 18px;
}

.attachment-preview {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px;
  scrollbar-width: thin;
}

.attachment-preview.empty {
  display: none;
}

.attachment-preview-chip {
  align-items: center;
  background: #eef5fc;
  border: 1px solid var(--border-soft);
  display: inline-flex;
  flex: 0 0 auto;
  gap: 5px;
  max-width: 180px;
  min-width: 0;
  border-radius: 999px;
  color: #22313f;
  font-size: 12px;
  font-weight: 700;
  height: 25px;
  padding: 0 4px 0 9px;
}

.attachment-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-remove {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  height: 18px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 18px;
}

.attachment-remove:hover {
  background: #fff1f0;
  border-color: #ffd0cc;
  color: var(--red);
}

.comment-entry {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.comment-action-rail {
  align-content: end;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.comment-visibility-control {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--blue-dark);
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  position: relative;
  width: 34px;
}

.comment-visibility-control:hover {
  background: #f4f8fc;
  border-color: #9cc4e7;
}

.comment-visibility-control select {
  cursor: pointer;
  inset: 0;
  opacity: 0;
  padding: 0;
  position: absolute;
}

.visibility-icon {
  display: inline-block;
  height: 16px;
  position: relative;
  width: 16px;
}

.visibility-public .visibility-icon {
  border: 2px solid currentColor;
  border-radius: 999px;
}

.visibility-public .visibility-icon::before,
.visibility-public .visibility-icon::after {
  background: currentColor;
  content: "";
  left: 3px;
  position: absolute;
  right: 3px;
}

.visibility-public .visibility-icon::before {
  height: 2px;
  top: 5px;
}

.visibility-public .visibility-icon::after {
  bottom: 3px;
  top: 3px;
  width: 2px;
  left: 5px;
  right: auto;
}

.visibility-internal {
  color: #7a4b00;
}

.visibility-internal .visibility-icon::before {
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  content: "";
  height: 8px;
  left: 3px;
  position: absolute;
  top: 0;
  width: 10px;
}

.visibility-internal .visibility-icon::after {
  background: currentColor;
  border-radius: 3px;
  bottom: 0;
  content: "";
  height: 10px;
  left: 1px;
  position: absolute;
  right: 1px;
}

.comment-input {
  border: 0;
  background: transparent;
  min-height: 64px;
  padding: 0;
  resize: none;
}

.comment-input:focus {
  box-shadow: none;
  outline: 0;
}

.comment-send-button {
  align-items: center;
  align-self: end;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.comment-send-button:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.comment-send-button:disabled {
  opacity: 0.45;
}

.send-icon {
  display: inline-block;
  height: 14px;
  position: relative;
  width: 16px;
}

.send-icon::before {
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  content: "";
  height: 8px;
  position: absolute;
  right: 2px;
  top: 2px;
  transform: rotate(45deg);
  width: 8px;
}

.send-icon::after {
  background: currentColor;
  content: "";
  height: 2px;
  left: 1px;
  position: absolute;
  right: 3px;
  top: 6px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.message-bubble .attachment-list {
  margin-top: 8px;
}

.attachment-list.empty {
  display: none;
}

.attachment-preview-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  width: 100%;
}

.attachment-image-link {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  display: block;
  max-width: 100%;
  overflow: hidden;
}

.attachment-image-preview {
  aspect-ratio: 4 / 3;
  background: #edf2f7;
  display: block;
  max-height: 220px;
  object-fit: cover;
  width: 100%;
}

.attachment-link {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text);
  display: inline-flex;
  gap: 8px;
  max-width: 100%;
  padding: 5px 8px;
  text-decoration: none;
}

.message-bubble .attachment-link {
  background: rgba(255, 255, 255, 0.72);
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-size {
  color: var(--muted);
  flex: 0 0 auto;
}

.ticket-savebar {
  background: #ffffff;
  border-top: 1px solid var(--border-soft);
  bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 16px;
  position: sticky;
}

.muted {
  color: var(--muted);
}

.status-ok {
  color: var(--green);
  font-weight: 700;
}

.status-error {
  color: var(--red);
}

.empty-state {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 10px;
  justify-content: center;
  justify-items: center;
  min-height: 260px;
  padding: 24px;
  text-align: center;
}

.empty-state h3,
.empty-inline h3 {
  color: var(--text);
  font-size: 17px;
  margin: 0;
}

.empty-state p,
.empty-inline p {
  margin: 0;
  max-width: 460px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 2px;
}

.admin-shell {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.admin-sidebar {
  align-content: start;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-auto-rows: max-content;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  position: sticky;
  top: 70px;
}

.admin-side-button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  text-align: left;
}

.admin-side-button:hover,
.admin-side-button:focus-visible {
  background: var(--panel-strong);
  border-color: var(--border-soft);
}

.admin-side-button.active {
  background: #e9f2fb;
  border-color: #9cc4e7;
  color: var(--blue-dark);
}

.admin-side-button strong {
  font-size: 13px;
}

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

.admin-section-stage,
.admin-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.admin-section-stage {
  overflow: auto;
}

.product-context {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: flex-start;
  margin-bottom: 10px;
  min-width: 0;
  padding: 14px 16px;
}

.product-context-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.product-context-kicker {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.product-context h1 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}

.product-context-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-key-pill {
  background: #edf6ff;
  border: 1px solid #c9dff3;
  border-radius: 999px;
  color: var(--blue-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 5px 8px;
}

.admin-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  padding: 12px;
}

.admin-section-panel,
.product-section-panel {
  align-self: start;
}

#productIndexPanel {
  height: 100%;
}

#productDetailView {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-bottom: 8px;
}

.panel-head h2 {
  font-size: 16px;
  margin: 0;
}

.panel-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.admin-list {
  align-content: start;
  display: grid;
  gap: 6px;
  grid-auto-rows: max-content;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.admin-list-tools {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 220px);
}

.admin-list-tools.compact {
  grid-template-columns: minmax(240px, 1fr);
}

.admin-list-tools label {
  display: grid;
  gap: 6px;
}

.admin-row {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) repeat(5, auto);
  min-height: 40px;
  padding: 7px;
}

.product-index-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.admin-row-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-main strong,
.admin-row-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.email-overview {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.maintenance-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.email-stat,
.maintenance-item {
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  display: grid;
  gap: 2px;
  padding: 8px;
  min-width: 0;
}

.email-stat span,
.maintenance-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.email-stat strong,
.maintenance-item strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.email-row {
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.email-row:hover,
.email-row:focus-visible {
  background: #f8fbfd;
}

.pager {
  align-items: center;
  border-top: 1px solid var(--border-soft);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
}

.pager-summary {
  color: var(--muted);
  font-size: 12px;
  margin-right: auto;
}

.email-detail {
  display: grid;
  gap: 12px;
}

.fact-list {
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  overflow: hidden;
}

.fact-block {
  align-items: start;
  background: #fff;
  border-bottom: 1px solid var(--border-soft);
  display: grid;
  gap: 8px;
  grid-template-columns: 96px minmax(0, 1fr);
  padding: 8px 10px;
}

.ticket-side .fact-block {
  gap: 6px;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 6px 9px;
}

.fact-block:last-child {
  border-bottom: 0;
}

.fact-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.ticket-side .fact-label {
  font-size: 11px;
}

.fact-block strong {
  overflow-wrap: anywhere;
}

.email-body {
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
}

.token-result {
  background: #ecfdf3;
  border: 1px solid #a6d8b7;
  border-radius: 6px;
  color: #174b2b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  padding: 8px;
}

.token-result:empty {
  display: none;
}

.empty-inline {
  color: var(--muted);
  display: grid;
  gap: 5px;
  padding: 8px 2px;
}

@media (max-width: 1050px) {
  .shell,
  .ticket-layout,
  .admin-shell,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .ticket-layout {
    grid-template-rows: minmax(260px, 42%) minmax(0, 1fr);
    overflow: hidden;
  }

  .status-filter-list {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .filter-popover .status-filter-list {
    flex-wrap: wrap;
    overflow: visible;
  }

  .admin-sidebar {
    display: flex;
    overflow-x: auto;
    position: static;
  }

  .admin-side-button {
    min-width: 160px;
  }

  .product-context {
    align-items: stretch;
    display: grid;
  }

  .ticket-detail-pane {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    display: grid;
  }

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

  .topbar-actions > * {
    flex: 1;
  }

  .shell {
    padding: 8px;
  }

  .detail-controls,
  .ticket-detail-grid,
  .ticket-list-topbar,
  .admin-list-tools {
    grid-template-columns: 1fr;
  }

  .ticket-list-topbar {
    align-items: stretch;
  }

  .ticket-toolbar-actions {
    justify-content: stretch;
  }

  .ticket-toolbar-actions > .toolbar-menu {
    flex: 1;
  }

  .ticket-toolbar-actions > .toolbar-menu > button {
    width: 100%;
  }

  .status-filter-list {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .ticket-detail-grid {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .ticket-side {
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    max-height: 180px;
  }

  .email-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-alert {
    left: 8px;
    right: 8px;
    top: 8px;
  }

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

  .message-bubble {
    max-width: calc(100% - 42px);
    min-width: 0;
  }

  .issue-row {
    gap: 6px;
    grid-template-columns: 1fr;
  }

  .issue-row > * {
    grid-column: 1;
  }
}
