:root {
  --bg: #090a0d;
  --sidebar: #0d0e12;
  --surface: #111217;
  --surface-2: #15161c;
  --surface-3: #1b1c23;
  --line: #24262e;
  --line-soft: #1d1e24;
  --text: #f5f5f6;
  --muted: #8b8d98;
  --muted-2: #646671;
  --red: #eb3f3b;
  --red-bright: #ff5a55;
  --red-soft: rgba(235, 63, 59, .12);
  --green: #36c991;
  --yellow: #f1b84b;
  --blue: #62a8ff;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 65% -10%, rgba(155, 35, 31, .08), transparent 30%),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: 256px;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  background: rgba(13, 14, 18, .96);
  border-right: 1px solid var(--line-soft);
  backdrop-filter: blur(20px);
}
.brand, .login-brand { display: flex; align-items: center; gap: 12px; padding: 0 7px; }
.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #363943;
  border-radius: 10px;
  background: linear-gradient(145deg, #22242c, #111217);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px rgba(0, 0, 0, .28);
}
.brand-mark b { position: relative; z-index: 1; font-size: 20px; font-style: italic; font-weight: 900; letter-spacing: -2px; }
.brand-mark i {
  position: absolute;
  right: -10px;
  bottom: -11px;
  width: 30px;
  height: 30px;
  background: var(--red);
  border-radius: 50%;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-size: 18px; letter-spacing: .24em; font-weight: 900; }
.brand-copy small { margin-top: 6px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .22em; }
.workspace {
  display: grid;
  grid-template-columns: 36px 1fr 8px;
  align-items: center;
  gap: 10px;
  margin: 30px 0 18px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.workspace-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--red-soft);
  color: var(--red-bright);
  font-size: 11px;
  font-weight: 800;
}
.workspace span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.workspace small { color: var(--muted-2); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.workspace strong { overflow: hidden; margin-top: 2px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.workspace-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(54, 201, 145, .65); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { margin: 16px 12px 7px; color: #50525b; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  color: #8f919a;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .025); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, var(--red-soft), rgba(235, 63, 59, .035));
  box-shadow: inset 2px 0 var(--red);
}
.nav-icon { color: #737580; font-size: 17px; text-align: center; }
.nav-item.active .nav-icon { color: var(--red-bright); }
.nav-count { padding: 1px 7px; border-radius: 10px; background: #24262d; color: #b2b3ba; font-size: 10px; }
.status-card {
  margin-top: auto;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, .015);
}
.status-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; color: var(--muted); font-size: 10px; }
.status-row span { display: flex; align-items: center; gap: 7px; }
.status-row b { color: var(--green); font-size: 9px; text-transform: uppercase; }
.status-row small { color: var(--muted-2); }
.online-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.sidebar-user { display: grid; grid-template-columns: 36px 1fr 32px; align-items: center; gap: 9px; padding: 17px 4px 0; }
.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #343640;
  border-radius: 11px;
  background: linear-gradient(145deg, #353843, #1c1e25);
  color: #d6d6da;
  font-size: 11px;
  font-weight: 800;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-copy { min-width: 0; display: flex; flex-direction: column; }
.user-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.user-copy small { color: var(--muted-2); font-size: 9px; text-transform: capitalize; }
.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { border-color: var(--line); color: var(--text); background: var(--surface-2); }

.main { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 86px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 clamp(24px, 4vw, 58px);
  border-bottom: 1px solid rgba(36, 38, 46, .7);
  background: rgba(9, 10, 13, .83);
  backdrop-filter: blur(18px);
}
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-title p { margin: 0 0 3px; color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.topbar-title h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.command-button, .date-range, .demo-pill {
  height: 35px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
}
.command-button { cursor: pointer; }
.command-button:hover { color: var(--text); border-color: #343640; }
.command-button kbd { padding: 1px 5px; border: 1px solid #30323a; border-radius: 4px; color: #666873; background: #18191e; font: 8px inherit; }
.demo-pill { border-color: rgba(241, 184, 75, .2); color: var(--yellow); background: rgba(241, 184, 75, .06); }
.mobile-menu { display: none; }
.content { width: min(1600px, 100%); margin: 0 auto; padding: 44px clamp(24px, 4vw, 58px) 70px; }
.view { display: none; animation: reveal .3s ease both; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.eyebrow { color: var(--red-bright); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.section-heading h2 { margin: 7px 0 3px; font-size: clamp(25px, 2.2vw, 35px); font-weight: 640; letter-spacing: -.045em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.live-indicator, .security-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}
.live-indicator i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.security-pill { color: var(--green); border-color: rgba(54, 201, 145, .18); background: rgba(54, 201, 145, .05); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.kpi-card, .panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 21, 27, .92), rgba(15, 16, 21, .92));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .018);
}
.kpi-card { position: relative; min-height: 174px; padding: 18px 19px 15px; overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 50%, rgba(255,255,255,.012)); }
.kpi-card.featured { border-color: rgba(235, 63, 59, .25); background: radial-gradient(circle at 100% 0, rgba(235, 63, 59, .11), transparent 43%), linear-gradient(145deg, #171316, #111217); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-icon { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #aaaab2; background: rgba(255,255,255,.02); font-size: 13px; }
.kpi-icon.red { color: var(--red-bright); border-color: rgba(235,63,59,.2); background: var(--red-soft); }
.delta { padding: 3px 7px; border-radius: 10px; color: #686a73; background: rgba(255,255,255,.025); font-size: 8px; }
.delta.up { color: var(--green); background: rgba(54,201,145,.07); }
.delta.down { color: var(--blue); background: rgba(98,168,255,.07); }
.kpi-card > p { margin: 18px 0 1px; color: var(--muted); font-size: 10px; }
.kpi-card > strong { font-size: 31px; font-weight: 620; letter-spacing: -.05em; }
.kpi-card > strong small { color: var(--muted-2); font-size: 12px; font-weight: 500; letter-spacing: normal; }
.mini-meta { position: absolute; inset: auto 19px 14px; display: flex; justify-content: space-between; color: var(--muted-2); font-size: 8px; }
.mini-meta span { display: flex; align-items: center; gap: 4px; }
.mini-meta b { color: #c2c3c8; }
.urgent-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--red); }
.sparkline { color: var(--green); letter-spacing: 1px; }
.stars { color: var(--yellow); letter-spacing: 1px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); gap: 13px; margin-top: 13px; }
.panel { padding: 20px; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.panel-header h3, .settings-title h3, .quality-note h3, .shield-card h3, .command-card h3 { margin: 4px 0 0; font-size: 14px; font-weight: 620; }
.panel-total { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 9px; }
.panel-total b { color: var(--text); font-size: 12px; }
.chart-panel, .category-panel { min-height: 315px; }
.chart-wrap { position: relative; height: 225px; margin: 15px -3px -5px; }
#trend-chart { width: 100%; height: 100%; }
.link-button { padding: 4px 0; border: 0; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.link-button:hover { color: var(--red-bright); }
.category-list { display: flex; flex-direction: column; gap: 20px; margin-top: 25px; }
.category-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; }
.category-emoji { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.03); }
.category-info { min-width: 0; }
.category-name { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 10px; }
.category-name span:last-child { color: var(--muted); }
.progress { height: 3px; overflow: hidden; border-radius: 3px; background: #24262d; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a72e2b, var(--red-bright)); }
.category-count { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #c7c7cb; font-size: 10px; }
.queue-panel { margin-top: 13px; }
.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #ec504b;
  border-radius: 9px;
  color: white;
  background: linear-gradient(180deg, #ee4b46, #d93430);
  box-shadow: 0 6px 18px rgba(235,63,59,.15), inset 0 1px rgba(255,255,255,.2);
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}
.primary-button:hover { filter: brightness(1.08); }
.ticket-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 17px; }
.ticket-compact { position: relative; padding: 13px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(255,255,255,.012); overflow: hidden; }
.ticket-compact::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: #484a53; }
.ticket-compact[data-priority="urgent"]::before, .ticket-compact[data-priority="high"]::before { background: var(--red); }
.ticket-compact-top { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 8px; }
.ticket-compact h4 { overflow: hidden; margin: 10px 0 4px; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ticket-compact p { margin: 0; color: var(--muted); font-size: 9px; }

.toolbar { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.search { flex: 1; max-width: 380px; display: flex; align-items: center; gap: 8px; height: 37px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #0e0f13; }
.search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.search input::placeholder { color: #52545e; }
.filter-pills { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 10px; background: #0d0e12; }
.filter-pills button { padding: 0 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.filter-pills button.active { color: var(--text); background: #25272e; }
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; min-width: 840px; }
th { padding: 11px 17px; color: #555761; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); font-size: 8px; font-weight: 750; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
td { padding: 15px 17px; border-bottom: 1px solid var(--line-soft); color: #b8b9bf; font-size: 10px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.012); }
.ticket-number { color: var(--text); font-weight: 700; }
.ticket-subject { display: flex; flex-direction: column; max-width: 280px; }
.ticket-subject b { overflow: hidden; color: #dedee1; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ticket-subject span { color: var(--muted-2); font-size: 8px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.035); font-size: 8px; white-space: nowrap; }
.status-badge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #777984; }
.status-badge.open { color: #ff807c; background: var(--red-soft); }
.status-badge.open::before { background: var(--red-bright); }
.status-badge.waiting_team { color: var(--yellow); background: rgba(241,184,75,.08); }
.status-badge.waiting_team::before { background: var(--yellow); }
.status-badge.waiting_customer { color: var(--blue); background: rgba(98,168,255,.08); }
.status-badge.waiting_customer::before { background: var(--blue); }
.status-badge.closed { color: var(--green); background: rgba(54,201,145,.08); }
.status-badge.closed::before { background: var(--green); }
.rating-cell { color: var(--yellow); }

.team-hero {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 60px;
  align-items: center;
  min-height: 160px;
  padding: 28px 34px;
  border: 1px solid rgba(235,63,59,.18);
  border-radius: var(--radius);
  background: radial-gradient(circle at 8% 80%, rgba(235,63,59,.14), transparent 28%), linear-gradient(130deg, #171215, #111217);
}
.team-hero h3 { margin: 5px 0 0; font-size: 42px; letter-spacing: -.06em; }
.team-hero h3 small { color: var(--yellow); font-size: 17px; }
.team-hero p { margin: 0; color: var(--muted); font-size: 10px; }
.team-hero-metric { min-width: 120px; display: flex; flex-direction: column; padding-left: 30px; border-left: 1px solid var(--line); }
.team-hero-metric strong { font-size: 23px; font-weight: 600; }
.team-hero-metric span { color: var(--muted); font-size: 9px; }
.team-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 13px; }
.team-card { padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); }
.team-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.team-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, #393b46, #1e2027); font-size: 11px; font-weight: 800; }
.team-card-head div { display: flex; flex-direction: column; }
.team-card-head b { font-size: 11px; }
.team-card-head span { color: var(--green); font-size: 8px; }
.team-stat { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 9px; }
.team-stat b { color: #d7d7da; font-weight: 600; }
.team-stat .rating-cell { color: var(--yellow); }
.quality-note { display: flex; align-items: center; gap: 18px; margin-top: 13px; }
.quality-note p, .shield-card p, .command-card p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.quality-icon, .settings-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--red-bright); background: var(--red-soft); font-size: 17px; }

.moderation-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 13px; }
.audit-list { margin: 17px -20px -20px; }
.audit-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; padding: 13px 20px; border-top: 1px solid var(--line-soft); }
.audit-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: #aaaab1; background: #202128; font-size: 12px; }
.audit-row div { display: flex; flex-direction: column; }
.audit-row b { font-size: 10px; }
.audit-row span, .audit-row time { color: var(--muted-2); font-size: 8px; }
.mod-side { display: flex; flex-direction: column; gap: 13px; }
.shield-card { display: grid; grid-template-columns: 45px 1fr auto; align-items: center; gap: 12px; }
.shield { width: 45px; height: 45px; display: grid; place-items: center; border: 1px solid rgba(54,201,145,.18); border-radius: 13px; color: var(--green); background: rgba(54,201,145,.06); font-size: 20px; }
.toggle { width: 30px; height: 17px; padding: 2px; border-radius: 10px; background: #2d2f37; }
.toggle i { display: block; width: 13px; height: 13px; border-radius: 50%; background: #777984; }
.toggle.on { background: rgba(54,201,145,.22); }
.toggle.on i { margin-left: 13px; background: var(--green); }
.command-card h3 { margin-top: 7px; }
.command-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin: 17px 0 15px; }
.command-cloud code { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; color: #c6c7cc; background: #0c0d11; font-size: 9px; }

.save-state { color: var(--muted-2); font-size: 9px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.settings-card { display: flex; flex-direction: column; gap: 15px; }
.settings-title { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.settings-title p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.settings-card label { display: flex; justify-content: space-between; align-items: center; gap: 20px; color: var(--muted); font-size: 10px; }
.settings-card input:not([type="checkbox"]) {
  width: min(250px, 58%);
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: #d6d6da;
  background: #0d0e12;
  font-size: 9px;
}
.settings-card input:focus { border-color: rgba(235,63,59,.55); box-shadow: 0 0 0 3px rgba(235,63,59,.08); }
.settings-card select, .article-form select {
  height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: #d6d6da;
  background: #0d0e12;
  font-size: 9px;
}
.input-suffix { width: min(250px, 58%); display: flex; }
.input-suffix input:not([type="checkbox"]) { width: 100%; border-radius: 8px 0 0 8px; }
.input-suffix span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; color: var(--muted); background: var(--surface-3); font-size: 9px; }
.check-row input { accent-color: var(--red); }
.privacy-notice { padding: 12px; border: 1px solid rgba(98,168,255,.14); border-radius: 10px; background: rgba(98,168,255,.04); }
.privacy-notice b { color: var(--blue); font-size: 9px; }
.privacy-notice p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.settings-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 13px; padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); }
.settings-actions p { margin: 0; color: var(--muted); font-size: 9px; }

.skeleton { background: linear-gradient(90deg, #1a1b21, #24252c, #1a1b21); background-size: 200% 100%; animation: skeleton 1.4s infinite; }
.skeleton.line { height: 32px; border-radius: 8px; }
@keyframes skeleton { to { background-position: -200% 0; } }
.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: 340px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  background: #1a1b20;
  box-shadow: var(--shadow);
  font-size: 10px;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: rgba(235,63,59,.35); color: #ff8581; }

.login-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 50% 0, rgba(235,63,59,.12), transparent 35%), #090a0d; }
.login-shell { width: min(430px, calc(100% - 36px)); text-align: center; }
.login-brand { justify-content: center; margin-bottom: 30px; text-align: left; }
.login-card { padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: rgba(17,18,23,.9); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card h1 { margin: 10px 0 5px; font-size: 29px; letter-spacing: -.04em; }
.login-card > p { margin: 0 auto 25px; color: var(--muted); font-size: 11px; }
.login-form { display: flex; flex-direction: column; gap: 13px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 9px; }
.login-form input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--text);
  background: #0b0c10;
}
.login-form input:focus { border-color: rgba(235,63,59,.55); box-shadow: 0 0 0 3px rgba(235,63,59,.08); }
.local-login { width: 100%; margin-top: 5px; border: 0; background: linear-gradient(180deg, #ee4b46, #d93430); cursor: pointer; }
.form-error { margin: -8px 0 16px; padding: 10px 12px; border: 1px solid rgba(235,63,59,.3); border-radius: 9px; color: #ff8b87; background: rgba(235,63,59,.07); font-size: 10px; text-align: left; }
.qr-code { display: block; width: 220px; max-width: 100%; margin: 0 auto 16px; padding: 8px; border-radius: 14px; background: white; }
.manual-secret { margin: 0 0 18px; color: var(--muted); font-size: 9px; }
.manual-secret code { display: block; overflow-wrap: anywhere; margin-top: 8px; padding: 9px; border-radius: 7px; color: var(--text); background: #090a0d; letter-spacing: .08em; }
.totp-input { font-size: 20px !important; font-weight: 700; letter-spacing: .25em; text-align: center; }
.recovery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.recovery-grid code { padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #0a0b0e; font-size: 11px; letter-spacing: .08em; }
.discord-login { display: flex; justify-content: center; align-items: center; gap: 9px; height: 42px; border-radius: 10px; background: #5865f2; font-size: 11px; font-weight: 700; }
.discord-login:hover { filter: brightness(1.08); }
.demo-login { display: block; margin-top: 14px; color: var(--muted); font-size: 10px; }
.login-security { display: flex; gap: 10px; margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line-soft); color: var(--green); text-align: left; }
.login-security p { margin: 0; color: var(--muted); font-size: 9px; }
.login-security b { color: #c7c8cc; }
.login-footer { margin-top: 22px; color: var(--muted-2); font-size: 9px; }
.error-page { width: min(480px, calc(100% - 40px)); text-align: center; }
.error-code { color: var(--red); font-size: 70px; font-weight: 800; letter-spacing: -.08em; }
.error-page h1 { margin: 0; font-size: 25px; }
.error-page p { margin: 8px 0 25px; color: var(--muted); }
.error-page .primary-button { padding: 10px 15px; }

.compose-card, .article-editor { margin-bottom: 13px; border-color: rgba(235,63,59,.22); }
.compose-form, .article-form { display: flex; flex-direction: column; gap: 11px; margin-top: 18px; }
.compose-form label, .article-form > label, .article-options label {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 9px;
}
.compose-form input, .compose-form textarea, .article-form input, .article-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  resize: vertical;
  color: var(--text);
  background: #0d0e12;
  font-size: 10px;
}
.compose-form input { height: 35px; }
.compose-form input:focus, .compose-form textarea:focus, .article-form input:focus, .article-form textarea:focus {
  border-color: rgba(235,63,59,.55);
  box-shadow: 0 0 0 3px rgba(235,63,59,.08);
}
.compose-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--muted-2); font-size: 8px; }
.mail-layout { display: grid; grid-template-columns: 210px minmax(280px, .7fr) minmax(360px, 1.3fr); gap: 13px; min-height: 620px; }
.mail-sidebar { display: flex; flex-direction: column; }
.mail-sidebar > strong { overflow-wrap: anywhere; margin: 7px 0 22px; font-size: 11px; }
.mail-folders { display: flex; flex-direction: column; gap: 4px; margin: 0 -8px; }
.mail-folders button {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  text-align: left;
  cursor: pointer;
}
.mail-folders button.active { color: var(--text); background: var(--red-soft); }
.mail-folders b { min-width: 20px; padding: 1px 5px; border-radius: 8px; color: var(--red-bright); background: rgba(235,63,59,.12); font-size: 8px; text-align: center; }
.mail-security { display: flex; gap: 8px; margin-top: auto; padding: 12px; border: 1px solid rgba(54,201,145,.12); border-radius: 10px; color: var(--green); background: rgba(54,201,145,.04); }
.mail-security p { margin: 0; color: var(--muted); font-size: 8px; }
.mail-security b { color: #c9cacd; }
.mail-list-panel { padding-right: 0; padding-left: 0; overflow: hidden; }
.mail-list-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 0 18px 16px; }
.mail-list-head h3 { margin: 4px 0 0; font-size: 14px; }
.mail-list { border-top: 1px solid var(--line-soft); }
.mail-list > .skeleton { margin: 12px 18px; }
.mail-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; padding: 14px 17px; border: 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); background: transparent; text-align: left; cursor: pointer; }
.mail-row:hover, .mail-row.active { background: rgba(255,255,255,.02); }
.mail-row.unread { color: var(--text); }
.mail-row-dot { width: 5px; height: 5px; margin-top: 6px; border-radius: 50%; background: transparent; }
.mail-row.unread .mail-row-dot { background: var(--red-bright); }
.mail-row-copy { min-width: 0; display: flex; flex-direction: column; }
.mail-row-copy strong, .mail-row-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.mail-row-copy b { margin-top: 3px; font-weight: 500; }
.mail-row-copy span { overflow: hidden; color: var(--muted-2); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.mail-row time { color: var(--muted-2); font-size: 8px; }
.mail-reader { min-width: 0; }
.empty-state { min-height: 300px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted-2); }
.empty-state > span { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 13px; font-size: 18px; }
.empty-state h3 { margin: 12px 0 2px; color: #b9bac0; font-size: 12px; }
.empty-state p { margin: 0; font-size: 9px; }
.message-head { padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.message-head h3 { margin: 7px 0 12px; font-size: 19px; line-height: 1.3; }
.message-meta { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 9px; }
.message-meta div { display: flex; flex-direction: column; }
.message-meta b { color: #d1d1d5; }
.message-body { min-height: 250px; padding: 22px 2px; color: #d6d6da; font-size: 11px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.attachment-list a { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--blue); font-size: 9px; }
.knowledge-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(420px, 1.2fr); gap: 13px; }
.knowledge-search { max-width: none; margin-bottom: 16px; }
.knowledge-list { display: flex; flex-direction: column; margin: 0 -20px -20px; }
.knowledge-row { padding: 15px 20px; border: 0; border-top: 1px solid var(--line-soft); color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.knowledge-row:hover, .knowledge-row.active { background: rgba(255,255,255,.02); }
.knowledge-row h4 { margin: 0 0 4px; font-size: 11px; }
.knowledge-row p { margin: 0; color: var(--muted); font-size: 9px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tag { padding: 2px 6px; border-radius: 8px; color: var(--red-bright); background: var(--red-soft); font-size: 7px; }
.knowledge-reader h2 { margin: 6px 0; font-size: 23px; letter-spacing: -.03em; }
.knowledge-reader .article-summary { color: var(--muted); font-size: 10px; }
.article-body { padding-top: 20px; color: #d0d0d4; line-height: 1.75; white-space: pre-wrap; font-size: 11px; }
.article-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.article-options label { grid-template-columns: 90px 1fr; }
.nested-form { display: flex; flex-direction: column; gap: 12px; }
.nested-form label { align-items: center; flex-direction: row; }
.nested-form .primary-button { align-self: flex-end; margin-top: 4px; }
.account-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.account-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 7px; padding: 7px 0; }
.account-row > span { min-width: 0; display: flex; flex-direction: column; }
.account-row b { overflow: hidden; font-size: 9px; text-overflow: ellipsis; }
.account-row small { overflow: hidden; color: var(--muted-2); font-size: 7px; text-overflow: ellipsis; }
.account-row select { height: 28px; font-size: 8px; }
.mini-button { padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #0d0e12; font-size: 7px; cursor: pointer; }
.mini-button:hover { color: var(--text); }

@media (max-width: 1150px) {
  .kpi-grid, .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mail-layout { grid-template-columns: 190px 1fr; }
  .mail-reader { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); box-shadow: 30px 0 70px rgba(0,0,0,.5); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .main { grid-column: auto; }
  .mobile-menu { display: grid; }
  .overview-grid, .moderation-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .knowledge-layout { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  .search { max-width: none; }
  .filter-pills { overflow-x: auto; min-height: 37px; }
  .filter-pills button { min-width: fit-content; }
}
@media (max-width: 620px) {
  .topbar { height: 72px; padding: 0 16px; }
  .content { padding: 30px 16px 50px; }
  .topbar-title p, .top-avatar, .command-button kbd, .demo-pill { display: none; }
  .topbar-title h1 { font-size: 14px; }
  .command-button { width: 34px; padding: 0; justify-content: center; font-size: 0; }
  .command-button span { font-size: 15px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .kpi-grid, .team-grid, .ticket-list { grid-template-columns: 1fr; }
  .team-hero { grid-template-columns: 1fr 1fr; gap: 20px; padding: 24px; }
  .team-hero > div:first-child { grid-column: 1 / -1; }
  .team-hero-metric { min-width: 0; padding-left: 0; border: 0; }
  .panel { padding: 16px; }
  .audit-list, .table-wrap { margin-right: -16px; margin-left: -16px; }
  .settings-card label { align-items: flex-start; flex-direction: column; gap: 6px; }
  .settings-card input:not([type="checkbox"]), .input-suffix { width: 100%; }
  .check-row { flex-direction: row !important; align-items: center !important; }
  .settings-actions { align-items: stretch; flex-direction: column; gap: 14px; }
  .mail-layout { grid-template-columns: 1fr; }
  .mail-reader { grid-column: auto; }
  .compose-form label, .article-form > label { grid-template-columns: 1fr; gap: 5px; }
  .article-options { grid-template-columns: 1fr; }
  .article-options label { grid-template-columns: 1fr; gap: 5px; }
  .compose-actions { align-items: stretch; flex-direction: column; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}
.wide-field { grid-column: 1 / -1; }
.bot-config-grid { margin: 20px 0; }
.question-row {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr .6fr .6fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
}
.category-config-row {
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.category-config-row:hover { border-color: var(--red); }
.category-config-row small { display: block; color: var(--muted); margin-top: 4px; }
.permission-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
  align-items: center;
}
.danger-button {
  border: 1px solid #8d2f35;
  color: #ff8b91;
  background: rgba(180, 40, 50, .12);
  border-radius: 10px;
  padding: 10px 14px;
}
label small { color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .compact-grid, .question-row { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
}
