:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f9f9f9;
  --panel: #ffffff;
  --panel-2: #f9f9f9;
  --panel-3: #f4f4f4;
  --line: #e5e5e5;
  --line-2: #d1d1d1;
  --text: #0d0d0d;
  --muted: #676767;
  --muted-soft: #676767;
  --primary: #0d0d0d;
  --primary-hover: #0d0d0d;
  --secondary: #0d0d0d;
  --background: #ffffff;
  --surface: #ffffff;
  --danger: #000000;
  --danger-hover: #000000;
  --success: #000000;
  --radius: 24px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.08);
  --font-ui: var(--font-fa);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-fa);
}

a {
  color: inherit;
}

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

textarea {
  direction: auto;
}

.is-hidden {
  display: none !important;
}

.autofill-decoy {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
}

.page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(0, 0, 0, 0.03) 0%, transparent 60%),
    var(--bg);
}

.page-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.02) 0%, transparent 58%);
}

.page-glow-login {
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.03) 0%, transparent 58%);
}

.page-glow-register {
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.03) 0%, transparent 58%);
}

.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.78);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
  color: #000000;
  padding: 7px 12px;
  font-size: 12px;
}

.auth-badge-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 16px;
}

.auth-badge-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.12);
  color: #a7f3d0;
}

.auth-title {
  margin-top: 18px;
  font-size: 30px;
  font-weight: 700;
}

.auth-subtitle {
  margin-top: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
}

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

.auth-form[hidden] {
  display: none !important;
}

.auth-submit {
  width: 100%;
}

.auth-footer {
  margin-top: 20px;
  color: #cbd5e1;
  font-size: 14px;
}

.auth-footer--dialog {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
}

.auth-footer--dialog[hidden] {
  display: none !important;
}

.auth-switch-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.auth-switch-link {
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}

.auth-switch-link:hover {
  color: var(--primary);
}

.auth-panel[hidden] {
  display: none !important;
}

.auth-title--dialog {
  margin-top: 0;
  font-size: 26px;
}

.auth-subtitle--dialog {
  margin-bottom: 0;
}

.auth-panel--otp {
  display: grid;
  gap: 12px;
}

.auth-status {
  margin: 0;
  min-height: 22px;
}

.auth-status[hidden] {
  display: none;
}

.auth-verify-form {
  gap: 14px;
}

.auth-verify-form .input {
  text-align: center;
  letter-spacing: 0.35em;
}

.app-shell {
  position: relative;
  z-index: 1;
  height: 100vh;
  padding: 10px;
}

.app-frame {
  height: 100%;
  border: 1px solid rgba(30, 41, 59, 0.9);
  border-radius: 28px;
  background: rgba(2, 6, 23, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100%;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.sidebar {
  width: 320px;
  max-width: 86vw;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.96);
  overflow-x: hidden;
}

.sidebar-actions,
.sidebar-footer,
.topbar,
.composer-wrap {
  border-color: var(--line);
}

.sidebar-actions {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-search-wrap {
  padding: 14px 14px 0;
}

.sidebar-folder-actions {
  margin-top: 10px;
}

.sidebar-folder-btn {
  width: 100%;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #cbd5e1;
}

.sidebar-user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
}

.main-panel {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.7);
}

.topbar-main,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-block {
  min-width: 0;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.messages-panel {
  position: relative;
  flex: 1;
  min-height: 0;
}

.messages {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: auto;
  padding: 24px 16px;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.empty-state-inner {
  max-width: 760px;
  text-align: center;
}

.empty-state-badge {
  display: inline-flex;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.1);
  color: #000000;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
}

.empty-state-title {
  margin: 18px 0 10px;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
}

.empty-state-text {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.composer-wrap {
  border-top: 1px solid var(--line);
  padding: 16px;
  background: rgba(2, 6, 23, 0.75);
}

.composer-inner {
  max-width: 900px;
  margin: 0 auto;
}

.composer {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.75);
  padding: 10px;
}

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

.composer-input {
  width: 100%;
  min-height: 44px;
  height: 44px;
  box-sizing: border-box;
  margin: 0;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 11px 10px;
  line-height: 22px;
  overflow-y: hidden;
}

.composer-input::placeholder {
  color: #64748b;
}

.composer-submit {
  flex: 0 0 auto;
}

.composer-hint {
  margin-top: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 16px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:focus-visible,
.input:focus-visible,
.dialog-close:focus-visible,
.sidebar-link-button:focus-visible,
.sidebar-icon-button:focus-visible,
.prompt-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
}

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

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

.btn-fill {
  width: 100%;
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--panel-3);
  color: var(--text);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: #e0f2fe;
  border-color: var(--line-2);
}

.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.link-inline {
  color: var(--primary);
  text-decoration: none;
}

.link-inline:hover {
  color: var(--primary-hover);
}

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

.field-label {
  color: #cbd5e1;
  font-size: 14px;
}

.input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  padding: 0 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input:focus {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
}

.composer-input:focus {
  box-shadow: none;
}

.input:focus {
  border-color: var(--primary);
}

.input-select {
  max-width: 200px;
}

.alert {
  border: 1px solid #000000;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.8;
}

.alert-error {
  background: rgba(69, 10, 10, 0.55);
  color: #000000;
}

.dialog {
  width: min(100% - 24px, 640px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.dialog-header,
.dialog-body {
  padding: 20px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.dialog-header-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.dialog-header--move {
  align-items: center;
  gap: 10px;
}

.dialog-title {
  font-size: 15px;
  font-weight: 700;
}

.dialog-close {
  appearance: none;
  -webkit-appearance: none;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1a1a1a;
  color: #e5e7eb;
  font: inherit;
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
}

.dialog-close svg {
  width: 18px;
  height: 18px;
  display: block;
}

.dialog-close:hover {
  border-color: rgba(0, 0, 0, 0.28);
  background: #202020;
  color: #ffffff;
}

.dialog-body {
  display: grid;
  gap: 16px;
}

.dialog-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}

.help-guide-card .help-guide-lead {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.9;
}

.help-guide-heading {
  margin: 20px 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.help-guide-heading:first-of-type {
  margin-top: 0;
}

.help-guide-card .help-guide-text {
  margin: 0;
}

.help-guide-card .help-guide-text + .help-guide-text,
.help-guide-heading + .help-guide-text {
  margin-top: 10px;
}

.help-guide-card .help-guide-heading + .help-guide-text + .help-guide-text {
  margin-top: 10px;
}

.help-guide-card .help-guide-text strong {
  color: var(--text);
  font-weight: 600;
}

.help-guide-card--compact {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: none;
}

.help-guide-card--compact .help-guide-lead {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.65;
}

.help-guide-card--compact .help-guide-heading {
  margin: 12px 0 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.help-guide-card--compact .help-guide-heading:first-of-type {
  margin-top: 0;
}

.help-guide-card--compact .help-guide-text {
  font-size: 11px;
  line-height: 1.65;
}

.help-guide-card--compact .help-guide-text + .help-guide-text {
  margin-top: 6px;
}

.help-guide-card--compact .help-guide-heading + .help-guide-text {
  margin-top: 0;
}

.help-guide-list {
  margin: 6px 0 0;
  padding: 0 18px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.help-guide-list li + li {
  margin-top: 4px;
}

.help-guide-card--compact .help-guide-list {
  font-size: 11px;
}

.help-guide-text--closing {
  margin-top: 10px;
  font-weight: 600;
  color: var(--text);
}

.page-app .help-guide-card--compact {
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: none;
  gap: 0;
}

.page-app.theme-light .help-guide-card--compact {
  border: 1px solid #e5e5e5;
  background: #ffffff;
}

.page-app .help-guide-card--compact .help-guide-lead,
.page-app .help-guide-card--compact .help-guide-text,
.page-app .help-guide-card--compact .help-guide-heading {
  font-size: 11px;
  line-height: 1.65;
}

.page-app .help-guide-card--compact .help-guide-lead {
  margin-bottom: 10px;
}

.page-app .help-guide-card--compact .help-guide-heading {
  margin: 12px 0 6px;
}

.page-app .help-guide-list {
  color: #4b5563;
}

.page-app.theme-dark .help-guide-card--compact,
.page-app.theme-dark #helpDialog .help-guide-card--compact,
.page-app.theme-dark #serviceRulesDialog .help-guide-card--compact {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.page-app.theme-dark .help-guide-card .help-guide-lead,
.page-app.theme-dark .help-guide-card .help-guide-heading,
.page-app.theme-dark .help-guide-card .help-guide-text,
.page-app.theme-dark .help-guide-card .help-guide-text strong,
.page-app.theme-dark #helpDialog .help-guide-card--compact .help-guide-lead,
.page-app.theme-dark #helpDialog .help-guide-card--compact .help-guide-heading,
.page-app.theme-dark #helpDialog .help-guide-card--compact .help-guide-text,
.page-app.theme-dark #serviceRulesDialog .help-guide-card--compact .help-guide-lead,
.page-app.theme-dark #serviceRulesDialog .help-guide-card--compact .help-guide-heading,
.page-app.theme-dark #serviceRulesDialog .help-guide-card--compact .help-guide-text {
  color: #f5f5f5;
}

.page-app.theme-dark #helpDialog .dialog-note,
.page-app.theme-dark #serviceRulesDialog .dialog-note,
.page-app.theme-dark .help-guide-card .dialog-note {
  color: #c4c4c4;
}

.page-app.theme-dark .help-guide-list,
.page-app.theme-dark #helpDialog .help-guide-list,
.page-app.theme-dark #serviceRulesDialog .help-guide-list {
  color: #a3a3a3;
}

.page-app.theme-dark .help-guide-text--closing,
.page-app.theme-dark #serviceRulesDialog .help-guide-text--closing {
  color: #f5f5f5;
}

.page-app.theme-dark #helpDialog .dialog-header,
.page-app.theme-dark #serviceRulesDialog .dialog-header,
.page-app.theme-dark #helpDialog[open] .dialog-header,
.page-app.theme-dark #serviceRulesDialog[open] .dialog-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.page-app.theme-dark #helpDialog .dialog-body,
.page-app.theme-dark #serviceRulesDialog .dialog-body {
  color: #ececec;
}

.page-app #helpDialog[open] .dialog-header,
.page-app #serviceRulesDialog[open] .dialog-header {
  padding: 11px 14px;
}

.page-app #helpDialog[open] .dialog-title,
.page-app #serviceRulesDialog[open] .dialog-title {
  font-size: 15px;
}

.page-app #helpDialog[open] .dialog-body,
.page-app #serviceRulesDialog[open] .dialog-body {
  padding: 10px 12px 12px;
}

.page-app #helpDialog .help-guide-card--compact,
.page-app #serviceRulesDialog .help-guide-card--compact {
  padding: 10px 12px;
  border-radius: 10px;
}

.page-app #helpDialog .help-guide-card--compact .help-guide-lead,
.page-app #helpDialog .help-guide-card--compact .help-guide-text,
.page-app #helpDialog .help-guide-card--compact .help-guide-heading,
.page-app #helpDialog .help-guide-card--compact .help-guide-list,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-lead,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-text,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-heading,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-list {
  font-size: 10.5px;
  line-height: 1.58;
}

.page-app #helpDialog .help-guide-card--compact .help-guide-lead,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-lead {
  margin-bottom: 8px;
}

.page-app #helpDialog .help-guide-card--compact .help-guide-heading,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-heading {
  margin: 10px 0 4px;
  font-size: 10.5px;
}

.page-app #helpDialog .help-guide-card--compact .help-guide-text + .help-guide-text,
.page-app #helpDialog .help-guide-card--compact .help-guide-heading + .help-guide-text,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-text + .help-guide-text,
.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-heading + .help-guide-text {
  margin-top: 5px;
}

.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-list {
  margin-top: 4px;
  padding-right: 16px;
  line-height: 1.62;
}

.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-list li + li {
  margin-top: 3px;
}

.page-app #serviceRulesDialog .help-guide-card--compact .help-guide-text--closing {
  margin-top: 8px;
}

.dialog-body--move {
  gap: 12px;
}

.dialog-form-stack {
  display: grid;
  gap: 14px;
}

.dialog-folder {
  width: min(100% - 24px, 480px);
}

.dialog-confirm {
  width: min(100% - 24px, 440px);
}

.dialog-confirm-copy {
  color: var(--text);
  font-size: 14px;
  line-height: 2;
}

.dialog-confirm-actions {
  justify-content: flex-start;
}

.dialog-select-full {
  width: 100%;
  max-width: none;
}

.dialog-surface-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.dialog-selection-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.dialog-move {
  width: min(100% - 24px, 420px);
}

.dialog-move .dialog-header,
.dialog-move .dialog-body {
  padding: 16px;
}

.dialog-move .dialog-select-full {
  min-height: 44px;
  border-radius: 14px;
}

.dialog-move .dialog-actions {
  margin-top: 0;
}

.page-app .dialog-move .dialog-close.dialog-close--soft {
  width: 38px;
  min-width: 38px;
}

.page-app .dialog-move .dialog-surface-card {
  padding: 14px;
}

.page-app .dialog-move .dialog-select-full {
  border-color: #e5e7eb;
  background: #ffffff;
  color: #0f172a;
  box-shadow: none;
}

.page-app .dialog-move .btn-primary {
  min-height: 44px;
  border-radius: 12px;
  background: #0f172a;
  border-color: #0f172a;
}

.page-app .dialog-move .btn-primary:hover:not(:disabled) {
  background: #1e293b;
  border-color: #1e293b;
}

.page-app .dialog-move .btn-primary:disabled {
  background: #cbd5e1;
  border-color: #cbd5e1;
  color: #f8fafc;
  opacity: 1;
}

.dialog-close--soft {
  min-width: 72px;
}

.folder-name-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.folder-icon-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.folder-icon-button:hover,
.folder-icon-button.is-open {
  border-color: rgba(0, 0, 0, 0.22);
  background: #f5f5f5;
}

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

.folder-icon-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0d0d0d;
}

.folder-icon-glyph svg {
  width: 18px;
  height: 18px;
  display: block;
}

.folder-icon-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.folder-icon-picker[hidden] {
  display: none !important;
}

.folder-icon-choice {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.folder-icon-choice:hover {
  border-color: rgba(0, 0, 0, 0.2);
  background: #f5f5f5;
}

.folder-icon-choice.is-active {
  border-color: #0d0d0d;
  background: #f0f0f0;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.conversation-empty,
.conversation-item {
  border-radius: 18px;
  padding: 14px;
}

.conversation-empty {
  border: 1px dashed var(--line-2);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.conversation-item {
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.8);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.conversation-item:hover {
  background: rgba(15, 23, 42, 0.92);
}

.conversation-item--after-folders {
  margin-top: 14px;
}

.conversation-item.is-active {
  border-color: rgba(0, 0, 0, 0.75);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
  background: rgba(15, 23, 42, 0.98);
}

.conversation-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.conversation-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.conversation-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.conversation-item.is-editing {
  border-color: rgba(0, 0, 0, 0.35);
}

.conversation-item-title-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.2;
}

.conversation-item-meta {
  margin-top: 8px;
  color: #64748b;
  font-size: 11px;
}

.conversation-menu {
  position: relative;
  flex-shrink: 0;
}

.conversation-menu-trigger {
  opacity: 0;
  width: 30px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.18s ease, color 0.18s ease;
}

.conversation-menu-dots {
  width: 16px;
  height: 4px;
  display: block;
}

.conversation-item:has(.conversation-menu.is-open) {
  position: relative;
  z-index: 25;
}

.conversation-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  bottom: auto;
  inset-inline-end: 0;
  z-index: 30;
  min-width: 168px;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.98);
  box-shadow: 0 14px 36px rgba(2, 6, 23, 0.42);
}

.conversation-menu-panel[hidden] {
  display: none !important;
}

.conversation-menu-item {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 12px;
  text-align: start;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.conversation-menu-item:hover {
  background: rgba(51, 65, 85, 0.72);
}

.conversation-menu-item--danger {
  color: #fca5a5;
}

.conversation-menu-item--danger:hover {
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
}

.conversation-item:hover .conversation-menu-trigger,
.conversation-item.is-active .conversation-menu-trigger,
.conversation-menu.is-open .conversation-menu-trigger {
  opacity: 1;
}

.conversation-menu-trigger:hover,
.conversation-menu.is-open .conversation-menu-trigger {
  background: transparent;
  color: #cbd5e1;
}

.conversation-folder {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.conversation-folder-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 4px;
  cursor: pointer;
}

.conversation-folder-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.conversation-folder-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  flex: 0 0 auto;
}

.conversation-folder-icon .folder-icon-glyph svg {
  width: 16px;
  height: 16px;
}

.conversation-folder-copy {
  min-width: 0;
}

.conversation-folder-title {
  color: #0d0d0d;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-folder-chevron {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #676767;
  transition: transform 0.18s ease, color 0.18s ease;
}

.conversation-folder-chevron svg {
  width: 16px;
  height: 16px;
}

.conversation-folder.is-open .conversation-folder-chevron {
  transform: rotate(90deg);
  color: #0d0d0d;
}

.conversation-folder-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  flex: 0 0 auto;
  margin-inline-start: auto;
}

.conversation-folder:has(.conversation-menu.is-open) {
  position: relative;
  z-index: 25;
}

.conversation-folder-head:hover .conversation-menu-trigger,
.conversation-folder .conversation-menu.is-open .conversation-menu-trigger {
  opacity: 1;
}

.conversation-folder-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #676767;
  padding: 0;
  cursor: pointer;
  opacity: 1;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.conversation-folder-btn svg {
  width: 13px;
  height: 13px;
}

.conversation-folder-btn:hover {
  opacity: 1;
  background: #ececec;
  color: #0d0d0d;
}

.conversation-folder-btn--danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fda4af;
}

.conversation-folder-list {
  display: grid;
  gap: 2px;
  margin-inline-start: 6px;
  padding-inline-start: 6px;
  border-inline-start: 0;
}

.conversation-folder-list[hidden] {
  display: none !important;
}

.conversation-item--nested {
  margin-inline-start: 0;
  padding: 3px 6px;
  border-radius: 10px;
}

.conversation-item--nested .conversation-item-row {
  gap: 3px;
}

.conversation-item--nested .conversation-item-title {
  font-size: 9px;
}

.conversation-item--nested .conversation-item-meta {
  display: none;
}

.conversation-item--nested .conversation-menu-trigger {
  width: 22px;
  height: 20px;
}

.conversation-item--nested .conversation-menu-dots {
  width: 12px;
}

.conversation-folder-empty {
  padding: 2px 0 0;
  color: #64748b;
  font-size: 12px;
}

.message-row {
  display: flex;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto 18px;
}

.message-row--user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  background: var(--panel-2);
}

.message-avatar--assistant {
  background: rgba(49, 46, 129, 0.38);
}

.message-bubble {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(2, 6, 23, 0.9);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.12);
}

.message-bubble--assistant {
  flex: 1;
}

.message-bubble--user {
  max-width: min(85%, 640px);
  background: rgba(15, 23, 42, 0.96);
}

.message-body {
  font-size: 14px;
  line-height: 1.9;
  direction: ltr;
  text-align: left;
}

.message-body--rtl {
  direction: rtl;
  text-align: right;
}

.message-body--ltr {
  direction: ltr;
  text-align: left;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-small {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 12px;
}

.text-danger {
  color: #000000;
}

.tibra-msg {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.9;
  direction: inherit;
  text-align: inherit;
}

.tibra-prose {
  line-height: 1.9;
  direction: inherit;
  text-align: inherit;
}

.message-body--rtl .tibra-prose pre,
.message-body--rtl .tibra-prose code,
.message-body--rtl .tibra-prose :not(pre) > code {
  direction: ltr;
  text-align: left;
}

.tibra-prose > :first-child {
  margin-top: 0;
}

.tibra-prose > :last-child {
  margin-bottom: 0;
}

.tibra-prose p,
.tibra-prose ul,
.tibra-prose ol,
.tibra-prose blockquote,
.tibra-prose pre,
.tibra-prose .md-table-wrap {
  margin: 0 0 1rem;
}

.tibra-prose .md-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.tibra-prose .md-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}

.tibra-prose .md-table th,
.tibra-prose .md-table td {
  border: 1px solid #e5e5e5;
  padding: 0.55rem 0.75rem;
  text-align: start;
  vertical-align: top;
}

.tibra-prose .md-table th {
  background: #f7f7f8;
  color: #0d0d0d;
  font-weight: 600;
}

.tibra-prose .md-table td {
  color: #0d0d0d;
}

.message-body--rtl .tibra-prose .md-table th,
.message-body--rtl .tibra-prose .md-table td {
  text-align: start;
}

.tibra-prose ul,
.tibra-prose ol {
  padding-inline-start: 1.3rem;
}

.tibra-prose li + li {
  margin-top: 0.35rem;
}

.tibra-prose h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.85rem;
  line-height: 1.6;
}

.tibra-prose a.md-link {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.tibra-prose li .list-item-extra {
  margin-top: 0.4rem;
  color: #4b5563;
  font-size: 0.95em;
  line-height: 1.75;
}

.tibra-prose li .code-block {
  margin: 0.55rem 0 0;
}

.tibra-prose blockquote {
  border-inline-start: 3px solid #6366f1;
  padding-inline-start: 1rem;
  color: #cbd5e1;
}

.code-block {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #020617;
}

.code-block-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.9);
  direction: ltr;
}

.code-block-lang {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code-copy-btn {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0 10px;
  cursor: pointer;
}

.code-copy-btn:hover {
  background: #162033;
}

.tibra-prose pre {
  overflow: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px;
  direction: ltr;
  text-align: left;
}

.tibra-prose code {
  font-family: var(--font-mono);
}

.tibra-prose :not(pre) > code {
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.1rem 0.35rem;
  font-size: 0.92em;
}

.tibra-scroll {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tibra-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: inline-flex;
  }
}

@media (min-width: 1025px) {
  .sidebar-overlay {
    display: none !important;
  }

  .page-app .sidebar-toggle {
    display: inline-flex;
  }

  .page-app.sidebar-collapsed .topbar .sidebar-toggle {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0;
  }

  .app-frame {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .input-select {
    max-width: none;
    flex: 1;
  }

  .dialog-actions,
  .composer-row {
    flex-direction: column;
  }

  .composer-submit,
  .dialog-actions .btn {
    width: 100%;
  }

  .message-row,
  .message-row--user {
    flex-direction: column;
  }

  .message-bubble--user,
  .message-bubble--assistant {
    max-width: none;
    width: 100%;
  }
}

.page-app {
  background: #ffffff;
  color: #000000;
}

.page-app .app-shell {
  padding: 0;
}

.page-app .app-frame {
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.page-app .app-layout {
  background: #ffffff;
}

.page-app .sidebar {
  width: 260px;
  background: #ffffff;
  border-left: 1px solid #ececec;
}

.page-app .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
}

.page-app .sidebar-brand-copy {
  min-width: 0;
}

.page-app .sidebar-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
}

.page-app .sidebar-brand-text {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
}

.page-app .sidebar-brand-subtitle {
  margin-top: 2px;
  color: #9ca3af;
  font-size: 12px;
}

.page-app .brand-subtitle:empty {
  display: none;
}

.page-app .sidebar-toolbar,
.page-app .sidebar-footer,
.page-app .topbar,
.page-app .composer-wrap {
  border-color: #ececec;
}

.page-app .sidebar-section {
  padding: 12px 14px 0;
}

.page-app .sidebar-section-title {
  margin-bottom: 10px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-app .sidebar-shortcuts {
  display: grid;
  gap: 8px;
}

.page-app .sidebar-shortcut {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  border-radius: 14px;
  background: #ffffff;
  color: #374151;
}

.page-app .sidebar-search,
.page-app .input,
.page-app .composer {
  border-color: #e5e7eb;
}

.page-app .input {
  min-height: 42px;
  background: #ffffff;
  color: #000000;
  box-shadow: none;
}

.page-app .input::placeholder,
.page-app .composer-input::placeholder {
  color: #9ca3af;
}

.page-app .btn-secondary {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.12);
}

.page-app .btn-secondary:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.18);
}

.page-app .btn-primary {
  background: #000000;
  border-color: #000000;
}

.page-app .btn-primary:hover {
  background: #000000;
  border-color: #000000;
}

.page-app .btn-danger {
  background: #ef4444;
  border-color: #ef4444;
}

.page-app .topbar {
  min-height: 58px;
  padding: 10px 22px;
  background: #ffffff;
}

.page-app .brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #000000;
}

.page-app .brand-subtitle {
  margin-top: 4px;
  color: #9ca3af;
  font-size: 12px;
}

.page-app .topbar-user-chip {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  color: #374151;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-app .input-select {
  max-width: 170px;
  border-radius: 999px;
  background: #ffffff;
}

.page-app .chat-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-app .main-panel {
  background: #ffffff;
}

.page-app .chat-compose-area {
  flex: 0 0 auto;
  width: 100%;
}

.page-app .main-panel.is-empty .chat-stage {
  justify-content: center;
  align-items: center;
}

.page-app .main-panel.is-empty .messages-panel {
  display: none;
}

.page-app .main-panel.is-empty .chat-compose-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 32px;
}

.page-app .main-panel:not(.is-empty) .chat-compose-area {
  margin-top: auto;
}

.page-app .main-panel.is-empty .messages {
  display: none;
}

.page-app .messages {
  padding: 28px 22px;
}

.page-app .message-row {
  margin-bottom: 22px;
}

.page-app .messages-panel {
  background: #ffffff;
}

.page-app .empty-state {
  position: static;
  padding: 0 20px 12px;
}

.page-app .empty-state-inner {
  width: 100%;
  max-width: 560px;
}

.page-app .empty-state-title {
  margin: 8px 0 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  color: #1f2937;
}

.page-app .empty-state-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ffffff;
  color: #000000;
  font-size: 12px;
  font-weight: 600;
}

.page-app .empty-state-text {
  max-width: 580px;
  margin: 14px auto 0;
  color: #6b7280;
}

.page-app .empty-state-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.page-app .suggestion-card {
  display: block;
  text-align: left;
  min-height: 136px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  color: #000000;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.page-app .suggestion-card:hover {
  transform: translateY(-2px);
  border-color: #d1d5db;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08);
}

.page-app .suggestion-card-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
}

.page-app .suggestion-card-text {
  display: block;
  margin-top: 10px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.8;
}

.page-app .composer-wrap {
  border-top: 0;
  padding: 0 16px 28px;
  background: transparent;
}

.page-app .main-panel.is-empty .composer-wrap {
  padding-bottom: 0;
}

.page-app .composer-inner {
  max-width: 840px;
}

.page-app .composer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #e5e5e5;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  padding: 6px 8px;
}

.page-app .composer-row {
  align-items: center;
}

.page-app .composer-row-actions {
  display: contents;
}

.page-app .composer-row > .composer-attach-btn,
.page-app .composer-row > .composer-submit,
.page-app .composer-row-actions > .composer-attach-btn,
.page-app .composer-row-actions > .composer-submit {
  align-self: center;
  flex-shrink: 0;
}

.page-app .composer-plus {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4b5563;
  cursor: default;
  font-size: 24px;
  line-height: 1;
}

.page-app .composer-input {
  min-height: 44px;
  height: 44px;
  color: #000000;
  padding: 11px 8px;
  line-height: 22px;
  box-sizing: border-box;
  margin: 0;
  overflow-y: hidden;
}

.page-app .composer-submit {
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
}

.page-app .composer-submit-icon {
  display: none;
  align-items: center;
  justify-content: center;
}

.page-app .composer-submit-icon:not([hidden]) {
  display: inline-flex;
}

.page-app .composer-submit-icon[hidden] {
  display: none !important;
}

.page-app .composer-submit-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.page-app .composer-submit-label {
  display: inline;
}

.page-app .composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #ececec;
}

.page-app .composer-toolbar-left,
.page-app .composer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-app .composer-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #000000;
  font-size: 12px;
  font-weight: 600;
}

.page-app .composer-badge-muted {
  background: #f3f4f6;
  color: #6b7280;
}

.page-app .composer-toolbar-right {
  color: #9ca3af;
  font-size: 12px;
}

.page-app .composer-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.page-app .composer-attach-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.page-app .composer-attach-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0d0d0d;
}

.page-app .composer-attach-btn.is-uploading {
  pointer-events: none;
  opacity: 0.65;
}

.page-app .composer-attach-btn:disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.55;
}

.page-app .composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 4px 0;
}

.page-app .composer-attachments[hidden] {
  display: none !important;
  padding: 0;
  margin: 0;
}

.page-app .composer-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(100%, 280px);
  padding: 6px 8px 6px 6px;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #f9fafb;
}

.page-app .composer-attachment-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.page-app .composer-attachment-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #ececec;
  font-size: 18px;
  flex-shrink: 0;
}

.page-app .composer-attachment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.page-app .composer-attachment-name {
  font-size: 12px;
  font-weight: 600;
  color: #0d0d0d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-app .composer-attachment-size {
  font-size: 11px;
  color: #6b7280;
}

.page-app .composer-attachment-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-inline-start: 2px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.page-app .composer-attachment-remove:hover {
  background: #ececec;
  color: #0d0d0d;
}

.page-app .message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.page-app .message-attachment {
  display: block;
  text-decoration: none;
  color: inherit;
}

.page-app .message-attachment--image img {
  display: block;
  max-width: min(100%, 320px);
  max-height: 240px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  object-fit: contain;
}

.page-app .message-attachment--file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.04);
  font-size: 12px;
  font-weight: 600;
}

.page-app .message-attachment--file:hover {
  background: rgba(0, 0, 0, 0.07);
}

.page-app .composer-attach-soon {
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2f7;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
}

.page-app .composer-tools {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 0 8px 12px;
  direction: rtl;
}

.page-app #composerWebSearchBtn {
  grid-column: 1;
  grid-row: 1;
}

.page-app #composerDeepAnalysisBtn {
  grid-column: 2;
  grid-row: 1;
}

.page-app #composerProgrammingBtn {
  grid-column: 3;
  grid-row: 1;
}

.page-app .composer-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: none;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.page-app.theme-light .composer-tool-btn {
  border: 1px solid #e5e5e5;
  background: #ffffff;
  color: #4b5563;
}

.page-app.theme-light .composer-tool-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #111827;
}

.page-app.theme-light .composer-tool-btn.is-active {
  background: #f3f4f6;
  border-color: #0d0d0d;
  color: #0d0d0d;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.page-app.theme-light .composer-tool-btn:active {
  background: #ececec;
  border-color: #0d0d0d;
  color: #0d0d0d;
}

.page-app .composer-tool-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.page-app .composer-tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.page-app .composer-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.page-app .prompt-chip {
  min-height: 34px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  color: #4b5563;
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.page-app .prompt-chip:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.page-app .composer-hint {
  color: #9ca3af;
}

.page-app .conversation-empty {
  border-color: #e5e7eb;
  color: #6b7280;
  background: #ffffff;
}

.page-app .conversation-item {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 6px 10px;
  margin-bottom: 0;
}

.page-app .conversation-item:hover,
.page-app .conversation-item.is-active {
  background: #ececec;
  box-shadow: none;
}

.page-app .conversation-item--after-folders {
  margin-top: 6px;
}

.page-app .conversation-item.is-active {
  border-color: transparent;
}

.page-app .conversation-item-title {
  color: #0d0d0d;
}

.page-app .conversation-item-title-input {
  color: #0d0d0d;
  background: #ffffff;
  border-color: #d1d5db;
}

.page-app .conversation-item.is-editing .conversation-menu-trigger {
  opacity: 0;
  pointer-events: none;
}

.page-app .conversation-item-meta {
  color: #676767;
}

.page-app .conversation-folder-icon {
  background: transparent;
}

.page-app .conversation-folder-title {
  color: #0d0d0d;
}

.page-app .conversation-folder-chevron {
  color: #676767;
}

.page-app .conversation-folder.is-open .conversation-folder-chevron {
  color: #0d0d0d;
}

.page-app .conversation-folder-list {
  border-inline-start-color: transparent;
}

.page-app .conversation-item--nested {
  padding: 3px 6px;
}

.page-app .conversation-folder-btn {
  color: #676767;
}

.page-app .conversation-folder-btn:hover {
  background: #ececec;
  color: #0d0d0d;
}

.page-app .conversation-folder-btn--danger:hover {
  background: rgba(254, 226, 226, 0.95);
  color: #dc2626;
}

.page-app .conversation-menu-trigger {
  background: transparent;
  color: #64748b;
}

.page-app .conversation-menu-trigger:hover,
.page-app .conversation-menu.is-open .conversation-menu-trigger {
  background: transparent;
  color: #0f172a;
}

.page-app .conversation-menu-panel {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.page-app .conversation-menu-item {
  color: #0f172a;
}

.page-app .conversation-menu-item:hover {
  background: rgba(241, 245, 249, 0.95);
}

.page-app .conversation-menu-item--danger {
  color: #dc2626;
}

.page-app .conversation-menu-item--danger:hover {
  background: rgba(254, 226, 226, 0.7);
}

.page-app .conversation-delete {
  color: #dc2626;
}

.page-app .conversation-delete:hover {
  border-color: #000000;
  background: #fef2f2;
}

.page-app .sidebar-bottom-links {
  display: grid;
  gap: 6px;
  padding: 12px 14px 8px;
  margin-top: auto;
}

.page-app .sidebar-link-button {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #374151;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.page-app .sidebar-link-button:hover {
  background: #ececec;
}

.page-app .sidebar-footer {
  display: block;
  border-top: 1px solid #ececec;
  color: #6b7280;
  overflow: visible;
}

.page-app .sidebar-account {
  position: relative;
}

.page-app .sidebar-account-trigger {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: background 0.18s ease;
}

.page-app .sidebar-account-trigger:hover,
.page-app .sidebar-account-trigger.is-open {
  background: rgba(0, 0, 0, 0.04);
}

.page-app .sidebar-account-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(145deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #111827;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.page-app .sidebar-account-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-app .sidebar-account-avatar-fallback {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.page-app .sidebar-account-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.page-app .sidebar-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111827;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.page-app .sidebar-account-plan {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
}

.page-app .sidebar-account-store-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #6b7280;
}

.page-app .sidebar-account-store-icon svg {
  width: 18px;
  height: 18px;
}

.page-app .sidebar-account-panel {
  position: absolute;
  inset-inline: 0;
  bottom: calc(100% + 10px);
  z-index: 40;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5e5e5;
  border-radius: 18px;
  background: #f9f9f9;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.page-app .sidebar-account-panel[hidden] {
  display: none !important;
}

.page-app .sidebar-account-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-app .sidebar-account-panel-identity {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: start;
}

.page-app .sidebar-account-panel-name {
  color: #111827;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

.page-app .sidebar-account-panel-contact {
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  direction: ltr;
  text-align: right;
  unicode-bidi: plaintext;
}

.page-app .sidebar-account-logout {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #ffffff;
  color: #111827;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.page-app .sidebar-account-logout:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.page-app .sidebar-account-logout svg {
  width: 18px;
  height: 18px;
}

.page-app .sidebar-account-panel .sidebar-user-plan-row {
  margin-top: 0;
}

.page-app .sidebar-account-panel .sidebar-plan-usage {
  margin-top: 0;
}

.page-app .sidebar-user-label {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 6px;
}

.page-app .sidebar-user {
  color: #000000;
  font-size: 13px;
}

.page-app .message-avatar {
  border-color: #e5e7eb;
  background: #f3f4f6;
  color: #000000;
}

.page-app .message-avatar--assistant {
  background: #000000;
  color: #ffffff;
}

.page-app .message-bubble {
  border-color: #ececec;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.03);
}

.page-app .message-bubble--user {
  background: #f4f4f4;
  color: #0d0d0d;
}

.page-app .message-actions {
  margin-top: 14px;
}

.page-app .message-body,
.page-app .tibra-msg,
.page-app .tibra-prose {
  color: #000000;
}

.page-app .tibra-prose blockquote {
  color: #374151;
  border-inline-start-color: #d1d5db;
}

.page-app .tibra-prose pre {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.page-app .code-block {
  border-color: #e5e7eb;
  background: #f8fafc;
}

.page-app .code-block-bar {
  border-bottom-color: #e5e7eb;
  background: #ffffff;
}

.page-app .code-block-lang {
  color: #000000;
}

.page-app .code-copy-btn {
  border-color: rgba(0, 0, 0, 0.12);
  background: #ffffff;
  color: #0f172a;
}

.page-app .code-copy-btn:hover {
  background: #ffffff;
}

.page-app .tibra-prose pre {
  background: transparent;
}

.page-app .tibra-prose :not(pre) > code {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.page-app .text-danger {
  color: #dc2626;
}

.page-app .dialog {
  border-color: #e5e7eb;
  background: #ffffff;
  color: #000000;
}

.page-app .dialog-settings {
  width: min(100% - 24px, 640px);
}

.page-app .dialog-folder {
  width: min(100% - 24px, 460px);
}

.page-app .dialog-header--settings {
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
}

.page-app .dialog-auth {
  width: min(100% - 24px, 460px);
}

.page-app .dialog-close,
.page-app .dialog-note,
.page-app .field-label {
  color: #64748b;
}

.page-app .dialog-title {
  color: #0f172a;
}

.page-app .dialog-close {
  border-color: #e5e7eb;
  background: #ffffff;
  color: #6b7280;
}

.page-app .dialog-close:hover {
  border-color: #d1d5db;
  background: #f8fafc;
  color: #111827;
}

.page-app .dialog-surface-card {
  border-color: #e5e7eb;
  background: #f8fafc;
}

.page-app .settings-grid {
  display: grid;
  gap: 14px;
}

.page-app .settings-card {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.84);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.page-app .settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-app .settings-card-title {
  color: #000000;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-app .settings-card-note {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.page-app .settings-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.page-app .settings-header-close-form {
  margin: 0;
  display: flex;
  align-items: center;
}

.page-app .settings-theme-toggle,
.page-app .settings-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
}

.page-app.theme-light .settings-lang-toggle {
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.page-app .settings-lang-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.page-app .settings-lang-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.page-app.theme-light .settings-lang-option:has(.settings-lang-input:checked) {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.page-app.theme-dark .settings-lang-toggle {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.page-app.theme-dark .settings-lang-option {
  color: #94a3b8;
}

.page-app.theme-dark .settings-lang-option:has(.settings-lang-input:checked) {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.page-app.theme-light .settings-theme-toggle {
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.page-app .settings-theme-option {
  position: relative;
  display: inline-flex;
  width: 34px;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.page-app .settings-theme-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.page-app .settings-theme-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  pointer-events: none;
}

.page-app .settings-theme-option-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.page-app.theme-light .settings-theme-option:hover .settings-theme-option-icon {
  color: #0f172a;
}

.page-app.theme-light .settings-theme-option:has(.settings-theme-input:checked),
.page-app.theme-light .settings-theme-option.is-selected {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.page-app.theme-light .settings-theme-option:has(.settings-theme-input:checked) .settings-theme-option-icon,
.page-app.theme-light .settings-theme-option.is-selected .settings-theme-option-icon {
  color: #0f172a;
}

.page-app .settings-theme-option:has(.settings-theme-input:focus-visible) {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.page-app .settings-profile-row {
  gap: 12px;
}

.page-app .settings-profile-field-full {
  margin-top: 0;
}

.page-app .settings-profile-contact-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-app .settings-profile-birth {
  display: grid;
  gap: 8px;
}

.page-app .settings-profile-birth-row {
  gap: 10px;
}

.page-app .field-row.settings-profile-birth-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page-app .settings-profile-birth-row .input-select {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.page-app .settings-profile-birth-row .field {
  min-width: 0;
}

.page-app .field-label--sub {
  font-size: 12px;
  color: #6b7280;
}

.page-app.theme-dark .field-label--sub {
  color: #a3a3a3;
}

.page-app .settings-profile-textarea {
  min-height: 72px;
  resize: vertical;
}

.page-app .input-readonly,
.page-app .input.input-readonly {
  cursor: default;
  background: #f9fafb;
  color: #374151;
}

.page-app .input-readonly:focus,
.page-app .input.input-readonly:focus {
  border-color: #e5e5e5;
  box-shadow: none;
}

.page-app .settings-avatar-block {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.page-app .settings-avatar-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.page-app .settings-avatar-preview {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  background: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-app .settings-avatar-pick-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 0 0 auto;
}

.page-app .settings-avatar-pick-btn {
  flex: 0 0 auto;
  min-height: 42px;
  white-space: nowrap;
}

.page-app .settings-avatar-limit {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #6b7280;
}

.page-app .settings-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-app .settings-avatar-fallback {
  color: #111827;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.page-app .settings-actions {
  justify-content: stretch;
}

.page-app .settings-save-btn,
.page-app .settings-plan-btn {
  width: 100%;
}

.page-app .settings-plan-panel {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.page-app .settings-plan-row,
.page-app .sidebar-user-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-app .settings-plan-row {
  margin-top: 0;
}

.page-app .sidebar-user-plan-row {
  margin-top: 12px;
}

.page-app .sidebar-plan-usage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.page-app .sidebar-plan-progress {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 10px;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  background: #ffffff;
}

.page-app .sidebar-plan-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-app .sidebar-plan-progress-label {
  color: #676767;
  font-size: 11px;
  font-weight: 600;
}

.page-app .sidebar-plan-progress-percent {
  color: #000000;
  font-size: 12px;
  font-weight: 700;
}

.page-app .sidebar-plan-progress-track {
  position: relative;
  overflow: hidden;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: #e5e5e5;
}

.page-app .sidebar-plan-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #000000 0%, #000000 55%, #000000 100%);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.24);
}

.page-app .sidebar-plan-usage-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  background: #ffffff;
}

.page-app .sidebar-plan-usage-label {
  color: #676767;
  font-size: 11px;
  font-weight: 600;
}

.page-app .sidebar-plan-usage-value {
  color: #000000;
  font-size: 14px;
  font-weight: 700;
}

.page-app .settings-plan-label,
.page-app .sidebar-user-plan-label {
  color: #676767;
  font-size: 12px;
  font-weight: 600;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #ececec;
  color: #0d0d0d;
  font-size: 12px;
  font-weight: 600;
}

.dialog-plans--upgrade {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000000;
  color: #f5f5f5;
  box-shadow: none;
  overflow: hidden;
}

.dialog-plans--upgrade::backdrop {
  background: #000000;
}

.plans-upgrade {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.plans-upgrade-close {
  position: absolute;
  top: 18px;
  inset-inline-start: 18px;
  z-index: 2;
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f5;
  font: inherit;
  cursor: pointer;
}

.plans-upgrade-close svg {
  width: 18px;
  height: 18px;
  display: block;
}

.plans-upgrade-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.plans-upgrade-header {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 56px 24px 10px;
  text-align: center;
}

.plans-upgrade-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.plans-upgrade-segment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.plans-upgrade-segment-btn {
  appearance: none;
  -webkit-appearance: none;
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #a3a3a3;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.plans-upgrade-segment-btn.is-active {
  background: #2a2a2a;
  color: #ffffff;
}

.plans-upgrade-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px 24px 12px;
}

.plans-upgrade-panel.is-hidden {
  display: none;
}

.plans-upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.plans-upgrade-panel[data-plans-panel="scale"] .plans-upgrade-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 1320px);
}

.plan-upgrade-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
  padding: 22px 20px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: #1a1a1a;
}

.plan-upgrade-card.is-active {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.plan-upgrade-card-top {
  display: grid;
  gap: 10px;
}

.plan-upgrade-name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.plan-upgrade-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  line-height: 1.2;
}

.plan-upgrade-price-amount {
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.plan-upgrade-price-suffix {
  font-size: 14px;
  font-weight: 600;
  color: #a3a3a3;
}

.plan-upgrade-tagline {
  margin: 0;
  color: #a3a3a3;
  font-size: 13px;
  line-height: 1.7;
}

.plan-upgrade-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 46px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.plan-upgrade-btn--upgrade {
  border: 0;
  background: #ffffff;
  color: #0a0a0a;
}

.plan-upgrade-btn--upgrade:hover:not(:disabled) {
  background: #e5e5e5;
}

.plan-upgrade-btn--current,
.plan-upgrade-btn:disabled {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #d4d4d4;
  cursor: default;
}

.plan-upgrade-features {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-upgrade-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #d4d4d4;
  font-size: 13px;
  line-height: 1.65;
}

.plan-upgrade-feature-icon {
  flex: 0 0 auto;
  margin-top: 2px;
  color: #ffffff;
}

.plan-upgrade-footnote {
  margin: auto 0 0;
  color: #737373;
  font-size: 11px;
  line-height: 1.7;
}

.plans-upgrade-footer {
  flex: 0 0 auto;
  padding: 8px 24px 28px;
  text-align: center;
}

.plans-upgrade-footer-note {
  margin: 0;
  color: #737373;
  font-size: 12px;
  line-height: 1.8;
}

/* Legacy plan card hooks (settings / mono overrides) */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.plan-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.plan-card.is-active {
  border-color: rgba(0, 0, 0, 0.46);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12);
}

.plan-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-card-name {
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.plan-card-current {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  color: #000000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.plan-card-hint {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  margin-top: 4px;
}

.plan-card-limit {
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.plan-card-price {
  color: #000000;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.page-app .plan-select-btn:not(.plan-upgrade-btn) {
  min-height: 44px;
  margin-top: 4px;
  border-radius: 16px;
}

.page-app .field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
  animation: tibra-bounce 1.1s infinite ease-in-out;
}

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

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

.toast-region {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.96);
  color: #000000;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.12);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  border-color: #bbf7d0;
}

.toast--error {
  border-color: #000000;
}

@keyframes tibra-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.45;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.page-app {
  position: relative;
  min-height: 100vh;
  background: #ffffff;
  color: #000000;
}

.page-app .app-ambient {
  position: fixed;
  inset: auto;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.page-app .app-ambient-a {
  top: -120px;
  right: -80px;
  background: rgba(0, 0, 0, 0.28);
}

.page-app .app-ambient-b {
  bottom: -160px;
  left: -100px;
  background: rgba(0, 0, 0, 0.16);
}

.page-app .app-shell {
  position: relative;
  z-index: 1;
  padding: 0;
}

.page-app .app-frame {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
  overflow: hidden;
}

.page-app .app-layout {
  gap: 0;
  background: transparent;
}

.page-app .sidebar {
  flex: 0 0 292px;
  width: 292px;
  padding: 14px;
  background: #f9f9f9;
  border-left: 1px solid #e5e5e5;
  overflow-x: hidden;
  transition: width 0.22s ease, flex-basis 0.22s ease, padding 0.22s ease, opacity 0.2s ease,
    border-color 0.22s ease;
}

.page-app .sidebar-brand,
.page-app .sidebar-toolbar,
.page-app .sidebar-search-panel,
.page-app .sidebar-section,
.page-app .conversation-list,
.page-app .sidebar-bottom-links,
.page-app .sidebar-footer,
.page-app .sidebar-overview {
  position: relative;
  z-index: 1;
}

.page-app .sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 14px;
}

.page-app .sidebar-brand-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-app .sidebar-brand-copy {
  flex: 0 1 auto;
  min-width: 0;
}

.page-app .sidebar-brand-mark {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.page-app .sidebar-brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.page-app .sidebar-brand-text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-app .sidebar-brand-subtitle {
  color: #64748b;
}

.page-app .sidebar-collapse-btn,
.page-app .sidebar-expand-btn {
  display: inline-flex;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: #475569;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.page-app .sidebar-collapse-btn {
  margin-inline-start: auto;
}

.page-app .sidebar-collapse-btn svg,
.page-app .sidebar-expand-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

.page-app .sidebar-collapse-btn:hover,
.page-app .sidebar-expand-btn:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.page-app.theme-dark .sidebar-collapse-btn,
.page-app.theme-dark .sidebar-expand-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.page-app.theme-dark .sidebar-collapse-btn:hover,
.page-app.theme-dark .sidebar-expand-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  box-shadow: none;
}

@media (max-width: 1024px) {
  .page-app .sidebar-collapse-btn {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  .page-app .sidebar-collapse-btn {
    display: inline-flex !important;
  }
}

.page-app .sidebar-rail-end,
.page-app .sidebar-toolbar-main .sidebar-rail-action-icon {
  display: none;
}

.page-app .sidebar-rail-action,
.page-app .sidebar-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-app .sidebar-toolbar {
  padding: 0 8px 10px;
  direction: rtl;
}

.page-app .sidebar-toolbar #newChatBtn {
  flex: 1 1 auto;
  min-width: 0;
}

.page-app .sidebar-toolbar-icon-btn {
  display: inline-flex;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #334155;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.page-app .sidebar-toolbar-icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.page-app .sidebar-toolbar-icon-btn:hover,
.page-app .sidebar-toolbar-icon-btn.is-active {
  background: #ffffff;
  border-color: rgba(199, 210, 254, 0.95);
  color: #0f172a;
}

.page-app .sidebar-toolbar-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  border-radius: 12px;
  font-size: 13px;
  white-space: nowrap;
}

.page-app .sidebar-search-panel {
  padding: 0 8px 10px;
}

.page-app .sidebar-search-panel[hidden] {
  display: none !important;
}

.page-app .sidebar-search-panel .sidebar-search {
  min-height: 42px;
  border-radius: 12px;
}

@media (min-width: 1025px) {
  .page-app.sidebar-collapsed .sidebar {
    flex: 0 0 56px;
    width: 56px;
    min-width: 56px;
    padding: 12px 8px;
    opacity: 1;
    pointer-events: auto;
    overflow: hidden;
    align-items: center;
  }

  .page-app.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    width: 100%;
    padding: 0 0 10px;
  }

  .page-app.sidebar-collapsed .sidebar-brand-main {
    justify-content: center;
    width: 100%;
  }

  .page-app.sidebar-collapsed .sidebar-brand-copy,
  .page-app.sidebar-collapsed .sidebar-collapse-btn,
  .page-app.sidebar-collapsed .sidebar-close-button {
    display: none !important;
  }

  .page-app.sidebar-collapsed .sidebar-brand-logo {
    width: 32px;
    height: 32px;
  }

  .page-app.sidebar-collapsed .conversation-list,
  .page-app.sidebar-collapsed .sidebar-utility-links,
  .page-app.sidebar-collapsed .sidebar-search-panel {
    display: none !important;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar {
    width: 100%;
    padding: 0;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 0;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar #sidebarSearchBtn {
    order: 1;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar #newChatBtn {
    order: 2;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar #createFolderBtn {
    order: 3;
  }

  .page-app.sidebar-collapsed .sidebar-rail-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .page-app.sidebar-collapsed .sidebar-rail-end {
    margin-top: auto;
    padding: 10px 0 4px;
  }

  .page-app.sidebar-collapsed .sidebar-expand-btn,
  .page-app.sidebar-collapsed .sidebar-toolbar-icon-btn,
  .page-app.sidebar-collapsed .sidebar-toolbar-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow: none;
  }

  .page-app.sidebar-collapsed .sidebar-expand-btn {
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    color: #475569;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar-icon-btn,
  .page-app.sidebar-collapsed .sidebar-toolbar-main {
    color: #6b7280;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar-icon-btn svg,
  .page-app.sidebar-collapsed .sidebar-expand-btn svg,
  .page-app.sidebar-collapsed .sidebar-toolbar-main .sidebar-rail-action-icon svg {
    width: 20px;
    height: 20px;
    display: block;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar-main .sidebar-rail-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar-main .sidebar-rail-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .page-app.sidebar-collapsed .sidebar-toolbar-main {
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
  }

  .page-app.sidebar-collapsed .sidebar-expand-btn:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  }

  .page-app.sidebar-collapsed .sidebar-toolbar-icon-btn:hover,
  .page-app.sidebar-collapsed .sidebar-toolbar-main:hover {
    background: rgba(148, 163, 184, 0.16);
    color: #334155;
  }

  .page-app.sidebar-collapsed .sidebar-footer {
    width: 100%;
    margin: 0;
    padding: 8px 0 4px;
    border-top: 0;
    background: transparent;
  }

  .page-app.sidebar-collapsed .sidebar-account-trigger {
    justify-content: center;
    width: 40px;
    min-height: 40px;
    margin: 0 auto;
    padding: 0;
    gap: 0;
    border: 0;
    background: transparent;
  }

  .page-app.sidebar-collapsed .sidebar-account-copy,
  .page-app.sidebar-collapsed .sidebar-account-store-icon {
    display: none !important;
  }

  .page-app.sidebar-collapsed .sidebar-account-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .page-app.sidebar-collapsed .sidebar-footer-btn--guest {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0 auto;
    padding: 0;
    border-radius: 12px;
  }

  .page-app.sidebar-collapsed .sidebar-footer-btn--guest .sidebar-rail-action-icon {
    display: inline-flex;
    color: #ffffff;
  }

  .page-app.sidebar-collapsed .sidebar-footer-btn--guest .sidebar-rail-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .page-app.theme-dark.sidebar-collapsed .sidebar-expand-btn {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
  }

  .page-app.theme-dark.sidebar-collapsed .sidebar-toolbar-icon-btn,
  .page-app.theme-dark.sidebar-collapsed .sidebar-toolbar-main {
    color: #d4d4d4;
  }

  .page-app.theme-dark.sidebar-collapsed .sidebar-toolbar-main {
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f5;
  }

  .page-app.theme-dark.sidebar-collapsed .sidebar-expand-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
  }

  .page-app.theme-dark.sidebar-collapsed .sidebar-toolbar-icon-btn:hover,
  .page-app.theme-dark.sidebar-collapsed .sidebar-toolbar-main:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
  }
}

.page-app .sidebar-close-button {
  display: none;
}

.page-app.theme-dark .sidebar-toolbar-icon-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e5e5e5;
}

.page-app.theme-dark .sidebar-toolbar-icon-btn:hover,
.page-app.theme-dark .sidebar-toolbar-icon-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.page-app .sidebar-overview {
  margin: 14px 8px 0;
  padding: 16px 16px 14px;
  border: 1px solid rgba(199, 210, 254, 0.95);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.96) 0%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow: 0 14px 36px rgba(79, 70, 229, 0.08);
}

.page-app .sidebar-overview-label {
  color: #6366f1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-app .sidebar-overview-value {
  margin-top: 8px;
  color: #0f172a;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.page-app .sidebar-section {
  padding: 18px 8px 0;
}

.page-app .sidebar-shortcuts {
  gap: 10px;
}

.page-app .sidebar-shortcut {
  min-height: 42px;
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.page-app .conversation-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px 6px;
  overflow-x: hidden;
}

.page-app .sidebar-utility-links {
  display: grid;
  gap: 2px;
  padding: 10px 8px 16px;
  margin-bottom: 8px;
}

.page-app .conversation-empty {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.page-app .conversation-item {
  margin-bottom: 0;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.page-app .conversation-item:hover,
.page-app .conversation-item.is-active {
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.page-app .conversation-item-title {
  font-size: 14px;
  font-weight: 400;
  color: #0f172a;
}

.page-app .conversation-item-meta {
  margin-top: 8px;
}

.page-app .sidebar-link-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #000000;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.page-app .sidebar-link-button:hover {
  background: rgba(255, 255, 255, 0.84);
}

.page-app .sidebar-link-button--icon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}

.page-app .sidebar-link-button--icon svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #000000;
}

.page-app .sidebar-footer {
  position: relative;
  z-index: 6;
  margin: 0 8px 0;
  padding: 18px 16px 16px;
  border: 0;
  border-top: 1px solid #e5e5e5;
  border-radius: 0;
  background: #f9f9f9;
  box-shadow: none;
  overflow: visible;
}

.page-app .sidebar-user-email {
  margin-top: 8px;
  color: #676767;
  font-size: 12px;
  font-weight: 500;
}

.page-app .sidebar-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-app .sidebar-footer-copy {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.page-app .sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.page-app .sidebar-footer-actions--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.page-app .guest-access-card {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: #ffffff;
}

.page-app .sidebar-icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.page-app .sidebar-icon-button:hover {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(199, 210, 254, 0.95);
}

.page-app .sidebar-icon-button svg {
  width: 18px;
  height: 18px;
}

.page-app .sidebar-icon-button--account {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 10px;
}

.page-app .sidebar-icon-button--account svg {
  width: 16px;
  height: 16px;
}

.page-app .sidebar-footer-btn {
  min-height: 42px;
  border-radius: 12px;
}

.page-app .sidebar-footer-btn--guest {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
}

.page-app .sidebar-footer--guest {
  display: block;
  margin: 0 8px 8px;
  padding: 10px 12px 12px;
}

.page-app.is-guest .sidebar-utility-links {
  padding-bottom: 8px;
  margin-bottom: 0;
}

.page-app .main-panel {
  position: relative;
  background: transparent;
}

.page-app .topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 14px 18px 0;
  min-height: 74px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.07);
  backdrop-filter: blur(16px);
}

.page-app .topbar-main {
  gap: 14px;
}

.page-app .sidebar-toggle {
  min-width: 46px;
  min-height: 46px;
  border-radius: 16px;
  background: rgba(241, 245, 249, 0.88);
}

.page-app .brand-eyebrow {
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-app .brand-title {
  margin-top: 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.page-app .brand-subtitle {
  margin-top: 6px;
  color: #64748b;
}

.page-app .topbar-actions {
  gap: 10px;
}

.page-app .topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.86);
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.page-app .topbar-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.page-app .topbar-user-chip,
.page-app .input-select {
  min-height: 42px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
}

.page-app .chat-stage {
  padding: 16px 18px 18px;
}

.page-app .messages-panel {
  flex: 1;
  min-height: 0;
  padding: 10px 0 0;
  background: transparent;
  overflow: hidden;
}

.page-app .messages {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 18px 120px 14px;
}

.page-app .main-panel:not(.is-empty) .messages-panel::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  z-index: 2;
  height: 42px;
  pointer-events: none;
  bottom: 0;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(238, 242, 255, 0.82) 100%);
}


.page-app .empty-state {
  width: 100%;
  padding: 0 14px 18px;
}

.page-app .empty-state-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 44px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.82) 100%);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.08);
}

.page-app .empty-state-kicker {
  min-height: 32px;
  padding: 0 14px;
  background: rgba(0, 0, 0, 0.12);
  color: #000000;
}

.page-app .empty-state-title {
  max-width: 760px;
  margin-top: 16px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.page-app .empty-state-text {
  max-width: 680px;
  margin: 18px 0 0;
  color: #475569;
  font-size: 15px;
  line-height: 1.9;
}

.page-app .empty-state-pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.page-app .feature-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.page-app .empty-state-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.page-app .suggestion-card {
  min-height: 172px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 249, 0.88) 100%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
}

.page-app .suggestion-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 0, 0, 0.45);
  box-shadow: 0 26px 52px rgba(0, 0, 0, 0.12);
}

.page-app .suggestion-card-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.92);
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-app .suggestion-card-title {
  margin-top: 14px;
  font-size: 18px;
}

.page-app .suggestion-card-text {
  margin-top: 12px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.8;
}

.page-app .empty-state-footer {
  margin-top: 20px;
}

.page-app .empty-state-note {
  color: #64748b;
  font-size: 13px;
}

.page-app .message-row {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 26px;
}

.page-app .message-row--user {
  flex-direction: row-reverse;
}

.page-app .message-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.page-app .message-avatar--assistant {
  background: linear-gradient(135deg, #000000 0%, #000000 100%);
}

.page-app .message-bubble {
  max-width: min(780px, calc(100% - 56px));
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06);
}

.page-app .message-bubble--assistant {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.86) 100%);
}

.page-app .message-bubble--user {
  background: #f4f4f4;
  color: #0d0d0d;
}

.page-app .message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #676767;
  font-size: 12px;
}

.page-app .message-bubble--user .message-meta,
.page-app .message-bubble--user .message-body,
.page-app .message-bubble--user .tibra-msg {
  color: #0d0d0d;
}

.page-app .message-meta-role {
  font-weight: 700;
}

.page-app .message-meta-sep {
  opacity: 0.65;
}

.page-app .message-body,
.page-app .tibra-msg,
.page-app .tibra-prose {
  font-size: 15px;
  line-height: 1.9;
}

.page-app .message-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  direction: rtl;
}

.page-app .message-actions .btn-secondary {
  width: auto;
  flex: 0 0 auto;
  min-height: 36px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.88);
}

.page-app .message-action-icon-btn {
  display: inline-flex;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.page-app .message-action-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.page-app .composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 0 14px 14px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(238, 242, 255, 0.82) 34%, rgba(238, 242, 255, 0.96) 100%);
}

.page-app .composer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.page-app .main-panel:not(.is-empty) .composer-shell,
.page-app .main-panel:not(.is-empty) .composer-actions {
  display: none;
}

.page-app .composer-shell {
  margin-bottom: 14px;
}

.page-app .composer-shell-label {
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-app .composer-shell-title {
  margin-top: 6px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-app .chat-prompt-heading {
  display: none;
  width: 100%;
  text-align: center;
}

.page-app .main-panel.is-empty .chat-prompt-heading {
  display: block;
}

.page-app .main-panel:not(.is-empty) .chat-prompt-heading {
  display: none;
}

.page-app .chat-prompt-title {
  margin: 0;
  color: #0d0d0d;
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-align: center;
}

.page-app .main-panel.is-empty .composer-wrap {
  position: static;
  width: 100%;
  padding: 0;
  background: transparent;
}

.page-app .main-panel.is-empty .composer-inner {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.page-app .composer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.06);
}

.page-app .composer-plus {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 14px;
  background: rgba(241, 245, 249, 0.96);
  color: #334155;
}

.page-app .composer-input {
  min-height: 44px;
  height: 44px;
  padding: 11px 8px;
  font-size: 15px;
  line-height: 22px;
  box-sizing: border-box;
  margin: 0;
  overflow-y: hidden;
}

.page-app .composer-submit {
  min-height: 34px;
  padding: 0 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #000000 0%, #000000 100%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
}

.page-app .composer-toolbar {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
}

.page-app .composer-badge {
  min-height: 30px;
  background: rgba(219, 234, 254, 0.86);
  color: #000000;
}

.page-app .composer-badge-muted {
  background: rgba(241, 245, 249, 0.92);
}

.page-app .composer-actions {
  justify-content: flex-start;
  gap: 10px;
  margin-top: 16px;
}

.page-app .prompt-chip {
  min-height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.96);
  background: rgba(255, 255, 255, 0.88);
  color: #334155;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.03);
}

.page-app .prompt-chip:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(199, 210, 254, 0.92);
}

.page-app .composer-hint {
  margin-top: 12px;
  color: #64748b;
  font-size: 12px;
}

.page-app .typing-indicator span {
  background: linear-gradient(135deg, #000000 0%, #000000 100%);
}

.page-app .toast {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.page-app.theme-dark {
  color-scheme: dark;
  background: #212121;
  color: #ececec;
}

.page-app.theme-light {
  color-scheme: light;
}

.page-app.theme-dark .app-ambient-a {
  background: rgba(255, 255, 255, 0.06);
  opacity: 0.26;
}

.page-app.theme-dark .app-ambient-b {
  background: rgba(255, 255, 255, 0.04);
  opacity: 0.18;
}

.page-app.theme-dark .app-frame {
  border-color: #424242;
  background: #212121;
  box-shadow: none;
}

.page-app.theme-dark .main-panel,
.page-app.theme-dark .chat-stage {
  background: transparent;
}

.page-app.theme-dark .app-frame,
.page-app.theme-dark .topbar,
.page-app.theme-dark .composer-inner,
.page-app.theme-dark .empty-state-inner,
.page-app.theme-dark .message-bubble,
.page-app.theme-dark .dialog,
.page-app.theme-dark .settings-card {
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(10, 10, 10, 0.9);
  color: #f5f5f5;
}

.page-app.theme-dark .sidebar-footer {
  border-color: rgba(255, 255, 255, 0.1);
  background: #000000;
  color: #ffffff;
}

.page-app.theme-dark .sidebar-account-trigger:hover,
.page-app.theme-dark .sidebar-account-trigger.is-open {
  background: rgba(255, 255, 255, 0.06);
}

.page-app.theme-dark .sidebar-account-avatar {
  background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
  color: #f5f5f5;
}

.page-app.theme-dark .settings-avatar-preview {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.page-app.theme-dark .settings-avatar-limit {
  color: #a3a3a3;
}

.page-app.theme-dark .input-readonly,
.page-app.theme-dark .input.input-readonly {
  background: rgba(255, 255, 255, 0.06);
  color: #d4d4d4;
  border-color: rgba(255, 255, 255, 0.12);
}

.page-app.theme-dark .settings-avatar-fallback,
.page-app.theme-dark .sidebar-account-avatar-fallback {
  color: #f5f5f5;
}

.page-app.theme-dark .sidebar-account-name,
.page-app.theme-dark .sidebar-account-panel-name {
  color: #f5f5f5;
}

.page-app.theme-dark .sidebar-account-plan,
.page-app.theme-dark .sidebar-account-panel-contact,
.page-app.theme-dark .sidebar-account-store-icon {
  color: #a3a3a3;
}

.page-app.theme-dark .sidebar-account-panel {
  border-color: rgba(255, 255, 255, 0.12);
  background: #111111;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
}

.page-app.theme-dark .sidebar-account-logout {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5f5;
}

.page-app.theme-dark .sidebar-account-panel .sidebar-plan-progress,
.page-app.theme-dark .sidebar-account-panel .sidebar-plan-usage-item {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.page-app.theme-dark .sidebar-account-panel .sidebar-plan-progress-percent,
.page-app.theme-dark .sidebar-account-panel .sidebar-plan-usage-value {
  color: #f5f5f5;
}

.page-app.theme-dark .sidebar {
  border-color: rgba(255, 255, 255, 0.08);
  background: #171717;
  color: #ececec;
}

.page-app.theme-dark .conversation-list .conversation-folder-title,
.page-app.theme-dark .conversation-list .conversation-item-title {
  color: #ececec;
}

.page-app.theme-dark .conversation-list .conversation-folder-chevron,
.page-app.theme-dark .conversation-list .conversation-folder-btn {
  color: #b4b4b4;
}

.page-app.theme-dark .conversation-item:hover,
.page-app.theme-dark .conversation-item.is-active,
.page-app.theme-dark .sidebar-icon-button,
.page-app.theme-dark .sidebar-footer-btn,
.page-app.theme-dark .sidebar-search,
.page-app.theme-dark .input,
.page-app.theme-dark .composer,
.page-app.theme-dark .prompt-chip,
.page-app.theme-dark .feature-pill,
.page-app.theme-dark .message-action-icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e5e7eb;
}

.page-app.theme-dark .message-action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.page-app.theme-dark .message-actions .btn-secondary {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(6, 6, 6, 0.96);
  color: #ececec;
}

.page-app.theme-dark .guest-access-card {
  border-color: rgba(255, 255, 255, 0.12);
  background: #000000;
}

.page-app.theme-dark .auth-status {
  color: #cbd5e1;
}

.page-app.theme-dark .conversation-empty,
.page-app.theme-dark .suggestion-card {
  background: rgba(8, 8, 8, 0.94);
  border-color: rgba(255, 255, 255, 0.07);
  color: #f5f5f5;
}

.page-app.theme-dark .composer-wrap {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(3, 3, 3, 0.88) 34%, rgba(0, 0, 0, 0.98) 100%);
}

.page-app.theme-dark .composer-tool-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #d4d4d4;
}

.page-app.theme-dark .composer-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.page-app.theme-dark .composer-tool-btn:active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.page-app.theme-dark .composer-tool-btn.is-active {
  background: #3f3f46;
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.page-app.theme-dark .composer-tool-btn.is-active:hover,
.page-app.theme-dark .composer-tool-btn.is-active:active {
  background: #52525b;
  border-color: rgba(255, 255, 255, 0.42);
  color: #ffffff;
}

.page-app.theme-dark .composer-tool-btn:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
}

.page-app.theme-dark .composer-tool-icon,
.page-app.theme-dark .composer-tool-icon svg {
  color: inherit;
}

.page-app.theme-dark .main-panel:not(.is-empty) .messages-panel::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(1, 1, 1, 0.96) 100%);
}

.page-app.theme-dark .topbar {
  background: rgba(5, 5, 5, 0.86);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
}

.page-app.theme-dark .sidebar {
  background: rgba(3, 3, 3, 0.88);
  border-left-color: rgba(255, 255, 255, 0.06);
}

.page-app.theme-dark .sidebar-overview {
  border-color: rgba(0, 0, 0, 0.22);
  background: linear-gradient(180deg, rgba(8, 8, 8, 0.94) 0%, rgba(2, 2, 2, 0.98) 100%);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

.page-app.theme-dark .sidebar-overview-label,
.page-app.theme-dark .composer-shell-label,
.page-app.theme-dark .brand-eyebrow {
  color: #ffffff;
}

.page-app.theme-dark .sidebar-brand-mark {
  background: transparent;
  box-shadow: none;
}

.page-app.theme-dark .sidebar-brand-logo {
  filter: brightness(0) invert(1);
}

.page-app.theme-dark .brand-title,
.page-app.theme-dark .sidebar-brand-text,
.page-app.theme-dark .conversation-item-title,
.page-app.theme-dark .composer-shell-title,
.page-app.theme-dark .settings-card-title,
.page-app.theme-dark .sidebar-user {
  color: #fafafa;
}

.page-app.theme-dark .conversation-item-title-input {
  color: #fafafa;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.page-app.theme-dark .brand-subtitle,
.page-app.theme-dark .sidebar-brand-subtitle,
.page-app.theme-dark .empty-state-text,
.page-app.theme-dark .empty-state-note,
.page-app.theme-dark .suggestion-card-text,
.page-app.theme-dark .field-label,
.page-app.theme-dark .dialog-note,
.page-app.theme-dark .composer-hint,
.page-app.theme-dark .conversation-item-meta,
.page-app.theme-dark .message-meta {
  color: #a3a3a3;
}

.page-app.theme-dark .sidebar-plan-usage-item {
  border-color: rgba(255, 255, 255, 0.12);
  background: #000000;
}

.page-app.theme-dark .sidebar-plan-progress {
  border-color: rgba(255, 255, 255, 0.12);
  background: #000000;
}

.page-app.theme-dark .sidebar-plan-progress-label {
  color: #ffffff;
}

.page-app.theme-dark .sidebar-plan-progress-percent {
  color: #ffffff;
}

.page-app.theme-dark .sidebar-plan-progress-track {
  background: rgba(255, 255, 255, 0.12);
}

.page-app.theme-dark .sidebar-plan-progress-fill {
  background: #ffffff;
  box-shadow: none;
}

.page-app.theme-dark .sidebar-plan-usage-value {
  color: #ffffff;
}

.page-app.theme-dark .empty-state-title,
.page-app.theme-dark .message-body,
.page-app.theme-dark .tibra-msg,
.page-app.theme-dark .tibra-prose,
.page-app.theme-dark .dialog-title {
  color: #f5f5f5;
}

.page-app.theme-dark .message-bubble--assistant {
  background: linear-gradient(180deg, rgba(8, 8, 8, 0.96) 0%, rgba(3, 3, 3, 0.94) 100%);
}

.page-app.theme-dark .message-bubble--user {
  background: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #000000 !important;
}

.page-app.theme-dark .message-avatar {
  background: linear-gradient(135deg, #0f0f10 0%, #262626 100%);
  color: #f5f5f5;
}

.page-app.theme-dark .message-avatar--assistant,
.page-app.theme-dark .composer-submit {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

.page-app.theme-dark .sidebar-link-button:hover,
.page-app.theme-dark .sidebar-icon-button:hover,
.page-app.theme-dark .prompt-chip:hover {
  background: rgba(18, 18, 18, 0.98);
}

.page-app.theme-dark .sidebar-close-button {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.94);
  color: #f5f5f5;
}

.page-app.theme-dark .sidebar-collapse-btn {
  background: transparent;
  color: #6f6f6f;
}

.page-app.theme-dark .sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #a3a3a3;
}

.page-app.theme-dark .sidebar-close-button:hover {
  background: rgba(18, 18, 18, 0.98);
}

.page-app.theme-dark .sidebar-link-button {
  color: #f5f5f5;
}

.page-app.theme-dark .sidebar-link-button--icon svg {
  color: #f5f5f5;
}

.page-app.theme-dark .topbar-user-chip,
.page-app.theme-dark .input-select,
.page-app.theme-dark .topbar-status {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.94);
  color: #e5e7eb;
}

.page-app.theme-dark .topbar-status-dot {
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

.page-app.theme-dark .conversation-item {
  background: transparent;
}

.page-app.theme-dark .conversation-item:hover,
.page-app.theme-dark .conversation-item.is-active {
  background: rgba(14, 14, 14, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.page-app.theme-dark .dialog-close {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.94);
  color: #d4d4d8;
}

.page-app.theme-dark .dialog-close:hover {
  background: rgba(18, 18, 18, 0.98);
  color: #fafafa;
}

.page-app.theme-dark .dialog-surface-card {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.page-app.theme-dark .folder-icon-preview {
  color: #f8fafc;
}

.page-app.theme-dark .folder-icon-button {
  border-color: rgba(0, 0, 0, 0.16);
  background: rgba(8, 8, 8, 0.96);
}

.page-app.theme-dark .folder-icon-button:hover,
.page-app.theme-dark .folder-icon-button.is-open {
  border-color: rgba(0, 0, 0, 0.32);
  background: rgba(18, 18, 18, 0.98);
}

.page-app.theme-dark .folder-icon-choice {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.96);
  color: #f8fafc;
}

.page-app.theme-dark .folder-icon-choice:hover {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(18, 18, 18, 0.98);
}

.page-app.theme-dark .folder-icon-choice.is-active {
  border-color: rgba(0, 0, 0, 0.42);
  background: rgba(0, 0, 0, 0.12);
}

.page-app.theme-dark .settings-card-note {
  color: #a3a3a3;
}

.page-app.theme-dark .settings-card {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.9);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.page-app.theme-dark .settings-theme-toggle {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #1a1a1a;
}

.page-app.theme-dark .settings-theme-option-icon {
  color: #a1a1aa;
}

.page-app.theme-dark .settings-theme-option:hover .settings-theme-option-icon {
  color: #fafafa;
}

.page-app.theme-dark .settings-theme-option:has(.settings-theme-input:checked),
.page-app.theme-dark .settings-theme-option.is-selected {
  background: #52525b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.page-app.theme-dark .settings-theme-option:has(.settings-theme-input:checked) .settings-theme-option-icon,
.page-app.theme-dark .settings-theme-option.is-selected .settings-theme-option-icon {
  color: #ffffff;
}

.page-app.theme-dark .settings-theme-option:has(.settings-theme-input:focus-visible) {
  outline-color: #818cf8;
}

.page-app.theme-dark .settings-plan-panel {
  background: transparent;
}

.page-app .dialog-settings .dialog-close {
  width: 38px;
  min-width: 38px;
  border-color: #e5e7eb;
  background: #ffffff;
  color: #6b7280;
}

.page-app .dialog-settings .dialog-close:hover {
  background: #f8fafc;
  border-color: #d1d5db;
  color: #111827;
}

.page-app.theme-dark .plan-badge {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.page-app.theme-dark .settings-plan-label {
  color: #a3a3a3;
}

.page-app.theme-dark .sidebar-footer .sidebar-user-plan-label,
.page-app.theme-dark .sidebar-footer .sidebar-plan-usage-label,
.page-app.theme-dark .sidebar-footer .sidebar-plan-progress-label,
.page-app.theme-dark .sidebar-footer .sidebar-user-email {
  color: #ffffff;
}

.page-app.theme-dark .plan-card {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.96) 0%, rgba(5, 5, 5, 0.94) 100%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.page-app.theme-dark .plan-card.is-active {
  border-color: rgba(0, 0, 0, 0.5);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12);
}

.page-app.theme-dark .plan-card-name,
.page-app.theme-dark .plan-card-price {
  color: #fafafa;
}

.page-app.theme-dark .plan-card-limit {
  color: #d4d4d8;
}

.page-app.theme-dark .plan-card-current {
  background: rgba(0, 0, 0, 0.16);
  color: #ff8a33;
}

.page-app.theme-dark .toast {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.96);
  color: #f5f5f5;
}

.page-app.theme-dark .tibra-prose blockquote {
  color: #d4d4d8;
  border-inline-start-color: #3f3f46;
}

.page-app.theme-dark .tibra-prose pre,
.page-app.theme-dark .tibra-prose :not(pre) > code {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e5e7eb;
}

.page-app.theme-dark .code-block {
  border-color: rgba(255, 255, 255, 0.1);
  background: #0a0a0a;
  color: #e5e7eb;
}

.page-app.theme-dark .code-block pre,
.page-app.theme-dark .code-block pre code {
  color: #e5e7eb;
}

.page-app.theme-dark .code-block-bar {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  background: #141414;
}

.page-app.theme-dark .code-block-lang {
  color: #94a3b8;
}

.page-app.theme-dark .code-copy-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: #1a1a1a;
  color: #f1f5f9;
}

.page-app.theme-dark .code-copy-btn:hover {
  background: #262626;
  color: #ffffff;
}

.page-app.theme-dark .tibra-prose pre {
  background: transparent;
  color: #e5e7eb;
}

.page-app.theme-dark .conversation-delete {
  color: #f87171;
}

.page-app.theme-dark .folder-icon-glyph,
.page-app.theme-dark .conversation-folder-icon .folder-icon-glyph {
  color: #111;
}

.page-app.theme-dark .conversation-folder-icon {
  background: transparent;
}

.page-app.theme-dark .folder-icon-button,
.page-app.theme-dark .folder-icon-choice {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
}

.page-app.theme-dark .conversation-folder-title {
  color: #ececec;
}

.page-app.theme-dark .conversation-folder-empty {
  color: #a3a3a3;
}

.page-app.theme-dark .conversation-folder-chevron {
  color: #737373;
}

.page-app.theme-dark .conversation-folder.is-open .conversation-folder-chevron {
  color: #fafafa;
}

.page-app.theme-dark .conversation-folder-list {
  border-inline-start-color: transparent;
}

.page-app.theme-dark .conversation-folder-btn {
  color: #a3a3a3;
}

.page-app.theme-dark .conversation-folder-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fafafa;
}

.page-app.theme-dark .conversation-menu-trigger {
  background: transparent;
  color: #a3a3a3;
}

.page-app.theme-dark .conversation-menu-trigger:hover,
.page-app.theme-dark .conversation-menu.is-open .conversation-menu-trigger {
  background: transparent;
  color: #fafafa;
}

.page-app.theme-dark .conversation-menu-panel {
  background: rgba(18, 18, 18, 0.98);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

.page-app.theme-dark .conversation-menu-item {
  color: #e5e5e5;
}

.page-app.theme-dark .conversation-menu-item:hover {
  background: rgba(38, 38, 38, 0.95);
}

.page-app.theme-dark .conversation-menu-item--danger {
  color: #fca5a5;
}

.page-app.theme-dark .conversation-menu-item--danger:hover {
  background: rgba(127, 29, 29, 0.32);
  color: #fecaca;
}

@media (max-width: 1024px) {
  .page-app .sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.92);
  }

  .page-app .empty-state-inner {
    padding: 34px 24px;
  }

  .page-app .empty-state-grid {
    grid-template-columns: 1fr;
  }

  .page-app.theme-dark .sidebar {
    background: rgba(3, 3, 3, 0.98);
  }
}

@media (max-width: 720px) {
  .page-app .empty-state-inner {
    display: none;
  }

  .page-app .app-shell {
    padding: 0;
  }

  .page-app .app-frame {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .page-app .topbar {
    margin: 0;
    border-radius: 0 0 22px 22px;
    flex-direction: column;
    align-items: stretch;
  }

  .page-app .topbar-actions {
    justify-content: space-between;
  }

  .page-app .topbar-status {
    display: none;
  }

  .page-app .topbar-user-chip {
    max-width: 100%;
  }

  .page-app .composer-actions {
    justify-content: flex-start;
  }

  .page-app .empty-state-grid {
    grid-template-columns: 1fr;
  }

  .page-app .empty-state-inner {
    padding: 28px 20px;
    border-radius: 24px;
  }

  .page-app .empty-state-title {
    font-size: 34px;
  }

  .page-app .messages {
    padding: 8px 4px 110px;
  }

  .page-app .message-row,
  .page-app .message-row--user {
    flex-direction: column;
  }

  .page-app .message-bubble {
    max-width: none;
    width: 100%;
  }

  .page-app .composer-wrap {
    padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .page-app .composer-inner {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .page-app .composer-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-app .field-row {
    grid-template-columns: 1fr;
  }

  .page-app .settings-profile-contact-row,
  .page-app .settings-profile-row {
    grid-template-columns: 1fr;
  }

  .page-app .field-row.settings-profile-birth-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-app .dialog-settings {
    display: flex;
    flex-direction: column;
    width: min(100% - 16px, 640px);
    max-height: min(100dvh - 16px, 920px);
  }

  .page-app .dialog-settings .dialog-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
  }

  .page-app .dialog-settings .dialog-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
  }

  .page-app .dialog-settings .dialog-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .page-app .dialog-settings .dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .page-app .settings-avatar-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .page-app .settings-avatar-pick-wrap {
    align-items: center;
    width: 100%;
  }

  .page-app .settings-avatar-pick-btn {
    width: 100%;
    max-width: 280px;
  }

  .page-app #helpDialog[open],
  .page-app #serviceRulesDialog[open] {
    width: min(100% - 16px, 500px);
    max-height: min(92dvh, 680px);
  }

  .page-app #helpDialog[open] .dialog-header,
  .page-app #serviceRulesDialog[open] .dialog-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
  }

  .page-app #helpDialog[open] .dialog-title,
  .page-app #serviceRulesDialog[open] .dialog-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    font-size: 17px;
  }

  .page-app #helpDialog[open] .dialog-close,
  .page-app #serviceRulesDialog[open] .dialog-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .page-app #helpDialog[open] .dialog-body,
  .page-app #serviceRulesDialog[open] .dialog-body {
    padding: 12px 14px 16px;
  }

  .page-app #helpDialog .help-guide-card--compact,
  .page-app #serviceRulesDialog .help-guide-card--compact {
    padding: 10px 12px;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .plans-upgrade-grid,
  .plans-upgrade-panel[data-plans-panel="scale"] .plans-upgrade-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .plans-upgrade-header {
    padding: calc(48px + env(safe-area-inset-top, 0px)) 12px 10px;
    gap: 14px;
  }

  .plans-upgrade-title {
    font-size: clamp(22px, 6vw, 32px);
    padding-inline: 48px;
  }

  .plans-upgrade-segment {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
    padding: 6px;
    gap: 6px;
  }

  .plans-upgrade-segment-btn {
    flex: 1 1 auto;
    min-width: min(100%, 120px);
    padding: 0 12px;
    font-size: 12px;
  }

  .plans-upgrade-body {
    padding: 12px 12px 8px;
  }

  .plans-upgrade-footer {
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .plans-upgrade-footer-note {
    font-size: 11px;
    line-height: 1.65;
  }

  .plans-upgrade-close {
    top: calc(10px + env(safe-area-inset-top, 0px));
    inset-inline-start: 12px;
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .plan-upgrade-card {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .plan-upgrade-name {
    font-size: 20px;
  }
}

.page-app .app-shell {
  min-height: 100dvh;
}

.page-app .app-frame {
  min-height: calc(100dvh - 36px);
}

.page-app .topbar-main,
.page-app .brand-block,
.page-app .topbar-actions {
  min-width: 0;
}

.page-app .brand-title,
.page-app .brand-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-app .brand-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
}

.page-app .dialog {
  max-height: min(100dvh - 24px, 920px);
}

.page-app .dialog-body {
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.page-app .dialog-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.page-app #helpDialog[open],
.page-app #serviceRulesDialog[open] {
  width: min(100% - 28px, 500px);
  max-height: min(78dvh, 620px);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.page-app #helpDialog::-webkit-scrollbar,
.page-app #serviceRulesDialog::-webkit-scrollbar,
.page-app .dialog-help::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.page-app #helpDialog .dialog-header,
.page-app #serviceRulesDialog .dialog-header,
.page-app .dialog-help .dialog-header {
  flex: 0 0 auto;
}

.page-app #helpDialog .dialog-body,
.page-app #serviceRulesDialog .dialog-body,
.page-app .dialog-help .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.page-app #helpDialog .dialog-body::-webkit-scrollbar,
.page-app #serviceRulesDialog .dialog-body::-webkit-scrollbar,
.page-app .dialog-help .dialog-body::-webkit-scrollbar,
.page-app #helpDialog *::-webkit-scrollbar,
.page-app #serviceRulesDialog *::-webkit-scrollbar,
.page-app .dialog-help *::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

.page-app #helpDialog *,
.page-app #serviceRulesDialog *,
.page-app .dialog-help * {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.page-app .conversation-list,
.page-app .messages,
.page-app .md-table-wrap {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.page-app .conversation-list::-webkit-scrollbar,
.page-app .messages::-webkit-scrollbar,
.page-app .md-table-wrap::-webkit-scrollbar,
.page-app .sidebar::-webkit-scrollbar,
.page-app .tibra-prose pre::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.page-app .sidebar,
.page-app .tibra-prose pre {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

@media (max-width: 1280px) {
  .page-app .app-shell {
    padding: 12px;
  }

  .page-app .app-frame {
    min-height: calc(100dvh - 24px);
    border-radius: 24px;
  }

  .page-app .sidebar {
    width: 272px;
  }

  .page-app .topbar {
    margin: 12px 12px 0;
  }

  .page-app .chat-stage {
    padding: 14px 12px 12px;
  }

  .page-app .messages {
    padding-inline: 10px;
  }
}

@media (max-width: 1024px) {
  .page-app {
    overflow-x: hidden;
  }

  .page-app.sidebar-open {
    overflow: hidden;
  }

  .page-app .app-shell {
    padding: 10px;
  }

  .page-app .app-frame {
    min-height: calc(100dvh - 20px);
    border-radius: 22px;
  }

  .page-app .sidebar {
    width: min(320px, 88vw);
    max-width: 88vw;
    padding: 12px;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-left: 0;
    box-shadow: 16px 0 42px rgba(15, 23, 42, 0.14);
  }

  .page-app .sidebar-brand {
    position: sticky;
    top: 0;
    z-index: 3;
    padding-top: 10px;
    padding-bottom: 12px;
    background: inherit;
    backdrop-filter: blur(18px);
  }

  .page-app .sidebar-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .page-app.theme-dark .sidebar {
    box-shadow: 16px 0 42px rgba(0, 0, 0, 0.36);
  }

  .page-app .topbar {
    margin: 10px 10px 0;
    min-height: 70px;
    padding: 12px 14px;
  }

  .page-app .brand-title {
    font-size: 20px;
  }

  .page-app .chat-stage {
    padding: 12px 10px 10px;
  }

  .page-app .messages {
    padding: 8px 6px 112px;
  }

  .page-app .empty-state-inner,
  .page-app .composer-inner {
    border-radius: 24px;
  }

  .page-app .empty-state-inner {
    padding: 30px 22px;
  }

  .page-app .suggestion-card {
    min-height: 148px;
    padding: 18px;
  }

  .page-app .dialog {
    width: min(100% - 20px, 920px);
  }

  .page-app .dialog-header,
  .page-app .dialog-body {
    padding: 18px;
  }

  .page-app .plan-card-price {
    font-size: 28px;
  }
}

@media (max-width: 840px) {
  .page-app .topbar {
    align-items: flex-start;
  }

  .page-app .topbar-main {
    width: 100%;
    align-items: flex-start;
  }

  .page-app .brand-title {
    font-size: 19px;
  }

  .page-app .empty-state-title {
    font-size: clamp(30px, 6vw, 40px);
  }

  .page-app .empty-state-text {
    font-size: 15px;
    line-height: 1.8;
  }

  .page-app .sidebar-footer {
    padding: 16px 14px 14px;
  }

  .page-app .settings-plan-row,
  .page-app .sidebar-user-plan-row,
  .page-app .plan-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-app .message-bubble {
    max-width: min(100%, 100%);
  }
}

@media (max-width: 720px) {
  .page-app .app-ambient {
    display: none;
  }

  .page-app .sidebar {
    width: min(320px, 92vw);
    max-width: 92vw;
    padding: 10px;
  }

  .page-app .sidebar-brand {
    padding: 6px 6px 12px;
  }

  .page-app .sidebar-toolbar {
    gap: 6px;
  }

  .page-app .sidebar-toolbar-icon-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .page-app .sidebar-toolbar-main {
    min-height: 40px;
    font-size: 11px;
    padding-inline: 8px;
  }

  .page-app .sidebar-toolbar,
  .page-app .sidebar-search-panel,
  .page-app .sidebar-utility-links,
  .page-app .conversation-list,
  .page-app .sidebar-footer {
    padding-left: 6px;
    padding-right: 6px;
  }

  .page-app .sidebar-footer {
    margin-top: 12px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
  }

  .page-app .sidebar-footer--guest {
    margin-top: 8px;
    padding: 8px 10px 10px;
  }

  .page-app .topbar {
    margin: 0;
    min-height: auto;
    padding: 12px 14px;
    border-radius: 0 0 18px 18px;
    gap: 10px;
    flex-direction: row;
    align-items: center;
  }

  .page-app .topbar-main {
    width: 100%;
    gap: 10px;
    align-items: center;
  }

  .page-app .sidebar-toggle {
    min-width: 42px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 14px;
  }

  .page-app .brand-eyebrow {
    font-size: 10px;
  }

  .page-app .brand-title {
    margin-top: 2px;
    font-size: 18px;
  }

  .page-app .brand-subtitle {
    margin-top: 4px;
    font-size: 12px;
  }

  .page-app .topbar-actions {
    display: none;
  }

  .page-app .chat-stage {
    padding: 10px 8px 8px;
  }

  .page-app .messages-panel {
    padding-top: 4px;
  }

  .page-app .messages {
    padding: 6px 0 104px;
  }

  .page-app .message-row {
    gap: 10px;
    margin-bottom: 18px;
  }

  .page-app .message-bubble {
    padding: 16px 16px 14px;
    border-radius: 18px;
  }

  .page-app .message-body,
  .page-app .tibra-msg,
  .page-app .tibra-prose {
    font-size: 14px;
    line-height: 1.8;
  }

  .page-app .message-actions {
    flex-wrap: wrap;
  }

  .page-app .empty-state {
    padding: 0 0 14px;
  }

  .page-app .empty-state-inner {
    padding: 24px 16px;
    border-radius: 22px;
  }

  .page-app .empty-state-title {
    margin-top: 14px;
    font-size: 28px;
    line-height: 1.08;
  }

  .page-app .empty-state-text {
    margin-top: 14px;
    font-size: 13px;
  }

  .page-app .feature-pill {
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }

  .page-app .suggestion-card {
    min-height: auto;
    padding: 16px;
    border-radius: 18px;
  }

  .page-app .suggestion-card-title {
    font-size: 16px;
  }

  .page-app .suggestion-card-text {
    font-size: 13px;
    line-height: 1.7;
  }

  .page-app .composer-wrap {
    padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .page-app .main-panel.is-empty .chat-compose-area {
    padding: 0 12px calc(16px + env(safe-area-inset-bottom, 0px));
    gap: 18px;
  }

  .page-app .composer-inner,
  .page-app .main-panel.is-empty .composer-inner {
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    backdrop-filter: none;
  }

  .page-app .main-panel:not(.is-empty) .composer-wrap {
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .page-app .composer-shell {
    margin-bottom: 12px;
  }

  .page-app .composer-shell-title {
    font-size: 18px;
  }

  .page-app .composer {
    padding: 12px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .page-app .composer-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .page-app .composer-plus {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 12px;
  }

  .page-app .composer-input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    min-height: 40px;
    height: 40px;
    max-height: 96px;
    padding: 9px 4px;
    font-size: 14px;
    line-height: 22px;
  }

  .page-app .composer-row-actions {
    display: inline-flex;
    flex-direction: row;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    width: auto;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .page-app .composer-row-actions .composer-attach-btn,
  .page-app .composer-row-actions .composer-submit {
    align-self: center;
    box-shadow: none;
  }

  .page-app .composer-row-actions .composer-attach-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    min-width: 36px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    color: #6b7280;
  }

  .page-app .composer-row-actions .composer-attach-btn:hover {
    background: #f8fafc;
    border-color: #d1d5db;
    color: #374151;
  }

  .page-app .composer-row-actions .composer-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 36px;
    width: 36px;
    padding: 0;
    border: 1px solid #0f172a;
    border-radius: 12px;
    background: #0f172a;
    color: #ffffff;
  }

  .page-app .composer-row-actions .composer-submit:hover {
    background: #1e293b;
    border-color: #1e293b;
    opacity: 1;
  }

  .page-app .composer-row-actions .composer-submit-label {
    display: none;
  }

  .page-app .composer-row-actions .composer-submit-icon:not([hidden]) {
    display: inline-flex;
  }

  .page-app .composer-row-actions .composer-submit-icon svg {
    width: 17px;
    height: 17px;
  }

  .page-app .composer-tools {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 0;
    padding: 10px 12px 12px;
    border-top: 1px solid #ececec;
    direction: rtl;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .page-app .composer-tools::-webkit-scrollbar {
    display: none;
  }

  .page-app .composer-tool-btn {
    width: auto;
    max-width: none;
    flex: 0 0 auto;
    min-height: 40px;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
    gap: 6px;
    white-space: nowrap;
  }

  .page-app .composer-toolbar {
    gap: 8px;
  }

  .page-app .composer-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .page-app .prompt-chip {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  .page-app .dialog {
    width: min(100% - 12px, 920px);
    max-height: min(100dvh - 12px, 920px);
    border-radius: 20px;
  }

  .page-app .dialog-header,
  .page-app .dialog-body {
    padding: 14px;
  }

  .page-app .dialog-title {
    font-size: 16px;
  }

  .page-app .settings-card {
    padding: 16px;
    border-radius: 16px;
  }

  .page-app .plan-card {
    padding: 16px;
    border-radius: 18px;
  }

  .page-app .plan-card-price {
    font-size: 24px;
  }

  .page-app.theme-dark .sidebar-footer {
    border-color: rgba(255, 255, 255, 0.08);
  }
}

@media (max-width: 560px) {
  .page-app .topbar {
    padding: 10px 12px;
    border-radius: 0 0 16px 16px;
  }

  .page-app .brand-eyebrow {
    display: none;
  }

  .page-app .brand-title {
    font-size: 17px;
  }

  .page-app .empty-state-inner {
    padding: 20px 14px;
  }

  .page-app .empty-state-pill-row {
    gap: 8px;
  }

  .page-app .empty-state-title {
    font-size: 26px;
  }

  .page-app .empty-state-note {
    font-size: 12px;
  }

  .page-app .message-bubble {
    padding: 14px;
    border-radius: 16px;
  }

  .page-app .message-meta {
    margin-bottom: 8px;
    font-size: 11px;
  }

  .page-app .composer-inner {
    padding: 0;
    border-radius: 18px;
  }

  .page-app .composer-shell-title {
    font-size: 16px;
  }

  .page-app .composer-badge {
    min-height: 28px;
    font-size: 11px;
  }

  .page-app #helpDialog[open],
  .page-app #serviceRulesDialog[open] {
    width: min(100% - 12px, 500px);
    max-height: min(94dvh, 720px);
  }

  .page-app #helpDialog[open] .dialog-header,
  .page-app #serviceRulesDialog[open] .dialog-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
  }

  .page-app #helpDialog[open] .dialog-title,
  .page-app #serviceRulesDialog[open] .dialog-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    font-size: 17px;
  }

  .page-app #helpDialog[open] .dialog-close,
  .page-app #serviceRulesDialog[open] .dialog-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .page-app #helpDialog[open] .dialog-body,
  .page-app #serviceRulesDialog[open] .dialog-body {
    padding: 12px 14px 16px;
  }

  .page-app .dialog-settings .dialog-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
  }

  .page-app .dialog-settings .dialog-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    font-size: 17px;
  }

  .page-app .dialog-settings .dialog-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .page-app .dialog-settings {
    display: flex;
    flex-direction: column;
    width: min(100% - 12px, 640px);
    max-height: min(100dvh - 12px, 920px);
  }

  .page-app .dialog-settings .dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 14px 16px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .page-app .settings-profile-contact-row,
  .page-app .settings-profile-row {
    grid-template-columns: 1fr;
  }

  .page-app .field-row.settings-profile-birth-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .page-app .settings-card {
    padding: 14px;
    gap: 12px;
  }

  .page-app .settings-avatar-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .page-app .settings-avatar-pick-wrap {
    align-items: center;
    width: 100%;
  }

  .page-app .settings-avatar-pick-btn {
    width: 100%;
    max-width: 280px;
  }

  .page-app .dialog-folder .dialog-header,
  .page-app .dialog-move .dialog-header,
  .page-app #renameConversationDialog .dialog-header,
  .page-app .dialog-confirm .dialog-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .page-app .dialog-folder .dialog-title,
  .page-app #renameConversationDialog .dialog-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
  }

  .page-app .dialog-move .dialog-header-copy {
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-app .dialog-folder .dialog-close,
  .page-app .dialog-move .dialog-close,
  .page-app #renameConversationDialog .dialog-close,
  .page-app .dialog-confirm .dialog-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .page-app .dialog-folder,
  .page-app .dialog-move,
  .page-app #renameConversationDialog {
    width: min(100% - 16px, 480px);
  }

  .page-app .dialog-folder .dialog-header,
  .page-app .dialog-folder .dialog-body {
    padding: 14px 16px;
  }

  .page-app .folder-name-row {
    direction: rtl;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
  }

  .page-app .folder-icon-button {
    width: 52px;
    min-height: 44px;
  }

  .page-app .folder-icon-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .page-app .dialog-actions {
    width: 100%;
  }

  .page-app .dialog-actions .btn {
    width: 100%;
  }

  .page-app .settings-card-title,
  .page-app .plan-card-name {
    font-size: 16px;
  }

  .page-app .plan-card-limit {
    font-size: 14px;
  }

  .page-app .toast-region {
    right: 10px;
    left: 10px;
    bottom: 10px;
  }

  .page-app .toast {
    min-width: 0;
    max-width: none;
  }
}

.page-auth .auth-shell,
.page-auth .auth-card,
.page-auth .auth-form,
.page-app .sidebar,
.page-app .sidebar-footer,
.page-app .guest-access-card,
.page-app .topbar,
.page-app .chat-stage,
.page-app .empty-state-inner,
.page-app .composer-inner,
.page-app .composer,
.page-app .dialog,
.page-app .settings-card,
.page-app .plan-card,
.page-app .message-bubble,
.page-app .code-block,
.page-app .code-block-bar,
.page-app .toast {
  min-width: 0;
}

.page-app .conversation-item-row,
.page-app .dialog-header,
.page-app .dialog-actions,
.page-app .settings-plan-row,
.page-app .sidebar-user-plan-row,
.page-app .message-actions,
.page-app .composer-toolbar,
.page-app .composer-toolbar-left {
  flex-wrap: wrap;
}

.page-app .conversation-delete {
  flex: 0 0 auto;
}

.page-app .code-block-bar {
  flex-wrap: wrap;
}

.page-app .code-copy-btn,
.page-app .message-actions .btn,
.page-app .sidebar-link-button,
.page-app .sidebar-footer-btn,
.page-app .dialog-close {
  max-width: 100%;
}

.page-app .tibra-prose,
.page-app .tibra-msg,
.page-app .message-body,
.page-app .conversation-item-title,
.page-app .sidebar-user,
.page-app .sidebar-user-email,
.page-app .brand-title,
.page-app .brand-subtitle,
.page-app .settings-card-note {
  font-size: 13px;
  line-height: 1.95;
}

.page-app .help-guide-card .help-guide-lead,
.page-app .help-guide-card .help-guide-text,
.page-app .help-guide-card .help-guide-heading {
  font-size: 13px;
  line-height: 1.95;
}

.page-app .help-guide-card .help-guide-heading {
  font-weight: 700;
}

.page-app .dialog-note {
  overflow-wrap: anywhere;
}

.page-app .plans-grid,
.page-app .settings-grid,
.page-app .empty-state-grid {
  min-width: 0;
}

@media (max-width: 1180px) {
  .page-app .empty-state-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-app .messages {
    max-width: 100%;
  }

  .page-app .composer-inner,
  .page-app .empty-state-inner {
    max-width: 100%;
  }
}

@media (max-width: 960px) {
  .page-app .dialog {
    width: min(100% - 18px, 840px);
  }

  .plans-upgrade-grid,
  .plans-upgrade-panel[data-plans-panel="scale"] .plans-upgrade-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 720px);
  }

  .page-app .topbar {
    gap: 12px;
  }

  .page-app .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .plans-upgrade-grid,
  .plans-upgrade-panel[data-plans-panel="scale"] .plans-upgrade-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .page-app .conversation-delete {
    opacity: 1;
  }

  .page-app .conversation-item {
    padding: 6px 10px;
  }

  .page-app .conversation-item-row {
    align-items: flex-start;
  }

  .page-app .settings-grid {
    gap: 14px;
  }

  .page-app .sidebar-footer-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 680px) {
  .page-auth {
    padding: 14px;
    align-items: stretch;
  }

  .page-auth .auth-shell {
    max-width: 100%;
    display: flex;
    align-items: center;
  }

  .page-auth .auth-card {
    width: 100%;
    padding: 22px 18px;
    border-radius: 20px;
  }

  .page-auth .auth-title {
    margin-top: 14px;
    font-size: 24px;
  }

  .page-auth .auth-subtitle,
  .page-auth .auth-footer {
    font-size: 13px;
  }

  .page-app .sidebar-link-button--icon {
    min-height: 40px;
    padding: 8px 10px;
  }

  .page-app .guest-access-card {
    padding: 12px;
  }

  .page-app .code-block-bar {
    align-items: stretch;
    padding: 10px 12px;
  }

  .page-app .code-copy-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .page-auth .auth-card {
    padding: 18px 14px;
    border-radius: 18px;
  }

  .page-auth .auth-badge {
    font-size: 11px;
    padding: 6px 10px;
  }

  .page-auth .auth-title {
    font-size: 22px;
  }

  .page-app .sidebar {
    width: min(340px, 100%);
    max-width: 100%;
  }

  .page-app .sidebar-brand-mark {
    width: auto;
    height: auto;
  }

  .page-app .sidebar-brand-logo {
    width: 34px;
    height: 34px;
  }

  .page-app .sidebar-brand-text {
    font-size: 14px;
  }

  .page-app .sidebar-close-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .page-app .sidebar-user-email {
    font-size: 11px;
  }

  .page-app .conversation-item {
    padding: 6px 10px;
    border-radius: 10px;
  }

  .page-app .conversation-delete {
    width: 32px;
    height: 32px;
  }

  .page-app .empty-state-inner {
    padding: 18px 12px;
    border-radius: 18px;
  }

  .page-app .feature-pill {
    width: 100%;
    justify-content: center;
  }

  .page-app .suggestion-card {
    padding: 14px;
    border-radius: 16px;
  }

  .page-app .message-row {
    margin-bottom: 16px;
  }

  .page-app .message-bubble {
    padding: 13px 12px;
  }

  .page-app .message-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    direction: rtl;
  }

  .page-app .message-actions .btn-secondary {
    width: auto;
    flex: 0 0 auto;
  }

  .page-app .composer-wrap {
    padding-inline: 8px;
  }

  .page-app .composer {
    padding: 10px;
    border-radius: 16px;
  }

  .page-app .composer-tools {
    gap: 5px;
    padding-inline: 8px;
  }

  .page-app .composer-tool-btn {
    width: auto;
    max-width: none;
    justify-content: center;
    padding: 8px 10px;
    font-size: 11px;
    white-space: nowrap;
  }

  .page-app .chat-prompt-title {
    font-size: clamp(18px, 5.2vw, 22px);
  }

  .page-app .dialog {
    width: min(100% - 8px, 920px);
    max-height: min(100dvh - 8px, 920px);
    border-radius: 18px;
  }

  .page-app .dialog-header,
  .page-app .dialog-body {
    padding: 12px;
  }

  .page-app .settings-card,
  .page-app .plan-card {
    padding: 14px;
  }

  .page-app .plan-badge,
  .page-app .plan-card-current {
    font-size: 10px;
  }
}

@media (max-height: 760px) and (min-width: 721px) {
  .page-app .topbar {
    min-height: 64px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .page-app .chat-stage {
    padding-top: 10px;
  }

  .page-app .empty-state-inner {
    padding: 28px 24px;
  }

  .page-app .empty-state-title {
    font-size: clamp(28px, 4vw, 42px);
  }

  .page-app .composer-inner {
    padding: 10px 12px 12px;
  }
}

@media (max-height: 560px) {
  .page-app .sidebar {
    overflow: auto;
  }

  .page-app .empty-state {
    align-items: flex-start;
  }

  .page-app .empty-state-inner {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .page-app .composer-shell,
  .page-app .composer-toolbar,
  .page-app .composer-actions {
    margin-top: 10px;
  }
}

.page-app {
  direction: rtl;
  text-align: right;
}

.page-app .app-layout {
  direction: rtl;
}

.page-app .sidebar,
.page-app .topbar,
.page-app .chat-stage,
.page-app .composer,
.page-app .composer-row,
.page-app .composer-row-actions,
.page-app .composer-tools,
.page-app .message-actions,
.page-app .composer-toolbar,
.page-app .composer-toolbar-left,
.page-app .settings-grid,
.page-app .settings-card,
.page-app .dialog,
.page-app .dialog-header,
.page-app .dialog-body,
.page-app .field,
.page-app .brand-block,
.page-app .conversation-item,
.page-app .conversation-item-row,
.page-app .sidebar-footer,
.page-app .sidebar-footer-actions,
.page-app .sidebar-user-plan-row,
.page-app .settings-plan-row {
  direction: rtl;
  text-align: right;
}

.page-app .sidebar {
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  border-left: 0;
}

.page-app .sidebar-link-button,
.page-app .prompt-chip {
  text-align: right;
}

.page-app .composer-input,
.page-app .sidebar-search,
.page-app .input,
.page-app .input-select {
  text-align: right;
}

.page-app .dialog-actions,
.page-app .message-actions {
  justify-content: flex-start;
}

.page-app .messages {
  padding: 10px 14px 120px 18px;
}

.page-app .toast-region {
  left: 18px;
  right: auto;
}

@media (max-width: 1024px) {
  .page-app .sidebar {
    right: 0;
    left: auto;
    transform: translateX(100%);
    box-shadow: -16px 0 42px rgba(15, 23, 42, 0.14);
  }

  .page-app .sidebar.is-open {
    transform: translateX(0);
  }

  .page-app.theme-dark .sidebar {
    box-shadow: -16px 0 42px rgba(0, 0, 0, 0.36);
  }

  .page-app .sidebar-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .page-app .toast-region {
    left: 10px;
    right: 10px;
  }

  .page-app .sidebar-fab {
    top: 10px;
    right: 10px;
  }
}

/* ChatGPT-like palette (light) */
.page,
.page-app,
.page-auth {
  background: #ffffff;
  color: #0d0d0d;
}

.page {
  background:
    radial-gradient(circle at top, rgba(0, 0, 0, 0.03) 0%, transparent 60%),
    #ffffff;
}

.page-glow,
.page-glow-login,
.page-glow-register,
.page-app .app-ambient-a,
.page-app .app-ambient-b {
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.03) 0%, transparent 62%);
  opacity: 0.35;
}

.page-auth .auth-card,
.page-app .empty-state-inner,
.page-app .dialog,
.page-app .settings-card,
.page-app .plan-card,
.page-app .toast,
.page-app .guest-access-card,
.page-app .conversation-empty,
.page-app .suggestion-card,
.page-app .sidebar-overview {
  border-color: #e5e5e5;
  background: #ffffff;
  color: #0d0d0d;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.page-app .app-frame,
.page-app .topbar {
  border-color: #e5e5e5;
  background: #ffffff;
  color: #0d0d0d;
  box-shadow: none;
}

.page-app .sidebar,
.page-app .sidebar-footer {
  border-color: #e5e5e5;
  background: #f9f9f9;
  color: #0d0d0d;
  box-shadow: none;
}

.page-app .composer-inner {
  border-color: #e5e5e5;
  background: #ffffff;
  color: #0d0d0d;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.page-app .message-bubble {
  border-color: transparent;
  background: transparent;
  color: #0d0d0d;
  box-shadow: none;
}

.page-app.theme-dark .sidebar,
.page-app.theme-dark .sidebar-footer {
  background: #171717;
  border-color: #424242;
  color: #ececec;
}

.page-app.theme-dark .app-frame,
.page-app.theme-dark .topbar,
.page-app.theme-dark .main-panel {
  background: #212121;
  color: #ececec;
}

.page-app .topbar {
  background: #ffffff;
}

.page-app.theme-dark .topbar {
  background: #000000;
}

.page-app .main-panel:not(.is-empty) .messages-panel::after,
.page-app .composer-wrap,
.page-app.theme-dark .composer-wrap {
  background: linear-gradient(180deg, transparent 0%, #212121 100%);
}

.page-app .sidebar-brand-text,
.page-app .brand-title,
.page-app .conversation-item-title,
.page-app .settings-card-title,
.page-app .plan-card-name,
.page-app .plan-card-price,
.page-app .sidebar-user,
.page-app .empty-state-title,
.page-app .composer-shell-title,
.page-app .dialog-title,
.page-auth .auth-title {
  color: #0d0d0d;
}

.page-app .sidebar-brand-subtitle,
.page-app .brand-subtitle,
.page-app .empty-state-text,
.page-app .empty-state-note,
.page-app .conversation-item-meta,
.page-app .settings-card-note,
.page-app .dialog-note,
.page-app .field-label,
.page-app .composer-hint,
.page-app .message-meta,
.page-auth .auth-subtitle,
.page-auth .auth-footer,
.page-auth .auth-status {
  color: var(--muted);
}

.page-app .input,
.page-app .input-select,
.page-app .sidebar-search,
.page-app .sidebar-icon-button,
.page-app .sidebar-close-button,
.page-app .prompt-chip,
.page-app .feature-pill,
.page-app .topbar-user-chip,
.page-app .topbar-status,
.page-app .message-actions .btn-secondary,
.page-auth .input,
.page-auth .dialog-close {
  border-color: #e5e5e5;
  background: #ffffff;
  color: #0d0d0d;
}

.page-app .composer-input {
  color: #0d0d0d;
  caret-color: #0d0d0d;
}

.page-app .input::placeholder,
.page-app .composer-input::placeholder,
.page-auth .input::placeholder {
  color: #676767;
}

.page-app .btn-primary,
.page-app .composer-submit,
.page-auth .btn-primary,
.page-auth .auth-badge,
.page-app .empty-state-kicker,
.page-app .composer-badge,
.page-app .plan-card-current {
  border-color: #0d0d0d;
  background: #0d0d0d;
  color: #ffffff;
  border-radius: 9999px;
  box-shadow: none;
}

.page-app .sidebar-footer-btn--guest {
  border: 1px solid #e5e5e5;
  background: #ffffff;
  color: #0d0d0d;
  border-radius: 9999px;
  box-shadow: none;
}

.page-app .plan-badge,
.page-app.theme-dark .plan-badge {
  border: 0;
  background: #ececec;
  color: #0d0d0d;
  box-shadow: none;
}

.page-app .btn-primary:hover,
.page-app .composer-submit:hover,
.page-auth .btn-primary:hover {
  background: #0d0d0d;
  border-color: #0d0d0d;
  color: #ffffff;
  opacity: 0.9;
}

.page-app .sidebar-footer-btn--guest:hover {
  background: #ececec;
  border-color: #e5e5e5;
  color: #0d0d0d;
}

.page-app.theme-dark .composer-attach-btn {
  background: transparent;
  color: #a3a3a3;
}

.page-app.theme-dark .composer-attach-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fafafa;
}

.page-app.theme-dark .composer-attachment-chip {
  border-color: rgba(255, 255, 255, 0.12);
  background: #2a2a2a;
}

.page-app.theme-dark .composer-attachment-name {
  color: #ececec;
}

.page-app.theme-dark .message-attachment--file {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.page-app .composer-attach-soon,
.page-app.theme-dark .composer-attach-soon {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.72);
}

.page-app .btn-secondary,
.page-auth .btn-secondary {
  border-color: rgba(0, 0, 0, 0.12);
  background: #ffffff;
  color: #000000;
}

.page-app .btn-secondary:hover,
.page-auth .btn-secondary:hover,
.page-app .sidebar-link-button:hover,
.page-app .sidebar-icon-button:hover,
.page-app .prompt-chip:hover,
.page-app .conversation-item:hover,
.page-app .conversation-item.is-active,
.page-app .sidebar-close-button:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.2);
  color: #000000;
}

.page-app .sidebar-link-button,
.page-app .sidebar-link-button--icon svg,
.page-app .code-copy-btn,
.page-app .dialog-close {
  color: #6b7280;
}

.page-auth .auth-switch-link,
.page-auth .link-inline,
.page-app .link-inline {
  color: #000000;
}

.page-app .dialog-auth .dialog-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-app .dialog-auth .dialog-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  text-align: right;
}

.page-app .dialog-auth .dialog-close {
  width: 38px;
  min-width: 38px;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #000000;
}

.page-app .dialog-auth .dialog-close:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.2);
  color: #000000;
}

.page-app .code-copy-btn,
.page-app .message-actions .btn-secondary {
  border-color: rgba(0, 0, 0, 0.12);
  background: #ffffff;
  color: #000000;
  font-weight: 600;
}

.page-app .brand-eyebrow,
.page-app .sidebar-overview-label,
.page-app .composer-shell-label,
.page-app.theme-light .code-block-lang,
.page-auth .auth-badge {
  color: #000000;
}

.page-app .sidebar-overview,
.page-app .suggestion-card,
.page-app .plan-card,
.page-app .settings-card,
.page-app .empty-state-inner {
  background: #ffffff;
}

.page-app .suggestion-card:hover,
.page-app .plan-card.is-active {
  border-color: rgba(0, 0, 0, 0.34);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.12);
}

.page-app .message-avatar {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #000000;
}

.page-app .message-avatar--assistant {
  background: #000000;
  color: #ffffff;
}

.page-app .message-bubble--assistant {
  background: #ffffff;
  color: #000000;
}

.page-app .message-bubble--user {
  background: #f4f4f4;
  border-color: transparent;
  color: #0d0d0d;
}

.page-app.theme-dark .message-bubble--user {
  background: #303030;
  border-color: transparent;
  color: #ececec;
}

.page-app .message-bubble--user .message-meta,
.page-app .message-bubble--user .message-body,
.page-app .message-bubble--user .tibra-msg {
  color: inherit;
}

.page-app .message-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
}

.page-app .message-row--user {
  justify-content: flex-end;
  flex-direction: row;
}

.page-app .message-bubble--assistant,
.page-app .message-bubble--user,
.page-app.theme-dark .message-bubble--assistant,
.page-app.theme-dark .message-bubble--user {
  flex: 0 1 auto;
  width: auto;
  max-width: min(82%, 780px);
}

.page-app .message-row .message-bubble--assistant {
  margin-right: auto;
}

.page-app .message-row--user .message-bubble--user {
  margin-left: auto;
}

.page-app .message-bubble--assistant .message-meta {
  color: rgba(0, 0, 0, 0.55);
}

.page-app .message-bubble--assistant .message-body,
.page-app .message-bubble--assistant .tibra-msg,
.page-app .message-bubble--assistant .tibra-prose {
  color: #000000;
}

.page-app.theme-dark .message-bubble--assistant .message-meta {
  color: rgba(255, 255, 255, 0.62);
}

.page-app.theme-dark .message-bubble--assistant .message-body,
.page-app.theme-dark .message-bubble--assistant .tibra-msg,
.page-app.theme-dark .message-bubble--assistant .tibra-prose {
  color: #ffffff;
}

.page-app.theme-dark .tibra-prose a.md-link {
  color: #7cb8ff;
}

.page-app.theme-dark .tibra-prose li .list-item-extra {
  color: #d1d5db;
}

@media (max-width: 720px) {
  .page-app .message-row,
  .page-app .message-row--user {
    flex-direction: row;
    align-items: flex-start;
  }

  .page-app .message-row {
    justify-content: flex-start;
  }

  .page-app .message-row--user {
    justify-content: flex-end;
  }

  .page-app .message-bubble--assistant,
  .page-app .message-bubble--user,
  .page-app.theme-dark .message-bubble--assistant,
  .page-app.theme-dark .message-bubble--user {
    width: auto;
    max-width: 92%;
  }
}

.page-app .tibra-prose blockquote {
  color: rgba(0, 0, 0, 0.72);
  border-inline-start-color: #000000;
}

.page-app.theme-light .code-block,
.page-app.theme-light .tibra-prose pre,
.page-app.theme-light .tibra-prose :not(pre) > code {
  border-color: rgba(0, 0, 0, 0.12);
  background: #ffffff;
  color: #000000;
}

.page-app.theme-light .code-block-bar {
  border-bottom-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.04);
}

.page-app.theme-light .code-copy-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #000000;
}

.page-app.theme-dark .code-block,
.page-app.theme-dark .code-block pre,
.page-app.theme-dark .code-block pre code,
.page-app.theme-dark .tibra-prose pre,
.page-app.theme-dark .tibra-prose pre code,
.page-app.theme-dark .tibra-prose :not(pre) > code {
  color: #e5e7eb;
}

.page-app.theme-dark #helpDialog.dialog-help,
.page-app.theme-dark #serviceRulesDialog.dialog-help {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(10, 10, 10, 0.96);
  color: #f5f5f5;
}

.page-app.theme-dark #helpDialog .dialog-title,
.page-app.theme-dark #serviceRulesDialog .dialog-title,
.page-app.theme-dark #helpDialog[open] .dialog-title,
.page-app.theme-dark #serviceRulesDialog[open] .dialog-title {
  color: #f5f5f5;
}

.page-app .message-actions .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #000000;
}

.page-app .empty-state-inner,
.page-app .empty-state-title,
.page-app .empty-state-text,
.page-app .empty-state-note {
  text-align: center;
}

.page-app .empty-state-title {
  display: block;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center !important;
}

.page-app .empty-state-text,
.page-app .empty-state-note {
  margin-left: auto;
  margin-right: auto;
}

.page-app .typing-indicator span,
.page-app .topbar-status-dot {
  background: #000000;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
}

.page-app .toast--success {
  border-color: rgba(0, 0, 0, 0.32);
}

.page-app .toast--error {
  border-color: rgba(239, 68, 68, 0.32);
}

.page-app .sidebar-fab {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 35;
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.page-app.theme-dark,
.page-app.theme-dark .main-panel,
.page-app.theme-dark .chat-stage {
  background: #000000;
  color: #ffffff;
}

.page-app .message-image-card {
  display: grid;
  gap: 12px;
}

.page-app .message-image-frame {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.88);
}

.page-app .message-image-media {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
}

.page-app .message-image-error {
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.8;
}

.page-app .message-image-meta {
  display: grid;
  gap: 10px;
}

.page-app .message-image-prompt,
.page-app .message-image-revised {
  color: #374151;
  font-size: 13px;
  line-height: 1.8;
}

.page-app .message-image-revised {
  color: #6b7280;
}

.page-app .message-image-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-app .message-image-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background: rgba(255, 237, 213, 0.8);
  color: #c2410c;
  font-size: 11px;
  font-weight: 700;
}

.page-app .message-image-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-app.theme-dark .message-image-frame {
  border-color: rgba(0, 0, 0, 0.14);
  background: rgba(20, 20, 20, 0.96);
}

.page-app.theme-dark .message-image-prompt {
  color: #e5e7eb;
}

.page-app.theme-dark .message-image-revised {
  color: #a3a3a3;
}

.page-app.theme-dark .message-image-badge {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(38, 22, 12, 0.9);
  color: #fdba74;
}

/* Mobile-first responsive refinements */
.page-app .topbar {
  display: none;
}

.page-app .topbar-main {
  width: 100%;
}

.page-app .brand-block {
  min-width: 0;
  flex: 1;
}

.page-app .brand-title,
.page-app .brand-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-app .sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.page-app .sidebar-toggle-icon {
  display: inline-grid;
  gap: 4px;
  flex: 0 0 auto;
}

.page-app .sidebar-toggle-line {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.page-app.sidebar-open .sidebar-toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.page-app.sidebar-open .sidebar-toggle-line:nth-child(2) {
  opacity: 0;
}

.page-app.sidebar-open .sidebar-toggle-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 1024px) {
  .page-app .topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    margin: 0;
    min-height: 68px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0 0 22px 22px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(18px);
  }

  .page-app .main-panel {
    min-height: 100dvh;
  }

  .page-app .sidebar {
    right: 0;
    left: auto;
    width: min(360px, 92vw);
    max-width: 92vw;
    height: 100dvh;
    padding: 12px;
    border-right: 0;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    box-shadow: -16px 0 42px rgba(0, 0, 0, 0.36);
  }

  .page-app .sidebar.is-open {
    transform: translateX(0);
  }

  .page-app .sidebar-overlay {
    z-index: 24;
    backdrop-filter: blur(2px);
  }

  .page-app .sidebar-fab {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    min-width: 46px;
    min-height: 46px;
    padding: 0 12px;
    border-radius: 14px;
    box-shadow: none;
  }

  .page-app .chat-stage {
    padding-top: 0;
  }

  .page-app .messages {
    padding-bottom: 118px;
  }

  .page-app .composer-wrap {
    padding: 0 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .page-app .composer-inner {
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }

  .page-app .composer {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .page-app .composer-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .page-app .composer-input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    min-height: 40px;
    height: 40px;
    max-height: 96px;
  }

  .page-app .composer-row-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    padding: 0;
    background: transparent;
  }

  .page-app .composer-row-actions .composer-attach-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    min-width: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    color: #6b7280;
  }

  .page-app .composer-row-actions .composer-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid #0f172a;
    border-radius: 12px;
    background: #0f172a;
    color: #ffffff;
  }

  .page-app .composer-row-actions .composer-submit-label {
    display: none;
  }

  .page-app .composer-row-actions .composer-submit-icon:not([hidden]) {
    display: inline-flex;
  }

  .page-app .composer-tools {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 0;
    padding: 10px 12px 12px;
    border-top: 1px solid #ececec;
    direction: rtl;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .page-app .composer-tools::-webkit-scrollbar {
    display: none;
  }

  .page-app .composer-tool-btn {
    width: auto;
    max-width: none;
    flex: 0 0 auto;
    min-height: 40px;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .page-app .composer-toolbar-left {
    width: 100%;
  }

  .page-app .composer-badge {
    max-width: 100%;
    white-space: normal;
    text-align: right;
  }
}

@media (max-width: 720px) {
  .page-app .app-shell {
    padding: 0;
  }

  .page-app .app-frame {
    min-height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .page-app .topbar {
    min-height: 64px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    border-radius: 0;
  }

  .page-app .topbar-main {
    align-items: center;
    gap: 10px;
  }

  .page-app .brand-eyebrow {
    font-size: 10px;
  }

  .page-app .brand-title {
    margin-top: 2px;
    font-size: 16px;
  }

  .page-app .brand-subtitle {
    margin-top: 2px;
    font-size: 11px;
  }

  .page-app .sidebar {
    width: min(320px, 100vw);
    max-width: 100vw;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .page-app .sidebar-brand {
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
  }

  .page-app .chat-stage {
    padding: 0 8px 8px;
  }

  .page-app .messages {
    padding: 8px 10px 120px;
  }

  .page-app .message-image-actions {
    flex-wrap: wrap;
  }

  .page-app .composer-toolbar,
  .page-app .composer-toolbar-left {
    align-items: stretch;
  }

  .page-app .composer-attach-btn {
    width: max-content;
    max-width: 100%;
  }

  .page-app .composer-badge-muted {
    width: 100%;
    min-height: auto;
    padding: 10px 12px;
    border-radius: 16px;
    justify-content: flex-start;
    line-height: 1.8;
  }
}

@media (max-width: 560px) {
  .page-app .topbar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .page-app .sidebar {
    width: 100vw;
    max-width: 100vw;
  }

  .page-app .sidebar-toggle-label {
    display: none;
  }

  .page-app .sidebar-fab {
    min-width: 44px;
    padding: 0 10px;
  }

  .page-app .brand-title {
    font-size: 15px;
  }

  .page-app .brand-subtitle {
    font-size: 10px;
  }

  .page-app .chat-stage {
    padding-inline: 6px;
  }

  .page-app .messages {
    padding: 8px 8px 126px;
  }

  .page-app .message-image-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .page-app .composer-tools {
    gap: 5px;
    padding-inline: 8px;
  }

  .page-app .composer-tool-btn {
    width: auto;
    max-width: none;
    justify-content: center;
    padding: 8px 9px;
    white-space: nowrap;
  }
}
