:root {
  --bg: #0f1722;
  --bg-soft: #131d2b;
  --panel: #111b28;
  --panel-alt: #182433;
  --surface: #ffffff;
  --surface-alt: #f3f6fa;
  --surface-muted: #e8edf4;
  --border-dark: rgba(255, 255, 255, 0.08);
  --border: #d8e1ec;
  --border-strong: #bcc9d8;
  --text: #0f1b2d;
  --text-soft: #53657d;
  --text-faint: #7e8ea4;
  --text-on-dark: #f5f7fb;
  --accent: #2f5b8f;
  --accent-strong: #1f436b;
  --accent-soft: #dce8f5;
  --success: #2e7d5a;
  --warning: #9b7336;
  --danger: #a45050;
  --shadow-xl: 0 28px 60px rgba(7, 15, 26, 0.24);
  --shadow-lg: 0 18px 36px rgba(15, 23, 34, 0.1);
  --shadow-sm: 0 10px 20px rgba(15, 23, 34, 0.06);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: 180ms ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(47, 91, 143, 0.2), transparent 22%),
    radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.06), transparent 18%),
    linear-gradient(180deg, #0e1621 0%, #111b28 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-right: 1px solid var(--border-dark);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #284f7d 0%, #3e6ea8 100%);
  color: var(--text-on-dark);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  color: rgba(245, 247, 251, 0.62);
}

.brand-title {
  margin: 0;
  color: var(--text-on-dark);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  color: rgba(245, 247, 251, 0.78);
  font-weight: 700;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-item:hover,
.nav-item.active {
  color: var(--text-on-dark);
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.sidebar-card {
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--border-dark);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 247, 251, 0.86);
}

.sidebar-card-muted {
  background: rgba(255, 255, 255, 0.025);
}

.sidebar-card-title {
  margin: 0 0 10px;
  color: var(--text-on-dark);
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-copy,
.sidebar-list {
  margin: 0;
  color: rgba(245, 247, 251, 0.72);
  line-height: 1.7;
  font-size: 0.92rem;
}

.sidebar-list {
  padding-left: 18px;
}

.main-panel {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-meta {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.page-title {
  margin: 0 0 10px;
  color: var(--text-on-dark);
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  font-weight: 600;
}

.page-subtitle {
  max-width: 760px;
  margin: 0;
  color: rgba(245, 247, 251, 0.72);
  line-height: 1.7;
}

.topbar-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-dark);
  border-radius: 999px;
  color: rgba(245, 247, 251, 0.88);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  font-weight: 700;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--border-dark);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.lang-option {
  min-width: 94px;
  min-height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(245, 247, 251, 0.74);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.lang-option:hover {
  color: var(--text-on-dark);
}

.lang-option.active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.account-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.account-badge {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
  padding: 10px 14px;
  border: 1px solid var(--border-dark);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-on-dark);
}

.account-badge-credits {
  background: rgba(255, 255, 255, 0.1);
}

.account-label {
  color: rgba(245, 247, 251, 0.56);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.btn-logout {
  min-height: 48px;
  border-color: var(--border-dark);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-on-dark);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.summary-tile {
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--border-dark);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
  box-shadow: var(--shadow-xl);
}

.summary-label {
  display: block;
  margin-bottom: 10px;
  color: rgba(245, 247, 251, 0.6);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.summary-value {
  display: block;
  margin-bottom: 8px;
  color: var(--text-on-dark);
  font-size: 1rem;
  font-weight: 800;
}

.summary-meta {
  color: rgba(245, 247, 251, 0.68);
  font-size: 0.88rem;
  line-height: 1.6;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 360px;
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}

.primary-column,
.secondary-column {
  min-width: 0;
}

.card {
  padding: 24px;
  margin-bottom: 18px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.section-head,
.history-header,
.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-head {
  margin-bottom: 22px;
}

.history-header {
  margin-bottom: 16px;
}

.results-head {
  margin-bottom: 16px;
}

.section-kicker {
  color: var(--accent);
}

.section-copy {
  max-width: 460px;
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.card-title {
  margin: 0 0 18px;
  color: var(--text);
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.18;
}

.card-title.no-margin {
  margin-bottom: 0;
}

.auth-card {
  margin-bottom: 22px;
}

.auth-head {
  margin-bottom: 18px;
}

.auth-form-grid {
  margin-bottom: 14px;
}

.auth-actions,
.admin-create-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.auth-submit {
  width: auto;
  min-width: 180px;
}

.auth-message,
.admin-message {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.error-text {
  color: var(--danger);
}

.form-group-checkbox {
  justify-content: flex-end;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.admin-card {
  margin-top: 22px;
}

.admin-users-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 16px;
}

.admin-users-title {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  font-weight: 600;
}

.admin-users-list {
  display: grid;
  gap: 14px;
}

.admin-user-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff 0%, #f7f9fc 100%);
}

.admin-user-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-user-summary strong {
  display: block;
  margin-bottom: 4px;
}

.admin-user-role,
.admin-user-stats {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.admin-user-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.btn-inline {
  min-height: 52px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

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

.form-group label {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.required {
  color: var(--accent);
}

.optional {
  color: var(--text-faint);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--text);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: #8b99ab;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 91, 143, 0.12);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.btn-primary,
.btn-pdf-main,
.btn-sm,
.btn-icon,
.btn-secondary {
  font: inherit;
}

.btn-primary {
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #1f436b 0%, #2f5b8f 100%);
  color: var(--text-on-dark);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(31, 67, 107, 0.28);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 34px rgba(31, 67, 107, 0.32);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-secondary:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

.status-card {
  background: linear-gradient(135deg, #122131 0%, #1c3147 100%);
  border-color: rgba(255, 255, 255, 0.06);
}

.status-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 247, 251, 0.88);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-pill.queued {
  color: #e6cd9a;
  background: rgba(155, 115, 54, 0.18);
}

.status-pill.running {
  color: #d8e7f8;
  background: rgba(47, 91, 143, 0.24);
}

.status-pill.completed {
  color: #caeadb;
  background: rgba(46, 125, 90, 0.2);
}

.status-pill.failed {
  color: #efc9c9;
  background: rgba(164, 80, 80, 0.2);
}

.job-id {
  color: rgba(245, 247, 251, 0.66);
  font-size: 0.8rem;
  font-weight: 700;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-bar-bg {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #85a9d1 0%, #dce8f5 100%);
  transition: width 0.4s ease;
}

.progress-pct {
  min-width: 44px;
  text-align: right;
  color: var(--text-on-dark);
  font-weight: 800;
}

.status-stage,
.status-msg {
  margin: 0;
  color: var(--text-on-dark);
}

.status-stage {
  margin-bottom: 6px;
  font-size: 1rem;
  font-weight: 700;
}

.status-msg {
  color: rgba(245, 247, 251, 0.72);
  line-height: 1.6;
}

.error-card {
  border-color: #ecd0d0;
  background: #fff9f9;
}

.error-card h3 {
  margin: 0 0 8px;
  color: var(--danger);
}

.error-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.result-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.kpi-card {
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff 0%, #f7f9fc 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kpi-value {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-family: 'Fraunces', serif;
  font-size: 1.9rem;
  line-height: 1;
}

.kpi-meta {
  color: var(--text-faint);
  font-size: 0.85rem;
  line-height: 1.5;
}

.pdf-bar {
  margin: 0;
}

.btn-pdf-main {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.btn-pdf-main:hover {
  background: var(--surface-alt);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.summary-text {
  margin: 0;
  color: var(--text);
  line-height: 1.9;
}

.summary-glossary {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--surface-muted);
}

.summary-glossary-title {
  margin-bottom: 12px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.summary-glossary-list {
  display: grid;
  gap: 10px;
}

.query-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.query-plan-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-alt);
}

.query-plan-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.query-plan-item {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.query-plan-item:first-of-type {
  padding-top: 0;
  border-top: none;
}

.query-plan-target {
  color: var(--accent-strong);
  font-size: 0.96rem;
  font-weight: 800;
  unicode-bidi: plaintext;
}

.query-plan-translation {
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.glossary-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
}

.glossary-original {
  color: var(--accent-strong);
  font-weight: 800;
  unicode-bidi: plaintext;
}

.glossary-separator {
  color: var(--text-faint);
  font-weight: 800;
}

.glossary-translation {
  color: var(--text);
  font-weight: 700;
}

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

.metric-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--surface-muted);
}

.metric-item:last-child {
  border-bottom: none;
}

.metric-label {
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 600;
}

.metric-label-small {
  font-size: 0.8rem;
}

.metric-value {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: right;
}

.metric-value.accent {
  color: var(--accent);
}

.metric-value.up {
  color: var(--success);
}

.metric-value.down {
  color: var(--danger);
}

.metric-clusters {
  margin-top: 14px;
}

.cluster-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cluster-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.quality-item {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.q-label {
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.q-value {
  margin-bottom: 8px;
  color: var(--text);
  font-family: 'Fraunces', serif;
  font-size: 1.8rem;
}

.q-meta {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.q-meta.success {
  color: var(--success);
}

.q-meta.warning {
  color: var(--warning);
}

.sov-row-label {
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sov-label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-soft);
}

.sov-bar-track {
  display: flex;
  height: 34px;
  margin-bottom: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-muted);
}

.sov-bar-ana,
.sov-bar-rakip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  font-size: 0.78rem;
  font-weight: 800;
}

.sov-bar-ana {
  background: linear-gradient(90deg, #1f436b 0%, #2f5b8f 100%);
  color: var(--text-on-dark);
}

.sov-bar-rakip {
  background: #d7e2ef;
  color: var(--accent-strong);
}

.insight-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid #dce8e1;
  background: #f7fbf9;
  color: var(--text);
  line-height: 1.7;
}

.insight-list.threat li {
  border-color: #edd7d7;
  background: #fff8f8;
}

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

.process-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.process-item span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

.process-item strong {
  color: var(--text);
  font-size: 0.92rem;
}

.history-empty {
  margin: 0;
  color: var(--text-soft);
  text-align: center;
  padding: 16px 0 4px;
}

.history-board {
  width: 100%;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
  color: var(--accent-strong);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent);
  background: #fff;
  transform: translateY(-1px);
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface-muted);
}

.history-item:last-child {
  border-bottom: none;
}

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

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

.history-topic {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: anywhere;
}

.history-vs,
.history-meta {
  color: var(--text-soft);
}

.history-meta {
  display: block;
  font-size: 0.78rem;
}

.history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 152px;
  flex-shrink: 0;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  min-width: 72px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.btn-sm:hover {
  background: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-pdf-sm {
  color: var(--accent-strong);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.videos-table {
  width: 100%;
  border-collapse: collapse;
}

.videos-table th,
.videos-table td {
  padding: 14px 16px;
  text-align: left;
}

.videos-table th {
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.videos-table td {
  border-top: 1px solid var(--surface-muted);
  color: var(--text);
  font-size: 0.88rem;
  vertical-align: top;
}

.videos-table tbody tr:hover td {
  background: #fbfcfe;
}

.video-link {
  color: var(--accent);
  font-weight: 700;
}

.video-link:hover {
  text-decoration: underline;
}

.video-text {
  max-width: 320px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.video-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 700;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-empty-cell {
  text-align: center;
  color: var(--text-soft);
  padding: 28px 16px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
  background: var(--surface-alt);
  color: var(--text-soft);
}

.hidden {
  display: none !important;
}

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

  .secondary-column {
    order: -1;
  }

  .summary-strip,
  .result-kpi-grid,
  .query-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-dark);
  }

  .topbar,
  .section-head,
  .history-header,
  .results-head {
    flex-direction: column;
  }

  .topbar-meta {
    width: 100%;
    justify-items: stretch;
  }

  .lang-switch,
  .topbar-badges,
  .account-panel {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .main-panel,
  .sidebar {
    padding: 18px;
  }

  .summary-strip,
  .result-kpi-grid,
  .form-grid,
  .metrics-row,
  .query-plan-grid {
    grid-template-columns: 1fr;
  }

  .lang-switch {
    width: 100%;
  }

  .lang-option {
    flex: 1 1 0;
    min-width: 0;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .history-main {
    flex-direction: column;
    gap: 10px;
  }

  .history-actions {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .admin-inline-form {
    grid-template-columns: 1fr;
  }

  .auth-submit,
  .btn-secondary,
  .btn-sm {
    width: 100%;
  }
}
