:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --internal: #fef3c7;
  --sidebar-width: 232px;
  --sidebar-collapsed-width: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  background: white; border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; align-items: center; gap: 16px;
}
header.topbar .brand { font-weight: 700; font-size: 18px; color: var(--primary); }
header.topbar nav { display: flex; gap: 14px; font-size: 14px; }
header.topbar .btn { font-size: 13px; padding: 6px 10px; }
header.topbar .spacer { flex: 1; }
header.topbar .user-info { font-size: 13px; color: var(--muted); }
header.topbar button { font-size: 13px; }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  background: #fff;
  border-right: 1px solid var(--border);
  box-shadow: 10px 0 28px rgba(15, 23, 42, 0.05);
  transition: width .18s ease;
}
.has-sidebar { padding-left: var(--sidebar-width); transition: padding-left .18s ease; }
.has-sidebar.sidebar-collapsed { padding-left: var(--sidebar-collapsed-width); }
.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed-width); }
.has-sidebar main { max-width: none; margin: 0; }
.sidebar-head { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--primary);
  font-weight: 800;
  font-size: 18px;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-toggle {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  font-size: 18px;
}
.sidebar-toggle:hover { background: #f3f4f6; color: var(--text); }
.sidebar-nav { display: grid; gap: 4px; margin-top: 8px; }
.sidebar-nav a,
.sidebar-new,
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}
.sidebar-nav a:hover,
.sidebar-new:hover,
.sidebar-logout:hover { background: #f3f4f6; text-decoration: none; color: var(--text); }
.sidebar-nav a.active { background: #dbeafe; color: #1d4ed8; }
.sidebar-new { background: var(--primary); color: #fff; margin-top: 8px; justify-content: flex-start; }
.sidebar-new:hover { background: var(--primary-dark); color: #fff; }
.sidebar-icon { flex: 0 0 24px; width: 24px; display: inline-grid; place-items: center; font-weight: 800; }
.sidebar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-spacer { flex: 1; }
.sidebar-user { display: grid; gap: 4px; padding: 10px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
.sidebar-user span:first-child { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #dbeafe; color: #1d4ed8; display: inline-grid; place-items: center; font-weight: 800; }
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .sidebar-user,
.sidebar-collapsed .sidebar-new .sidebar-label,
.sidebar-collapsed .sidebar-logout .sidebar-label { display: none; }
.sidebar-collapsed .sidebar-head { justify-content: center; }
.sidebar-collapsed .sidebar-brand { justify-content: center; }
.sidebar-collapsed .sidebar-toggle { margin-left: 0; }
.sidebar-collapsed .sidebar-nav a,
.sidebar-collapsed .sidebar-new,
.sidebar-collapsed .sidebar-logout { justify-content: center; padding-left: 6px; padding-right: 6px; }

@media (max-width: 760px) {
  .has-sidebar { padding-left: var(--sidebar-collapsed-width); }
  .app-sidebar { width: var(--sidebar-collapsed-width); }
  .app-sidebar .sidebar-label,
  .app-sidebar .sidebar-user,
  .app-sidebar .sidebar-new .sidebar-label,
  .app-sidebar .sidebar-logout .sidebar-label { display: none; }
}

main { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 24px 0 12px; }

.ticket-detail-page { max-width: 1680px; padding-top: 12px; }
.ticket-summary-card { padding: 10px 14px; margin-bottom: 8px; }
.ticket-summary-card h1 { margin: 0 !important; font-size: 20px; }
.ticket-summary-card .badge { margin-right: 4px; }
.ticket-summary-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ticket-summary-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ticket-summary-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-summary-meta { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 0 0 auto; }
.ticket-summary-body {
  white-space: pre-wrap;
  margin-top: 10px;
  line-height: 1.4;
  max-height: 44px;
  overflow: hidden;
}
.ticket-detail-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: stretch;
}
.ticket-manage-column,
.ticket-side-column {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.ticket-manage-card { display: grid; gap: 2px; }
.manage-requester-card {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.manage-requester-name { font-weight: 700; }
.manage-requester-card a { font-size: 13px; word-break: break-all; }
.ticket-conversation-column {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 148px);
}
.ticket-conversation-column h2 { flex: 0 0 auto; }
.conversation-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
}
.thread-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.conversation-divider { flex: 0 0 auto; margin: 12px 0; border: none; border-top: 1px solid var(--border); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 240px 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: inherit; background: white; color: var(--text);
}
input[type="checkbox"] { width: auto; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.form-row { margin-bottom: 12px; }
.form-row.inline { display: flex; gap: 8px; align-items: center; }
.form-row.inline label { margin: 0; }
.inline-actions { display: flex; gap: 8px; align-items: center; }
.inline-actions input { flex: 1; }
.inline-actions button { flex: 0 0 auto; }
button, .btn {
  display: inline-block; cursor: pointer; padding: 8px 14px; border-radius: 6px;
  border: 1px solid transparent; font-size: 14px; font-weight: 500;
  background: var(--primary); color: white; transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--primary-dark); text-decoration: none; }
button.secondary, .btn.secondary { background: white; color: var(--text); border-color: var(--border); }
button.secondary:hover, .btn.secondary:hover { background: #f3f4f6; }
button.danger, .btn.danger { background: var(--danger); }
button.danger:hover { background: #b91c1c; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.contact-lookup { position: relative; }
.contact-suggestions {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  max-height: 240px;
  overflow-y: auto;
}
button.contact-suggestion {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 0.7fr);
  width: 100%;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: white;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}
button.contact-suggestion:hover,
button.contact-suggestion:focus {
  background: #f8fafc;
  color: var(--text);
  outline: none;
}
button.contact-suggestion:last-child { border-bottom: 0; }
button.contact-suggestion strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
button.contact-suggestion span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th { text-align: left; padding: 10px; background: #f9fafb; border-bottom: 1px solid var(--border); font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
table td { padding: 10px; border-bottom: 1px solid var(--border); }
table tr:hover td { background: #f9fafb; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge.status-open { background: #dbeafe; color: #1e40af; }
.badge.status-pending { background: #fef3c7; color: #92400e; }
.badge.status-solved { background: #dcfce7; color: #166534; }
.badge.status-closed { background: #e5e7eb; color: #374151; }
.badge.priority-low { background: #f3f4f6; color: #4b5563; }
.badge.priority-normal { background: #dbeafe; color: #1e40af; }
.badge.priority-high { background: #fed7aa; color: #9a3412; }
.badge.priority-urgent { background: #fee2e2; color: #991b1b; }
.badge.role-agent { background: #ccfbf1; color: #115e59; }
.badge.role-admin { background: #fce7f3; color: #9f1239; }
.badge.tag { background: #f3f4f6; color: #4b5563; margin-right: 4px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-option { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; background: #f9fafb; color: var(--text); cursor: pointer; font-size: 13px; }
.tag-option input { width: auto; }
.tag-option.selected { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.tag-select-widget { display: grid; gap: 8px; }
.current-tag { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-suggestions { display: grid; gap: 4px; border: 1px solid var(--border); border-radius: 6px; background: white; padding: 4px; max-height: 180px; overflow-y: auto; }
button.tag-suggestion { display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: 4px; background: white; color: var(--text); box-shadow: none; }
button.tag-suggestion:hover { background: #f3f4f6; color: var(--text); }
.macro-suggestions { display: grid; gap: 4px; border: 1px solid var(--border); border-radius: 6px; background: white; padding: 4px; max-height: 240px; overflow-y: auto; margin-top: 6px; }
button.macro-suggestion { display: grid; gap: 3px; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 4px; background: white; color: var(--text); box-shadow: none; }
button.macro-suggestion:hover { background: #f3f4f6; color: var(--text); }
button.macro-suggestion span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.macro-suggestion em { justify-self: start; padding: 1px 7px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: 11px; font-style: normal; }
.macro-editor-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.macro-editor-tools.compact { margin-bottom: 4px; }
.macro-editor-tools button { padding: 4px 8px; font-size: 12px; }
.macro-editor-tools .muted { line-height: 1.3; }

.muted { color: var(--muted); font-size: 13px; }
.error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 6px; margin: 8px 0; font-size: 14px; }
.success { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 6px; margin: 8px 0; font-size: 14px; }
.hidden { display: none !important; }

.thread { display: flex; flex-direction: column; gap: 12px; }
.comment { background: #f9fafb; border: 1px solid var(--border); border-left: 4px solid #cbd5e1; border-radius: 6px; padding: 12px 14px; }
.comment.staff { background: #f0fdfa; border-color: #99f6e4; border-left-color: #14b8a6; }
.comment.requester { background: #eff6ff; border-color: #bfdbfe; border-left-color: #3b82f6; }
.comment.internal { background: #fffbeb; border-color: #fcd34d; border-left-color: #f59e0b; }
.comment header { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.comment header strong { color: var(--text); }
.comment-author-line { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.comment-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: #dbeafe; color: #1d4ed8; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.comment .body { white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
.comment .body.rich-text { white-space: normal; }
.comment-signature { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 13px; line-height: 1.45; }
.rich-text-image { display: block; max-width: 100%; max-height: 360px; margin: 8px 0; border-radius: 8px; border: 1px solid var(--border); background: white; }
.comment-badge { flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.comment-badge.staff { background: #ccfbf1; color: #115e59; }
.comment-badge.requester { background: #dbeafe; color: #1d4ed8; }
.comment-badge.internal { background: #fef3c7; color: #92400e; }
.comment-composer {
  flex: 0 0 auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  overflow: visible;
  background: white;
}
.composer-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.composer-back { color: var(--muted); font-size: 16px; line-height: 1; }
.composer-mode {
  width: auto;
  min-width: 128px;
  padding: 4px 24px 4px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
}
.composer-mode:focus { box-shadow: none; border-color: transparent; }
.comment-composer .form-row { padding: 0 12px; }
.comment-composer .form-row:first-of-type { padding-top: 12px; }
.comment-composer .form-row:last-child { padding-bottom: 12px; }
.composer-body { padding: 12px; min-height: 116px; }
.composer-body textarea { display: block; min-height: 112px; border: 0; box-shadow: none; resize: vertical; padding: 8px 0; }
.composer-body textarea:focus { border: 0; box-shadow: none; }
.composer-panel { padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fff; }
.composer-toolbar { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--border); background: #fff; }
.composer-tool { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); box-shadow: none; font-size: 16px; }
.composer-tool.text { width: auto; padding: 0 8px; font-size: 13px; }
.composer-tool.italic { font-style: italic; }
.composer-tool:hover { background: #f3f4f6; color: var(--text); }
.composer-send { margin-left: auto; }
.composer-attachment-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.composer-attachment-list span { padding: 3px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12px; }
.emoji-choice { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; box-shadow: none; font-size: 18px; }
.emoji-choice:hover { background: #f3f4f6; }
#comment-form.composer-internal { background: #fffbeb; border-color: #fcd34d; }
#comment-form.composer-internal .composer-topbar { background: #fffbeb; border-bottom-color: #fcd34d; }
#comment-form.composer-internal .composer-panel,
#comment-form.composer-internal .composer-toolbar { background: #fffbeb; border-color: #fcd34d; }
#comment-form.composer-internal textarea[name="body"] {
  background: #fffbeb;
}
#comment-form.composer-internal textarea[name="body"]::placeholder { color: #92400e; opacity: .75; }
#comment-form.composer-internal input[type="file"] { border-color: #fcd34d; background: #fffbeb; }

.attachment-list { list-style: none; padding: 0; margin: 8px 0; }
.attachment-list li { padding: 6px 0; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.attachment-delete { font-size: 11px; padding: 2px 6px; margin-left: auto; }
.attachment-comment .body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.comment-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.comment-attachment-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.comment-attachment-card a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.comment-attachment-card .attachment-delete { margin-left: 0; justify-self: start; }
.comment-attachment-thumb {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: white;
  min-height: 82px;
}
.comment-attachment-thumb img,
.comment-attachment-thumb video { display: block; width: 100%; height: 120px; object-fit: cover; }
.comment-attachment-thumb audio { display: block; width: 100%; }
.comment-attachment-thumb iframe { display: block; width: 100%; height: 160px; border: 0; background: white; }
.attachment-inline-preview {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f9fafb;
  overflow: hidden;
  width: 100%;
  max-width: 520px;
}
.attachment-inline-preview img,
.attachment-inline-preview video { display: block; max-width: 100%; height: auto; }
.attachment-inline-preview audio { display: block; width: 100%; }
.attachment-inline-preview iframe { display: block; width: 100%; height: 340px; border: 0; background: white; }

.filter-sidebar { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 16px; height: fit-content; }
.filter-sidebar .form-row { margin-bottom: 10px; }
.filter-sidebar h3 { margin: 0 0 12px; font-size: 14px; }
.assignee-workload { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.assignee-workload > span { line-height: 1.35; }
.workload-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  box-shadow: none;
}
.workload-chip:hover { background: #eef2ff; color: var(--text); }
.workload-chip strong {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  text-align: center;
}

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.ticket-count { padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: white; font-size: 13px; }

.history-list { display: grid; gap: 8px; }
.history-list.compact { gap: 6px; }
#requester-history {
  min-height: 420px;
  max-height: calc(100vh - 330px);
  overflow-y: auto;
}
.requester-card { display: grid; gap: 12px; }
.requester-profile { display: flex; align-items: center; gap: 12px; }
.requester-avatar { width: 38px; height: 38px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; display: grid; place-items: center; font-weight: 700; }
.requester-name { font-weight: 700; margin-bottom: 2px; }
.requester-email { font-size: 13px; word-break: break-all; }
.requester-email-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.spam-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #fee2e2; color: #991b1b; font-size: 11px; font-weight: 800; }
.spam-warning { padding: 8px 10px; border: 1px solid #fecaca; border-radius: 8px; background: #fef2f2; color: #991b1b; font-size: 13px; }
.copy-email { width: 24px; height: 24px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--muted); box-shadow: none; font-size: 13px; }
.copy-email:hover { background: #f3f4f6; color: var(--text); }
.copy-email-status { font-size: 12px; }
.requester-meta { display: grid; gap: 8px; }
.requester-meta div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.requester-meta span { flex: 0 0 auto; }
.requester-meta strong { min-width: 0; text-align: right; word-break: break-word; }
.profile-card { display: grid; gap: 18px; }
.profile-avatar-block { display: flex; gap: 16px; align-items: center; }
.profile-avatar-preview { width: 88px; height: 88px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; display: grid; place-items: center; font-size: 32px; font-weight: 800; overflow: hidden; flex: 0 0 auto; }
.profile-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.history-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f9fafb;
  color: var(--text);
}
.history-item:hover { background: #f3f4f6; text-decoration: none; }
.history-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.requester-history-row td { background: #f8fafc; padding: 12px; }
.requester-history-body { padding: 4px; }

.dash-tile { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 18px; }
.dash-tile .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.dash-tile .value { font-size: 28px; font-weight: 700; margin-top: 4px; }

.dashboard-controls { display: flex; flex-direction: column; gap: 10px; }
.dashboard-controls-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.dashboard-controls-top .form-row { margin: 0; min-width: 220px; flex: 1 1 260px; }
.dashboard-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.dashboard-filter-grid .form-row { margin: 0; }
.dashboard-filter-grid .form-row.inline { align-self: end; }
.dashboard-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.widget-picker { display: grid; gap: 8px; }
.widget-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f9fafb;
  padding: 8px 10px;
}
.widget-picker-row label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}
.widget-picker-controls { display: flex; gap: 6px; }
.widget-picker-controls button { font-size: 12px; padding: 2px 8px; }

.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
.dashboard-widget-tile { grid-column: span 4; }
.dashboard-widget-table { grid-column: 1 / -1; }

@media (max-width: 980px) {
  .ticket-detail-grid { grid-template-columns: 1fr; }
  .ticket-manage-column,
  .ticket-side-column { position: static; max-height: none; overflow: visible; }
  .conversation-card { height: auto; min-height: 0; }
  .thread-scroll { max-height: 60vh; }
  .dashboard-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-widget-tile { grid-column: span 6; }
}

@media (max-width: 680px) {
  .dashboard-controls-top { align-items: stretch; }
  .dashboard-controls-top .form-row { min-width: 100%; flex-basis: 100%; }
  .dashboard-filter-grid { grid-template-columns: 1fr; }
  .dashboard-filter-actions { justify-content: flex-start; }
  .dashboard-widget-tile { grid-column: 1 / -1; }
  .widget-picker-row { flex-direction: column; align-items: flex-start; }
}

.ticket-select-col { width: 34px; text-align: center; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bulk-actions select { width: auto; min-width: 160px; }
