@font-face {
  font-family: "Vazir";
  src: url("./fonts/vazirmatn/Vazir-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("./fonts/vazirmatn/Vazir-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("./fonts/vazirmatn/Vazir.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("./fonts/vazirmatn/Vazir-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("./fonts/vazirmatn/Vazir-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #eef3f8;
  --bg-accent: rgba(19, 126, 168, 0.12);
  --bg-accent-soft: rgba(79, 174, 129, 0.12);
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-soft: #f7fbff;
  --surface-muted: #edf4fa;
  --ink: #132034;
  --ink-soft: #52627a;
  --ink-faint: #7a889b;
  --line: rgba(157, 181, 206, 0.35);
  --line-strong: rgba(116, 147, 180, 0.45);
  --brand: #1178a8;
  --brand-strong: #0b5f86;
  --brand-soft: rgba(17, 120, 168, 0.11);
  --success: #177b52;
  --success-soft: rgba(23, 123, 82, 0.1);
  --warning: #b7791f;
  --warning-soft: rgba(183, 121, 31, 0.12);
  --danger: #bb3f57;
  --danger-soft: rgba(187, 63, 87, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 14px 32px rgba(15, 35, 58, 0.08);
  --shadow-md: 0 22px 54px rgba(15, 35, 58, 0.12);
  --shadow-lg: 0 28px 70px rgba(15, 35, 58, 0.16);
  --transition-fast: 180ms ease;
  --transition-normal: 260ms ease;
}

html[data-theme="dark"],
body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d141c;
  --bg-accent: rgba(33, 106, 148, 0.18);
  --bg-accent-soft: rgba(71, 138, 106, 0.14);
  --surface: rgba(18, 26, 36, 0.92);
  --surface-strong: #141d28;
  --surface-soft: #1a2531;
  --surface-muted: #22303f;
  --ink: #e8f0f8;
  --ink-soft: #b3c0cf;
  --ink-faint: #8a99aa;
  --line: rgba(110, 131, 156, 0.28);
  --line-strong: rgba(129, 156, 186, 0.42);
  --brand: #4ab0e3;
  --brand-strong: #2a8dc0;
  --brand-soft: rgba(74, 176, 227, 0.14);
  --success: #4fd090;
  --success-soft: rgba(79, 208, 144, 0.12);
  --warning: #e7b14d;
  --warning-soft: rgba(231, 177, 77, 0.12);
  --danger: #f07a92;
  --danger-soft: rgba(240, 122, 146, 0.14);
  --shadow-sm: 0 16px 34px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 24px 58px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Vazir", "Vazirmatn", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(760px 430px at 100% 0%, var(--bg-accent) 0%, transparent 60%),
    radial-gradient(640px 360px at 0% 2%, var(--bg-accent-soft) 0%, transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 30%),
    var(--bg);
  transition: background var(--transition-normal), color var(--transition-normal);
}

a {
  color: inherit;
  text-decoration: none;
}

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

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1200px, 94vw);
  margin: 24px auto 32px;
  animation: page-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-home {
  display: grid;
  gap: 18px;
}

.hero-block,
.panel,
.help-card,
.error-card,
.site-footer,
.top-bar,
.content-card,
.side-card,
.ticket-summary-item,
.ticket-view-header {
  backdrop-filter: blur(12px);
}

.hero-block {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow-lg);
  padding: clamp(22px, 4vw, 42px);
}

.hero-block::after {
  content: "";
  position: absolute;
  inset: auto auto -48px -48px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, var(--brand-soft) 0%, transparent 68%);
  pointer-events: none;
}

.hero-block h1 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.45;
}

.lead {
  margin: 0;
  max-width: 880px;
  color: var(--ink-soft);
  line-height: 2;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
}

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

.surface-card,
.panel,
.help-card,
.error-card,
.site-footer,
.top-bar,
.content-card,
.side-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: 
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.2s ease,
    background 0.25s ease,
    color 0.25s ease;
}

.surface-card {
  padding: 20px;
}

.surface-card:hover,
.panel:hover,
.help-card:hover,
.ticket-summary-item:hover,
.content-card:hover,
.side-card:hover,
.ticket-view-header:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.surface-card h2,
.panel h2,
.help-card h2,
.content-card h3 {
  margin: 0 0 10px;
}

.surface-card p,
.help-card p,
.help-card ul,
.top-bar p,
.muted,
.hint,
.ticket-summary-preview,
.reply-item p:last-child,
.attachment-item p:last-child,
.note-item p:last-child,
.footer-text,
.footer-copy {
  color: var(--ink-soft);
}

.top-bar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.35rem;
}

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

.chip,
.counter,
.meta-pill,
.ticket-unread-badge,
.ticket-status-banner,
.ticket-hint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
}

.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 7px 12px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.chip:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.chip-muted,
.counter-muted {
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.realtime-chip {
  min-width: 78px;
  border-color: transparent;
}

.realtime-chip .fa-circle {
  font-size: 0.55rem;
}

.realtime-chip-connected {
  background: var(--success-soft);
  color: var(--success);
}

.realtime-chip-connecting {
  background: var(--warning-soft);
  color: var(--warning);
}

.realtime-chip-disconnected {
  background: var(--danger-soft);
  color: var(--danger);
}

.counter,
.meta-pill,
.ticket-unread-badge {
  border: 1px solid var(--line);
  padding: 5px 10px;
  background: var(--surface-soft);
  transition: background 0.2s ease, color 0.2s ease;
}

.counter:hover {
  background: var(--surface-muted);
}

.counter-soft {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.ticket-unread-badge {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.btn,
.footer-button,
.footer-links a,
.side-nav-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: 
    transform 0.15s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.15s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.15s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.btn:hover,
.footer-button:hover,
.footer-links a:hover,
.side-nav-link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active,
.footer-button:active,
.footer-links a:active,
.side-nav-link:active {
  transform: scale(0.98);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: 0 16px 34px rgba(17, 120, 168, 0.24);
}

.btn-soft,
.footer-button,
.footer-links a,
.side-nav-link {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, var(--danger), #a42d46);
  box-shadow: 0 16px 34px rgba(187, 63, 87, 0.22);
}

.message-area {
  margin-top: 12px;
  min-height: 28px;
}

.success-text,
.error-text {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  animation: slide-down 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-text {
  color: var(--success);
  background: var(--success-soft);
}

.error-text {
  color: var(--danger);
  background: var(--danger-soft);
}

.dashboard-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel-form {
  position: sticky;
  top: 104px;
}

.field,
.ticket-filter-field,
.side-stack,
.upload-progress-wrap,
.upload-meta,
.ticket-section-stack {
  display: grid;
  gap: 8px;
}

.field {
  margin-bottom: 12px;
}

.field label,
.ticket-filter-field,
.inline-controls label,
.side-checkboxes label {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  transition: 
    border-color 0.2s ease,
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.25s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.95;
}

.section-head,
.section-head-actions,
.ticket-group-head,
.ticket-summary-head,
.footer-grid,
.inline-controls,
.ticket-summary-meta,
.ticket-status-row,
.ticket-hero-meta,
.ticket-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-head,
.ticket-group-head,
.footer-grid,
.ticket-summary-head,
.ticket-status-row,
.ticket-hero-meta {
  justify-content: space-between;
}

.btn-compact {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.ticket-toolbar,
.ticket-groups,
.ticket-group,
.ticket-detail-wrap,
.reply-list,
.attachment-list,
.note-list,
.help-grid {
  display: grid;
  gap: 14px;
}

.ticket-filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(180px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

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

.ticket-pagination-label {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.ticket-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.ticket-separator::before,
.ticket-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.ticket-summary-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--surface-strong), var(--surface-soft));
  padding: 14px;
  cursor: pointer;
  transition: 
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.2s ease;
}

.ticket-summary-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
  transition: background 0.2s ease;
}

.ticket-summary-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ticket-summary-status-open::before {
  background: var(--brand-soft);
}

.ticket-summary-status-answered::before {
  background: rgba(37, 99, 235, 0.22);
}

.ticket-summary-status-in_progress::before {
  background: var(--warning-soft);
}

.ticket-summary-status-resolved::before {
  background: var(--success-soft);
}

.ticket-summary-status-closed::before {
  background: var(--danger-soft);
}

.ticket-summary-item-unread::before {
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
}

.ticket-summary-item-unread {
  border-color: rgba(17, 120, 168, 0.35);
}

.ticket-summary-title,
.ticket-group-head h3,
.side-card-title,
.footer-title {
  margin: 0;
}

.ticket-summary-title {
  font-size: 1rem;
}

.ticket-summary-preview {
  margin: 0;
  line-height: 1.9;
}

.meta-pill {
  color: var(--ink-soft);
}

.ticket-detail-wrap {
  margin-top: 6px;
}

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

.ticket-main-column {
  display: grid;
  gap: 14px;
}

.ticket-sidebar {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 104px;
}

.ticket-view-header,
.content-card,
.side-card {
  padding: 16px;
}

.ticket-view-header {
  display: grid;
  gap: 14px;
  background: linear-gradient(150deg, var(--surface-strong), var(--surface-soft));
}

.ticket-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ticket-hero-title {
  display: grid;
  gap: 8px;
}

.ticket-hero-title h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.ticket-hero-description {
  margin: 0;
  color: var(--ink-soft);
  line-height: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ticket-hero-meta {
  justify-content: flex-start;
}

.ticket-status-banner {
  padding: 8px 14px;
  border: 1px solid transparent;
}

.ticket-status-banner-open {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.ticket-status-banner-answered {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.ticket-status-banner-in_progress {
  background: var(--warning-soft);
  color: var(--warning);
}

.ticket-status-banner-resolved {
  background: var(--success-soft);
  color: var(--success);
}

.ticket-status-banner-closed {
  background: var(--danger-soft);
  color: var(--danger);
}

.ticket-hint-badge {
  padding: 8px 12px;
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ticket-meta-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.ticket-meta-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.side-nav-card {
  background: linear-gradient(180deg, var(--surface-soft), var(--surface));
}

.side-nav-link {
  justify-content: flex-start;
  border-radius: var(--radius-sm);
}

.side-danger {
  border-color: rgba(187, 63, 87, 0.22);
  background: linear-gradient(180deg, var(--danger-soft), var(--surface));
}

.reply-item,
.attachment-item,
.note-item,
.upload-summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 12px;
  transition: 
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.2s ease,
    background 0.25s ease;
}

.reply-item:hover,
.attachment-item:hover,
.note-item:hover,
.upload-summary-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.reply-item p,
.attachment-item p,
.note-item p,
.upload-summary-card p {
  margin: 0;
}

.reply-item p:first-child,
.note-item p:first-child {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.95;
  color: var(--ink);
}

.reply-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px !important;
}

.edited-indicator,
.reply-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  padding: 4px 8px;
}

.reply-edit-btn {
  cursor: pointer;
}

.reply-edit-btn:hover {
  color: var(--brand);
}

.atlasgpt-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.atlasgpt-reply-badge {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.atlasgpt-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 18, 30, 0.42);
  backdrop-filter: blur(8px);
}

.atlasgpt-panel {
  width: min(760px, 96vw);
  max-height: min(86vh, 820px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.atlasgpt-panel-head,
.atlasgpt-actions,
.atlasgpt-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.atlasgpt-panel h3,
.atlasgpt-panel p {
  margin: 0;
}

.atlasgpt-draft-preview,
.atlasgpt-empty,
.atlasgpt-feedback-box,
.atlas-visual-card,
.atlas-metric-card,
.atlas-generation-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 12px;
}

.atlasgpt-draft-preview p,
.atlas-generation-detail pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.95;
}

body[data-page="admin-atlasgpt"] .atlas-admin-panel {
  gap: 18px;
}

body[data-page="admin-atlasgpt"] .atlas-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

body[data-page="admin-atlasgpt"] .atlas-metric-card {
  min-height: 78px;
  padding: 14px;
  border-top: 0;
  border-inline-start: 3px solid var(--brand);
  background: var(--surface-strong);
}

body[data-page="admin-atlasgpt"] .atlas-metric-card strong {
  font-size: 1.18rem;
}

body[data-page="admin-atlasgpt"] .atlas-visual-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  background: var(--surface-strong);
}

body[data-page="admin-atlasgpt"] .atlas-recent-panel .section-head > div {
  display: grid;
  gap: 3px;
}

body[data-page="admin-atlasgpt"] .atlas-recent-panel .section-head p {
  margin: 0;
}

body[data-page="admin-atlasgpt"] .atlas-generation-item {
  padding: 0;
  overflow: hidden;
  background: var(--surface-strong);
}

body[data-page="admin-atlasgpt"] .atlas-generation-item summary {
  min-height: 54px;
  padding: 12px 14px;
}

body[data-page="admin-atlasgpt"] .atlas-generation-detail {
  margin: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

body[data-page="admin-atlasgpt"] .atlas-export-grid {
  align-items: start;
}

.atlas-agent-run-row {
  min-height: 48px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
}

@media (max-width: 720px) {
  .atlas-agent-run-row { grid-template-columns: 1fr auto; }
}

.atlasgpt-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink-soft);
}

.atlasgpt-feedback-box {
  display: grid;
  gap: 10px;
}

.atlasgpt-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.atlasgpt-float {
  position: fixed;
  z-index: 60;
  min-width: 136px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: grab;
  touch-action: none;
}

.atlasgpt-float:active {
  cursor: grabbing;
}

.atlas-admin-panel,
.atlas-generation-list,
.atlas-prompts-list {
  display: grid;
  gap: 12px;
}

.atlas-metric-grid,
.atlas-visual-grid,
.atlas-export-grid {
  display: grid;
  gap: 10px;
}

.atlas-metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.atlas-visual-grid,
.atlas-export-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.atlas-metric-card {
  display: grid;
  gap: 6px;
}

.atlas-metric-card span {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.atlas-metric-card strong {
  font-size: 1.1rem;
}

.atlas-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.atlas-checks {
  align-self: center;
}

.atlas-ratio-bar,
.atlas-progress {
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-muted);
  display: flex;
  align-items: stretch;
  position: relative;
}

.atlas-ratio-bar span,
.atlas-progress span {
  display: block;
  background: var(--success);
}

.atlas-ratio-bar .atlas-negative {
  background: var(--danger);
}

.atlas-ratio-bar .atlas-muted-bar {
  background: var(--warning);
}

.atlas-progress strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  color: var(--ink);
}

.atlas-generation-item {
  cursor: default;
}

.atlas-generation-item summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  list-style: none;
}

.atlas-generation-item summary::-webkit-details-marker {
  display: none;
}

.atlas-generation-detail {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.atlas-generation-detail h4 {
  margin: 0;
}

.atlas-generation-detail pre {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 10px;
  font-family: inherit;
}

.reply-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(17, 120, 168, 0.22);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
}

.reply-edit-banner span,
.reply-edit-cancel {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.reply-edit-cancel {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 7px 10px;
}

.reply-edit-cancel:hover {
  color: var(--danger);
  border-color: rgba(187, 63, 87, 0.3);
}

.attachment-preview {
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.attachment-preview img,
.attachment-preview video {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #111827;
}

.attachment-preview audio {
  display: block;
  width: 100%;
}

.upload-dropzone {
  position: relative;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface-soft), var(--surface));
  padding: 18px 16px;
  display: grid;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  transition: 
    transform 0.15s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.15s ease,
    background 0.2s ease,
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.upload-dropzone:hover,
.upload-dropzone.is-dragging {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: linear-gradient(180deg, var(--brand-soft), var(--surface));
  box-shadow: var(--shadow-sm);
}

.upload-dropzone-icon {
  font-size: 1.35rem;
  color: var(--brand);
}

.upload-dropzone-title {
  font-weight: 700;
}

.upload-dropzone-hint,
.upload-meta,
.file-preview-meta span {
  color: var(--ink-soft);
  font-size: 0.87rem;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-preview img,
.file-preview-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.file-preview img {
  object-fit: cover;
}

.file-preview-icon {
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-strong);
  font-size: 1.2rem;
}

.file-preview-meta {
  display: grid;
  gap: 4px;
}

.file-preview-meta strong,
.upload-summary-card strong {
  color: var(--ink);
}

.upload-progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.upload-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.upload-guidelines {
  margin: 0;
  padding-right: 18px;
  color: var(--ink-soft);
  line-height: 1.9;
  font-size: 0.88rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.users-table-wrap {
  max-height: min(68vh, 720px);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-strong);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.help-grid {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.help-card {
  padding: 20px;
}

.help-card ul {
  margin: 0;
  padding-right: 18px;
  line-height: 2;
}

.error-card {
  padding: 28px;
}

.site-footer {
  width: min(1200px, 94vw);
  margin: 0 auto 24px;
  padding: 16px 18px;
}

.footer-brand {
  display: grid;
  gap: 6px;
}

.footer-title {
  font-weight: 800;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-copy {
  margin: 12px 0 0;
  font-size: 0.86rem;
}

.theme-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 40;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.25s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px) rotate(8deg);
  box-shadow: var(--shadow-lg);
}

.theme-toggle .fa-sun {
  display: none;
}

body[data-theme="dark"] .theme-toggle .fa-sun {
  display: inline-block;
}

body[data-theme="dark"] .theme-toggle .fa-moon {
  display: none;
}

.reveal,
.ticket-summary-item,
.help-card,
.panel,
.content-card,
.side-card,
.reply-item,
.attachment-item,
.note-item {
  animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.reveal:nth-child(2),
.ticket-summary-item:nth-child(2),
.help-card:nth-child(2),
.reply-item:nth-child(2),
.attachment-item:nth-child(2),
.note-item:nth-child(2) {
  animation-delay: 50ms;
}

.reveal:nth-child(3),
.ticket-summary-item:nth-child(3),
.help-card:nth-child(3),
.reply-item:nth-child(3),
.attachment-item:nth-child(3),
.note-item:nth-child(3) {
  animation-delay: 100ms;
}

.reveal:nth-child(4),
.ticket-summary-item:nth-child(4),
.help-card:nth-child(4),
.reply-item:nth-child(4),
.attachment-item:nth-child(4),
.note-item:nth-child(4) {
  animation-delay: 150ms;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-subtle {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.ticket-unread-badge {
  animation: pulse-subtle 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1040px) {
  .dashboard-layout,
  .ticket-layout,
  .help-grid,
  .atlas-metric-grid,
  .atlas-visual-grid,
  .atlas-export-grid {
    grid-template-columns: 1fr;
  }

  .panel-form,
  .ticket-sidebar,
  .top-bar {
    position: static;
  }

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

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

@media (max-width: 700px) {
  .page-shell,
  .site-footer {
    width: min(96vw, 100%);
  }

  .surface-grid,
  .ticket-filters,
  .ticket-meta-grid,
  .atlas-filter-grid {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .section-head-actions,
  .ticket-pagination,
  .footer-links,
  .ticket-page-actions {
    width: 100%;
  }

  .btn,
  .footer-button,
  .footer-links a {
    width: 100%;
  }

  .ticket-hero-head,
  .ticket-summary-head,
  .footer-grid {
    align-items: flex-start;
  }

  .file-preview {
    flex-direction: column;
    align-items: flex-start;
  }

  .theme-toggle {
    left: 14px;
    bottom: 14px;
    width: 48px;
    height: 48px;
  }
}

/* TicketPanel interface refresh */
:root {
  --bg: #f3f5f6;
  --bg-accent: transparent;
  --bg-accent-soft: transparent;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #f7f9fa;
  --surface-muted: #edf1f2;
  --ink: #182023;
  --ink-soft: #566267;
  --ink-faint: #7b878c;
  --line: #dfe5e7;
  --line-strong: #c8d1d4;
  --brand: #087f8c;
  --brand-strong: #05636d;
  --brand-soft: #e4f4f5;
  --success: #18794e;
  --success-soft: #e8f6ef;
  --warning: #a65f00;
  --warning-soft: #fff3dc;
  --danger: #b4233c;
  --danger-soft: #fdecef;
  --focus: #ffcf33;
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 5px;
  --shadow-sm: 0 1px 2px rgba(24, 32, 35, 0.06);
  --shadow-md: 0 8px 24px rgba(24, 32, 35, 0.09);
  --shadow-lg: 0 18px 50px rgba(24, 32, 35, 0.16);
  --transition-fast: 140ms ease;
  --transition-normal: 220ms ease;
}

body[data-theme="dark"] {
  --bg: #111516;
  --surface: #181d1f;
  --surface-strong: #1c2224;
  --surface-soft: #22292b;
  --surface-muted: #2a3235;
  --ink: #f0f3f3;
  --ink-soft: #b7c0c2;
  --ink-faint: #899598;
  --line: #303a3d;
  --line-strong: #465255;
  --brand: #46bdc5;
  --brand-strong: #82d6db;
  --brand-soft: #17393c;
  --success: #66cc99;
  --success-soft: #18382b;
  --warning: #f1b75a;
  --warning-soft: #3a2d18;
  --danger: #ff8195;
  --danger-soft: #3f2027;
  --focus: #ffd84d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.4);
}

html {
  scroll-padding-top: 96px;
}

body {
  min-width: 320px;
  background: var(--bg);
  letter-spacing: 0;
}

.hero-block,
.panel,
.help-card,
.error-card,
.site-footer,
.top-bar,
.content-card,
.side-card,
.ticket-summary-item,
.ticket-view-header {
  backdrop-filter: none;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 16px auto 36px;
  animation: page-enter 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-header {
  position: sticky;
  top: 10px;
  z-index: 50;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
}

.app-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.app-brand-mark,
.page-heading-icon,
.panel-heading-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
}

.app-brand-mark {
  width: 42px;
  height: 42px;
  font-size: 1.05rem;
}

.app-brand-copy {
  display: grid;
  line-height: 1.45;
}

.app-brand-copy strong {
  font-size: 0.94rem;
}

.app-brand-copy small {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.app-nav-panel {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.app-nav a {
  position: relative;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 5px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 500;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.app-nav a:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.app-nav a[aria-current="page"] {
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-weight: 700;
}

.app-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 10px;
  left: 10px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.app-nav-toggle {
  display: none;
}

.app-header .top-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.app-account {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding-inline-start: 10px;
  border-inline-start: 1px solid var(--line);
}

.app-account-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--brand-strong);
  font-weight: 700;
}

.app-account > span:last-child {
  min-width: 0;
  display: grid;
  line-height: 1.5;
}

.app-account strong {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.app-account small {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.icon-btn:hover {
  color: var(--brand-strong);
  border-color: var(--line-strong);
  background: var(--surface-muted);
  transform: translateY(-1px);
}

.icon-btn-danger:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 38%, var(--line));
  background: var(--danger-soft);
}

.page-heading {
  min-height: 118px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 24px 4px 18px;
}

.page-heading-icon {
  width: 48px;
  height: 48px;
  background: var(--ink);
}

.page-heading h1 {
  margin: 1px 0 4px;
  font-size: clamp(1.32rem, 2vw, 1.72rem);
  line-height: 1.5;
}

.page-heading p {
  margin: 0;
  color: var(--ink-soft);
}

.page-heading .page-kicker {
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 700;
}

.page-heading-action {
  margin-inline-start: auto;
}

.panel,
.help-card,
.error-card,
.content-card,
.side-card,
.ticket-view-header {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel:hover,
.help-card:hover,
.content-card:hover,
.side-card:hover,
.ticket-view-header:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.panel-heading-icon {
  width: 38px;
  height: 38px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.panel-heading h2,
.panel-heading p,
.section-head h2,
.section-head p {
  margin: 0;
}

.panel-heading h2,
.section-head h2 {
  font-size: 1.04rem;
}

.panel-heading p,
.section-head p {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.79rem;
}

.dashboard-layout {
  margin-top: 0;
  grid-template-columns: minmax(300px, 350px) minmax(0, 1fr);
  gap: 16px;
}

.panel-form {
  top: 88px;
}

.field {
  margin-bottom: 15px;
}

.field label,
.ticket-filter-field > span {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

input,
textarea,
select {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 rgba(24, 32, 35, 0.02);
}

textarea {
  min-height: 126px;
}

input:hover,
textarea:hover,
select:hover {
  border-color: color-mix(in srgb, var(--ink-soft) 55%, var(--line));
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--focus);
}

.btn,
.footer-button,
.footer-links a,
.side-nav-link {
  min-height: 44px;
  border-radius: 6px;
  padding: 9px 15px;
  font-weight: 600;
  box-shadow: none;
}

.btn:hover,
.footer-button:hover,
.footer-links a:hover,
.side-nav-link:hover {
  transform: translateY(-1px);
  box-shadow: none;
}

.btn:active,
.footer-button:active,
.footer-links a:active,
.side-nav-link:active {
  transform: translateY(0);
}

.btn-primary {
  color: #ffffff;
  background: var(--brand);
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--brand-strong);
}

.btn-soft,
.footer-button,
.footer-links a,
.side-nav-link {
  background: var(--surface-soft);
  border-color: var(--line);
}

.btn-danger {
  background: var(--danger);
  box-shadow: none;
}

.btn-compact {
  min-height: 40px;
  padding: 7px 11px;
  font-size: 0.82rem;
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.message-area {
  position: sticky;
  top: 86px;
  z-index: 45;
  min-height: 0;
  margin: 0 0 10px;
}

.success-text,
.error-text {
  border: 1px solid currentColor;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
}

.section-head {
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.chip,
.counter,
.meta-pill,
.ticket-unread-badge,
.ticket-status-banner,
.ticket-hint-badge {
  border-radius: 4px;
}

.chip {
  padding: 6px 9px;
  font-size: 0.75rem;
}

.realtime-chip {
  min-width: 72px;
  justify-content: flex-start;
}

.realtime-chip-connected {
  color: var(--success);
  background: var(--success-soft);
}

.realtime-chip-connecting {
  color: var(--warning);
  background: var(--warning-soft);
}

.realtime-chip-disconnected,
.realtime-chip-expired {
  color: var(--danger);
  background: var(--danger-soft);
}

.realtime-chip-offline {
  color: var(--ink-soft);
  background: var(--surface-muted);
}

.realtime-chip-connecting .fa-circle {
  animation: realtime-pulse 1.1s ease-in-out infinite;
}

.ticket-toolbar {
  gap: 12px;
  margin-bottom: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.ticket-filters {
  grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(150px, 1fr)) auto;
}

.ticket-group {
  gap: 8px;
}

.ticket-group-head {
  min-height: 38px;
  padding-inline: 2px;
}

.ticket-group-head h3 {
  font-size: 0.92rem;
}

.ticket-summary-list {
  display: grid;
  gap: 7px;
}

.ticket-summary-item {
  border-radius: 6px;
  background: var(--surface-strong);
  padding: 0;
  box-shadow: none;
}

.ticket-summary-item > a {
  display: block;
  padding: 13px 14px;
}

.ticket-summary-item::before {
  right: 0;
  left: auto;
  width: 3px;
}

.ticket-summary-item:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 5px 14px rgba(24, 32, 35, 0.07);
}

.ticket-summary-title {
  font-size: 0.94rem;
}

.ticket-summary-preview {
  margin: 5px 0 9px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 0.82rem;
  line-height: 1.8;
}

.ticket-summary-meta {
  gap: 6px;
}

.meta-pill {
  padding: 4px 7px;
  border: 0;
  background: var(--surface-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.ticket-separator {
  margin-block: 7px 2px;
}

.ticket-separator::before,
.ticket-separator::after {
  background: var(--line);
}

.ticket-pagination {
  padding-top: 2px;
}

.ticket-detail-surface {
  min-height: 320px;
}

.ticket-detail-wrap {
  margin: 0;
}

.ticket-layout {
  grid-template-columns: minmax(0, 1fr) minmax(290px, 330px);
  gap: 16px;
}

.ticket-main-column,
.ticket-sidebar {
  gap: 12px;
}

.ticket-sidebar {
  top: 88px;
  gap: 16px;
}

.ticket-sidebar > *,
#staff-test-slot,
#atlasgpt-agent-slot {
  min-width: 0;
  margin: 0;
}

#staff-test-slot,
#atlasgpt-agent-slot {
  display: grid;
  gap: 0;
}

.atlas-agent-working {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--brand) 38%, var(--line));
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.08);
}

.atlas-agent-working::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: var(--brand);
  transform-origin: right;
  animation: atlas-agent-progress 1.6s ease-in-out infinite;
}

.atlas-agent-working-head,
.atlas-agent-thinking {
  display: flex;
  align-items: center;
  gap: 11px;
}

.atlas-agent-working-head p,
.atlas-agent-thinking span {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.65;
}

.atlas-agent-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  animation: atlas-agent-pulse 1.8s ease-in-out infinite;
}

.atlas-agent-thinking {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.atlas-agent-thinking img {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  opacity: 0.78;
}

body[data-theme="dark"] .atlas-agent-thinking img {
  filter: invert(1);
}

@keyframes atlas-agent-progress {
  0%, 100% { transform: scaleX(0.15); opacity: 0.45; }
  50% { transform: scaleX(1); opacity: 1; }
}

@keyframes atlas-agent-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 7px rgba(37, 99, 235, 0.08); }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-agent-working::after,
  .atlas-agent-mark { animation: none; }
}

.ticket-view-header,
.content-card,
.side-card {
  padding: 17px;
}

.ticket-view-header {
  background: var(--surface);
}

.ticket-hero-title h2 {
  font-size: clamp(1.12rem, 2vw, 1.42rem);
}

.ticket-status-banner,
.ticket-hint-badge {
  padding: 6px 9px;
}

.ticket-meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ticket-meta-item {
  border-radius: 5px;
  background: var(--surface-soft);
}

.content-card > h3,
.side-card-title {
  margin: 0 0 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}

.reply-list {
  gap: 9px;
}

.reply-item,
.attachment-item,
.note-item,
.upload-summary-card {
  border-radius: 6px;
  background: var(--surface-soft);
}

.reply-item:hover,
.attachment-item:hover,
.note-item:hover,
.upload-summary-card:hover {
  transform: none;
}

.reply-item {
  position: relative;
  padding: 14px;
  border-inline-start: 3px solid var(--line-strong);
}

.reply-item p:first-child,
.note-item p:first-child {
  font-size: 0.9rem;
  line-height: 2;
}

.side-nav-card {
  background: var(--surface);
}

.side-nav-link {
  min-height: 40px;
  margin-top: 4px;
}

.side-danger {
  background: var(--danger-soft);
}

.upload-dropzone {
  border-radius: 6px;
  background: var(--surface-soft);
}

.atlasgpt-modal-backdrop {
  background: rgba(8, 13, 15, 0.62);
  backdrop-filter: blur(5px);
  animation: modal-fade-in 160ms ease both;
}

.atlasgpt-panel {
  border-radius: 8px;
  padding: 18px;
  animation: modal-enter 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.atlasgpt-draft-preview,
.atlasgpt-empty,
.atlasgpt-feedback-box,
.atlas-visual-card,
.atlas-metric-card,
.atlas-generation-item {
  border-radius: 6px;
}

.atlasgpt-float {
  min-height: 46px;
  border-radius: 7px;
}

.atlas-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.atlas-metric-card {
  min-height: 86px;
  align-content: center;
  border-top: 3px solid var(--brand);
}

.atlas-visual-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.atlas-filter-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.atlas-ratio-bar,
.atlas-progress {
  border-radius: 4px;
}

.table-wrap {
  border-radius: 6px;
  border: 1px solid var(--line);
}

table {
  border-collapse: collapse;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 0.78rem;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

tbody tr:hover {
  background: var(--surface-soft);
}

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

.help-card {
  padding: 18px;
}

.help-card h2 {
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
}

.site-footer {
  width: min(1440px, calc(100% - 32px));
  margin: 20px auto 16px;
  border-radius: 8px;
  box-shadow: none;
}

.theme-toggle {
  width: 46px;
  height: 46px;
  border-radius: 7px;
}

.skeleton-stack {
  display: grid;
  gap: 12px;
}

.skeleton-stack span {
  min-height: 110px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  animation: skeleton-pulse 1.4s ease-in-out infinite alternate;
}

.skeleton-stack span:nth-child(2) {
  min-height: 230px;
  animation-delay: 120ms;
}

.skeleton-stack span:nth-child(3) {
  min-height: 150px;
  animation-delay: 240ms;
}

.auth-shell {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  color: #f4f7f7;
  background: #111718;
}

.auth-product-preview {
  position: absolute;
  z-index: -1;
  inset: clamp(26px, 6vw, 80px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: #172022;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  opacity: 0.5;
  transform: perspective(1200px) rotateX(3deg) scale(1.03);
}

.auth-product-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 16, 0.56);
}

.auth-preview-bar {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-preview-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4cb9c1;
}

.auth-preview-bar span:nth-child(2) {
  background: #e3ad55;
}

.auth-preview-bar span:nth-child(3) {
  background: #d9687c;
}

.auth-preview-layout {
  min-height: calc(100% - 62px);
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.auth-preview-side {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 28px 22px;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-preview-side span,
.auth-preview-heading,
.auth-preview-ticket {
  display: block;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
}

.auth-preview-side span {
  height: 42px;
}

.auth-preview-main {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 38px;
}

.auth-preview-heading {
  width: 36%;
  height: 34px;
  margin-bottom: 8px;
  background: rgba(76, 185, 193, 0.28);
}

.auth-preview-ticket {
  height: 104px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-content {
  width: min(620px, 100%);
  display: grid;
  justify-items: center;
  text-align: center;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 20px;
  color: #c3d0d2;
  font-size: 0.86rem;
}

.auth-brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #ffffff;
  background: #087f8c;
}

.auth-content h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 5.6rem);
  line-height: 1.25;
  color: #ffffff;
}

.auth-content > p:not(.auth-brand) {
  max-width: 540px;
  margin: 16px 0 26px;
  color: #c3d0d2;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 2;
}

.auth-login-btn {
  min-width: 220px;
}

.auth-content small {
  margin-top: 16px;
  color: #9fadaf;
}

@keyframes realtime-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes skeleton-pulse {
  from { opacity: 0.48; }
  to { opacity: 0.9; }
}

@media (max-width: 1120px) {
  .app-brand-copy {
    display: none;
  }

  .app-header {
    gap: 12px;
  }

  .app-nav-panel {
    gap: 10px;
  }

  .app-nav a span {
    display: none;
  }

  .app-nav a {
    width: 42px;
    justify-content: center;
    padding: 8px;
  }

  .app-account > span:last-child {
    display: none;
  }

  .app-account {
    padding-inline-start: 8px;
  }

  .atlas-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .atlas-filter-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

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

  .panel-form,
  .ticket-sidebar,
  .top-bar {
    position: static;
  }

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

  .side-nav-card,
  .side-danger {
    grid-column: 1 / -1;
  }

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

  .atlas-metric-grid,
  .atlas-visual-grid,
  .atlas-export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1440px);
    margin-top: 10px;
  }

  .app-header {
    top: 6px;
    min-height: 60px;
    padding: 8px;
  }

  .app-brand-copy {
    display: grid;
  }

  .app-brand {
    margin-inline-end: auto;
  }

  .app-nav-toggle {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
    color: var(--ink);
  }

  .app-nav-panel {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-7px);
    pointer-events: none;
  }

  .app-nav-open .app-nav-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .app-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .app-nav a {
    width: auto;
    justify-content: flex-start;
    padding-inline: 12px;
  }

  .app-nav a span {
    display: inline;
  }

  .app-header .top-actions {
    justify-content: space-between;
    padding-top: 9px;
    border-top: 1px solid var(--line);
  }

  .app-account > span:last-child {
    display: grid;
  }

  .page-heading {
    min-height: 102px;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 20px 2px 14px;
  }

  .page-heading-icon {
    width: 42px;
    height: 42px;
  }

  .page-heading-action {
    width: 100%;
    margin: 4px 0 0;
  }

  .page-heading-action .btn {
    width: 100%;
  }

  .section-head,
  .section-head-actions {
    align-items: stretch;
  }

  .section-head-actions {
    width: 100%;
  }

  .ticket-filters,
  .atlas-filter-grid,
  .atlas-metric-grid,
  .atlas-visual-grid,
  .atlas-export-grid,
  .help-grid,
  .ticket-sidebar,
  .ticket-meta-grid {
    grid-template-columns: 1fr;
  }

  .side-nav-card,
  .side-danger {
    grid-column: auto;
  }

  .ticket-toolbar {
    padding: 10px;
  }

  .ticket-pagination {
    justify-content: center;
  }

  .ticket-summary-item > a {
    padding: 12px;
  }

  .ticket-summary-meta .meta-pill:nth-last-child(-n + 2) {
    display: none;
  }

  .panel,
  .ticket-view-header,
  .content-card,
  .side-card,
  .help-card {
    padding: 14px;
  }

  .site-footer {
    width: min(100% - 20px, 1440px);
  }

  .auth-shell {
    padding: 20px;
  }

  .auth-product-preview {
    inset: 18px;
  }

  .auth-preview-layout {
    grid-template-columns: 1fr;
  }

  .auth-preview-side {
    display: none;
  }

  .auth-preview-main {
    padding: 24px;
  }

  .auth-content h1 {
    font-size: clamp(2.5rem, 16vw, 4.2rem);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .app-nav-panel {
    transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
  }

  .reveal {
    animation: content-enter 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}

.theme-toggle-inline {
  position: static;
  inset: auto;
  z-index: auto;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 6px;
  box-shadow: none;
}

.theme-toggle-inline:hover {
  transform: none;
  box-shadow: none;
}

.email-setup-notice {
  margin: 10px 0 0;
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--line));
  border-inline-start: 3px solid var(--warning);
  border-radius: 6px;
  background: var(--warning-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-setup-notice p {
  flex: 1;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.75;
}

.email-setup-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--warning);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-notice {
  min-height: 48px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--brand);
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--ink-soft);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  font-size: 0.9rem;
  line-height: 1.8;
}

.form-notice i {
  color: var(--brand-strong);
  margin-top: 5px;
}

@media (min-width: 721px) and (max-width: 1120px) {
  .ticket-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .email-setup-notice {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .email-setup-notice p {
    flex-basis: calc(100% - 44px);
  }

  .email-setup-notice .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes content-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
