:root {
  --bg: #070b14;
  --panel: rgba(16, 23, 38, .78);
  --panel-strong: #111827;
  --border: rgba(148, 163, 184, .14);
  --text: #f8fafc;
  --muted: #8b9bb3;
  --blue: #5b8cff;
  --cyan: #2dd4bf;
  --violet: #8b5cf6;
  --danger: #fb7185;
  --warning: #fbbf24;
  --success: #34d399;
  --shadow: 0 22px 70px rgba(0,0,0,.38);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 15% 10%, rgba(91,140,255,.12), transparent 30%), radial-gradient(circle at 90% 15%, rgba(139,92,246,.12), transparent 28%), var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.glass-panel { background: linear-gradient(145deg, rgba(20,29,49,.88), rgba(10,15,26,.78)); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(22px); }
.eyebrow { display: block; color: #7da2ff; font-size: .68rem; font-weight: 800; letter-spacing: .18em; margin-bottom: 10px; }
.brand-mark { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-weight: 900; letter-spacing: -.04em; background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 14px 38px rgba(91,140,255,.33); }
.brand-mark.small { width: 44px; height: 44px; border-radius: 14px; }
.primary-button, .secondary-button, .icon-button, .text-button { border: 0; color: var(--text); }
.primary-button { padding: 12px 18px; border-radius: 12px; background: linear-gradient(135deg, var(--blue), var(--violet)); font-weight: 750; box-shadow: 0 10px 30px rgba(91,140,255,.25); }
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.secondary-button { padding: 11px 16px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.icon-button { background: transparent; color: #9fb1ca; padding: 8px; font-size: .78rem; }
.text-button { background: transparent; color: #86a6ff; font-weight: 700; }
.full-width { width: 100%; }

.login-page { overflow: hidden; }
.ambient { position: fixed; border-radius: 50%; filter: blur(30px); opacity: .45; pointer-events: none; }
.ambient-one { width: 360px; height: 360px; background: rgba(91,140,255,.24); top: -80px; right: 10%; }
.ambient-two { width: 320px; height: 320px; background: rgba(139,92,246,.18); left: -80px; bottom: -80px; }
.login-shell { min-height: 100vh; width: min(1120px, calc(100% - 40px)); margin: auto; display: grid; grid-template-columns: 1.1fr .9fr; gap: 70px; align-items: center; }
.login-brand h1 { font-size: clamp(3rem, 8vw, 6.5rem); letter-spacing: -.07em; margin: 24px 0 12px; line-height: .95; }
.login-brand p { max-width: 560px; color: var(--muted); font-size: 1.08rem; line-height: 1.8; }
.feature-list { display: grid; gap: 14px; margin-top: 38px; color: #c8d4e6; }
.feature-list div { display: flex; gap: 15px; align-items: center; }
.feature-list span { color: #7897ea; font-size: .72rem; letter-spacing: .12em; }
.login-card { border-radius: 26px; padding: 36px; }
.login-card-header { color: var(--muted); font-size: .78rem; display: flex; align-items: center; gap: 9px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 15px var(--success); display: inline-block; }
.login-card h2 { font-size: 2rem; margin: 25px 0 8px; }
.login-card > p { color: var(--muted); margin: 0 0 26px; }
label { display: grid; gap: 9px; color: #cbd5e1; font-size: .84rem; font-weight: 650; }
form { display: grid; gap: 18px; }
input, select, textarea { width: 100%; color: var(--text); background: rgba(5,9,18,.72); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: rgba(91,140,255,.7); box-shadow: 0 0 0 3px rgba(91,140,255,.12); }
.password-wrap { display: flex; align-items: center; background: rgba(5,9,18,.72); border: 1px solid var(--border); border-radius: 12px; }
.password-wrap input { border: 0; background: transparent; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.form-error { min-height: 18px; margin: -4px 0; color: var(--danger); font-size: .82rem; }
.demo-note { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; text-align: center; }
.shake { animation: shake .4s ease; }
@keyframes shake { 25% { transform: translateX(-7px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }

.app-layout { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; gap: 18px; padding: 18px; }
.sidebar { position: sticky; top: 18px; height: calc(100vh - 36px); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 4px 4px 22px; }
.sidebar-brand div:last-child { display: grid; gap: 4px; }
.sidebar-brand span, .user-card span { color: var(--muted); font-size: .72rem; }
.sidebar-nav { display: grid; gap: 8px; }
.nav-item { width: 100%; border: 0; border-radius: 12px; background: transparent; color: #91a1b8; padding: 12px 13px; display: flex; gap: 12px; align-items: center; text-align: left; }
.nav-item:hover, .nav-item.active { color: white; background: linear-gradient(90deg, rgba(91,140,255,.18), rgba(139,92,246,.08)); box-shadow: inset 3px 0 0 var(--blue); }
.sidebar-footer { margin-top: auto; display: grid; gap: 14px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.025); }
.user-card > div:nth-child(2) { display: grid; gap: 3px; }
.avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(91,140,255,.18); color: #9db4ff; font-weight: 800; }
.main-content { min-width: 0; padding: 8px 10px 30px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px 4px 26px; }
.topbar h1 { margin: 0; font-size: 2rem; letter-spacing: -.04em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search-box { min-width: 300px; display: flex; align-items: center; gap: 10px; padding-left: 13px; border: 1px solid var(--border); border-radius: 12px; background: rgba(8,13,23,.66); }
.search-box input { border: 0; background: transparent; padding-left: 0; box-shadow: none; }
.view { display: none; animation: fadeIn .28s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }
.welcome-banner { border-radius: 22px; padding: 28px; display: flex; justify-content: space-between; align-items: center; overflow: hidden; position: relative; }
.welcome-banner:after { content: ''; position: absolute; width: 240px; height: 240px; right: -50px; top: -110px; background: radial-gradient(circle, rgba(91,140,255,.25), transparent 68%); }
.welcome-banner h2 { margin: 0 0 10px; font-size: 1.7rem; }
.welcome-banner p { margin: 0; color: var(--muted); }
.system-pill { position: relative; z-index: 1; border: 1px solid rgba(52,211,153,.22); color: #a7f3d0; background: rgba(16,185,129,.08); border-radius: 999px; padding: 10px 14px; font-size: .78rem; display: flex; align-items: center; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
.stat-card { border-radius: 18px; padding: 20px; display: grid; gap: 6px; }
.stat-card .stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #9eb4ff; background: rgba(91,140,255,.12); font-size: .7rem; margin-bottom: 6px; }
.stat-card span { color: var(--muted); font-size: .8rem; }
.stat-card strong { font-size: 2rem; }
.stat-card small { color: #66758c; }
.content-grid { display: grid; gap: 16px; }
.dashboard-grid { grid-template-columns: 1.45fr .75fr; }
.content-card { border-radius: 20px; padding: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-heading h3 { margin: 0; font-size: 1.1rem; }
.recent-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.recent-item:last-child { border-bottom: 0; }
.recent-item > div { display: grid; gap: 5px; }
.recent-item span { color: var(--muted); font-size: .75rem; }
.status-badge, .priority-badge { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.status-new { color: #bfdbfe; background: rgba(59,130,246,.14); }
.status-in-progress { color: #ddd6fe; background: rgba(139,92,246,.14); }
.status-waiting { color: #fde68a; background: rgba(245,158,11,.12); }
.status-closed { color: #a7f3d0; background: rgba(16,185,129,.12); }
.priority-low { color: #bae6fd; background: rgba(14,165,233,.1); }
.priority-medium { color: #fde68a; background: rgba(245,158,11,.1); }
.priority-high, .priority-critical { color: #fecdd3; background: rgba(244,63,94,.12); }
.quick-action-list { display: grid; gap: 10px; }
.action-card { width: 100%; border-radius: 16px; padding: 16px; color: var(--text); display: flex; align-items: center; gap: 13px; text-align: left; }
.action-card:hover { transform: translateY(-2px); border-color: rgba(91,140,255,.4); }
.action-card > div:nth-child(2) { display: grid; gap: 5px; flex: 1; }
.action-card span { color: var(--muted); font-size: .74rem; }
.action-card em { color: #8ba9ff; font-size: .72rem; font-style: normal; font-weight: 750; }
.action-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(91,140,255,.18), rgba(139,92,246,.16)); }
.section-toolbar { margin-bottom: 16px; border-radius: 18px; padding: 14px; display: flex; align-items: center; justify-content: space-between; }
.filter-row { display: flex; gap: 10px; }
.filter-row select { min-width: 165px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: .8rem; }
th { color: #72839b; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; }
td { color: #c7d2e2; }
.ticket-title { display: grid; gap: 5px; min-width: 230px; }
.ticket-title small { color: var(--muted); max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-state { text-align: center; color: var(--muted); padding: 40px; }
.knowledge-grid, .action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.knowledge-card { border-radius: 20px; padding: 22px; min-height: 230px; }
.knowledge-card h3 { font-size: 1.16rem; margin: 12px 0; }
.knowledge-card p { color: var(--muted); line-height: 1.7; font-size: .86rem; }
.knowledge-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: rgba(91,140,255,.12); color: #9db4ff; font-size: .72rem; margin-bottom: 20px; }
.action-grid .action-card { min-height: 120px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(2,6,13,.72); backdrop-filter: blur(10px); }
.modal-backdrop.open { display: flex; }
.modal { width: min(700px, 100%); border-radius: 22px; padding: 24px; max-height: 92vh; overflow: auto; }
.form-grid { grid-template-columns: 1fr 1fr; }
.full-span { grid-column: 1 / -1; }
textarea { min-height: 110px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; opacity: 0; transform: translateY(15px); pointer-events: none; padding: 13px 17px; border-radius: 12px; background: #172033; border: 1px solid rgba(91,140,255,.3); box-shadow: var(--shadow); color: white; transition: .24s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .knowledge-grid { grid-template-columns: 1fr 1fr; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; padding: 50px 0; }
  .login-brand { display: none; }
  .app-layout { grid-template-columns: 1fr; padding: 10px; }
  .sidebar { position: static; height: auto; }
  .sidebar-nav { grid-template-columns: repeat(2, 1fr); }
  .sidebar-footer { margin-top: 18px; }
  .main-content { padding: 5px; }
  .topbar { flex-direction: column; }
  .topbar-actions, .search-box { width: 100%; min-width: 0; }
  .topbar-actions { justify-content: stretch; }
  .topbar-actions .primary-button { flex: 1; }
  .welcome-banner { align-items: flex-start; flex-direction: column; gap: 20px; }
  .stats-grid, .dashboard-grid, .knowledge-grid, .action-grid { grid-template-columns: 1fr; }
  .section-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .filter-row { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
}

.actions-intro { border-radius: 20px; padding: 22px; margin-bottom: 16px; display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.actions-intro h2 { margin: 6px 0 8px; }
.actions-intro p { margin: 0; color: var(--muted); }
.diagnostic-note { max-width: 310px; padding: 12px 14px; border: 1px solid rgba(91,140,255,.22); border-radius: 14px; background: rgba(91,140,255,.08); color: #a9beff; font-size: .78rem; line-height: 1.5; }
.action-filters { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }
.filter-chip { border: 1px solid var(--border); background: rgba(255,255,255,.025); color: var(--muted); border-radius: 999px; padding: 9px 13px; font-size: .76rem; }
.filter-chip:hover, .filter-chip.active { color: var(--text); border-color: rgba(91,140,255,.45); background: rgba(91,140,255,.12); }
.action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.action-grid .action-card { min-height: 250px; align-items: flex-start; }
.action-card .action-content { min-width: 0; display: grid; gap: 9px; flex: 1; }
.action-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.action-card code { display: block; max-height: 92px; overflow: auto; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06); color: #a8d8ff; font-size: .68rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.action-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.action-meta span, .admin-badge { width: fit-content; border: 1px solid rgba(91,140,255,.22); border-radius: 999px; padding: 4px 7px; background: rgba(91,140,255,.08); color: #9db5ff !important; font-size: .62rem !important; font-weight: 750; }
.admin-badge { border-color: rgba(245,158,11,.28); background: rgba(245,158,11,.1); color: #f6c469 !important; }
.action-warning { color: #e8b86b !important; font-size: .68rem !important; line-height: 1.4; }
.action-icon { flex: 0 0 auto; font-size: .63rem; font-weight: 850; letter-spacing: -.02em; color: #a7c6ff; }
.action-card.compact { min-height: 0; }
.action-card.compact .action-content { gap: 5px; }

@media (max-width: 800px) {
  .actions-intro { align-items: flex-start; flex-direction: column; }
  .diagnostic-note { max-width: none; }
  .action-grid { grid-template-columns: 1fr; }
}


/* Full-screen Quick Action copy animation */
.copy-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 18, .38);
  -webkit-backdrop-filter: blur(12px) saturate(.8);
  backdrop-filter: blur(12px) saturate(.8);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, visibility .22s ease;
}
.copy-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.copy-overlay-content {
  min-width: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px 34px;
  border: 1px solid rgba(123, 160, 255, .32);
  border-radius: 24px;
  background: rgba(10, 17, 34, .78);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45), 0 0 48px rgba(91, 140, 255, .16);
  transform: scale(.92);
  transition: transform .22s ease;
}
.copy-overlay.is-visible .copy-overlay-content { transform: scale(1); }
.copy-overlay-gear {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 5rem;
  line-height: 1;
  color: #9db5ff;
  filter: drop-shadow(0 0 18px rgba(91, 140, 255, .85));
  animation: copyOverlayGearSpin .8s linear infinite;
}
.copy-overlay-content strong { color: #f3f7ff; font-size: 1.05rem; }
.copy-overlay-content span { color: #8f9bb3; font-size: .84rem; }
body.copy-overlay-open { overflow: hidden; }
@keyframes copyOverlayGearSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .copy-overlay-gear { animation-duration: 1.6s; }
}
