@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@500;600;700;800&family=Inter:wght@400;450;500;550;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== THEME TOKENS ===== */
:root, [data-theme="dark"] {
  --font-heading: 'Raleway', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --ink: #f5f5f4;
  --ink-secondary: #a8a29e;
  --ink-tertiary: #78716c;
  --ink-muted: #57534e;
  --ink-dim: #44403c;

  --canvas: #0c0a09;
  --canvas-dot: rgba(255,255,255,0.03);
  --surface: rgba(28, 25, 23, 0.6);
  --surface-raised: rgba(41, 37, 36, 0.5);
  --surface-input: rgba(12, 10, 9, 0.7);
  --surface-hover: rgba(255,255,255,0.04);
  --surface-glass: rgba(28, 25, 23, 0.4);

  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.2);
  --border-focus: #f9a8d4;

  --accent: #f9a8d4;
  --accent-bg: rgba(249, 168, 212, 0.1);
  --accent-glow: rgba(249, 168, 212, 0.15);

  --accent-purple: #d8b4fe;
  --accent-purple-bg: rgba(216, 180, 254, 0.08);
  --accent-blue: #93c5fd;
  --accent-blue-bg: rgba(147, 197, 253, 0.08);
  --accent-orange: #fdba74;
  --accent-orange-bg: rgba(253, 186, 116, 0.08);

  --success: #86efac;
  --warning: #fde68a;
  --danger: #fca5a5;
  --success-bg: rgba(134, 239, 172, 0.1);
  --warning-bg: rgba(253, 230, 138, 0.1);
  --danger-bg: rgba(252, 165, 165, 0.1);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --ink: #1c1917;
  --ink-secondary: #57534e;
  --ink-tertiary: #78716c;
  --ink-muted: #a8a29e;
  --ink-dim: #d6d3d1;

  --canvas: #fafaf9;
  --canvas-dot: rgba(0,0,0,0.04);
  --surface: rgba(255, 255, 255, 0.7);
  --surface-raised: rgba(255, 255, 255, 0.85);
  --surface-input: rgba(245, 245, 244, 0.8);
  --surface-hover: rgba(0,0,0,0.03);
  --surface-glass: rgba(255, 255, 255, 0.6);

  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.2);
  --border-focus: #f472b6;

  --accent: #f472b6;
  --accent-bg: rgba(244, 114, 182, 0.08);
  --accent-glow: rgba(244, 114, 182, 0.12);

  --accent-purple: #a78bfa;
  --accent-purple-bg: rgba(167, 139, 250, 0.08);
  --accent-blue: #60a5fa;
  --accent-blue-bg: rgba(96, 165, 250, 0.08);
  --accent-orange: #fb923c;
  --accent-orange-bg: rgba(251, 146, 60, 0.08);

  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --success-bg: rgba(34, 197, 94, 0.08);
  --warning-bg: rgba(234, 179, 8, 0.08);
  --danger-bg: rgba(239, 68, 68, 0.08);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.1);
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  background-image:
    radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 20px 20px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }

::selection { background: var(--accent-bg); color: var(--ink); }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-glow);
  border-radius: 6px;
}

/* ===== TYPE ===== */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; color: var(--ink); text-wrap: balance; }
h1 { font-size: 22px; letter-spacing: -0.3px; }
h2 { font-size: 17px; letter-spacing: -0.2px; }
h3 { font-size: 15px; }
h4 { font-size: 14px; }

.text-primary { color: var(--ink); font-weight: 500; }
.text-secondary { color: var(--ink-secondary); font-weight: 450; }
.text-tertiary { color: var(--ink-tertiary); font-size: 13px; }
.text-muted { color: var(--ink-muted); font-size: 12px; }
.text-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-caption { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; color: var(--ink-tertiary); }

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill, 999px);
  border: 1px dotted var(--border);
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all var(--duration-fast, 150ms) var(--ease-out, cubic-bezier(0.23,1,0.32,1));
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--ink);
  background: var(--surface-hover);
}
[data-theme="dark"] .theme-toggle__sun { display: none; }
[data-theme="light"] .theme-toggle__moon { display: none; }

/* ===== PAGE CENTER ===== */
.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* ===== AUTH ===== */
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px dotted var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-card__brand { text-align: center; margin-bottom: 28px; }

.auth-card__brand .shield-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #f9a8d4 0%, #fdba74 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(249, 168, 212, 0.3);
}

[data-theme="light"] .auth-card__brand .shield-logo {
  box-shadow: 0 4px 24px rgba(244, 114, 182, 0.2);
}

.auth-card__brand h1 {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
  font-family: var(--font-heading);
}

.auth-card__brand p { font-size: 13px; color: var(--ink-tertiary); margin-top: 3px; }
.auth-card__footer { text-align: center; margin-top: 8px; padding-top: 16px; border-top: 1px dotted var(--border); }
.auth-card__footer a { font-size: 13px; color: var(--ink-tertiary); font-weight: 500; transition: color 150ms cubic-bezier(0.23,1,0.32,1); }
.auth-card__footer a:hover { color: var(--accent); }

.auth-divider {
  display: flex; align-items: center; gap: 16px;
  color: var(--ink-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.telegram-login { display: flex; justify-content: center; }

/* ===== FORM ===== */
.form { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.form__group { display: flex; flex-direction: column; gap: 5px; }

.form__group label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-tertiary);
  letter-spacing: 0.3px; text-transform: uppercase;
}

.form__group input, .form__group select, .form__group textarea {
  width: 100%; padding: 11px 14px;
  background: var(--surface-input);
  border: 1px dotted var(--border);
  border-radius: 10px;
  color: var(--ink); font-size: 14px; font-family: inherit;
  outline: none; backdrop-filter: blur(4px);
  transition: border-color 150ms cubic-bezier(0.23,1,0.32,1), box-shadow 150ms cubic-bezier(0.23,1,0.32,1);
}
.form__group input::placeholder { color: var(--ink-muted); }
.form__group input:hover, .form__group select:hover, .form__group textarea:hover { border-color: var(--border-hover); }
.form__group input:focus, .form__group select:focus, .form__group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form__hint { font-size: 12px; color: var(--ink-tertiary); line-height: 1.4; margin-top: 2px; }

.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap::after {
  content: ''; position: absolute; right: 14px; top: 50%;
  width: 8px; height: 8px;
  border: 2px solid var(--ink-tertiary); border-top: none; border-left: none;
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}

.form__role-preview { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.role-option { cursor: pointer; }
.role-option input { display: none; }

.role-option__card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px;
  background: var(--surface-raised);
  border: 1px dotted var(--border);
  border-radius: 10px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-tertiary);
  transition: all 250ms cubic-bezier(0.23,1,0.32,1);
  text-align: center;
  backdrop-filter: blur(4px);
}
.role-option:hover .role-option__card { border-color: var(--border-hover); color: var(--ink-secondary); }
.role-option input:checked + .role-option__card, .role-option--selected .role-option__card {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ===== ALERTS ===== */
.alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  border: 1px dotted var(--border);
  animation: slideDown 0.25s cubic-bezier(0.23,1,0.32,1);
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.alert--error { background: var(--danger-bg); color: var(--danger); }
.alert--success { background: var(--success-bg); color: var(--success); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px; font-weight: 550;
  font-family: var(--font-sans);
  border: 1px dotted var(--border);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  min-height: 40px;
  background: transparent;
  color: var(--ink-secondary);
  transition: all 250ms cubic-bezier(0.215,0.61,0.355,1);
}
.btn:hover { border-color: var(--border-hover); color: var(--ink); background: var(--surface-hover); }
.btn:active { transform: scale(0.96); }

.btn--primary {
  background: linear-gradient(135deg, #f9a8d4 0%, #fdba74 100%);
  color: #1c1917;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 16px rgba(249, 168, 212, 0.25);
}
.btn--primary:hover {
  box-shadow: 0 4px 24px rgba(249, 168, 212, 0.4);
  transform: translateY(-1px);
  color: #1c1917;
}

[data-theme="light"] .btn--primary {
  background: linear-gradient(135deg, #f472b6 0%, #fb923c 100%);
  color: #fff;
  box-shadow: 0 2px 16px rgba(244, 114, 182, 0.25);
}
[data-theme="light"] .btn--primary:hover { color: #fff; }

.btn--success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.btn--success:hover { opacity: 0.85; color: var(--success); }
.btn--danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn--danger:hover { opacity: 0.85; color: var(--danger); }

.btn--icon {
  width: 36px; height: 36px; padding: 0; min-height: auto;
  border-radius: 999px;
  background: transparent; color: var(--ink-tertiary);
}
.btn--icon:hover { color: var(--danger); background: var(--danger-bg); }

.btn--full { width: 100%; }
.btn--sm { padding: 6px 14px; font-size: 12px; min-height: 32px; }
.btn--xs { padding: 4px 10px; font-size: 11px; min-height: 26px; }
.btn--back { margin-bottom: 20px; align-self: flex-start; }

/* ===== BADGE ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  border: 1px dotted var(--border);
}
.badge--active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.badge--inactive { background: var(--surface-raised); color: var(--ink-tertiary); }

/* ===== TOGGLE ===== */
.toggle-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle__slider {
  position: absolute; inset: 0;
  background: var(--surface-raised);
  border: 1px dotted var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 150ms cubic-bezier(0.23,1,0.32,1);
}
.toggle__slider::before {
  content: ''; position: absolute;
  width: 17px; height: 17px; left: 2.5px; bottom: 2.5px;
  background: var(--ink-secondary);
  border-radius: 50%;
  transition: transform 150ms cubic-bezier(0.23,1,0.32,1);
}
.toggle input:checked + .toggle__slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle__slider::before { transform: translateX(20px); background: #fff; }
.toggle__label { font-size: 13px; color: var(--ink-secondary); font-weight: 500; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px dotted var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 11px 14px; text-align: left; }
.table th {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--ink-tertiary); background: var(--surface-raised); border-bottom: 1px dotted var(--border);
}
.table td { border-bottom: 1px dotted var(--border); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 150ms cubic-bezier(0.23,1,0.32,1); }
.table tbody tr:hover { background: var(--surface-hover); }
.table__id { font-family: var(--font-mono); font-size: 12px; color: var(--ink-tertiary); font-variant-numeric: tabular-nums; }
.table__username { font-weight: 550; color: var(--ink); }
.table__date { font-size: 12px; color: var(--ink-tertiary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table__th-actions { width: 40px; }

/* ===== ROLE BADGE ===== */
.role-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 550;
  border: 1px dotted var(--border);
}
.role-badge--creator { background: var(--accent-bg); color: var(--accent); }
.role-badge--admin { background: var(--accent-purple-bg); color: var(--accent-purple); }
.role-badge--agent { background: var(--success-bg); color: var(--success); }
.role-badge--developer { background: var(--accent-orange-bg); color: var(--accent-orange); }

/* ===== MAINTENANCE ===== */
.maintenance { text-align: center; max-width: 440px; width: 100%; padding: 48px 24px; margin: auto; animation: fadeInUp 0.5s cubic-bezier(0.23,1,0.32,1); }
.maintenance__icon { margin-bottom: 24px; display: inline-block; }
.maintenance__title { font-size: 26px; font-weight: 700; color: var(--ink); margin-bottom: 10px; line-height: 1.2; letter-spacing: -0.3px; font-family: var(--font-heading); }
.maintenance__text { font-size: 14px; color: var(--ink-secondary); margin-bottom: 32px; line-height: 1.6; }
.maintenance__loader { display: flex; justify-content: center; gap: 10px; margin-bottom: 28px; }
.maintenance__loader span { width: 10px; height: 10px; background: var(--accent); border-radius: 50%; animation: bounce 1.4s ease-in-out infinite both; }
.maintenance__loader span:nth-child(1) { animation-delay: -0.32s; }
.maintenance__loader span:nth-child(2) { animation-delay: -0.16s; }
.maintenance__loader span:nth-child(3) { animation-delay: 0s; }
@keyframes bounce { 0%,80%,100% { transform:scale(0);opacity:0.2 } 40% { transform:scale(1);opacity:1 } }
.maintenance__login {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, #f9a8d4 0%, #fdba74 100%);
  color: #1c1917; border-radius: 999px; font-weight: 600; font-size: 14px; border: none;
  box-shadow: 0 2px 16px rgba(249,168,212,0.25);
  transition: box-shadow 250ms cubic-bezier(0.215,0.61,0.355,1), transform 250ms cubic-bezier(0.215,0.61,0.355,1);
}
[data-theme="light"] .maintenance__login { background: linear-gradient(135deg, #f472b6 0%, #fb923c 100%); color: #fff; }
.maintenance__login:hover { box-shadow: 0 4px 24px rgba(249,168,212,0.4); transform: translateY(-1px); }

/* ===== FOOTER ===== */
.footer { text-align: center; font-size: 12px; color: var(--ink-muted); padding: 16px 24px 24px; }
.footer a { color: var(--ink-tertiary); font-weight: 500; transition: color 150ms cubic-bezier(0.23,1,0.32,1); }
.footer a:hover { color: var(--accent); }

/* ===== CLIENT PAGE ===== */
.client-page { min-height: 100vh; }

/* ===== TOPBAR ===== */
.topbar-client {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px dotted var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-client__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); font-size: 15px; }
.topbar-client__right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.topbar-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-secondary); font-size: 13px; font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px dotted var(--border);
  transition: all 150ms cubic-bezier(0.23,1,0.32,1);
}
.topbar-link:hover { color: var(--ink); border-color: var(--border-hover); background: var(--surface-hover); }
.topbar-link--admin { border-color: var(--accent-purple); color: var(--accent-purple); }
.topbar-link--admin:hover { border-color: var(--accent-purple); color: var(--ink); background: var(--accent-purple-bg); }

.profile-link-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-tertiary); font-size: 13px; transition: color 150ms cubic-bezier(0.23,1,0.32,1); }
.profile-link-back:hover { color: var(--ink); }

.impersonate select {
  background: var(--surface-raised); color: var(--ink);
  border: 1px dotted var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-family: inherit;
  cursor: pointer; outline: none;
}

.profile-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-raised);
  border: 1px dotted var(--border);
  border-radius: 999px; padding: 3px 6px 3px 3px;
  max-width: 220px; flex-shrink: 0;
  backdrop-filter: blur(4px);
}
.profile-pill__avatar {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
  background: linear-gradient(135deg, #f9a8d4, #fdba74);
  color: #1c1917;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.profile-pill__avatar--img { background-size: cover; background-position: center; text-indent: -9999px; }
.profile-pill__info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.profile-pill__name { font-size: 13px; font-weight: 550; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-pill__role { font-size: 11px; color: var(--ink-tertiary); }
.profile-pill__logout { color: var(--ink-tertiary); display: inline-flex; padding: 6px; border-radius: 50%; transition: all 150ms cubic-bezier(0.23,1,0.32,1); }
.profile-pill__logout:hover { color: var(--danger); background: var(--danger-bg); }

.maint-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  color: var(--warning); background: var(--warning-bg);
  border: 1px dotted var(--border); border-radius: 999px; padding: 4px 10px;
}
.maint-toggle { margin: 0; }

/* ===== VERIFICATION ===== */
.verified-check { color: var(--accent-purple); font-weight: 700; margin-left: 2px; cursor: help; }
.verified-check--sm { font-size: 10px; }
.verified-badge { color: var(--accent-purple); font-weight: 700; }

.celebrity-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 550;
  color: var(--accent-purple); background: var(--accent-purple-bg);
  border-radius: 999px; padding: 1px 7px; cursor: help;
}

/* ===== CLIENT MAIN ===== */
.client-main { max-width: 820px; margin: 0 auto; padding: 24px; }
.client-main--narrow { max-width: 640px; }
.client-main__head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.client-main__head h1 { font-size: 20px; font-weight: 700; color: var(--ink); margin: 0; flex: 1; letter-spacing: -0.3px; font-family: var(--font-heading); }
.ticket-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== EMPTY ===== */
.empty { text-align: center; color: var(--ink-secondary); padding: 56px 24px; border: 1px dotted var(--border); border-radius: 12px; font-size: 14px; line-height: 1.6; }

/* ===== TICKET LIST ===== */
.ticket-list { display: flex; flex-direction: column; gap: 8px; }

.ticket-card {
  display: block;
  background: var(--surface-glass);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px dotted var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  text-decoration: none; color: inherit;
  transition: border-color 250ms cubic-bezier(0.215,0.61,0.355,1),
              transform 250ms cubic-bezier(0.215,0.61,0.355,1),
              box-shadow 250ms cubic-bezier(0.215,0.61,0.355,1);
}
.ticket-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.ticket-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.ticket-card__subject { font-weight: 550; color: var(--ink); font-size: 14px; }
.ticket-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ink-tertiary); }
.ticket-card__user { font-weight: 500; color: var(--ink-secondary); }

/* ===== STATUS ===== */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  border: 1px dotted var(--border);
  white-space: nowrap;
}
.status--created { background: var(--surface-raised); color: var(--ink-tertiary); }
.status--waiting_user { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.status--waiting_support { background: var(--accent-blue-bg); color: var(--accent-blue); border-color: var(--accent-blue); }
.status--resolved { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.status--closed { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* ===== CHAT ===== */
.chat {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface-glass);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px dotted var(--border);
  border-radius: 16px;
  padding: 20px; max-height: 55vh; overflow-y: auto; margin-bottom: 12px;
}
.chat::-webkit-scrollbar { width: 4px; }
.chat::-webkit-scrollbar-track { background: transparent; }
.chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.chat-locked {
  background: var(--surface-glass);
  border: 1px dotted var(--border);
  border-radius: 10px;
  padding: 14px 18px; text-align: center;
  font-size: 13px; color: var(--ink-tertiary); line-height: 1.5;
}

.msg-system {
  text-align: center; font-size: 11px; color: var(--ink-tertiary);
  background: var(--surface-raised);
  border: 1px dotted var(--border);
  border-radius: 999px; padding: 4px 16px; margin: 4px auto; max-width: 80%;
  backdrop-filter: blur(4px);
}

.msg { max-width: 80%; padding: 10px 14px; border-radius: 16px; animation: fadeInUp 0.2s cubic-bezier(0.23,1,0.32,1); border: 1px dotted var(--border); }

.msg--me {
  align-self: flex-end;
  background: var(--accent-bg);
  border-color: var(--accent);
}
.msg--me .msg__head { color: var(--accent); }

.msg--them {
  align-self: flex-start;
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
}

.msg__head { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 3px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.msg__role { color: var(--ink-tertiary); font-weight: 400; font-size: 11px; }
.msg__body { font-size: 14px; color: var(--ink); white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg__time { font-size: 10px; color: var(--ink-muted); margin-top: 5px; text-align: right; font-variant-numeric: tabular-nums; opacity: 0.7; }

.chat-form { display: flex; gap: 8px; margin-bottom: 12px; }
.chat-form input {
  flex: 1;
  background: var(--surface-input);
  border: 1px dotted var(--border);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--ink); font-size: 14px; font-family: inherit;
  outline: none;
  transition: border-color 150ms cubic-bezier(0.23,1,0.32,1), box-shadow 150ms cubic-bezier(0.23,1,0.32,1);
}
.chat-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.status-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.status-form select, .status-form input[type="text"] {
  background: var(--surface-input);
  border: 1px dotted var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink); font-size: 13px; font-family: inherit;
  outline: none;
  transition: border-color 150ms cubic-bezier(0.23,1,0.32,1);
}
.status-form select:focus, .status-form input[type="text"]:focus { border-color: var(--accent); }

/* ===== CARD ===== */
.card {
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px dotted var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  animation: fadeInUp 0.35s cubic-bezier(0.23,1,0.32,1);
}
.card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.card__header-left { display: flex; align-items: center; gap: 10px; color: var(--ink-secondary); }
.card__header-left h2 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0; }
.card__desc { font-size: 13px; color: var(--ink-secondary); margin-bottom: 12px; line-height: 1.55; }

/* ===== DASHBOARD INFO ===== */
.dashboard-info { display: flex; flex-direction: column; gap: 8px; }
.dashboard-info__item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface-raised); border-radius: 10px; border: 1px dotted var(--border); backdrop-filter: blur(4px); }
.dashboard-info__label { font-size: 11px; color: var(--ink-tertiary); text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; }
.dashboard-info__value { font-size: 14px; color: var(--ink); font-weight: 550; font-variant-numeric: tabular-nums; }

/* ===== ADMIN SIDEBAR ===== */
.admin-page { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-right: 1px dotted var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform 250ms cubic-bezier(0.23,1,0.32,1);
}

.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 20px; font-size: 15px; font-weight: 700; color: var(--ink); border-bottom: 1px dotted var(--border); font-family: var(--font-heading); }
.sidebar__brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #f9a8d4, #fdba74);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
[data-theme="light"] .sidebar__brand-icon { background: linear-gradient(135deg, #f472b6, #fb923c); }

.nav { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav__link { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 999px; color: var(--ink-secondary); font-size: 13px; font-weight: 500; transition: all 150ms cubic-bezier(0.23,1,0.32,1); min-height: 40px; }
.nav__link:hover { color: var(--ink); background: var(--surface-hover); }
.nav__link--active { color: var(--accent); background: var(--accent-bg); }
.nav__link--active:hover { color: var(--accent); }
.nav__link--logout { margin-top: auto; color: var(--ink-tertiary); }
.nav__link--logout:hover { color: var(--danger); background: var(--danger-bg); }

.sidebar__footer { padding: 12px; border-top: 1px dotted var(--border); }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 8px; }
.sidebar__user-avatar { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f9a8d4, #fdba74); border-radius: 10px; color: #1c1917; font-size: 14px; font-weight: 700; }
[data-theme="light"] .sidebar__user-avatar { background: linear-gradient(135deg, #f472b6, #fb923c); color: #fff; }
.sidebar__user-info { display: flex; flex-direction: column; overflow: hidden; }
.sidebar__user-name { font-size: 13px; font-weight: 550; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 11px; color: var(--ink-tertiary); }

.main-content { flex: 1; margin-left: 260px; min-height: 100vh; }

.topbar {
  display: none; align-items: center; gap: 12px;
  padding: 12px 20px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px dotted var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar__menu { background: none; border: none; color: var(--ink-secondary); cursor: pointer; padding: 6px; min-height: 40px; min-width: 40px; display: flex; align-items: center; justify-content: center; border-radius: 999px; transition: background 150ms cubic-bezier(0.23,1,0.32,1); }
.topbar__menu:hover { background: var(--surface-hover); }
.topbar__title { font-size: 15px; font-weight: 600; color: var(--ink); }
.topbar__spacer { flex: 1; }
.content { padding: 24px; max-width: 960px; }
.content--narrow { max-width: 560px; }

/* ===== MODAL ===== */
.modal {
  border: none; border-radius: 20px;
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  color: var(--ink);
  padding: 28px; max-width: 400px; width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.25s cubic-bezier(0.23,1,0.32,1);
}
.modal::backdrop { background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal h2 { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 16px; }

/* ===== PROFILE ===== */
.profile-main { max-width: 920px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.profile-grid .card { margin-bottom: 0; }
.profile-grid h2 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.avatar-preview { display: flex; justify-content: center; margin-bottom: 16px; }
.avatar-preview__img { width: 100px; height: 100px; border-radius: 50%; background: linear-gradient(135deg, #f9a8d4, #fdba74); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; color: #1c1917; font-size: 34px; font-weight: 700; border: 2px dotted var(--border); box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md); }
.avatar-preview__img--empty { background: linear-gradient(135deg, #f9a8d4, #fdba74); }

/* ===== VERSION WIDGET ===== */
.version-widget { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; outline: none; }
.version-widget__badge { background: var(--surface-glass); backdrop-filter: blur(8px); color: var(--ink-secondary); border: 1px dotted var(--border); border-radius: 999px; padding: 6px 14px; font-size: 11px; font-weight: 600; cursor: help; box-shadow: var(--shadow-md); transition: border-color 150ms cubic-bezier(0.23,1,0.32,1), color 150ms cubic-bezier(0.23,1,0.32,1); }
.version-widget__badge:hover { border-color: var(--accent); color: var(--ink); }
.version-widget__popup { margin-bottom: 10px; width: 280px; background: var(--surface-glass); backdrop-filter: blur(16px); border: 1px dotted var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow-lg); }
.version-widget__popup[hidden] { display: none; }
.version-widget__title { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.version-widget__version { font-size: 12px; color: var(--ink-tertiary); margin-bottom: 12px; }
.version-widget__changelog-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-muted); font-weight: 600; margin-bottom: 6px; }
.version-widget__changelog ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.version-widget__changelog li { font-size: 12px; line-height: 1.45; color: var(--ink-secondary); padding-left: 12px; position: relative; }
.version-widget__changelog li::before { content: ''; position: absolute; left: 0; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

/* ===== TAG POPUP ===== */
.tag-pop { position: relative; cursor: help; outline: none; }
.tag-pop__card { display: none; }
.tag-pop-layer { position: fixed; display: none; width: 220px; background: var(--surface-glass); backdrop-filter: blur(20px); border: 1px dotted var(--border); border-radius: 12px; padding: 14px 16px; font-size: 12px; line-height: 1.5; color: var(--ink-secondary); box-shadow: var(--shadow-lg); z-index: 2000; pointer-events: none; animation: popIn 140ms cubic-bezier(0.23,1,0.32,1); }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.tag-pop-layer strong { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.tag-pop-layer strong::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-purple); box-shadow: 0 0 8px var(--accent-purple); }

/* ===== STAFF ===== */
.staff-main { max-width: 1080px; }
.staff-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.staff-layout > .card { padding: 16px; }
.staff-layout > .staff-chat { min-width: 0; }
.staff-layout h2 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.staff-members__list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.staff-members__item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; background: var(--surface-raised); border-radius: 10px; border: 1px dotted var(--border); backdrop-filter: blur(4px); }
.staff-members__name { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; }
.staff-members__role { font-size: 11px; color: var(--ink-tertiary); margin-left: auto; }
.staff-members__remove { margin-left: 4px; }
.staff-add-form { display: flex; gap: 8px; }
.mini-avatar { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #f9a8d4, #fdba74); background-size: cover; background-position: center; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #1c1917; flex: 0 0 22px; }
.mini-avatar--empty { background: linear-gradient(135deg, #f9a8d4, #fdba74); }
.staff-chat .chat { height: 60vh; }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 12px; }
.gap-xs { gap: 8px; }
.mt-sm { margin-top: 12px; }
.mb-sm { margin-bottom: 12px; }
.text-center { text-align: center; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 10px; font-weight: 700;
  color: #1c1917;
  background: linear-gradient(135deg, #f9a8d4, #fdba74);
  border-radius: 999px; line-height: 1;
  box-shadow: 0 0 8px rgba(249,168,212,0.4);
}
[data-theme="light"] .unread-badge { color: #fff; background: linear-gradient(135deg, #f472b6, #fb923c); }

/* ===== STATUS TIMELINE ===== */
.status-timeline { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.status-timeline__step { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-muted); font-weight: 500; transition: color 150ms cubic-bezier(0.23,1,0.32,1); }
.status-timeline__step:hover { color: var(--ink-secondary); }
.status-timeline__step--active { color: var(--ink-secondary); }
.status-timeline__step--done { color: var(--accent); }
.status-timeline__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted); }
.status-timeline__step--done .status-timeline__dot { background: var(--accent); }
.status-timeline__step--active .status-timeline__dot { background: var(--ink-secondary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .topbar-link span { display: none; }
  .topbar-link { padding: 6px 8px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar--open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { display: flex; }
  .content { padding: 16px; }
  .form__role-preview { grid-template-columns: repeat(2, 1fr); }
  .staff-layout { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .chat { max-height: 45vh; }
  .staff-chat .chat { height: 50vh; }
  .client-main { padding: 16px; }
}

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