:root {
  --accent: #ee3a34;
  --accent-dark: #d92d27;
  --accent-soft: #fff0ec;
  --accent-fade: #ffd5cb;
  --surface: #f5f7fb;
  --surface-soft: #fbfcff;
  --surface-strong: #eef2f8;
  --card: #ffffff;
  --line: #e5e9f3;
  --ink: #171d2f;
  --muted: #6e778d;
  --success: #16a34a;
  --warning: #f59e0b;
  --shadow: 0 24px 60px rgba(27, 33, 57, 0.12);
  --shadow-soft: 0 12px 28px rgba(27, 33, 57, 0.08);
  --shadow-popover: 0 28px 60px rgba(15, 23, 42, 0.18);
  --focus-ring: 0 0 0 4px rgba(238, 58, 52, 0.14);
  --radius-lg: 32px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --sidebar-width: 320px;
  --right-rail-width: 340px;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(238, 58, 52, 0.08), transparent 30%),
    linear-gradient(135deg, #fff8f6 0%, #f5f7fb 42%, #edf2f9 100%);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(142, 154, 180, 0.68) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(185, 195, 213, 0.95) 0%, rgba(142, 154, 180, 0.92) 100%);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(160, 171, 192, 1) 0%, rgba(119, 132, 160, 1) 100%);
  background-clip: padding-box;
}

#app {
  min-height: 100vh;
  height: 100dvh;
}

@media (min-width: 1181px) {
  body {
    overflow: hidden;
  }
}

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

button,
a,
input,
textarea,
select {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.16s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none !important;
  box-shadow: none !important;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.status-banner {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 14px 18px;
  border-radius: 999px;
  background: rgba(23, 29, 47, 0.92);
  color: white;
  box-shadow: var(--shadow);
  max-width: min(760px, calc(100vw - 36px));
}

.status-banner.error {
  background: rgba(217, 45, 39, 0.95);
}

.status-banner.success {
  background: rgba(22, 163, 74, 0.95);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 24, 38, 0.44);
  backdrop-filter: blur(10px);
  animation: overlayFadeIn 0.18s ease;
}

.modal-card {
  width: min(100%, 520px);
  padding: 24px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(238, 58, 52, 0.08), transparent 36%),
    rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 30px 70px rgba(16, 22, 40, 0.22);
  position: relative;
  overflow: hidden;
  animation: modalRiseIn 0.2s ease;
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, rgba(238, 58, 52, 0.95) 0%, rgba(255, 138, 102, 0.55) 100%);
}

.modal-head h3 {
  margin: 16px 0 8px;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.modal-field {
  margin-top: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.knowledge-detail-dialog {
  display: grid;
  gap: 14px;
}

.knowledge-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.knowledge-detail-updated {
  margin-top: -4px !important;
}

.knowledge-detail-content {
  max-height: min(42dvh, 360px);
  overflow: auto;
  padding: 16px 18px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--ink);
  line-height: 1.8;
  white-space: pre-wrap;
}

.knowledge-detail-structured {
  display: grid;
  gap: 14px;
  white-space: normal;
}

.knowledge-detail-section {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.knowledge-detail-section h4 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.knowledge-detail-section-body {
  display: grid;
  gap: 10px;
}

.knowledge-detail-section-body p,
.knowledge-detail-section-body ul,
.knowledge-detail-section-body ol {
  margin: 0;
  color: var(--muted);
  line-height: 1.85;
}

.knowledge-detail-section-body ul,
.knowledge-detail-section-body ol {
  padding-left: 1.25rem;
}

.knowledge-detail-section-body li + li {
  margin-top: 6px;
}

.knowledge-detail-highlight {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff7f4 0%, #fffdfb 100%);
  border: 1px solid rgba(238, 58, 52, 0.12);
}

.knowledge-detail-highlight.secondary {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-color: rgba(59, 130, 246, 0.12);
}

.knowledge-detail-highlight strong,
.knowledge-detail-highlight p {
  margin: 0;
}

.knowledge-detail-highlight p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.knowledge-detail-image {
  margin-top: 0;
}

.knowledge-detail-actions {
  justify-content: space-between;
}

.knowledge-detail-file-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-shell {
  min-height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(500px, 1.05fr) minmax(620px, 1fr);
  overflow: hidden;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 56px 56px 42px;
  color: white;
  background:
    radial-gradient(circle at bottom right, rgba(176, 22, 16, 0.3), transparent 28%),
    linear-gradient(160deg, #f13b34 0%, #ea302a 65%, #d7261f 100%);
}

.hero-panel::before,
.hero-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.hero-panel::before {
  width: 240px;
  height: 240px;
  right: -40px;
  bottom: -60px;
}

.hero-panel::after {
  width: 120px;
  height: 120px;
  left: -20px;
  top: 72%;
}

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark,
.sidebar-brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.brand-mark::before,
.sidebar-brand-mark::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid white;
  border-radius: 8px;
  transform: rotate(12deg);
}

.sidebar-brand-mark {
  width: 50px;
  height: 50px;
}

.brand-copy h1,
.sidebar-brand-copy strong {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-copy p,
.sidebar-brand-copy span {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.sidebar-brand-copy span {
  color: rgba(255, 255, 255, 0.72);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pill.light {
  background: rgba(255, 255, 255, 0.12);
}

.pill.soft {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(238, 58, 52, 0.12);
}

.hero-body {
  margin-top: clamp(28px, 5vh, 72px);
  max-width: 760px;
  display: grid;
  gap: 16px;
  flex: 1;
}

.hero-headline {
  margin: 10px 0 4px;
  font-size: clamp(2.4rem, 3.2vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 900;
}

.hero-description {
  margin: 0;
  max-width: 640px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero-metrics {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 840px;
}

.metric-card {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.metric-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.metric-label {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.92rem;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 24px 28px;
  min-height: 0;
}

.auth-panel-inner {
  width: min(100%, 700px);
}

.lang-switch {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  margin-bottom: 16px;
  color: #97a0b4;
  font-weight: 700;
}

.lang-switch .active {
  color: var(--ink);
  padding: 2px 6px;
  border: 2px solid #1a73e8;
  border-radius: 8px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 34px;
  padding: 30px 34px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  max-height: min(88dvh, 760px);
  overflow: auto;
}

.auth-card h2 {
  margin: 22px 0 10px;
  font-size: 2.4rem;
  letter-spacing: -0.04em;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.65;
}

.form-error-message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(220, 38, 38, 0.16);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.96), rgba(254, 226, 226, 0.88));
  color: #b91c1c;
  font-weight: 700;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 10px;
}

.field > label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #556074;
}

.field > label::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(238, 58, 52, 0.96), rgba(255, 120, 96, 0.9));
  box-shadow: 0 0 0 4px rgba(238, 58, 52, 0.12);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 8px 18px rgba(17, 24, 39, 0.035);
}

.field select,
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 48px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #7f8aa3 50%),
    linear-gradient(135deg, #7f8aa3 50%, transparent 50%),
    radial-gradient(circle at 100% 50%, rgba(238, 58, 52, 0.08), rgba(238, 58, 52, 0.02) 56%, transparent 57%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 255, 0.95));
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 14px) calc(50% - 2px),
    calc(100% - 1px) 0,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    54px 100%,
    100% 100%;
  background-repeat: no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 8px 18px rgba(17, 24, 39, 0.04);
}

select option {
  color: var(--ink);
  background: #fff;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(238, 58, 52, 0.52);
  box-shadow: var(--focus-ring);
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: rgba(133, 146, 171, 0.36);
}

.checkbox-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
  background: #fff;
}

.checkbox-field label {
  margin: 0;
}

.checkbox-field input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.inline-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.96rem;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: none;
  border-radius: 20px;
  padding: 14px 18px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #ff544b 100%);
  color: white;
  border: 1px solid rgba(188, 34, 28, 0.1);
  box-shadow: 0 16px 28px rgba(238, 58, 52, 0.24);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  color: var(--ink);
  border: 1px solid rgba(109, 123, 150, 0.2);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.ghost-button {
  background: linear-gradient(180deg, rgba(255, 243, 239, 0.96) 0%, rgba(255, 236, 230, 0.92) 100%);
  color: var(--accent);
  border: 1px solid rgba(238, 58, 52, 0.12);
  box-shadow: 0 10px 22px rgba(238, 58, 52, 0.08);
}

.danger-button {
  background: linear-gradient(180deg, #fff3f2 0%, #ffe6e4 100%);
  color: #c72720;
  border: 1px solid rgba(199, 39, 32, 0.14);
  box-shadow: 0 10px 22px rgba(199, 39, 32, 0.08);
}

.demo-box {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--surface);
  border-radius: 18px;
  color: var(--muted);
}

.demo-box strong {
  color: var(--ink);
}

.app-shell {
  min-height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  overflow: hidden;
}

.sidebar {
  padding: 20px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 26%),
    linear-gradient(180deg, #ef3a34 0%, #de2d27 60%, #c9241d 100%);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-card {
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.sidebar-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.65;
}

.sidebar-actions {
  display: grid;
  gap: 12px;
}

.sidebar button {
  width: 100%;
}

.sidebar-nav-card {
  display: grid;
  gap: 12px;
  flex: 0 0 auto;
}

.sidebar-nav-head p {
  margin: 6px 0 0;
}

.sidebar-nav-list {
  display: grid;
  gap: 10px;
  overflow: visible;
}

.sidebar-nav-button {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  text-align: left;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.sidebar-nav-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.sidebar-nav-button:focus-visible {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.14);
}

.sidebar-nav-button strong,
.sidebar-nav-button small {
  display: block;
}

.sidebar-nav-button strong {
  font-size: 0.96rem;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  vertical-align: middle;
}

.sidebar-nav-button small {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
}

.sidebar-nav-button.active {
  background: white;
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.4);
}

.sidebar-nav-button.active small {
  color: var(--muted);
}

.sidebar-nav-button.active .nav-badge {
  background: rgba(238, 58, 52, 0.12);
  color: var(--accent);
}

.conversation-subtle {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.84rem;
}

.main-stage {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 1.85rem;
  letter-spacing: -0.04em;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.notification-shell {
  position: relative;
}

.topbar-icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(23, 29, 47, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.topbar-icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(238, 58, 52, 0.2);
  background: #fff6f3;
  box-shadow: 0 14px 28px rgba(238, 58, 52, 0.12);
}

.topbar-icon-button:focus-visible {
  box-shadow: var(--focus-ring);
}

.topbar-icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-bell-button {
  position: relative;
}

.notification-bell-button.has-unread {
  border-color: rgba(238, 58, 52, 0.24);
  background: #fff5f3;
  color: #c62828;
}

.notification-shell.open .notification-bell-button {
  border-color: rgba(238, 58, 52, 0.28);
  background: linear-gradient(180deg, #fff7f5 0%, #fff1ed 100%);
  color: var(--accent);
  box-shadow: 0 16px 32px rgba(238, 58, 52, 0.16);
}

.topbar-icon-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff544b 100%);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(238, 58, 52, 0.24);
}

.notification-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 48px));
  padding: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-popover);
  backdrop-filter: blur(12px);
  z-index: 25;
  overflow: hidden;
  animation: dropdownReveal 0.18s ease;
}

.notification-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 18px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.notification-popover-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, rgba(255, 250, 249, 0.92) 0%, rgba(255, 255, 255, 0.8) 100%);
}

.notification-popover-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notification-popover-head strong {
  font-size: 1rem;
}

.notification-popover-head span {
  color: var(--muted);
  font-size: 0.9rem;
}

.notification-popover-head small {
  color: var(--muted);
  line-height: 1.5;
}

.notification-popover-list {
  display: grid;
  gap: 10px;
  max-height: min(48dvh, 420px);
  overflow: auto;
  padding-right: 4px;
}

.notification-item {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.notification-item:hover {
  transform: translateY(-1px);
  border-color: rgba(238, 58, 52, 0.24);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.notification-item:focus-visible {
  outline: none;
  border-color: rgba(238, 58, 52, 0.52);
  box-shadow: 0 0 0 4px rgba(238, 58, 52, 0.12);
}

.notification-item-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.notification-item-head strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.notification-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.notification-item small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.notification-empty {
  padding: 20px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  text-align: center;
  color: var(--muted);
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 700;
}

.chip {
  background: linear-gradient(180deg, #fff 0%, #f9fbff 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.chip.attention {
  background: #fff7ed;
  border-color: rgba(234, 88, 12, 0.18);
  color: #c2410c;
}

.chip.danger {
  background: #fff1f2;
  border-color: rgba(225, 29, 72, 0.18);
  color: #be123c;
}

.chip-button {
  cursor: pointer;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.info {
  background: #eff6ff;
  color: #1d4ed8;
}

.badge.warning {
  background: #fff4df;
  color: #9a6800;
}

.badge.success {
  background: #ecfdf3;
  color: #157a42;
}

.surface-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  gap: 16px;
  overflow: hidden;
}

.user-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, var(--right-rail-width));
}

.admin-grid {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(238, 58, 52, 0.14), rgba(255, 255, 255, 0.7));
  pointer-events: none;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.panel-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1.28rem;
}

.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.conversation-title-block {
  display: grid;
  gap: 12px;
}

.conversation-title-copy h2 {
  margin: 0;
}

.conversation-title-copy p {
  margin: 8px 0 0;
}

.conversation-title-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.conversation-title-controls input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.conversation-title-controls input:focus {
  border-color: rgba(238, 58, 52, 0.52);
  box-shadow: 0 0 0 4px rgba(238, 58, 52, 0.12);
}

.conversation-title-controls button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.status-inline-banner {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #f8fbff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.status-inline-banner strong {
  display: block;
  margin-bottom: 4px;
}

.status-inline-banner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.status-inline-banner.warning {
  background: #fff7ed;
  border-color: rgba(245, 158, 11, 0.24);
}

.status-inline-banner.danger {
  background: #fff1f2;
  border-color: rgba(225, 29, 72, 0.2);
}

.chat-stream {
  padding: 18px 18px;
  overflow: auto;
  display: grid;
  gap: 14px;
  align-content: start;
}

.message {
  max-width: 84%;
  padding: 14px 14px 12px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(23, 29, 47, 0.05);
}

.message.user {
  margin-left: auto;
  background: linear-gradient(135deg, #fff3f0 0%, #ffe9e4 100%);
  border-color: rgba(238, 58, 52, 0.15);
}

.message.assistant {
  background: #fff;
}

.message.admin {
  border-color: rgba(32, 133, 255, 0.18);
  background: linear-gradient(135deg, #f4f8ff 0%, #edf5ff 100%);
}

.message.system {
  max-width: 100%;
  background: #f4f7fb;
  color: var(--muted);
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.message-body {
  line-height: 1.8;
  white-space: pre-wrap;
}

.message-attachment {
  margin-top: 14px;
}

.message-ai-insight {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f6fbff 0%, #ffffff 100%);
  border: 1px solid rgba(59, 130, 246, 0.12);
  display: grid;
  gap: 6px;
}

.message-ai-insight strong,
.message-ai-insight p,
.message-ai-insight small {
  margin: 0;
}

.message-ai-insight p,
.message-ai-insight small {
  color: var(--muted);
  line-height: 1.6;
}

.message-attachment img {
  width: 100%;
  max-width: 360px;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.message-actions button {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font-weight: 700;
}

.message-action-button {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.message-action-button.speak {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
}

.message-action-button.stop {
  background: linear-gradient(135deg, #fff1f0 0%, #ffe0dc 100%);
  border-color: rgba(220, 38, 38, 0.18);
  color: #b91c1c;
}

.message-action-button.positive {
  background: linear-gradient(135deg, #ecfdf3 0%, #d1fae5 100%);
  border-color: rgba(22, 163, 74, 0.18);
  color: #15803d;
}

.message-action-button.caution {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: rgba(234, 88, 12, 0.18);
  color: #c2410c;
}

.message-action-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(23, 29, 47, 0.08);
}

.composer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, white 100%);
}

.composer-shell {
  padding: 12px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: white;
}

.composer-shell textarea {
  width: 100%;
  min-height: 72px;
  border: none;
  resize: vertical;
  outline: none;
}

.composer-status-row {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.voice-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.voice-status-card.active {
  background: #fff7f5;
  border-color: rgba(238, 58, 52, 0.16);
}

.voice-status-card.listening {
  background: #fff2ee;
  border-color: rgba(238, 58, 52, 0.24);
}

.voice-status-card.thinking {
  background: #fff8ef;
  border-color: rgba(245, 158, 11, 0.24);
}

.voice-status-card.speaking {
  background: #f2f7ff;
  border-color: rgba(37, 99, 235, 0.22);
}

.voice-status-card.rearming {
  background: #f7f8fc;
  border-color: rgba(110, 119, 141, 0.2);
}

.voice-status-indicator {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #a0a8ba;
  box-shadow: 0 0 0 0 rgba(160, 168, 186, 0.3);
}

.voice-status-indicator.listening {
  background: var(--accent);
  animation: voicePulse 1.2s ease-in-out infinite;
}

.voice-status-indicator.thinking {
  background: var(--warning);
  animation: voicePulse 1.5s ease-in-out infinite;
}

.voice-status-indicator.speaking {
  background: #2563eb;
  animation: voiceWave 1s ease-in-out infinite;
}

.voice-status-indicator.rearming {
  background: #6e778d;
  animation: voiceBlink 1.1s linear infinite;
}

.voice-status-copy {
  display: grid;
  gap: 2px;
}

.voice-status-copy strong {
  font-size: 0.88rem;
  color: var(--ink);
}

.voice-status-copy small {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.8rem;
}

.composer-inline-note,
.admin-reply-restriction {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff8ef 0%, #fff4df 100%);
  border: 1px solid rgba(245, 158, 11, 0.16);
  color: #9a6800;
  font-size: 0.84rem;
  line-height: 1.55;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-reply-composer {
  display: grid;
  gap: 10px;
}

.admin-reply-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, #fbfcff 100%);
}

.admin-reply-shell textarea {
  width: 100%;
  min-height: 48px;
  max-height: 160px;
  border: none;
  resize: vertical;
  outline: none;
  background: transparent;
  line-height: 1.6;
}

.admin-reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.composer-icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(23, 29, 47, 0.1);
}

.composer-icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-icon-button.attachment {
  color: #2563eb;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: rgba(37, 99, 235, 0.18);
}

.composer-icon-button.send {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #ff5b50 100%);
  border-color: transparent;
  box-shadow: 0 14px 24px rgba(238, 58, 52, 0.22);
}

.composer-icon-button.send svg {
  fill: currentColor;
  stroke: none;
}

.voice-toggle-button {
  min-width: 112px;
  height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.voice-toggle-button.active {
  background: linear-gradient(135deg, #fff1f0 0%, #ffdcd5 100%);
  border-color: rgba(238, 58, 52, 0.24);
  color: var(--accent);
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalRiseIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dropdownReveal {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes voicePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(238, 58, 52, 0.28);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 9px rgba(238, 58, 52, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(238, 58, 52, 0);
  }
}

@keyframes voiceWave {
  0%,
  100% {
    transform: scaleY(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.18);
  }
  50% {
    transform: scaleY(1.35);
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0);
  }
}

@keyframes voiceBlink {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.attachment-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--surface);
  margin-bottom: 12px;
}

.admin-attachment-preview {
  margin-bottom: 0;
}

.stack {
  display: grid;
  gap: 16px;
}

.context-panel {
  padding: 0;
  overflow: hidden;
}

.context-panel-body {
  padding: 14px;
  overflow: auto;
  display: grid;
  gap: 14px;
}

.dashboard-panel {
  display: grid;
  gap: 14px;
}

.dashboard-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.admin-dashboard-stack > * {
  min-width: 0;
}

.dashboard-screen {
  min-height: 0;
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  padding-right: 2px;
  padding-bottom: 28px;
}

.dashboard-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: visible;
  align-content: start;
  min-width: 0;
}

.dashboard-stage > * {
  min-width: 0;
}

.user-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.user-full-dashboard-stats {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.split-layout.dashboard-wide-grid,
.dashboard-grid-2,
.dashboard-visual-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  align-items: start;
}

.user-stat-card {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.04);
  display: grid;
  gap: 6px;
  min-width: 0;
}

.user-stat-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.user-stat-card strong {
  font-size: clamp(1.05rem, 1.2vw, 1.18rem);
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trend-card {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
}

.dashboard-summary-card {
  min-height: 220px;
}

.dashboard-summary-card-accent {
  background: linear-gradient(180deg, #ffffff 0%, #fff7f4 100%);
}

.dashboard-summary-card-warning {
  background: linear-gradient(180deg, #ffffff 0%, #fff9f1 100%);
}

.dashboard-summary-card-info {
  background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
}

.business-kpi-card {
  min-height: 180px;
}

.business-kpi-card.warning {
  background: linear-gradient(180deg, #ffffff 0%, #fff9f1 100%);
}

.business-kpi-card.info {
  background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
}

.business-kpi-value {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.report-snapshot-card {
  min-height: 100%;
}

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

.report-snapshot-metrics div {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.report-snapshot-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.report-snapshot-metrics strong {
  display: block;
  margin-top: 6px;
}

.dashboard-summary-body {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  min-height: 118px;
}

.dashboard-summary-value {
  font-size: clamp(3rem, 6vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--ink);
}

.dashboard-summary-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.trend-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.dashboard-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.trend-card-copy {
  min-width: 0;
}

.dashboard-section-copy {
  min-width: 0;
}

.trend-card-copy h3 {
  margin: 0;
}

.dashboard-section-copy h3 {
  margin: 0;
}

.trend-card-copy .subtle {
  margin: 6px 0 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dashboard-section-copy .subtle {
  margin: 6px 0 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 182px;
}

.trend-bar-column {
  display: grid;
  gap: 8px;
  align-items: end;
  justify-items: center;
  min-width: 0;
}

.trend-bar-value {
  min-height: 1em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.trend-bar-track {
  width: 100%;
  height: 124px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f3f6fb 0%, #e9eef6 100%);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.trend-bar-fill {
  position: absolute;
  inset: auto 0 0;
  border-radius: 999px;
  min-height: 0;
}

.trend-bar-fill.accent {
  background: linear-gradient(180deg, #ff8c74 0%, #ee3a34 100%);
}

.trend-bar-fill.info {
  background: linear-gradient(180deg, #7fb3ff 0%, #2563eb 100%);
}

.trend-bar-label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.distribution-list {
  display: grid;
  gap: 12px;
}

.distribution-row {
  display: grid;
  gap: 8px;
  align-content: start;
}

.distribution-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.distribution-head strong {
  font-size: 0.94rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.distribution-head span {
  color: var(--muted);
  font-size: 0.86rem;
  flex: 0 0 auto;
  text-align: right;
}

.distribution-user-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  flex: 1 1 220px;
}

.distribution-user-copy small {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-scroll-body {
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.dashboard-card {
  display: block;
  overflow: visible;
}

.dashboard-stage .dashboard-card,
.dashboard-stage .meta-card,
.dashboard-stage .trend-card {
  overflow: visible;
}

.dashboard-stage .admin-list,
.dashboard-stage .user-conversation-list,
.dashboard-stage .table-grid,
.dashboard-stage .knowledge-list,
.dashboard-stage .distribution-list {
  max-height: none !important;
  overflow: visible !important;
}

.admin-layout.dashboard-screen {
  grid-template-columns: minmax(0, 1fr);
}

.distribution-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f1f5fb 0%, #e7edf6 100%);
  overflow: hidden;
}

.distribution-fill {
  height: 100%;
  border-radius: inherit;
}

.distribution-fill.accent {
  background: linear-gradient(90deg, #ff8c74 0%, #ee3a34 100%);
}

.distribution-fill.info {
  background: linear-gradient(90deg, #7fb3ff 0%, #2563eb 100%);
}

.user-tab-card {
  display: grid;
  gap: 12px;
}

.user-tab-head h3 {
  margin: 0;
}

.user-tab-head p {
  margin: 6px 0 0;
}

.user-tab-list {
  display: grid;
  gap: 10px;
}

.user-tab-button {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.user-tab-button:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.user-tab-button:focus-visible {
  box-shadow: var(--focus-ring);
}

.user-tab-button strong,
.user-tab-button small {
  display: block;
}

.user-tab-button strong {
  font-size: 0.96rem;
}

.user-tab-button small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.user-tab-button .nav-badge {
  background: rgba(29, 78, 216, 0.1);
  color: #1d4ed8;
}

.user-tab-button.active {
  background: linear-gradient(135deg, #fff4f1 0%, #ffe8e2 100%);
  border-color: rgba(238, 58, 52, 0.2);
  box-shadow: 0 10px 24px rgba(238, 58, 52, 0.08);
}

.user-tab-button.active .nav-badge {
  background: rgba(238, 58, 52, 0.12);
  color: var(--accent);
}

.meta-card,
.source-card,
.quick-card,
.admin-section {
  padding: 16px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--line);
  min-height: 0;
  min-width: 0;
}

.source-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(72dvh, 760px);
  overflow: hidden;
}

.admin-section {
  overflow: auto;
}

.admin-detail {
  overflow: hidden;
}

.admin-status-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.compact-field {
  min-width: 220px;
  flex: 0 1 260px;
}

.status-note {
  margin-top: 6px !important;
  font-size: 0.92rem;
}

.subtle-inline {
  color: var(--muted);
  font-size: 0.94em;
}

.meta-card h3,
.source-card h3,
.quick-card h3,
.admin-section h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta-row span:last-child {
  text-align: right;
  color: var(--muted);
}

.source-list,
.quick-list,
.stats-grid,
.admin-list {
  display: grid;
  gap: 12px;
}

.source-list {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.user-conversation-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  max-height: min(62dvh, 620px);
  overflow: auto;
}

.user-conversation-list.dashboard-scroll-body {
  margin-top: 0;
  max-height: min(48dvh, 460px);
}

.user-conversation-item {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid transparent;
  cursor: pointer;
}

.user-conversation-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-soft);
}

.user-conversation-item:focus-visible {
  box-shadow: var(--focus-ring);
}

.user-conversation-item.active {
  border-color: rgba(238, 58, 52, 0.22);
  background: white;
}

.user-conversation-item strong {
  font-size: 0.96rem;
}

.user-conversation-preview {
  margin-top: 10px !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.7em * 2);
}

.user-conversation-meta {
  margin-top: 10px;
  color: var(--muted) !important;
}

.source-item {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
}

.source-item-button {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.source-item-button:hover {
  transform: translateY(-1px);
  border-color: rgba(238, 58, 52, 0.26);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.source-item-button:focus-visible {
  outline: none;
  border-color: rgba(238, 58, 52, 0.52);
  box-shadow: 0 0 0 4px rgba(238, 58, 52, 0.12);
}

.source-item strong,
.quick-list button {
  display: block;
}

.source-item p,
.source-item small {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.source-excerpt {
  font-size: 0.92rem;
}

.source-file-hint {
  display: block;
}

.source-image {
  width: 100%;
  margin-top: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.quick-list button {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  color: var(--ink);
}

.quick-list button:hover,
.icon-button:hover,
.voice-toggle-button:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-soft);
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-grid.user-full-dashboard-stats {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.admin-dashboard-stats {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.stat-card {
  padding: 22px;
  border-radius: 26px;
  background: white;
  border: 1px solid var(--line);
  min-width: 0;
}

.stat-card-mini {
  padding: 18px 18px 16px;
}

.stat-card-accent {
  background: linear-gradient(180deg, #ffffff 0%, #fff7f4 100%);
}

.stat-card-warning {
  background: linear-gradient(180deg, #ffffff 0%, #fff9f1 100%);
}

.stat-card strong {
  display: block;
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.stat-card span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.admin-layout {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding-right: 2px;
}

.split-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  min-height: 0;
}

.admin-list {
  max-height: 720px;
  overflow: auto;
}

.admin-list.dashboard-scroll-body {
  max-height: min(48dvh, 460px);
}

.admin-filter-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(251, 252, 255, 0.98) 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.admin-filter-card.collapsed {
  gap: 10px;
}

.admin-filter-card:not(.collapsed) .admin-filter-collapsed-summary {
  display: none;
}

.admin-filter-card.collapsed .admin-filter-grid {
  display: none;
}

.admin-filter-collapsed-summary {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.admin-filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.admin-filter-field {
  min-width: 0;
  flex: initial;
}

.admin-filter-field label {
  font-size: 0.88rem;
}

.admin-filter-summary {
  margin-top: 4px !important;
}

.admin-assignee-note {
  flex: 1 1 320px;
  align-self: end;
}

.admin-list-item {
  padding: 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid transparent;
  cursor: pointer;
}

.admin-list-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-soft);
}

.admin-list-item:focus-visible {
  box-shadow: var(--focus-ring);
}

.admin-list-item.active {
  border-color: rgba(238, 58, 52, 0.22);
  background: white;
}

.admin-list-item h4,
.admin-detail h4 {
  margin: 0 0 8px;
}

.admin-list-head {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.admin-list-owner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px !important;
}

.admin-list-owner strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.admin-list-owner span {
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-list-item p,
.admin-detail p,
.subtle {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.admin-list-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.7em * 2);
}

.admin-list-meta {
  align-items: start;
  gap: 10px;
}

.admin-list-meta span:last-child {
  text-align: right;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.toolbar .group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.knowledge-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 460px);
  min-height: 0;
}

.knowledge-list {
  display: grid;
  gap: 14px;
  max-height: 760px;
  overflow: auto;
  min-height: 0;
}

.knowledge-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid transparent;
}

.user-card {
  padding: 18px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid transparent;
}

.knowledge-suggestion-card.muted {
  opacity: 0.78;
}

.knowledge-card:hover,
.user-card:hover,
.table-row:hover {
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-soft);
}

.user-card.active {
  background: white;
  border-color: rgba(238, 58, 52, 0.22);
  box-shadow: 0 12px 24px rgba(238, 58, 52, 0.08);
}

.knowledge-card h4 {
  margin: 0 0 10px;
}

.knowledge-card-head {
  align-items: flex-start;
}

.knowledge-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-card h4 {
  margin: 0 0 10px;
}

.knowledge-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.user-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.knowledge-suggestion-reason {
  margin-top: 12px !important;
}

.suggestion-badges {
  margin-top: 12px;
}

.knowledge-suggestion-excerpt {
  margin-top: 12px;
}

.knowledge-suggestion-excerpt strong {
  display: block;
  margin-bottom: 8px;
}

.knowledge-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.knowledge-card-actions {
  margin-top: 2px;
}

.knowledge-preview {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 255, 0.92) 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.knowledge-preview-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}

.knowledge-preview-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.knowledge-preview-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.knowledge-preview-body p {
  margin: 0;
  color: #4c556c;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.knowledge-preview-more {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.user-card-actions {
  margin-top: 14px;
}

.table-grid {
  display: grid;
  gap: 12px;
  align-content: start;
}

.settings-inline-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.handoff-summary-card {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fffaf5 0%, #ffffff 100%);
  border: 1px solid rgba(245, 158, 11, 0.16);
  display: grid;
  gap: 14px;
}

.handoff-summary-lead {
  margin: 0;
  font-weight: 700;
  line-height: 1.7;
}

.handoff-summary-grid {
  display: grid;
  gap: 12px;
}

.progress-strip {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f1f5fb 0%, #e7edf6 100%);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
}

.progress-fill.success {
  background: linear-gradient(90deg, #3bb273 0%, #0f8b51 100%);
}

.progress-fill.warning {
  background: linear-gradient(90deg, #f59e0b 0%, #ea580c 100%);
}

.progress-fill.danger {
  background: linear-gradient(90deg, #fb7185 0%, #e11d48 100%);
}

.table-row {
  padding: 16px 18px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--line);
  min-width: 0;
}

.table-row strong,
.table-row p,
.table-row span {
  overflow-wrap: anywhere;
}

.ai-usage-conversation-list,
.ai-usage-call-list {
  min-height: 0;
}

.ai-usage-conversation-card {
  width: 100%;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 12px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.ai-usage-conversation-card:hover {
  transform: translateY(-1px);
  border-color: rgba(238, 58, 52, 0.22);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.ai-usage-conversation-card.active {
  background: white;
  border-color: rgba(238, 58, 52, 0.28);
  box-shadow: 0 16px 30px rgba(238, 58, 52, 0.08);
}

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

.ai-usage-summary-grid div {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 4px;
}

.ai-usage-summary-grid span {
  color: var(--muted);
  font-size: 0.82rem;
}

.ai-usage-summary-grid strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.ai-usage-summary-grid-detail {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-usage-footnote {
  margin-top: -4px !important;
}

.ai-usage-call-row {
  display: grid;
  gap: 12px;
}

.ai-usage-inline-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.ai-usage-inline-metrics strong {
  color: var(--ink);
  margin-left: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.empty-state h3 {
  margin: 0 0 10px;
  color: var(--ink);
}

.muted {
  color: var(--muted);
}

.divider {
  width: 100%;
  height: 1px;
  background: var(--line);
}

@media (max-height: 860px) and (min-width: 1181px) {
  .hero-panel {
    padding: 34px 36px 28px;
  }

  .brand-mark,
  .sidebar-brand-mark {
    transform: scale(0.9);
    transform-origin: left center;
  }

  .hero-headline {
    font-size: clamp(2.1rem, 2.8vw, 3.2rem);
  }

  .hero-description {
    font-size: 0.94rem;
  }

  .metric-card {
    padding: 14px 16px;
  }

  .metric-value {
    font-size: 1.9rem;
  }

  .topbar p,
  .panel-header p {
    display: none;
  }
}

@media (max-width: 1500px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-usage-summary-grid-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1400px) {
  .user-grid {
    grid-template-columns: 1fr;
  }

  .context-panel {
    grid-template-rows: auto 1fr;
  }

  .user-dashboard-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-full-dashboard-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .trend-card-head,
  .dashboard-section-head {
    grid-template-columns: 1fr;
  }

  .trend-card-head .badge,
  .dashboard-section-head .badge {
    justify-self: start;
  }
}

@media (max-width: 1480px) {
  .admin-layout.dashboard-screen .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .login-shell,
  .app-shell,
  .admin-filter-grid,
  .knowledge-grid,
  .split-layout,
  .stats-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .hero-body {
    margin-top: 64px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .ai-usage-summary-grid,
  .ai-usage-summary-grid-detail {
    grid-template-columns: 1fr;
  }

  .user-dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-full-dashboard-stats,
  .dashboard-wide-grid,
  .settings-inline-grid {
    grid-template-columns: 1fr;
  }

  .trend-bars {
    gap: 6px;
  }

  .sidebar {
    min-height: auto;
    overflow: visible;
  }

  .main-stage,
  .surface-grid,
  .app-shell {
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .knowledge-preview-row {
    grid-template-columns: 1fr;
  }

  .knowledge-preview-label {
    width: max-content;
  }

  .user-dashboard-stats,
  .user-full-dashboard-stats {
    grid-template-columns: 1fr;
  }
}
