@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Sora:wght@300;400;500;600;700&family=Special+Elite&display=swap");

/* =========
   Theme
   ========= */
:root {
  --topbar-h: 66px;
  --footer-h: 72px;
  --bg-main: #edf4ff;
  --bg-ink: #0b1426;
  --bg-panel: #f6f9ff;
  --bg-panel-alt: #edf3ff;
  --border: #cdd8ee;
  --shadow: 0 8px 18px rgba(12, 26, 48, 0.12);
  --shadow-soft: 0 4px 10px rgba(12, 26, 48, 0.08);
  --primary: #1e3a8a;
  --primary-dark: #0f1f5f;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #e6efff;
  --teal: #3b82f6;
  --teal-dark: #1e40af;
  --coral: #93c5fd;
  --coral-dark: #60a5fa;
  --gold: #dbeafe;
  --muted: #4b5a73;
  --muted-soft: #7f8ea8;
  --radius: 18px;
  --radius-sm: 14px;
  --btn-radius: 6px;
  --btn-radius-lg: 8px;
  --font-main: "Sora", "Avenir Next", "Trebuchet MS", sans-serif;
  --font-display: "Playfair Display", "Georgia", serif;
  --font-typewriter: "Special Elite", "Courier New", serif;
  --panel-bg: #f4fbf7;
  --panel-border: rgba(30, 58, 138, 0.16);
  --card-bg: #ffffff;
  --card-border: rgba(200, 214, 240, 0.8);
  --chat-surface: #ffffff;
  --chat-scroll-bg: transparent;
  --chat-bot-bg: #fdfefe;
  --chat-bot-border: rgba(30, 64, 175, 0.12);
  --chat-bot-shadow: 0 10px 18px rgba(30, 64, 175, 0.08);
  --chat-bot-border-kb: #16a34a;
  --chat-bot-border-web: #2563eb;
  --chat-bot-border-mixed: #f59e0b;
  --chat-user-bg: linear-gradient(135deg, #e6efff 0%, #d7e7ff 100%);
  --chat-user-border: rgba(37, 99, 235, 0.2);
  --chat-user-shadow: 0 12px 20px rgba(37, 99, 235, 0.12);
  --typing-bg: linear-gradient(135deg, #edf4ff 0%, #f4f8ff 55%, #e1ecff 100%);
  --typing-border: rgba(37, 99, 235, 0.3);
  --typing-dot: #2563eb;
}

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

.is-hidden,
.hidden {
  display: none;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-main);
  color: var(--bg-ink);
  background: linear-gradient(135deg, #e8f1ff 0%, #eef5ff 45%, #ffffff 100%);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body {
  min-height: 100svh;
}

body::before {
  content: "";
  position: fixed;
  inset: -15%;
  background:
    radial-gradient(circle at 12% 20%, rgba(37, 99, 235, 0.16), transparent 45%),
    radial-gradient(circle at 82% 16%, rgba(59, 130, 246, 0.24), transparent 42%),
    radial-gradient(circle at 88% 85%, rgba(147, 197, 253, 0.24), transparent 45%);
  z-index: -2;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* =========
   Top bar
   ========= */
.top-bar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  background: linear-gradient(90deg, #0f1f5f 0%, #1b48ab 52%, #2d6df1 100%);
  border-bottom: 1px solid rgba(147, 197, 253, 0.35);
  box-shadow: 0 18px 30px rgba(8, 18, 40, 0.35), inset 0 -1px 0 rgba(147, 197, 253, 0.25);
  color: #f8fafc;
  position: relative;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.top-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(147, 197, 253, 0), rgba(147, 197, 253, 0.85), rgba(147, 197, 253, 0));
  opacity: 0.7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-lg {
  width: 22px;
  height: 22px;
}

.brand-logo {
  width: 130px;
  height: 44px;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 6px 10px rgba(2, 6, 23, 0.3));
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #2f3f6b);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.2);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-left: 0;
  text-align: left;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.top-bar .brand-title {
  color: #f8fafc;
}

.brand-title span {
  color: var(--accent);
}

.top-bar .brand-title span {
  color: #7fc2ff;
}

.brand-title.typewriter {
  --typewriter-chars: 18;
  font-family: var(--font-typewriter);
  font-size: 20px;
  letter-spacing: 0.09em;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  width: calc(var(--typewriter-chars) * 1.1ch);
  animation: typewriter 2.6s steps(var(--typewriter-chars)) 0.3s both;
  text-shadow: 0 6px 14px rgba(2, 6, 23, 0.4);
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.top-bar .brand-subtitle {
  color: rgba(226, 232, 240, 0.85);
}

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: calc(var(--typewriter-chars) * 1.1ch);
  }
}


.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.top-account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid rgba(148, 197, 253, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.top-account-name {
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-link {
  border: 1px solid rgba(148, 197, 253, 0.45);
  background: rgba(15, 23, 42, 0.2);
  color: #f8fafc;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.top-link:hover,
.top-link:focus-visible {
  transform: translateY(-1px);
  background: rgba(15, 23, 42, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.theme-toggle {
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  padding: 7px 14px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  box-shadow: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  line-height: 1;
}

.backend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid rgba(248, 250, 252, 0.65);
  background: #c9c9c9;
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.2);
}

.backend-online {
  background: #33d69f;
  border-color: #1fa675;
}

.backend-error {
  background: #ff8080;
  border-color: #c24c4c;
}

/* =========
   Layout
   ========= */
.app-root {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  min-height: calc(100svh - var(--topbar-h) - var(--footer-h));
  padding: clamp(12px, 2vw, 18px) clamp(12px, 3vw, 20px) clamp(16px, 3vw, 22px);
  width: 100%;
  display: flex;
  overflow-x: hidden;
  overflow-y: auto;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.app-footer {
  min-height: var(--footer-h);
  padding: 14px 28px 18px;
  background: linear-gradient(90deg, #f7fff7 0%, #eef8e8 60%, #fff6d4 100%);
  border-top: 1px solid rgba(15, 59, 31, 0.12);
  box-shadow: 0 -10px 20px rgba(15, 59, 31, 0.08);
  transition: filter 0.2s ease, opacity 0.2s ease;
}

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

.footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-text {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.65);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.footer-logo {
  width: 120px;
  height: 32px;
  object-fit: contain;
}

.footer-right {
  text-align: right;
  color: rgba(15, 23, 42, 0.9);
}

.footer-title {
  font-size: 13px;
  font-weight: 700;
}

.footer-subtitle {
  font-size: 11px;
  color: rgba(15, 23, 42, 0.6);
}

.app-shell {
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  display: grid;
  gap: clamp(12px, 2vw, 18px);
  grid-template-columns: minmax(240px, 1fr) minmax(360px, 1.7fr) minmax(240px, 1fr);
  grid-template-areas: "sources chat kb";
  align-items: stretch;
  grid-auto-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.panel {
  background: var(--panel-bg);
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  z-index: 1;
  min-height: 0;
  height: 100%;
  animation: panelRise 0.5s ease both;
}

.panel:hover,
.panel:focus-within {
  z-index: 60;
}

.panel::before {
  content: none;
}

.panel-left,
.panel-kb {
  padding: 0;
  overflow: visible;
}

.panel-right {
  padding: 0;
  min-width: 0;
  min-height: 0;
}

.panel-left {
  grid-area: sources;
}

.panel-kb {
  grid-area: kb;
  z-index: 2;
  background: var(--panel-bg);
  border-color: var(--panel-border);
  box-shadow: var(--shadow);
}

.panel-right {
  grid-area: chat;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.left-scroll,
.kb-scroll {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  overflow: auto;
  min-height: 0;
  min-width: 0;
}

.kb-scroll {
  overflow-y: auto;
  padding-bottom: 24px;
  background: transparent;
}

.left-title {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  position: relative;
}

.left-title::before {
  content: "";
  display: none;
}

.left-title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 20%;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(42, 123, 255, 0.55), rgba(42, 123, 255, 0));
}

.doc-list-title,
.chat-title,
.doc-status-title,
.about-card-title,
.modal-title,
.status-title {
  position: relative;
  display: inline-flex;
  padding-bottom: 6px;
}

.doc-list-title::after,
.chat-title::after,
.doc-status-title::after,
.about-card-title::after,
.modal-title::after,
.status-title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 40%;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(25, 38, 80, 0.6), rgba(25, 38, 80, 0));
}

.chat-title::after {
  right: 20%;
  background: linear-gradient(90deg, rgba(42, 123, 255, 0.55), rgba(42, 123, 255, 0));
}

/* =========
   Cards / Blocks
   ========= */
.upload-card,
.doc-list-card,
.doc-status-block {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);
  overflow: visible;
}

.doc-list-card {
  position: relative;
}

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

.settings-block .setting-group {
  min-width: 0;
}

.settings-block select {
  width: 100%;
}

.settings-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 8px;
  margin-top: 0;
  margin-bottom: 0;
}

.settings-inline label {
  font-size: 9px;
}

.settings-inline select {
  font-size: 11px;
  padding: 6px 8px;
}

.chat-settings-card {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f6ff 100%);
  border: 1px solid rgba(59, 130, 246, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.chat-settings-title {
  font-size: 11px;
  font-weight: 800;
  color: #6b7280;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.chat-settings-card .chat-controls-inline {
  background: rgba(255, 255, 255, 0.9);
}

.web-mode-block {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 58, 138, 0.06);
  border: 1px solid rgba(30, 58, 138, 0.12);
}

.web-mode-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.web-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #0f172a;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.web-mode-option span {
  line-height: 1.2;
}

.web-mode-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

.web-mode-suboptions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 22px;
  margin-top: 4px;
}

.web-mode-radio {
  font-weight: 600;
  color: #1e293b;
}

.web-mode-option input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

.web-mode-option input[disabled] + span {
  opacity: 0.55;
}

.chat-input-shell {
  background: transparent;
  border-radius: 0;
  border: none;
  padding: 0;
  box-shadow: none;
  margin-top: auto;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.chat-controls-inline {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.chat-controls-inline .setting-group label {
  margin-bottom: 4px;
  padding-bottom: 2px;
  letter-spacing: 0.06em;
}

.chat-controls-inline .setting-group label::after {
  width: 18px;
  height: 1px;
}

.chat-controls-inline .setting-group select {
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 10px;
  box-shadow: none;
}

.mode-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 58, 138, 0.06);
  border: 1px solid rgba(30, 58, 138, 0.12);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.mode-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-swatch {
  width: 16px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid transparent;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
}

.mode-swatch-kb {
  border-color: var(--chat-bot-border-kb);
  background: rgba(22, 163, 74, 0.12);
}

.mode-swatch-web {
  border-color: var(--chat-bot-border-web);
  background: rgba(37, 99, 235, 0.12);
}

.mode-swatch-mixed {
  border-color: var(--chat-bot-border-mixed);
  background: rgba(245, 158, 11, 0.12);
}
.upload-top-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.upload-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--primary);
  border: none;
  gap: 6px;
  flex-direction: column;
}

.upload-icon svg {
  color: var(--primary);
}

.upload-icon-img,
.upload-icon .icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.upload-main-title {
  font-size: 17px;
  font-weight: 800;
}

.upload-main-subtext {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.upload-main-subtext span {
  color: var(--accent);
  font-weight: 700;
}

.setting-group label {
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-bottom: 4px;
  position: relative;
}

.setting-group label::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 26px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(25, 38, 80, 0.65), rgba(25, 38, 80, 0));
}

.input-wrapper {
  flex: 1;
  background: linear-gradient(180deg, #ffffff 0%, #edf4ff 100%);
  border-radius: 14px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  display: flex;
  align-items: stretch;
  padding: 6px 10px;
  min-width: 0;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.input-wrapper:focus-within {
  border-color: rgba(31, 111, 255, 0.45);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08), 0 8px 18px rgba(31, 111, 255, 0.12);
}

.setting-group select,
.input-wrapper input,
.input-wrapper textarea {
  width: 100%;
  border-radius: 10px;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  font-family: var(--font-main);
  padding: 8px 6px;
  outline: none;
}

.setting-group select {
  border: 1px solid rgba(30, 58, 138, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 9px;
}

.input-wrapper input,
.input-wrapper textarea {
  border: none;
  background: transparent;
}

.input-wrapper textarea {
  resize: none;
  line-height: 1.45;
  min-height: 40px;
  max-height: 40px;
  height: 40px;
  overflow-y: auto;
  font-family: var(--font-main);
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
}

.upload-middle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-top: 12px;
  align-items: center;
}

.upload-middle .setting-group {
  grid-column: 1 / -1;
}

.upload-middle .btn-with-info {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.upload-middle .btn-with-info .btn {
  flex: 1;
}

.setting-group-inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-group-inline label {
  margin-bottom: 0;
}

.setting-group-inline select {
  min-height: 36px;
  padding: 10px 16px;
  line-height: 1.1;
}

.btn {
  border-radius: var(--btn-radius);
  border: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f6ff 100%);
  color: var(--bg-ink);
  text-decoration: none;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  line-height: 1.1;
  min-height: 36px;
}

.panel-kb .btn,
.panel-kb select {
  height: 40px;
  min-height: 40px;
}

.panel-kb select {
  padding: 8px 12px;
}

.panel-kb .btn {
  padding: 0 16px;
}

.btn-with-info {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  white-space: normal;
  z-index: 1;
  width: 100%;
}

.select-with-info {
  width: 100%;
}

.btn-with-info .btn {
  width: 100%;
  justify-content: center;
}

.btn-with-info .file-btn {
  flex: 1;
}

.file-btn {
  background: linear-gradient(135deg, #ffffff 0%, #e8f1ff 100%);
  border: 1px solid rgba(37, 99, 235, 0.32);
  box-shadow: 0 14px 24px rgba(37, 99, 235, 0.16);
  color: #1e3a8a;
  letter-spacing: 0.01em;
}

.file-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.2);
}

.btn-with-info:hover,
.btn-with-info:focus-within {
  z-index: 80;
}

.info-button {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #1f1f1f;
  background: linear-gradient(145deg, #2f2f2f, #1f1f1f);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  z-index: 2;
}

.info-button .info-letter {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-1px);
}

.info-button::before,
.info-button::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.info-button::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 10px);
  right: 0;
  left: auto;
  transform: translateY(4px);
  background: linear-gradient(135deg, rgba(16, 24, 40, 0.98), rgba(8, 12, 24, 0.98));
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 11.5px;
  line-height: 1.3;
  width: max-content;
  max-width: 220px;
  text-align: left;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.25);
  z-index: 120;
  white-space: normal;
}

.info-button::before {
  content: "";
  bottom: calc(100% + 4px);
  right: 10px;
  left: auto;
  transform: none;
  border-width: 6px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
  z-index: 119;
}

.info-button.is-below::after {
  top: calc(100% + 10px);
  bottom: auto;
  transform: translateY(-4px);
}

.info-button.is-below::before {
  top: calc(100% + 4px);
  bottom: auto;
  border-color: transparent transparent #0f172a transparent;
}

.info-button:hover,
.info-button:focus-visible {
  color: #fff;
  border-color: #111827;
  background: linear-gradient(145deg, #3a3a3a, #232323);
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.14);
}

.info-button:hover::before,
.info-button:hover::after,
.info-button:focus::before,
.info-button:focus::after,
.info-button:focus-visible::before,
.info-button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg,
.theme-toggle svg {
  stroke-width: 1.8;
}

.btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.28);
}

.btn-danger {
  background: linear-gradient(135deg, #fee2e2, #fca5a5);
  border-color: rgba(239, 68, 68, 0.4);
  color: #9f1239;
}

.btn-ghost {
  background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
  border-color: rgba(37, 99, 235, 0.25);
  color: #1d4ed8;
}

.btn:hover,
.theme-toggle:hover,
.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.14);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

.btn.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn .icon,
.icon-btn .icon-img {
  width: 28px;
  height: 28px;
}

.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 4px;
}

.icon-img {
  display: block;
  object-fit: contain;
  width: 100%;
  height: 100%;
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: none;
}

.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.icon-btn-ghost {
  background: transparent;
}

.icon-btn-danger {
  color: #b91c1c;
  background: transparent;
}

.icon-btn-sm {
  width: 40px;
  height: 40px;
  border-radius: 9px;
}

.icon-btn-sm .icon,
.icon-btn-sm .icon-img {
  width: 30px;
  height: 30px;
}

.icon-btn-tight .icon,
.icon-btn-tight .icon-img {
  width: 24px;
  height: 24px;
}

.file-btn input[type="file"] {
  display: none;
}

.file-btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.file-name {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.upload-row-full {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.file-name.is-hidden {
  display: none;
}

.upload-popup-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  z-index: 120;
}

.upload-popup {
  width: min(980px, 94vw);
  height: 560px;
  background: linear-gradient(180deg, #fefeff 0%, #f3f7ff 100%);
  border-radius: 18px;
  border: 1px solid rgba(25, 38, 80, 0.12);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  position: relative;
  transition: width 0.25s ease, height 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.upload-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-popup-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-popup-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.upload-popup-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.upload-popup-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.upload-popup-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-popup-control {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #fff;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.upload-popup-control:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  border-color: rgba(47, 107, 255, 0.4);
}

.upload-popup-control:active {
  transform: translateY(0);
  box-shadow: var(--shadow-soft);
}

.upload-popup-control .control-icon {
  width: 18px;
  height: 18px;
}

.upload-popup-control .control-icon svg {
  width: 18px;
  height: 18px;
}

.upload-popup-control .control-icon.restore {
  display: none;
}

.upload-popup-close {
  border-radius: 999px;
}

.upload-popup-close.hidden {
  display: none;
}

.upload-popup-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.upload-popup-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.upload-popup-list {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(72px, auto);
  gap: 10px;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 6px 4px 2px;
}

.upload-popup-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 6px;
}

.upload-popup-row {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  align-items: stretch;
  padding: 12px 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  position: relative;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.upload-popup-row.is-active {
  border-color: rgba(47, 107, 255, 0.45);
  box-shadow: 0 16px 28px rgba(47, 107, 255, 0.18);
}

.upload-popup-row.is-done {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
  color: #1d4ed8;
}

.upload-popup-row.is-error {
  border-color: rgba(220, 38, 38, 0.4);
  background: #fef2f2;
  color: #b91c1c;
}

.upload-popup-row.is-done .upload-popup-file-status-text,
.upload-popup-row.is-done .upload-popup-file-status-percent {
  color: #1d4ed8;
}

.upload-popup-row.is-error .upload-popup-file-status-text,
.upload-popup-row.is-error .upload-popup-file-status-percent {
  color: #b91c1c;
}

.upload-popup-file-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.upload-popup-file-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 255, 0.9);
  display: grid;
  place-items: center;
}

.upload-popup-file-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.upload-popup-file-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-popup-file-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.upload-popup-file-status-text {
  font-weight: 600;
  color: var(--primary);
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-popup-file-status-percent {
  font-weight: 700;
  color: var(--primary);
  margin-left: auto;
}

.upload-popup-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.upload-popup-badge.hidden {
  display: none;
}

.upload-popup-loader {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px dashed rgba(37, 99, 235, 0.55);
  border-top-color: #2563eb;
  border-right-color: rgba(37, 99, 235, 0.2);
  animation: uploadSpin 0.9s linear infinite;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(224, 236, 255, 0.75));
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.35);
}

.upload-popup-loader::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(37, 99, 235, 0.25);
  animation: uploadSpinReverse 1.6s linear infinite;
}

.upload-popup-loader::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.45), transparent 70%);
  animation: uploadGlow 1.1s ease-in-out infinite;
}


.upload-popup-loader.hidden {
  display: none;
}


.upload-popup-remove {
  position: relative;
  top: auto;
  right: auto;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.7);
  background: rgba(255, 232, 232, 0.95);
  color: #b91c1c;
  font-size: 18px;
  line-height: 0.8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(248, 113, 113, 0.2);
}

.upload-popup-remove.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.upload-popup-progress-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-popup-progress-label {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  max-width: 200px;
}

.upload-popup-mini {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.upload-popup-mini-label {
  font-size: 11px;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-popup-mini-percent {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
}

.upload-popup-backdrop.is-minimized {
  background: transparent;
  backdrop-filter: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 18px 18px 0;
  pointer-events: none;
}

.upload-popup-backdrop.is-minimized .upload-popup {
  pointer-events: auto;
}

.upload-popup.is-minimized {
  width: min(420px, 94vw);
  height: 72px;
  padding: 10px 12px;
  gap: 8px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
  border-radius: 14px;
}

.upload-popup.is-minimized .upload-popup-subtitle,
.upload-popup.is-minimized .upload-popup-toolbar,
.upload-popup.is-minimized .upload-popup-list {
  display: none;
}

.upload-popup.is-minimized .upload-popup-mini {
  display: inline-flex;
}

.upload-popup.is-minimized .upload-popup-control .control-icon.maximize {
  display: none;
}

.upload-popup.is-minimized .upload-popup-control .control-icon.restore {
  display: inline-flex;
}

.upload-popup.is-maximized {
  width: min(1200px, 98vw);
  height: min(82vh, 860px);
}

.upload-popup.is-maximized .upload-popup-control .control-icon.maximize {
  display: none;
}

.upload-popup.is-maximized .upload-popup-control .control-icon.restore {
  display: inline-flex;
}

.upload-progress-orbit {
  --progress: 0;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: conic-gradient(#3b82f6 calc(var(--progress) * 1%), rgba(148, 163, 184, 0.18) 0);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.14);
  animation: pulseHalo 1.8s ease-in-out infinite;
}

.upload-progress-orbit::before {
  content: none;
}

.upload-progress-orbit::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.upload-progress-orbit span {
  position: relative;
  font-weight: 800;
  font-size: 12px;
  color: var(--primary);
  z-index: 1;
}

.upload-popup-file-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.upload-popup-file-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 55%, #60a5fa 100%);
  transition: width 0.25s ease;
}

.doc-status-block {
  background: linear-gradient(135deg, rgba(233, 241, 255, 0.95), rgba(248, 250, 255, 0.98));
  border: 1px dashed rgba(47, 107, 255, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-status-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-soft);
}

.doc-status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.doc-status-id {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: var(--teal-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.doc-status-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.doc-status-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-status-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  overflow-wrap: anywhere;
}

.doc-status-summary {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  max-height: 4.6em;
  overflow: hidden;
}

.doc-status-hint {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px dashed rgba(47, 107, 255, 0.2);
  padding-top: 8px;
}

.btn-mini {
  padding: 7px 12px;
  font-size: 12px;
  min-height: 30px;
}

/* =========
   Doc list
   ========= */
.doc-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-list-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.doc-list-title {
  font-size: 13px;
  font-weight: 800;
}

.doc-list-subtitle {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.doc-list-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 8px;
}

.sort-menu {
  position: absolute;
  right: 16px;
  top: 88px;
  width: 220px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(231, 238, 255, 0.98));
  border: 1px solid rgba(16, 35, 71, 0.12);
  box-shadow: 0 18px 32px rgba(11, 20, 38, 0.18);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 90;
}

.sort-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.sort-menu-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}

.sort-menu-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.sort-menu-row label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.sort-menu-row select {
  width: 100%;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(16, 35, 71, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
  font-weight: 600;
}

.sort-menu-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.doc-head-select .select-all {
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  white-space: nowrap;
}

.doc-row-head .doc-head-select .select-all {
  position: static;
  transform: none;
}

.select-all.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.doc-action-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.doc-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  container-type: inline-size;
}

.doc-list-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 2px;
}

.doc-row {
  display: grid;
  grid-template-columns: 28px minmax(140px, 1fr) minmax(160px, 220px);
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
  border: 1px solid rgba(30, 58, 138, 0.12);
  box-shadow: 0 10px 16px rgba(15, 23, 42, 0.06);
  min-width: 0;
}

.doc-row-head {
  grid-template-columns: minmax(120px, 170px) minmax(140px, 1fr) minmax(160px, 220px);
  column-gap: 16px;
  background: linear-gradient(90deg, rgba(226, 232, 255, 0.5), rgba(226, 232, 255, 0.2));
  border: 1px solid rgba(30, 58, 138, 0.08);
  box-shadow: none;
  padding: 6px 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-soft);
  font-size: 10px;
  font-weight: 800;
}

.doc-row-head .doc-cell-actions {
  justify-content: center;
  justify-self: center;
  min-width: 0;
  padding-right: 0;
}

.doc-head-select {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  min-height: 20px;
  min-width: 0;
}

.doc-head-file {
  padding-left: 0;
  padding-right: 24px;
  min-width: 0;
  justify-self: end;
  text-align: right;
}

.doc-row-head .doc-head-select .select-all {
  letter-spacing: 0.1em;
}

.doc-head-select .select-all span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-head-actions {
  text-align: center;
  padding-right: 0;
}

.doc-cell {
  min-width: 0;
}

.doc-cell-select {
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-file {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.doc-type-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #1e3a8a;
  flex-shrink: 0;
}

.doc-type-icon .icon,
.doc-type-icon .icon-img {
  width: 38px;
  height: 38px;
}

.doc-type-icon.pdf {
  color: #1d4ed8;
}

.doc-type-icon.audio {
  color: #0e7490;
}

.doc-file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.doc-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 4ch;
  max-width: 28ch;
}

.doc-id {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(31, 42, 74, 0.12);
  border: 1px solid rgba(31, 42, 74, 0.25);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.doc-tag.audio {
  background: rgba(47, 107, 255, 0.16);
  border-color: rgba(47, 107, 255, 0.35);
  color: var(--accent-dark);
}

.doc-tag.archived {
  background: rgba(148, 163, 184, 0.3);
  border-color: rgba(71, 85, 105, 0.5);
  color: #334155;
  font-weight: 700;
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.doc-cell-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-self: end;
  min-width: 0;
  padding-right: 4px;
}

@container (max-width: 560px) {
  .doc-row {
    grid-template-columns: 26px minmax(0, 1fr) minmax(132px, 160px);
    grid-template-rows: auto;
    row-gap: 6px;
    padding: 10px 12px;
  }
  .doc-cell-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
  }
  .doc-row-head {
    display: grid;
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  .doc-head-file {
    padding-left: 40px;
  }
  .doc-head-actions {
    text-align: right;
  }
  .doc-cell-actions {
    gap: 4px;
  }
  .doc-action-bar .icon-btn,
  .doc-cell-actions .icon-btn,
  .doc-cell-actions .icon-btn-sm {
    width: 30px;
    height: 30px;
  }
  .doc-action-bar .icon-btn .icon,
  .doc-action-bar .icon-btn .icon-img,
  .doc-cell-actions .icon-btn .icon,
  .doc-cell-actions .icon-btn .icon-img,
  .doc-cell-actions .icon-btn-sm .icon,
  .doc-cell-actions .icon-btn-sm .icon-img {
    width: 18px;
    height: 18px;
  }
}

.doc-action-bar .icon-btn,
.doc-cell-actions .icon-btn,
.doc-cell-actions .icon-btn-sm {
  width: clamp(30px, 5.2vw, 40px);
  height: clamp(30px, 5.2vw, 40px);
}

.doc-action-bar .icon-btn .icon,
.doc-action-bar .icon-btn .icon-img,
.doc-cell-actions .icon-btn .icon,
.doc-cell-actions .icon-btn .icon-img,
.doc-cell-actions .icon-btn-sm .icon,
.doc-cell-actions .icon-btn-sm .icon-img {
  width: clamp(18px, 3.8vw, 28px);
  height: clamp(18px, 3.8vw, 28px);
}

.doc-row.is-archived {
  opacity: 0.92;
}

.doc-row.is-active {
  border-color: rgba(30, 58, 138, 0.12);
  box-shadow: 0 10px 16px rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
}

.modal-audio-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-audio-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  overflow-wrap: anywhere;
}

.modal-audio-wrap audio {
  width: 100%;
}


/* =========
   Chat
   ========= */
.chat-panel-header {
  margin: 0 0 6px;
  padding: 12px 18px 4px;
  border-bottom: none;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  flex: 0 0 auto;
}

.chat-title {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary);
  overflow-wrap: anywhere;
}

.chat-subtitle {
  font-size: 12px;
  color: #4b5563;
  overflow-wrap: anywhere;
}

.chat-main {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  border-radius: 0;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
  gap: 6px;
  padding: 0 18px 0;
}

@media (min-width: 961px) {
  .app-shell {
    min-height: 100%;
  }
  .panel {
    height: 100%;
  }
  .panel-right {
    min-height: 0;
  }
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: none;
  scrollbar-gutter: stable;
}

.chat-message {
  max-width: 80%;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  background: var(--chat-bot-bg);
  box-shadow: var(--chat-bot-shadow);
  border: 3px solid var(--chat-bot-border);
  overflow-wrap: anywhere;
  position: relative;
  animation: bubbleIn 0.24s ease-out;
  transform-origin: left bottom;
}

.chat-message::before {
  content: "";
  position: absolute;
  width: 26px;
  height: 14px;
  left: 10px;
  top: -7px;
  background: inherit;
  border: 1px solid var(--chat-bot-border);
  border-bottom: none;
  border-right: none;
  transform: skewX(-20deg);
  border-top-left-radius: 8px;
}

.chat-message.bot {
  background: var(--chat-bot-bg);
  box-shadow: var(--chat-bot-shadow);
}

.chat-message.bot[data-mode="kb"] {
  border-color: var(--chat-bot-border-kb);
}

.chat-message.bot[data-mode="web_fallback"] {
  border-color: var(--chat-bot-border-web);
}

.chat-message.bot[data-mode="global"] {
  border-color: var(--chat-bot-border-web);
}

.chat-message.bot[data-mode="kb_plus_web"] {
  border-color: var(--chat-bot-border-mixed);
}

.chat-message.bot[data-mode="kb_combined"] {
  border-color: var(--chat-bot-border-mixed);
}

.chat-message.bot[data-mode="open"] {
  border-color: transparent;
}

.chat-message.bot[data-mode="kb"]::before {
  border-color: var(--chat-bot-border-kb);
}

.chat-message.bot[data-mode="web_fallback"]::before {
  border-color: var(--chat-bot-border-web);
}

.chat-message.bot[data-mode="global"]::before {
  border-color: var(--chat-bot-border-web);
}

.chat-message.bot[data-mode="kb_plus_web"]::before {
  border-color: var(--chat-bot-border-mixed);
}

.chat-message.bot[data-mode="kb_combined"]::before {
  border-color: var(--chat-bot-border-mixed);
}

.chat-message.bot[data-mode="open"]::before {
  border-color: transparent;
}


.chat-message.bot.is-thinking {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.chat-message.bot.is-thinking::before {
  content: none;
}

.chat-message.bot.is-thinking .chat-meta {
  margin-bottom: 4px;
}

.chat-message.user {
  margin-left: auto;
  background: var(--chat-user-bg);
  color: #0f172a;
  border: 3px solid var(--chat-user-border);
  box-shadow: var(--chat-user-shadow);
  border-radius: 14px;
  transform-origin: right bottom;
}

.chat-message.voice {
  background: var(--chat-user-bg);
  color: #0f172a;
  border: 1px solid var(--chat-user-border);
  box-shadow: var(--chat-user-shadow);
}

.chat-message.user::after,
.chat-message.voice::after {
  content: none;
}

.chat-message.user::before,
.chat-message.voice::before {
  left: auto;
  right: 10px;
  top: -7px;
  border: 1px solid var(--chat-user-border);
  border-bottom: none;
  border-left: none;
  transform: skewX(20deg);
}

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

.chat-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.chat-message.bot .chat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-meta-label {
  font-weight: 600;
}

.chat-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(15, 23, 42, 0.06);
  color: #1f2937;
}

.chat-mode-badge[data-mode="web_fallback"] {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.chat-mode-badge[data-mode="kb_plus_web"] {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.18);
  color: #047857;
}

.chat-mode-badge[data-mode="kb"] {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.18);
  color: #15803d;
}

.chat-mode-badge[data-mode="global"] {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
}

.chat-mode-badge[data-mode="kb_combined"] {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.chat-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-message.user .chat-meta {
  color: rgba(15, 23, 42, 0.7);
}

.chat-edit-btn,
.chat-retry-btn {
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(1px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-edit-btn svg,
.chat-retry-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.8;
}

.chat-message.user:hover .chat-edit-btn,
.chat-message.user:hover .chat-retry-btn,
.chat-message.user.is-editing .chat-edit-btn {
  opacity: 0.9;
  transform: translateY(0);
}

.chat-edit-controls {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-edit-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(30, 58, 138, 0.22);
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.9);
  resize: vertical;
  min-height: 52px;
}

.chat-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.voice-transcript {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: #0f172a;
  word-break: break-word;
}

.chat-audio {
  margin-top: 6px;
  width: 100%;
}

.chat-audio audio {
  width: 100%;
}

.chat-sources {
  margin-top: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px dashed rgba(30, 58, 138, 0.2);
  background: rgba(249, 250, 251, 0.7);
}

.chat-sources-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.chat-sources-list {
  display: grid;
  gap: 6px;
}

.chat-source-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-source-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.chat-source-meta {
  font-size: 11px;
  color: var(--muted);
}

.chat-input-bar {
  padding: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-radius: 16px;
  margin-top: 0;
  box-shadow: none;
}

.mic-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, #ffffff, #e5efff);
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mic-button.recording {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.35);
}

.mic-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 24px rgba(15, 23, 42, 0.16);
}

.mic-button svg {
  stroke: currentColor;
}

.chat-reset-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(201, 70, 42, 0.35);
  background: linear-gradient(135deg, #ffffff, #fbe7e3);
  color: #a23921;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(201, 70, 42, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.chat-reset-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 24px rgba(15, 23, 42, 0.16);
}

.chat-reset-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

.chat-reset-button svg {
  stroke: currentColor;
}

.recording-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 4px 0;
  min-height: 0;
}

.recording-hint:empty {
  display: none;
  margin: 0;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  min-height: 40px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

.live-transcript-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.live-transcript-loader.hidden {
  display: none;
}

.live-transcript-dots {
  display: inline-flex;
  gap: 3px;
}

.live-transcript-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: liveTranscriptPulse 1s infinite;
}

.live-transcript-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.live-transcript-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes liveTranscriptPulse {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 0.9;
  }
}

.send-btn .send-icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.voice-upload-row {
  padding: 0 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.voice-file-name {
  font-size: 12px;
  color: var(--muted);
  min-width: 160px;
  overflow-wrap: anywhere;
}

.typing-indicator {
  display: none;
  margin-bottom: 8px;
  margin-right: auto;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--typing-bg);
  border: 1px solid var(--typing-border);
  font-size: 11px;
  color: var(--muted);
  box-shadow: 0 12px 24px rgba(30, 64, 175, 0.18);
  position: relative;
  overflow: hidden;
  animation: thinkingPulse 2.4s ease-in-out infinite;
}

.typing-bubble::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.55) 45%, transparent 80%);
  transform: translateX(-60%);
  animation: typingSheen 1.6s infinite;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--typing-dot);
  opacity: 0.25;
  animation: typingBounce 0.9s infinite;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.12s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes typingBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

@keyframes typingSheen {
  0% {
    transform: translateX(-70%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes thinkingPulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 12px 24px rgba(30, 64, 175, 0.16);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(30, 64, 175, 0.22);
  }
}

/* =========
   Modal
   ========= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 18, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  backdrop-filter: blur(10px);
}

body.modal-open .top-bar,
body.modal-open .app-root,
body.modal-open .app-footer {
  filter: blur(3px);
  opacity: 0.75;
  pointer-events: none;
}

.modal {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 12px;
  padding: 18px 20px 16px;
  max-width: 380px;
  width: 92%;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.28);
  border: 1px solid rgba(23, 34, 59, 0.12);
  position: relative;
}

.modal-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.modal-body {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-footer .btn {
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 11px;
  min-height: 30px;
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.16);
}

.about-modal {
  max-width: 520px;
  width: min(520px, 92vw);
}

.about-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.about-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.about-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-lead {
  font-size: 13px;
  color: #1e293b;
  line-height: 1.55;
  margin: 0;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.about-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1e293b;
  background: linear-gradient(135deg, rgba(191, 219, 254, 0.7), rgba(224, 231, 255, 0.9));
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.about-close {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(23, 34, 59, 0.12);
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.about-card {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  padding: 12px;
}

.about-card-title {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.about-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.about-section {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(59, 130, 246, 0.25);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.8), rgba(248, 250, 255, 0.9));
}

.about-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1e293b;
  margin-bottom: 6px;
}

.about-section p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.about-footer {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.about-meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* =========
   Status modal
   ========= */
.status-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(6, 12, 18, 0.55);
  backdrop-filter: blur(12px);
}

.status-modal {
  background: linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
  border-radius: 14px;
  padding: 20px 22px 18px;
  width: min(420px, 92vw);
  box-shadow: 0 26px 60px rgba(2, 6, 23, 0.3);
  border: 1px solid rgba(23, 34, 59, 0.14);
  text-align: center;
  animation: statusPop 0.35s ease both;
}

.status-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  background: rgba(23, 34, 59, 0.08);
  color: var(--primary);
}

.status-title {
  font-size: 16px;
  font-weight: 700;
}

.status-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  margin: 8px auto 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.status-body {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 10px;
  white-space: pre-line;
}

.status-body::first-line {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.status-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.3);
  overflow: hidden;
  margin: 0 auto 12px;
  width: min(260px, 75%);
}

.status-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.25s ease;
}

.status-close-btn {
  margin-top: 12px;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 700;
}

.status-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.status-loader-upload .upload-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-loader-upload .upload-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.25;
  animation: uploadPulse 1s infinite;
}

.status-loader-upload .upload-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.status-loader-upload .upload-dot:nth-child(3) {
  animation-delay: 0.4s;
}


.loader-ring {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(31, 42, 74, 0.2);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.status-backdrop.status-success .status-icon {
  background: rgba(47, 107, 255, 0.12);
  color: var(--accent);
}

.status-backdrop.status-info .status-icon {
  background: rgba(255, 122, 89, 0.12);
  color: var(--accent);
}

/* =========
   Animations
   ========= */
@keyframes panelRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes uploadPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.25;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

@keyframes uploadSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes uploadSpinReverse {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes uploadGlow {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.05);
  }
}

@keyframes orbitSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseHalo {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.16);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 22px 34px rgba(15, 23, 42, 0.2);
  }
}

/* =========
   Responsive
   ========= */
@media (max-width: 1500px) {
  .app-shell {
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.5fr) minmax(220px, 1fr);
  }
}

@media (min-width: 1281px) {
  .app-shell {
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
  }
  .panel {
    height: 100%;
  }
  .panel-right {
    height: 100%;
  }
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: minmax(300px, 1fr) minmax(0, 1.2fr);
    grid-template-areas:
      "sources chat"
      "kb kb";
    gap: 14px;
    height: auto;
    grid-auto-rows: auto;
  }
  .panel-kb {
    min-height: 0;
  }
  .panel-right {
    overflow: hidden;
  }
}

@media (max-width: 960px) {
  .app-root {
    min-height: auto;
    padding: 10px;
    overflow: visible;
  }
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sources"
      "chat"
      "kb";
  }
  .app-shell {
    height: auto;
    grid-auto-rows: auto;
    max-width: 100%;
    margin: 0;
  }
  .panel {
    height: auto;
    z-index: 1;
  }
  .panel-left,
  .panel-right,
  .panel-kb {
    height: auto;
  }
  .panel-right {
    padding: 0;
    overflow: hidden;
    height: auto;
    min-height: 0;
  }
  .settings-inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .upload-popup-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .left-scroll,
  .kb-scroll,
  .chat-main {
    overflow: visible;
  }
  .chat-scroll {
    overflow-y: auto;
    max-height: none;
  }
  .chat-main {
    height: clamp(260px, 40svh, 480px);
  }
  .panel:hover,
  .panel:focus-within {
    z-index: 1;
  }
}

@media (max-height: 860px) {
  .app-shell {
    height: 100%;
  }
}

@media (max-width: 720px) {
  .app-root {
    padding: 8px;
  }
  .app-shell {
    gap: 14px;
  }
  .left-scroll,
  .kb-scroll {
    padding: 12px;
  }
  .upload-popup-list {
    grid-template-columns: 1fr;
  }
  .panel-right {
    padding: 0;
  }
  .chat-panel-header {
    margin-bottom: 8px;
    padding: 12px 12px 6px;
  }
  .chat-main {
    height: clamp(240px, 45svh, 420px);
    padding: 0 12px 0;
  }
  .doc-row {
    padding: 10px 14px;
  }
}

@media (max-width: 520px) {
  .panel-right {
    overflow: visible;
  }
}

@media (max-height: 720px) {
  .chat-main {
    min-height: 50vh;
  }
}

@media (max-width: 620px) {
  .top-bar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }
  .brand {
    flex: 1 1 100%;
  }
  .brand-logo {
    width: 110px;
    height: 38px;
  }
  .brand-title.typewriter {
    width: auto;
    animation: none;
    white-space: normal;
  }
  .top-right {
    width: 100%;
    justify-content: flex-start;
  }
  .app-root {
    overflow: visible;
  }
  .upload-middle {
    grid-template-columns: 1fr;
  }
  .settings-block {
    grid-template-columns: 1fr;
  }
  .settings-inline {
    grid-template-columns: 1fr;
  }
  .chat-input-bar {
    flex-wrap: wrap;
    align-items: stretch;
    row-gap: 8px;
  }
  .chat-input-bar .mic-button,
  .chat-input-bar .chat-reset-button,
  .chat-input-bar .send-btn {
    flex: 0 0 auto;
  }
  .chat-input-bar .input-wrapper {
    flex: 1 1 100%;
    order: 1;
  }
  .chat-input-bar .mic-button {
    order: 2;
  }
  .chat-input-bar .chat-reset-button {
    order: 3;
  }
  .chat-input-bar .send-btn {
    order: 4;
  }
  .live-transcript-loader {
    width: 100%;
    order: 5;
  }
  .voice-upload-row {
    padding: 0 6px 12px;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .footer-right {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .chat-message {
    max-width: 100%;
  }
  .doc-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .doc-cell-actions {
    justify-content: flex-start;
  }
  .doc-head-actions {
    text-align: left;
  }
  .doc-row-head {
    grid-template-columns: 1fr;
    text-align: left;
  }
}

@media (max-width: 820px) {
  .doc-cell-actions {
    gap: 6px;
    min-width: 140px;
  }
  .icon-btn,
  .icon-btn-sm {
    width: 34px;
    height: 34px;
  }
  .icon-btn .icon,
  .icon-btn .icon-img,
  .icon-btn-sm .icon,
  .icon-btn-sm .icon-img {
    width: 22px;
    height: 22px;
  }
  .icon-btn-tight .icon,
  .icon-btn-tight .icon-img {
    width: 20px;
    height: 20px;
  }
}

/* =========
   Dark theme
   ========= */
body.theme-dark {
  background: radial-gradient(circle at 20% 10%, #1a2438 0%, #0f172a 55%, #0a1120 100%);
  color: #e2e8f0;
  --border: #1f2a3a;
  --muted: #94a3b8;
  --muted-soft: #7c8aa3;
  --panel-bg: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(9, 14, 27, 0.98));
  --panel-border: rgba(59, 130, 246, 0.2);
  --card-bg: linear-gradient(160deg, rgba(15, 23, 42, 0.98), rgba(10, 16, 30, 0.98));
  --card-border: rgba(51, 65, 85, 0.6);
  --chat-surface: linear-gradient(180deg, #0b1324 0%, #0b1120 100%);
  --chat-scroll-bg: radial-gradient(circle at top left, rgba(42, 123, 255, 0.12), transparent 55%);
  --chat-bot-bg: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  --chat-bot-border: rgba(148, 163, 184, 0.22);
  --chat-bot-shadow: 0 16px 28px rgba(2, 6, 23, 0.55);
  --chat-user-bg: linear-gradient(135deg, #273449 0%, #1b2635 100%);
  --chat-user-border: rgba(148, 163, 184, 0.26);
  --chat-user-shadow: 0 18px 32px rgba(2, 6, 23, 0.55);
  --typing-bg: linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(12, 20, 35, 0.98));
  --typing-border: rgba(59, 130, 246, 0.32);
  --typing-dot: #8ab4ff;
}

body.theme-dark::before {
  background:
    radial-gradient(circle at 14% 18%, rgba(56, 189, 248, 0.16), transparent 45%),
    radial-gradient(circle at 82% 20%, rgba(59, 130, 246, 0.2), transparent 45%),
    radial-gradient(circle at 88% 84%, rgba(34, 211, 177, 0.16), transparent 45%);
}

body.theme-dark .panel {
  background: var(--panel-bg);
  border-color: var(--panel-border);
}

body.theme-dark .panel-kb {
  background: var(--panel-bg);
  border-color: var(--panel-border);
  box-shadow: var(--shadow);
}

body.theme-dark .kb-scroll {
  background: transparent;
}

body.theme-dark .upload-card,
body.theme-dark .doc-list-card,
body.theme-dark .doc-status-block {
  background: var(--card-bg);
  border-color: var(--card-border);
}

body.theme-dark .left-title {
  color: #dbeafe;
  text-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
}

body.theme-dark .left-title::before {
  display: none;
}

body.theme-dark .left-title::after {
  background: linear-gradient(90deg, rgba(147, 197, 253, 0.65), rgba(147, 197, 253, 0));
}

body.theme-dark .doc-list-title::after,
body.theme-dark .chat-title::after,
body.theme-dark .doc-status-title::after,
body.theme-dark .about-card-title::after,
body.theme-dark .modal-title::after,
body.theme-dark .status-title::after {
  background: linear-gradient(90deg, rgba(191, 219, 254, 0.6), rgba(191, 219, 254, 0));
}

body.theme-dark .chat-title::after {
  right: 20%;
  background: linear-gradient(90deg, rgba(147, 197, 253, 0.65), rgba(147, 197, 253, 0));
}

body.theme-dark .setting-group label {
  color: #e2e8f0;
}

body.theme-dark .setting-group label::after {
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.55), rgba(226, 232, 240, 0));
}

body.theme-dark .doc-status-name {
  color: #dbeafe;
}

body.theme-dark .doc-status-summary {
  color: #cbd5f5;
}

body.theme-dark .chat-main {
  background: var(--chat-surface);
}

body.theme-dark .chat-message {
  color: #e2e8f0;
}

body.theme-dark .chat-message.user {
  color: #fff;
}

body.theme-dark .chat-sources {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.65);
}

body.theme-dark .chat-source-title {
  color: #e2e8f0;
}

body.theme-dark .chat-input-bar {
  background: #0d1628;
  border-color: #1f2937;
  box-shadow: none;
}

body.theme-dark .chat-controls-inline {
  background: #0d1628;
  border-color: #1f2937;
  box-shadow: none;
}

body.theme-dark .doc-row {
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border-color: rgba(59, 130, 246, 0.18);
}

body.theme-dark .doc-row-head {
  color: rgba(148, 163, 184, 0.8);
}

body.theme-dark .doc-type-icon {
  background: rgba(148, 163, 184, 0.12);
  color: #c7d2fe;
}

body.theme-dark .doc-type-icon.pdf {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}

body.theme-dark .doc-type-icon.audio {
  background: rgba(14, 116, 144, 0.2);
  color: #67e8f9;
}

body.theme-dark .doc-tag {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.32);
  color: #e2e8f0;
}

body.theme-dark .doc-tag.audio {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
}

body.theme-dark .doc-tag.archived {
  background: rgba(71, 85, 105, 0.4);
  border-color: rgba(71, 85, 105, 0.6);
  color: #e2e8f0;
}

body.theme-dark .icon-btn {
  background: transparent;
  border-color: transparent;
  color: #e2e8f0;
  box-shadow: none;
}

body.theme-dark .doc-row-head {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.7));
  border-color: rgba(148, 163, 184, 0.2);
}

body.theme-dark .sort-menu {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(12, 18, 32, 0.98));
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 20px 36px rgba(2, 6, 23, 0.6);
}

body.theme-dark .sort-menu-title {
  color: #dbeafe;
}

body.theme-dark .sort-menu-row label {
  color: #cbd5f5;
}

body.theme-dark .sort-menu-row select {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1f2937;
}

body.theme-dark .icon-btn-danger {
  color: #fecaca;
  border-color: transparent;
  background: transparent;
}

body.theme-dark .input-wrapper,
body.theme-dark .setting-group select,
body.theme-dark .input-wrapper input,
body.theme-dark .input-wrapper textarea {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1f2937;
}

body.theme-dark .input-wrapper input,
body.theme-dark .input-wrapper textarea {
  border: none;
}

body.theme-dark .setting-group select {
  border: 1px solid #1f2937;
}

body.theme-dark .status-modal {
  background: #0f172a;
  border-color: #1f2937;
}

body.theme-dark .status-icon {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

body.theme-dark .info-button {
  border-color: #0f172a;
  background: linear-gradient(145deg, #3a3a3a, #242424);
  color: #fff;
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.45);
}

body.theme-dark .info-button::after {
  background: linear-gradient(135deg, rgba(2, 6, 23, 0.98), rgba(15, 23, 42, 0.98));
  border-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .info-button::before {
  border-color: #0b1220 transparent transparent transparent;
}

body.theme-dark .info-button.is-below::before {
  border-color: transparent transparent #0b1220 transparent;
}

body.theme-dark .top-link {
  border-color: rgba(37, 99, 235, 0.5);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #f8fafc;
}

body.theme-dark .about-modal {
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  border-color: #1f2937;
}

body.theme-dark .about-subtitle,
body.theme-dark .about-meta {
  color: #94a3b8;
}

body.theme-dark .about-lead {
  color: #e2e8f0;
}

body.theme-dark .about-pill {
  color: #e2e8f0;
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.35), rgba(15, 23, 42, 0.7));
  border-color: rgba(148, 163, 184, 0.22);
}

body.theme-dark .about-card {
  background: linear-gradient(180deg, #0b1220 0%, #0a1224 100%);
  border-color: rgba(148, 163, 184, 0.2);
}

body.theme-dark .about-card-title {
  color: #e2e8f0;
}

body.theme-dark .about-card p {
  color: #cbd5f5;
}

body.theme-dark .about-close {
  background: #0b1220;
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

body.theme-dark .about-section {
  border-color: rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.85), rgba(10, 18, 36, 0.9));
}

body.theme-dark .about-section-title {
  color: #e2e8f0;
}

body.theme-dark .about-section p {
  color: #cbd5f5;
}
.chat-message.user .chat-edit-btn,
.chat-message.user .chat-retry-btn {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================
   Auth + Account Pages
   ========================== */
.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 12%, rgba(37, 99, 235, 0.16), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(59, 130, 246, 0.18), transparent 42%),
    radial-gradient(circle at 70% 90%, rgba(148, 197, 253, 0.25), transparent 48%),
    linear-gradient(135deg, #f3f6ff 0%, #f9fbff 45%, #ffffff 100%);
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-shell {
  width: min(980px, 92vw);
  padding: 90px 0 110px;
}

.auth-card {
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.95), transparent 58%),
    linear-gradient(135deg, #ffffff 0%, #f3f6ff 55%, #eef2ff 100%);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 28px;
  padding: 52px 56px;
  box-shadow: 0 40px 90px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 82% 10%, rgba(59, 130, 246, 0.16), transparent 58%);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.auth-brand img {
  width: 82px;
  height: 82px;
}

.auth-brand h1 {
  font-size: 30px;
  margin: 0 0 4px;
  color: #0f172a;
}

.auth-brand p {
  margin: 0;
  color: #5b6b82;
  font-size: 15px;
}

.auth-form {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #1f2a44;
  font-size: 14px;
  width: 100%;
  max-width: 520px;
}

.auth-form input {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  color: #0f172a;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  width: 100%;
  max-width: 520px;
}

.password-field {
  position: relative;
  width: 100%;
  max-width: 520px;
}

.password-field input {
  padding-right: 84px;
  max-width: 100%;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(248, 250, 252, 0.9);
  color: #1e293b;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.auth-form input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.6);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.auth-form input::placeholder {
  font-size: 12px;
  color: #94a3b8;
}

.auth-card .btn {
  min-height: 36px;
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 8px;
}

.auth-form .btn {
  width: fit-content;
  justify-self: center;
}

.auth-message {
  min-height: 20px;
  color: #1e293b;
  font-weight: 600;
}

.auth-code {
  padding: 10px 12px;
  background: rgba(30, 64, 175, 0.08);
  border-radius: 10px;
  color: #1e3a8a;
  font-weight: 600;
}

.auth-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 14px;
}

.auth-footer a {
  color: #1e40af;
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  color: #1d4ed8;
}

.top-link-danger {
  color: #ffe4e6;
  border-color: rgba(253, 164, 175, 0.6);
  background: rgba(190, 18, 60, 0.25);
}

.profile-chip {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.25);
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
  min-height: 26px;
  border-radius: 7px;
}

.chat-list-card {
  margin-bottom: 20px;
}

.chat-list-inline {
  display: grid;
  gap: 10px;
}

.chat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.6);
}

.chat-item-title {
  font-weight: 600;
  color: #1e293b;
}

.chat-item-meta {
  font-size: 12px;
  color: #64748b;
}

.chat-item-actions {
  display: flex;
  gap: 6px;
}

.chat-item .btn {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 7px;
}

.landing-page .landing-shell {
  width: min(980px, 92vw);
  margin: auto;
  padding: 90px 0 110px;
}

.landing-card {
  position: relative;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.95), transparent 60%),
    linear-gradient(135deg, #ffffff 0%, #f3f6ff 55%, #eef2ff 100%);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 32px;
  padding: 64px 72px;
  box-shadow:
    0 40px 90px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}

.landing-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -45% -20%;
  height: 240px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(147, 197, 253, 0.08));
  filter: blur(6px);
}

.landing-main,
.landing-aside {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
}

.landing-badge {
  justify-self: start;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(30, 58, 138, 0.9);
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.16), rgba(14, 116, 144, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.landing-main .auth-brand {
  justify-content: center;
  text-align: center;
}

.landing-main .auth-brand img {
  width: 88px;
  height: 88px;
}

.landing-card .auth-brand h1 {
  color: #0f172a;
  font-size: 36px;
}

.landing-card .auth-brand p {
  color: rgba(71, 85, 105, 0.85);
  font-size: 15px;
}

.landing-lede {
  color: rgba(71, 85, 105, 0.9);
  font-size: 15px;
  line-height: 1.6;
  max-width: 520px;
}

.landing-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.landing-foot {
  color: rgba(71, 85, 105, 0.8);
  font-size: 13px;
}

@media (max-width: 720px) {
  .landing-card {
    padding: 32px 26px;
  }

  .landing-main,
  .landing-aside {
    gap: 16px;
  }
}

.account-shell {
  width: min(980px, 92vw);
  padding: 90px 0 110px;
}

.account-card {
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.95), transparent 58%),
    linear-gradient(135deg, #ffffff 0%, #f3f6ff 55%, #eef2ff 100%);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 28px;
  padding: 52px 56px;
  box-shadow: 0 40px 90px rgba(15, 23, 42, 0.14);
}

.account-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.account-actions .btn {
  min-height: 36px;
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 8px;
}

.account-actions-single {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-items: stretch;
}

.account-list h2 {
  margin: 0 0 12px;
  color: #1e293b;
}

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

.chat-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.chat-title {
  font-weight: 600;
  color: #0f172a;
}

.chat-meta {
  color: #64748b;
  font-size: 13px;
}

.chat-empty {
  color: #64748b;
  padding: 12px 0;
}

@media (max-width: 720px) {
  .auth-card {
    padding: 24px;
  }

  .chat-row {
    grid-template-columns: 1fr;
  }

  .account-actions {
    grid-template-columns: 1fr;
  }
}
