:root {
  color-scheme: dark;
  --bg: #0f1113;
  --bg-2: #0c0f12;
  --panel: #15191d;
  --panel-2: #191e24;
  --panel-3: #101418;
  --input: #11161b;
  --text: #edf2f7;
  --muted: #aab4c0;
  --muted-2: #778391;
  --line: #2a3139;
  --line-soft: rgba(255,255,255,.065);
  --accent: #65d2ff;
  --accent-2: #9c82ff;
  --accent-soft: rgba(101,210,255,.10);
  --success: #38df91;
  --warning: #ffd166;
  --danger: #ff6f7d;
  --info: #75a7ff;
  --shadow: 0 24px 70px rgba(0,0,0,.42);
  --shadow-soft: 0 12px 34px rgba(0,0,0,.24);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar: 248px;
  --topbar: 66px;
  --font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  background:
    radial-gradient(circle at 88% -10%, rgba(101,210,255,.08), transparent 32%),
    radial-gradient(circle at 8% 110%, rgba(156,130,255,.08), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(101,210,255,.25); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.13); border: 2px solid transparent; background-clip: padding-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); border: 2px solid transparent; background-clip: padding-box; }

.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient-orb { position: absolute; width: 420px; height: 420px; border-radius: 50%; filter: blur(100px); opacity: .10; }
.orb-one { top: -180px; right: -80px; background: var(--accent); }
.orb-two { bottom: -220px; left: -100px; background: var(--accent-2); }
.ambient-grid { position: absolute; inset: 0; opacity: .035; background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent 80%); }

.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.brand-lockup { display: inline-flex; align-items: center; gap: 0; color: var(--text); text-decoration: none; border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; }
.brand-lockup-logo-only { flex: 0 0 auto; }
.brand-logo-shell { position: relative; display: grid; place-items: center start; width: 168px; height: 52px; flex: 0 0 auto; overflow: visible; }
.brand-logo-shell.compact { width: 116px; height: 42px; }
.brand-logo { display: block; width: 100%; height: 100%; object-fit: contain; object-position: left center; filter: drop-shadow(0 0 12px rgba(101,210,255,.16)); }
.brand-logo-fallback { display: inline-flex; align-items: center; height: 100%; white-space: nowrap; font-size: 22px; font-weight: 900; letter-spacing: -.45px; color: var(--text); }
.brand-logo-shell.compact .brand-logo-fallback { font-size: 17px; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(460px, 1.1fr) minmax(420px, .9fr); }
.auth-brand-panel { position: relative; min-height: 100vh; padding: clamp(28px, 4vw, 58px); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border-right: 1px solid var(--line-soft); background: linear-gradient(150deg, rgba(21,25,29,.92), rgba(12,15,18,.96)); }
.auth-brand-panel::before { content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%; top: -300px; right: -220px; background: radial-gradient(circle, rgba(101,210,255,.18), transparent 65%); pointer-events: none; }
.auth-brand-panel::after { content: ''; position: absolute; inset: 0; opacity: .07; background: radial-gradient(circle at center, rgba(255,255,255,.7) 0 1px, transparent 1.5px); background-size: 34px 34px; mask-image: linear-gradient(120deg, black, transparent 72%); pointer-events: none; }
.auth-brand-top, .auth-story, .auth-brand-foot { position: relative; z-index: 1; }
.auth-brand-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.service-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,.20); }
.service-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.service-dot.checking { background: var(--warning); box-shadow: 0 0 10px var(--warning); animation: pulse 1.5s ease-in-out infinite; }
.service-dot.offline { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
@keyframes pulse { 50% { opacity: .45; transform: scale(.78); } }
.auth-story { max-width: 760px; margin: 8vh 0; }
.auth-story h1 { margin: 15px 0 18px; max-width: 690px; font-size: clamp(42px, 5vw, 72px); line-height: .98; letter-spacing: -.055em; text-wrap: balance; }
.auth-story > p { max-width: 650px; margin: 0; color: var(--muted); font-size: clamp(15px, 1.45vw, 19px); line-height: 1.65; }
.auth-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 36px; max-width: 720px; }
.auth-feature-grid article { display: flex; gap: 13px; min-height: 96px; padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgba(255,255,255,.025); backdrop-filter: blur(10px); }
.feature-icon { flex: 0 0 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); font-size: 10px; font-weight: 900; background: var(--accent-soft); border: 1px solid rgba(101,210,255,.2); }
.auth-feature-grid strong { display: block; font-size: 13px; margin-bottom: 5px; }
.auth-feature-grid small { display: block; color: var(--muted); line-height: 1.5; }
.auth-brand-foot { display: flex; align-items: center; gap: 10px; color: var(--muted-2); font-size: 11px; }
.separator-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }
.auth-form-panel { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: rgba(10,13,16,.64); }
.auth-card { position: relative; width: min(440px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(155deg, rgba(25,30,36,.97), rgba(16,20,24,.98)); box-shadow: var(--shadow); overflow: hidden; }
.auth-card::before { content: ''; position: absolute; left: 10%; right: 10%; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.auth-card-mark { display: none; width: min(188px, 66vw); height: 58px; margin-bottom: 18px; }
.auth-card-mark img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.auth-card h2 { margin: 8px 0 8px; font-size: 29px; letter-spacing: -.035em; }
.auth-card-copy { margin: 0 0 25px; color: var(--muted); line-height: 1.65; }
.auth-links { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 20px; color: var(--muted); font-size: 11px; }
.auth-links span { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.auth-links a { text-decoration: none; }
.auth-links a:hover { color: var(--accent); }

.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; }
.field input, .field textarea, .field select, .select-control {
  width: 100%; color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: 11px; outline: none; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input, .field select, .select-control { min-height: 42px; padding: 9px 12px; }
.field textarea { padding: 11px 12px; resize: vertical; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field input:focus, .field textarea:focus, .field select:focus, .select-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(101,210,255,.10); }
.field small { color: var(--muted-2); font-size: 10px; text-align: right; }
.check-field { display: flex; align-items: flex-start; gap: 10px; min-height: 70px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--input); cursor: pointer; }
.check-field input { margin-top: 3px; accent-color: var(--accent); }
.check-field strong, .check-field small { display: block; }
.check-field strong { font-size: 12px; }
.check-field small { color: var(--muted); margin-top: 3px; line-height: 1.4; }

.alert { padding: 11px 13px; margin-bottom: 16px; border-radius: 10px; border: 1px solid rgba(255,111,125,.34); color: #ff9aa4; background: rgba(255,111,125,.07); font-size: 12px; line-height: 1.5; }
.alert.success { color: var(--success); border-color: rgba(56,223,145,.28); background: rgba(56,223,145,.06); }
.alert.warning { color: var(--warning); border-color: rgba(255,209,102,.28); background: rgba(255,209,102,.06); }

.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-weight: 750; font-size: 12px; transition: transform .13s ease, filter .13s ease, border-color .13s ease, background .13s ease; text-decoration: none; white-space: nowrap; }
.button svg, .icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-primary { color: #071116; background: linear-gradient(135deg, var(--accent), #8ee1ff); box-shadow: 0 8px 22px rgba(101,210,255,.13); }
.button-primary:hover:not(:disabled) { filter: brightness(1.06); }
.button-secondary { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.button-secondary:hover:not(:disabled), .button-ghost:hover:not(:disabled) { border-color: rgba(101,210,255,.45); background: rgba(101,210,255,.06); }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button-danger { color: #fff; background: var(--danger); }
.button-large { width: 100%; min-height: 48px; margin-top: 5px; font-size: 13px; }
.button-full { width: 100%; }
.button-spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(7,17,22,.25); border-top-color: #071116; border-radius: 50%; animation: spin .7s linear infinite; }
.button.loading .button-spinner { display: inline-block; }
.button.loading > span:first-child { opacity: .62; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--muted); cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease; }
.icon-button:hover { color: var(--text); border-color: rgba(101,210,255,.42); background: rgba(101,210,255,.06); }
.icon-button.compact { width: 32px; height: 32px; border-radius: 8px; }

.desk { min-height: 100vh; background: var(--bg); }
.desk-topbar { position: fixed; z-index: 60; inset: 0 0 auto 0; height: var(--topbar); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(15,17,19,.88); backdrop-filter: blur(18px) saturate(115%); box-shadow: 0 8px 28px rgba(0,0,0,.16); }
.topbar-left, .topbar-actions { display: flex; align-items: center; min-width: 0; }
.topbar-left { gap: 14px; }
.topbar-actions { gap: 9px; }
.topbar-divider { width: 1px; height: 28px; background: var(--line); }
.workspace-label { color: var(--muted); font-size: 12px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-menu-wrap { position: relative; }
.account-button { min-width: 178px; height: 42px; display: flex; align-items: center; gap: 9px; padding: 4px 9px 4px 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); cursor: pointer; text-align: left; }
.account-button > svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; margin-left: auto; }
.account-avatar { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #061116; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 12px; font-weight: 900; }
.account-copy { display: grid; min-width: 0; }
.account-copy strong { max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.account-copy small { color: var(--muted); font-size: 9px; margin-top: 1px; }
.account-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 230px; padding: 7px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); box-shadow: var(--shadow-soft); }
.account-menu-head { display: grid; gap: 3px; padding: 10px 10px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 5px; }
.account-menu-head strong { font-size: 12px; }
.account-menu-head span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.account-menu a, .account-menu button { width: 100%; display: flex; align-items: center; min-height: 34px; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-decoration: none; cursor: pointer; text-align: left; font-size: 11px; }
.account-menu a:hover, .account-menu button:hover { color: var(--text); background: rgba(255,255,255,.045); }

.desk-body { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; padding-top: var(--topbar); }
.desk-sidebar { position: fixed; z-index: 50; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel-3); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 18px 12px; }
.sidebar-section + .sidebar-section { margin-top: 24px; }
.sidebar-section-label { padding: 0 10px 8px; color: var(--muted-2); font-size: 9px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 3px; }
.nav-item { width: 100%; min-height: 39px; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active { color: var(--text); border-color: rgba(101,210,255,.17); background: linear-gradient(90deg, rgba(101,210,255,.10), rgba(101,210,255,.035)); }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); font-size: 12px; }
.nav-item.active .nav-icon { color: var(--accent); background: rgba(101,210,255,.10); }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 720; }
.nav-count { min-width: 22px; height: 20px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.055); font-size: 9px; font-weight: 800; }
.nav-item.active .nav-count { color: var(--accent); background: rgba(101,210,255,.10); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--line); }
.sidebar-external { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 11px 8px 1px; color: var(--muted-2); font-size: 9px; text-decoration: none; }
.sidebar-external:hover { color: var(--accent); }
.sidebar-backdrop { position: fixed; z-index: 45; inset: var(--topbar) 0 0 0; border: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(2px); }

.desk-main { grid-column: 2; min-width: 0; min-height: calc(100vh - var(--topbar)); }
.connection-banner { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 8px 24px; border-bottom: 1px solid rgba(255,111,125,.24); color: #ff9aa4; background: rgba(255,111,125,.065); font-size: 11px; }
.connection-banner-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 9px var(--danger); }
.connection-banner button { margin-left: auto; border: 0; background: transparent; color: inherit; font-weight: 800; cursor: pointer; }
.list-view, .detail-view { width: min(1500px, 100%); margin: 0 auto; padding: 26px clamp(18px, 2.8vw, 42px) 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.page-heading h1 { margin: 5px 0 5px; font-size: clamp(24px, 2.4vw, 34px); letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.page-heading-actions { display: flex; align-items: center; gap: 8px; }
.summary-strip { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 9px; margin-bottom: 17px; }
.summary-card { min-height: 83px; display: grid; align-content: space-between; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(160deg, var(--panel-2), var(--panel)); cursor: pointer; text-align: left; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.summary-card:hover { transform: translateY(-1px); border-color: rgba(101,210,255,.35); }
.summary-card span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.summary-card strong { font-size: 23px; letter-spacing: -.04em; }
.summary-card.emphasis strong { color: var(--accent); }
.summary-card.warning strong { color: var(--warning); }
.summary-card.danger strong { color: var(--danger); }
.ticket-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.search-box { min-width: min(410px, 38vw); height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--input); }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(101,210,255,.09); }
.search-box svg { width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: none; background: transparent; color: var(--text); }
.search-box input::placeholder { color: var(--muted-2); }
.search-box kbd { min-width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: var(--muted-2); background: var(--panel); font-size: 9px; font-family: inherit; }
.filter-row { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.select-control { width: auto; min-width: 124px; min-height: 38px; padding: 7px 31px 7px 10px; color: var(--muted); font-size: 11px; }
.ticket-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-soft); }
.ticket-panel-head { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.015); }
.ticket-panel-head > div { display: flex; align-items: center; gap: 8px; }
.ticket-panel-head strong { font-size: 12px; }
.ticket-panel-head span { color: var(--muted-2); font-size: 9px; }
.ticket-panel-actions { justify-content: flex-end; }
.ticket-list { display: grid; }
.ticket-row { position: relative; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 150px 115px 125px; align-items: center; gap: 18px; min-height: 88px; padding: 13px 18px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--text); cursor: pointer; text-align: left; transition: background .14s ease; }
.ticket-row:last-child { border-bottom: 0; }
.ticket-row:hover { background: rgba(255,255,255,.025); }
.ticket-row.unread::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 10px rgba(101,210,255,.5); }
.ticket-main { min-width: 0; }
.ticket-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ticket-number { flex: 0 0 auto; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .03em; }
.ticket-subject { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 780; }
.ticket-preview { margin-top: 5px; max-width: 760px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.ticket-meta-line { display: flex; align-items: center; gap: 7px; margin-top: 7px; color: var(--muted-2); font-size: 9px; }
.ticket-meta-line .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.ticket-requester, .ticket-assignee, .ticket-time { min-width: 0; }
.ticket-column-label { display: block; margin-bottom: 4px; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ticket-column-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.ticket-time .ticket-column-value { color: var(--text); }
.badge-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 8px; font-weight: 820; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.status-new { color: var(--accent); border-color: rgba(101,210,255,.26); background: rgba(101,210,255,.07); }
.badge.status-in_progress { color: var(--info); border-color: rgba(117,167,255,.28); background: rgba(117,167,255,.07); }
.badge.status-waiting_customer { color: var(--warning); border-color: rgba(255,209,102,.28); background: rgba(255,209,102,.07); }
.badge.status-waiting_engineering { color: var(--accent-2); border-color: rgba(156,130,255,.28); background: rgba(156,130,255,.07); }
.badge.status-resolved { color: var(--success); border-color: rgba(56,223,145,.26); background: rgba(56,223,145,.06); }
.badge.status-closed { color: var(--muted-2); }
.badge.priority-urgent, .badge.severity-critical { color: var(--danger); border-color: rgba(255,111,125,.28); background: rgba(255,111,125,.07); }
.badge.priority-high, .badge.severity-high { color: var(--warning); border-color: rgba(255,209,102,.25); background: rgba(255,209,102,.06); }
.badge.escalated { color: var(--danger); border-color: rgba(255,111,125,.28); background: rgba(255,111,125,.07); }
.badge.no-dot::before { display: none; }
.empty-state { min-height: 390px; display: grid; place-items: center; align-content: center; text-align: center; padding: 40px 20px; }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 12px; border: 1px solid rgba(101,210,255,.22); border-radius: 18px; color: var(--accent); background: rgba(101,210,255,.07); }
.empty-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { margin: 0; font-size: 17px; }
.empty-state p { max-width: 420px; margin: 7px 0 16px; color: var(--muted); font-size: 11px; }
.pagination { min-height: 55px; display: flex; align-items: center; justify-content: center; gap: 14px; border-top: 1px solid var(--line); }
.pagination span { color: var(--muted); font-size: 10px; }
.loading-stack { padding: 14px; display: grid; gap: 9px; }
.loading-stack span { display: block; height: 62px; border-radius: 10px; background: linear-gradient(90deg, rgba(255,255,255,.025), rgba(255,255,255,.075), rgba(255,255,255,.025)); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }

.detail-view { max-width: 1480px; }
.detail-shell { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
.detail-main, .detail-aside { min-width: 0; }
.detail-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-soft); overflow: hidden; }
.detail-header { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.detail-back { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 0 14px; font-size: 10px; font-weight: 750; }
.detail-back:hover { color: var(--accent); }
.detail-back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-number { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .04em; }
.detail-title { margin: 5px 0 10px; font-size: clamp(21px, 2vw, 29px); line-height: 1.22; letter-spacing: -.035em; overflow-wrap: anywhere; }
.detail-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.conversation { padding: 19px 22px 24px; display: grid; gap: 14px; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
.message-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #071116; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 10px; font-weight: 900; }
.message.customer .message-avatar { color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.message.internal .message-avatar { color: #211a06; background: var(--warning); }
.message-card { min-width: 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); }
.message.internal .message-card { border-color: rgba(255,209,102,.27); background: rgba(255,209,102,.055); }
.message-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.message-author { display: flex; align-items: center; gap: 7px; min-width: 0; }
.message-author strong { font-size: 11px; }
.message-author span, .message-time { color: var(--muted-2); font-size: 8px; }
.message-body { color: #dce4ec; font-size: 12px; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.internal .message-body { color: #f6e9ba; }
.message-source { margin-top: 9px; color: var(--muted-2); font-size: 8px; }
.activity-entry { display: flex; align-items: center; gap: 8px; margin: 1px 0 1px 44px; color: var(--muted-2); font-size: 9px; }
.activity-entry::before, .activity-entry::after { content: ''; height: 1px; background: var(--line-soft); }
.activity-entry::before { width: 18px; }
.activity-entry::after { flex: 1; }
.reply-box { border-top: 1px solid var(--line); padding: 17px 22px 20px; background: rgba(0,0,0,.08); }
.reply-tabs { display: flex; gap: 5px; margin-bottom: 10px; }
.reply-tab { min-height: 31px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 780; }
.reply-tab.active { color: var(--accent); border-color: rgba(101,210,255,.38); background: rgba(101,210,255,.07); }
.reply-box textarea { width: 100%; min-height: 112px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; outline: none; resize: vertical; color: var(--text); background: var(--input); line-height: 1.55; }
.reply-box textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(101,210,255,.09); }
.reply-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.reply-hint { color: var(--muted-2); font-size: 9px; }
.reply-actions { display: flex; gap: 7px; }
.aside-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-soft); overflow: hidden; }
.aside-card + .aside-card { margin-top: 12px; }
.aside-card-head { min-height: 45px; display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.aside-card-head strong { font-size: 11px; }
.aside-card-body { padding: 13px; }
.property-list { display: grid; gap: 12px; }
.property-row { display: grid; gap: 4px; }
.property-row > span { color: var(--muted-2); font-size: 8px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.property-row > strong, .property-row > a { color: var(--text); font-size: 10px; font-weight: 650; overflow-wrap: anywhere; }
.property-row > a { color: var(--accent); text-decoration: none; }
.property-edit-grid { display: grid; gap: 9px; }
.property-edit-grid .field { margin: 0; }
.property-edit-grid .field input, .property-edit-grid .field select { min-height: 37px; padding: 7px 9px; font-size: 10px; }
.property-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 41px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--input); }
.property-switch span { font-size: 10px; }
.property-switch input { accent-color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 8px; }
.activity-list { display: grid; gap: 10px; max-height: 390px; overflow-y: auto; }
.activity-item { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 9px; }
.activity-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--muted-2); }
.activity-copy { color: var(--muted); font-size: 9px; line-height: 1.45; }
.activity-copy strong { color: var(--text); }
.activity-copy time { display: block; color: var(--muted-2); margin-top: 2px; font-size: 8px; }
.metadata-pre { max-height: 260px; overflow: auto; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--input); font: 9px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.modal-layer { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 22px; }
.modal-scrim { position: absolute; inset: 0; border: 0; background: rgba(4,7,9,.72); backdrop-filter: blur(8px); }
.modal-card { position: relative; z-index: 1; width: min(560px, 100%); max-height: min(90vh, 860px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); }
.modal-card-large { width: min(780px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 5px 0 4px; font-size: 22px; letter-spacing: -.035em; }
.modal-header p { margin: 0; color: var(--muted); font-size: 11px; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: rgba(0,0,0,.08); }
.form-stack { display: grid; gap: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 11px; }
.admin-create-fields { margin-top: 5px; padding-top: 16px; border-top: 1px solid var(--line); }

.toast-region { position: fixed; z-index: 160; right: 18px; bottom: 18px; width: min(390px, calc(100vw - 36px)); display: grid; gap: 8px; pointer-events: none; }
.toast { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); box-shadow: var(--shadow-soft); pointer-events: auto; animation: toastIn .2s ease; }
.toast-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--success); background: rgba(56,223,145,.08); font-weight: 900; }
.toast.error .toast-icon { color: var(--danger); background: rgba(255,111,125,.08); }
.toast-copy strong { display: block; font-size: 10px; }
.toast-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.toast button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.mobile-only { display: none; }

@media (max-width: 1180px) {
  :root { --sidebar: 225px; }
  .summary-strip { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .ticket-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { min-width: 0; width: 100%; }
  .filter-row { justify-content: flex-start; }
  .ticket-row { grid-template-columns: minmax(0, 1fr) 125px 105px; }
  .ticket-assignee { display: none; }
  .detail-shell { grid-template-columns: minmax(0, 1fr) 285px; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding: 20px; }
  .auth-card-mark { display: block; }
  .mobile-only { display: inline-grid; }
  .desk-topbar { padding: 0 10px; }
  .topbar-divider, .workspace-label { display: none; }
  .account-button { min-width: 0; }
  .account-copy { display: none; }
  .desk-body { grid-template-columns: 1fr; }
  .desk-sidebar { transform: translateX(-102%); transition: transform .18s ease; box-shadow: 18px 0 45px rgba(0,0,0,.32); }
  .desk-sidebar.open { transform: translateX(0); }
  .desk-main { grid-column: 1; }
  .detail-shell { grid-template-columns: 1fr; }
  .detail-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .aside-card + .aside-card { margin-top: 0; }
}

@media (max-width: 680px) {
  :root { --topbar: 58px; }
  .brand-logo-shell.compact { width: 104px; height: 38px; }
  .topbar-actions { gap: 6px; }
  #newTicketTopButton span { display: none; }
  #newTicketTopButton { width: 38px; padding: 0; }
  .account-button { width: 38px; padding: 3px; border-radius: 10px; }
  .account-button > svg { display: none; }
  .account-avatar { width: 30px; height: 30px; }
  .list-view, .detail-view { padding: 18px 12px 34px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading-actions { display: none; }
  .summary-strip { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .summary-card { flex: 0 0 132px; }
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .select-control { width: 100%; min-width: 0; }
  .ticket-panel { border-radius: 15px; }
  .ticket-row { grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 112px; padding: 14px; }
  .ticket-requester, .ticket-time { display: none; }
  .ticket-preview { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .detail-header, .conversation, .reply-box { padding-left: 14px; padding-right: 14px; }
  .detail-title-row { flex-direction: column; }
  .detail-actions { justify-content: flex-start; }
  .message { grid-template-columns: 28px minmax(0, 1fr); gap: 8px; }
  .message-avatar { width: 28px; height: 28px; border-radius: 8px; }
  .activity-entry { margin-left: 36px; }
  .reply-footer { align-items: stretch; flex-direction: column; }
  .reply-actions { justify-content: flex-end; }
  .detail-aside { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-layer { padding: 8px; align-items: end; }
  .modal-card { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal-header, .modal-body, .modal-footer { padding-left: 15px; padding-right: 15px; }
}

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