/*!*************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[3]!./app/globals.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************/
:root,
html[data-theme="light"] {
  --bg-canvas: #F6F4EE;
  --bg-surface-1: #FFFFFF;
  --bg-surface-2: #EFECE4;
  --bg-surface-3: #E5E0D4;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --text-primary: #14221D;
  --text-secondary: #435750;
  --text-muted: #6E827A;
  --text-on-brand: #FFFFFF;
  --brand-primary: #007A5E;
  --brand-primary-hover: #00624B;
  --brand-soft-bg: #E6F4F0;
  --brand-soft-border: #B2DFD2;
  --accent-gold: #B87D14;
  --accent-gold-bg: #FEF7E6;
  --accent-gold-border: #F5D488;
  --status-solved: #15803D;
  --status-solved-bg: #DCFCE7;
  --status-warning: #D97706;
  --status-warning-bg: #FEF3C7;
  --status-danger: #DC2626;
  --status-danger-bg: #FEE2E2;
  --status-info: #0284C7;
  --status-info-bg: #E0F2FE;
  --border-subtle: #E4E0D5;
  --border-strong: #C9C3B4;
  --focus-ring: rgba(0, 122, 94, 0.35);
  --shadow-card: 0 1px 3px rgba(20, 34, 29, 0.04), 0 1px 2px rgba(20, 34, 29, 0.02);
  --shadow-elevated: 0 12px 32px -4px rgba(20, 34, 29, 0.10), 0 4px 12px -2px rgba(20, 34, 29, 0.05);

  /* Legacy variable aliases for subpages */
  --bg: var(--bg-canvas);
  --bg-2: var(--bg-surface-2);
  --surface: var(--bg-surface-1);
  --brand: var(--brand-primary);
  --brand-2: var(--brand-primary-hover);
  --brand-deep: var(--text-primary);
  --brand-soft: var(--brand-soft-border);
  --text: var(--text-primary);
  --text-dim: var(--text-secondary);
  --line: var(--border-subtle);
  --shadow: var(--shadow-card);
  --radius: 10px;
  --font: "IBM Plex Sans Arabic", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

html[data-theme="dark"] {
  --bg-canvas: #0B1210;
  --bg-surface-1: #111C18;
  --bg-surface-2: #172621;
  --bg-surface-3: #1F332C;
  --bg-glass: rgba(17, 28, 24, 0.88);
  --text-primary: #F0F5F2;
  --text-secondary: #9EB0A8;
  --text-muted: #687D74;
  --text-on-brand: #06281E;
  --brand-primary: #10B981;
  --brand-primary-hover: #34D399;
  --brand-soft-bg: rgba(16, 185, 129, 0.12);
  --brand-soft-border: rgba(16, 185, 129, 0.28);
  --accent-gold: #F59E0B;
  --accent-gold-bg: rgba(245, 158, 11, 0.12);
  --accent-gold-border: rgba(245, 158, 11, 0.30);
  --status-solved: #4ADE80;
  --status-solved-bg: rgba(34, 197, 94, 0.14);
  --status-warning: #FBBF24;
  --status-warning-bg: rgba(245, 158, 11, 0.14);
  --status-danger: #F87171;
  --status-danger-bg: rgba(239, 68, 68, 0.14);
  --status-info: #38BDF8;
  --status-info-bg: rgba(14, 165, 233, 0.14);
  --border-subtle: #1E302A;
  --border-strong: #2C443B;
  --focus-ring: rgba(16, 185, 129, 0.40);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.30);
  --shadow-elevated: 0 16px 40px -4px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

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

button {
  cursor: pointer;
}

.tabular-nums {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* Sticky Top Navigation Header */
.ds-navbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 40;
  height: 62px;
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.ds-navbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ds-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ds-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #007A5E 0%, #064E3B 100%);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0, 122, 94, 0.25);
}

.ds-brand-text strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.ds-brand-text span {
  display: block;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--text-muted);
}

/* Global Search Bar (Command Palette ⌘K) */
.ds-search-wrap {
  flex: 1 1;
  max-width: 520px;
  position: relative;
}

.ds-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0 12px;
  height: 40px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ds-search-box:focus-within {
  background: var(--bg-surface-1);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.ds-search-box input,
.ds-search-box input:not([type]),
.ds-search-box input[type="text"],
.ds-search-box input[type="search"] {
  flex: 1 1;
  height: 100% !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 14px;
  color: var(--text-primary);
}

.ds-search-box input:focus,
.ds-search-box input:not([type]):focus,
.ds-search-box input[type="text"]:focus,
.ds-search-box input[type="search"]:focus {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.ds-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
}

.ds-search-dropdown {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 8px);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-elevated);
  padding: 8px;
  z-index: 60;
  max-height: 420px;
  overflow-y: auto;
}

.ds-search-hit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
}

.ds-search-hit:hover {
  background: var(--bg-surface-2);
}

/* Navbar Actions */
.ds-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-icon-btn {
  position: relative;
  height: 38px;
  min-width: 38px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.ds-icon-btn:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.ds-badge-count {
  position: absolute;
  top: -5px;
  inset-inline-end: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: var(--text-on-brand);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ds-btn-primary {
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 0;
  background: var(--brand-primary);
  color: var(--text-on-brand);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}

.ds-btn-primary:hover {
  background: var(--brand-primary-hover);
}

.ds-btn-ghost {
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ds-btn-ghost:hover {
  background: var(--bg-surface-2);
}

.ds-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.ds-btn:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-strong);
}

.ds-btn:active {
  transform: translateY(1px);
}

.ds-action-pill {
  height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ds-action-pill:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.ds-action-pill:active {
  transform: translateY(1px);
}

/* 3-Column App Shell */
.ds-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 20px 88px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-gap: 24px;
  gap: 24px;
  align-items: start;
}

.ds-sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  -webkit-padding-end: 4px;
          padding-inline-end: 4px;
}

.ds-nav-section {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
  box-shadow: var(--shadow-card);
}

.ds-nav-kicker {
  margin: 4px 8px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ds-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ds-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.12s ease;
}

.ds-nav-item:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.ds-nav-item.active {
  background: var(--brand-soft-bg);
  color: var(--brand-primary);
  font-weight: 700;
}

.ds-space-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ds-space-count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.ds-main-stage {
  min-width: 0;
}

/* Feed Layout with Right Context Rail */
.ds-feed-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  grid-gap: 22px;
  gap: 22px;
  align-items: start;
}

.ds-right-rail {
  position: -webkit-sticky;
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ds-rail-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.ds-rail-card h3 {
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Full-Width Discussion Card (Direction A "Emerald Manuscript") */
.ds-discussion-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.ds-discussion-card:hover {
  border-color: var(--border-strong);
}

.ds-discussion-card.pinned {
  -webkit-border-start: 3px solid var(--accent-gold);
          border-inline-start: 3px solid var(--accent-gold);
}

.ds-discussion-card.solved-card {
  -webkit-border-start: 3px solid var(--status-solved);
          border-inline-start: 3px solid var(--status-solved);
}

.ds-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ds-author-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ds-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.ds-badges-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ds-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
}

.ds-pill-pinned {
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold-border);
}

.ds-pill-solved {
  background: var(--status-solved-bg);
  color: var(--status-solved);
}

.ds-pill-space {
  background: var(--brand-soft-bg);
  color: var(--brand-primary);
}

/* Card Body + Adaptive Optional Thumbnails */
.ds-card-content-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ds-card-text-col {
  flex: 1 1;
  min-width: 0;
}

.ds-card-title {
  margin: 0 0 6px;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-primary);
}

.ds-card-title:hover {
  color: var(--brand-primary);
}

.ds-card-excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pattern 1: Compact Side Thumbnail (144x96px Web / 96x80px Mobile) */
.ds-thumb-side {
  position: relative;
  width: 144px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  flex-shrink: 0;
}

.ds-thumb-side img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ds-gallery-badge {
  position: absolute;
  bottom: 6px;
  inset-inline-start: 6px;
  background: rgba(11, 18, 16, 0.78);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

/* Pattern 2: Wide 16:9 Cover Banner */
.ds-thumb-cover {
  position: relative;
  width: 100%;
  max-height: 210px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  margin: 10px 0 6px;
}

.ds-thumb-cover img {
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  display: block;
}

/* Inline Horizontal Vote & Engagement Bar (30px height) */
.ds-card-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ds-engagement-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ds-vote-inline {
  display: inline-flex;
  align-items: center;
  height: 30px;
  border-radius: 999px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.ds-vote-inline.voted-up {
  background: var(--brand-soft-bg);
  border-color: var(--brand-soft-border);
  color: var(--brand-primary);
}

.ds-vote-inline.voted-down {
  background: var(--status-danger-bg);
  border-color: rgba(220, 38, 38, 0.3);
  color: var(--status-danger);
}

.ds-vote-btn {
  border: 0;
  background: transparent;
  height: 100%;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
}

.ds-vote-btn:hover {
  background: rgba(0, 122, 94, 0.10);
}

.ds-vote-score {
  font-size: 12.5px;
  font-weight: 700;
  padding: 0 4px;
}

.ds-metric-pill {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-surface-2);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.ds-metric-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.ds-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.ds-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ds-tab {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.ds-tab:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.ds-tab.active {
  background: var(--brand-soft-bg);
  border-color: var(--brand-soft-border);
  color: var(--brand-primary);
}

button.ds-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

/* Rich Prose & Quranic Verse Styling */
.ds-prose {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-primary);
  overflow-wrap: break-word;
}

.ds-prose p {
  margin: 0 0 14px;
}

.ds-prose h1,
.ds-prose h2,
.ds-prose h3,
.ds-prose h4 {
  margin: 20px 0 10px;
  font-weight: 700;
  line-height: 1.4;
}

.ds-quran-verse {
  margin: 16px 0;
  padding: 16px 20px;
  background: var(--accent-gold-bg);
  -webkit-border-start: 4px solid var(--accent-gold);
          border-inline-start: 4px solid var(--accent-gold);
  border-radius: 8px;
  font-size: 18px;
  line-height: 2.0;
  color: var(--text-primary);
}

.ds-quran-inline {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  font-weight: 600;
}

.ds-prose-figure {
  margin: 14px 0;
}

.ds-prose ul,
.ds-prose ol {
  margin: 8px 0 12px;
  -webkit-padding-start: 22px;
          padding-inline-start: 22px;
}

.ds-prose li {
  margin-bottom: 6px;
  line-height: 1.75;
}

.ds-prose li > p {
  display: inline;
  margin: 0;
}

.ds-prose-img {
  max-width: 100%;
  max-height: 460px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  display: block;
}

.ds-code-block {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: #0D1714;
  color: #E2F1EC;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
  border: 1px solid #1E302A;
}

.ds-inline-code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-surface-2);
}

.ds-spoiler {
  margin: 12px 0;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--bg-surface-2);
  padding: 10px 14px;
}

.ds-spoiler summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
}

.ds-post-mention,
.ds-user-mention,
.ds-tag-mention {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--brand-soft-bg);
  color: var(--brand-primary);
  font-size: 13px;
  font-weight: 600;
}

.ds-file-attachment {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: 8px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 13.5px;
  font-weight: 600;
}

/* Nested Reply Tree (Depth 0..4) */
.ds-reply-node {
  position: relative;
  margin-top: 12px;
}

.ds-reply-children {
  -webkit-margin-start: 22px;
          margin-inline-start: 22px;
  -webkit-padding-start: 16px;
          padding-inline-start: 16px;
  -webkit-border-start: 2px solid var(--border-subtle);
          border-inline-start: 2px solid var(--border-subtle);
}

.ds-reply-children:hover {
  border-inline-start-color: var(--brand-primary);
}

/* Floating Desktop Chat Dock */
.ds-chat-dock {
  position: fixed;
  bottom: 0;
  inset-inline-start: 24px;
  z-index: 45;
  width: 340px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
}

.ds-chat-dock-header {
  height: 44px;
  padding: 0 14px;
  background: var(--brand-primary);
  color: var(--text-on-brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

/* Mobile 5-Tab Bottom Navigation Bar */
.ds-mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  height: 60px;
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.ds-mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 8px;
}

.ds-mobile-tab.active {
  color: var(--brand-primary);
}

/* Keep Legacy Classes Styled Cleanly */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hero h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-primary);
}
.hero p {
  margin: 4px 0 0;
  color: var(--text-secondary);
}
.sort {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sort button {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.sort button.on {
  background: var(--brand-soft-bg);
  border-color: var(--brand-soft-border);
  color: var(--brand-primary);
}
.btn {
  border: 0;
  background: var(--brand-primary);
  color: var(--text-on-brand);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13.5px;
}
.ghost {
  background: var(--bg-surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.card,
.sheet,
.article,
.track,
.reply {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}
.sheet {
  padding: 18px 20px;
  margin-bottom: 14px;
}
.article {
  padding: 24px;
}
.reply {
  margin-top: 12px;
  padding: 14px 16px;
}
.reply.accepted {
  border-color: var(--status-solved);
  background: var(--status-solved-bg);
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}
.solved {
  background: var(--status-solved-bg);
  color: var(--status-solved);
}
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft-bg);
  color: var(--brand-primary);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 10px;
}
.tray {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.tray button {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
}
.tray button.on {
  border-color: var(--brand-primary);
  background: var(--brand-soft-bg);
  color: var(--brand-primary);
}
/* Form Controls & Emerald Manuscript Input System */
input:not([type]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="tel"],
.ds-input,
textarea {
  width: 100%;
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:not([type]):focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
.ds-input:focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--bg-surface-1);
}

/* Styled File Upload & Input Groups */
.ds-file-upload-card {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s ease;
}

.ds-file-upload-card:hover {
  border-color: var(--brand-primary);
  background: var(--brand-soft-bg);
}

.ds-file-upload-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--brand-primary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.ds-file-upload-btn:hover {
  background: var(--brand-primary);
  color: var(--text-on-brand);
  border-color: var(--brand-primary);
}

.ds-input-group {
  display: flex;
  align-items: stretch;
  margin-top: 4px;
  width: 100%;
}

.ds-input-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  -webkit-border-end: 0;
          border-inline-end: 0;
  border-start-start-radius: 8px;
  border-end-start-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ds-input-group .ds-input,
.ds-input-group input {
  margin-top: 0;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}

.ds-floating-reply-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 0;
  background: var(--brand-primary);
  color: #FFFFFF !important;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 122, 94, 0.25);
}

.ds-floating-reply-btn:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
}

.ds-floating-reply-btn:active {
  transform: translateY(0);
}

select {
  width: 100%;
  margin-top: 4px;
  padding: 10px 36px 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-1);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  cursor: pointer;
  -moz-appearance: none;
       appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E827A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[dir="rtl"] select,
html[dir="rtl"] select {
  padding: 10px 14px 10px 36px;
  background-position: left 12px center;
}

select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239EB0A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand-primary);
  cursor: pointer;
  border-radius: 4px;
  vertical-align: middle;
}

input[type="file"] {
  width: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-margin-end: 10px;
          margin-inline-end: 10px;
  -webkit-transition: all 0.15s ease;
  transition: all 0.15s ease;
}

input[type="file"]::file-selector-button {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-margin-end: 10px;
          margin-inline-end: 10px;
  transition: all 0.15s ease;
}

input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--brand-soft-bg);
  color: var(--brand-primary);
  border-color: var(--brand-soft-border);
}

input[type="file"]::file-selector-button:hover {
  background: var(--brand-soft-bg);
  color: var(--brand-primary);
  border-color: var(--brand-soft-border);
}

/* Custom Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Flash Highlight for newly created / navigated replies */
@keyframes ds-new-comment-flash {
  0% {
    background-color: var(--brand-soft-bg);
    box-shadow: 0 0 0 3px var(--brand-primary);
    transform: translateY(-2px);
  }
  30% {
    background-color: var(--brand-soft-bg);
    box-shadow: 0 0 0 3px var(--brand-primary);
    transform: translateY(-2px);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
    transform: translateY(0);
  }
}

.ds-flash-highlight {
  animation: ds-new-comment-flash 2.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  border-radius: 10px;
}

/* Floating Sticky Reply Trigger & Action Bar */
.ds-floating-reply-trigger {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-elevated);
  border-radius: 999px;
  padding: 8px 18px;
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  animation: ds-slide-up-fade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ds-floating-reply-trigger:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 16px 36px -4px rgba(20, 34, 29, 0.22);
}

@keyframes ds-slide-up-fade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 820px) {
  .ds-floating-reply-trigger {
    bottom: 74px; /* above mobile tabbar */
    padding: 7px 14px;
    font-size: 13px;
    width: calc(100vw - 32px);
    max-width: 360px;
    justify-content: space-between;
  }
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.75;
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.hint {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border-radius: 8px;
  padding: 10px 12px;
}
.error {
  color: var(--status-danger);
  font-size: 14px;
}

@media (max-width: 1080px) {
  .ds-feed-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ds-right-rail {
    display: none;
  }
}

.ds-mobile-search-btn {
  display: none;
}

@media (max-width: 820px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .hide-sm,
  .hide-mobile {
    display: none !important;
  }
  .ds-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 12px 84px;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .ds-main {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
  .ds-sidebar {
    display: none;
  }
  .ds-chat-dock {
    display: none;
  }
  .ds-mobile-tabbar {
    display: flex;
  }
  .ds-thumb-side {
    width: 96px;
    height: 80px;
  }
  .ds-navbar-inner {
    padding: 0 12px;
    gap: 8px;
    justify-content: space-between;
  }
  .ds-brand {
    gap: 8px;
  }
  .ds-brand-text span {
    display: none;
  }
  .ds-brand-text strong {
    font-size: 14px;
  }
  .ds-search-wrap {
    flex: 0 0 auto !important;
    max-width: none !important;
    min-width: 0;
  }
  .ds-search-box {
    display: none !important;
  }
  .ds-mobile-search-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  .ds-kbd {
    display: none;
  }
  .ds-nav-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .ds-nav-actions .ds-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}

