﻿/*
 * Older responsive system and late incremental visual overrides preserved for cascade compatibility.
 * Extracted from public/styles.css lines 2750-4057.
 */

/* =========================
   MOBILE / RESPONSIVE
========================= */

/* Hamburger â€” hidden on desktop */
#mobile-bar {
  display: none;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid #1f2937;
  background: #0c0e12;
  flex-shrink: 0;
}

#hamburger {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  margin: 0;
  border-radius: 4px;
  cursor: pointer;
}

#hamburger:hover {
  color: #e2e8f0;
  background: #161a22;
}

/* Overlay backdrop when sidebar is open */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 499;
}

#sidebar-overlay.visible {
  display: block;
}

/* Back bar â€” hidden on desktop */
#mobile-back-bar {
  display: none;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #1f2937;
  background: #0c0e12;
  flex-shrink: 0;
}

#mobile-back {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

#mobile-back:hover {
  color: #e2e8f0;
  background: transparent;
}

/* â”€â”€ Media query â”€â”€ */

@media (max-width: 768px) {
  /* Sidebar becomes a slide-in drawer */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 500;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
  }

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

  /* Chat column fills full width */
  #chat-col {
    width: 100% !important;
    min-width: 0;
    flex: 1;
  }

  /* Right panel becomes a full-screen overlay when active */
  #right {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 600;
    background: #0f1115;
    border-left: none;
    overflow-y: auto;
  }

  #right.mobile-open {
    display: flex;
    flex-direction: column;
  }

  /* Hide resizer */
  #resizer {
    display: none;
  }

  /* Show mobile-only elements */
  #mobile-bar {
    display: flex;
  }

  #mobile-back-bar {
    display: flex;
  }

  body.topbar-sheet-open #topbar-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    grid-template-columns: 1fr;
    row-gap: 10px;
    padding: 20px 16px 32px;
    background: #161a22;
    border-top: 1px solid #374151;
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    z-index: 700;
    animation: topbar-slide-up 0.22s ease;
  }

  body.topbar-sheet-open #topbar-overlay {
    display: block;
  }

  .topbar-provider-model {
    grid-template-columns: 1fr;
  }

  #topbar-controls select {
    padding: 9px 10px;
    font-size: 14px;
  }
}

/* =========================
   CHATBOBA APP SHELL REFRESH
========================= */

#container {
  background:
    radial-gradient(circle at 82% -12%, rgba(231, 199, 143, 0.06), transparent 34%),
    linear-gradient(180deg, #211d19 0%, #171411 100%);
  color: #f2e7d8;
}

#sidebar {
  width: 230px;
  box-sizing: border-box;
  background: #241f1a;
  border-right: 1px solid rgba(231, 199, 143, 0.16);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 18px 22px;
  box-sizing: border-box;
  color: #f7efe3;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid rgba(231, 199, 143, 0.16);
}

.sidebar-brand-cup {
  width: 28px;
  height: 28px;
}

#sidebar-nav {
  padding: 18px 12px;
  gap: 12px;
  overflow: hidden;
}

.nav-group {
  gap: 4px;
  padding-top: 0;
}

.nav-group + .nav-group {
  margin-top: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(231, 199, 143, 0.12);
}

#sidebar-nav button {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #cdbfad;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  margin: 0;
}

#sidebar-nav button:hover {
  background: rgba(67, 57, 47, 0.78);
  border-color: rgba(231, 199, 143, 0.12);
  color: #fff7eb;
}

#sidebar-nav button.active {
  padding-left: 14px;
  background: linear-gradient(180deg, rgba(231, 199, 143, 0.14), rgba(231, 199, 143, 0.07));
  border: 1px solid rgba(231, 199, 143, 0.26);
  color: #fff7eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#sidebar-nav .workspace-switcher button {
  width: auto;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #b8aa98;
  font-size: 12px;
  font-weight: 700;
}

#sidebar-nav .workspace-switcher button:hover {
  border: 0;
  color: #fff7eb;
  background: rgba(67, 57, 47, 0.66);
}

#sidebar-nav .workspace-switcher button.active {
  padding-left: 10px;
  border: 0;
  color: #1b130c;
  background: #dfb86d;
  box-shadow: none;
}

#sidebar-footer {
  padding: 18px 14px;
  gap: 14px;
  border-top: 1px solid rgba(231, 199, 143, 0.08);
  background: #241f1a;
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: radial-gradient(circle at 34% 28%, #d4ac6f, #8a5524 72%);
  box-shadow: 0 0 0 1px rgba(231, 199, 143, 0.28);
}

.sidebar-account-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#user-bar-email {
  color: #d8cbb8;
  font-size: 13px;
}

.sidebar-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d8b878;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d4ac6f;
  box-shadow: 0 0 8px rgba(212, 172, 111, 0.65);
}

.sidebar-footer-row {
  gap: 8px;
}

.sidebar-utility-nav button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #cdbfad;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
}

.sidebar-utility-nav button:hover {
  background: rgba(67, 57, 47, 0.78);
  border-color: rgba(231, 199, 143, 0.12);
  color: #fff7eb;
}

.user-bar-admin,
.user-bar-logout {
  flex: 1;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(231, 199, 143, 0.2);
  background: rgba(48, 41, 34, 0.82);
  color: #d8cbb8;
  font-size: 13px;
  font-weight: 600;
}

.user-bar-admin:hover,
.user-bar-logout:hover {
  background: rgba(67, 57, 47, 0.9);
  border-color: rgba(231, 199, 143, 0.32);
  color: #fff7eb;
}

#chat-col,
#right {
  background: #191512;
}

#right {
  border-left: 1px solid rgba(231, 199, 143, 0.16);
}

#resizer {
  background: rgba(231, 199, 143, 0.12);
}

#resizer:hover,
#resizer.active {
  background: rgba(231, 199, 143, 0.34);
}

#chat-headerbar,
#mobile-bar,
#mobile-back-bar {
  min-height: 58px;
  background: linear-gradient(180deg, #241f1a 0%, #1c1815 100%);
  border-bottom: 1px solid rgba(231, 199, 143, 0.16);
}

#chat-headerbar #profile,
#topbar-controls select,
.sidebar-controls select {
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(231, 199, 143, 0.2);
  background: rgba(48, 41, 34, 0.88);
  color: #f2e7d8;
}

#chat-headerbar #profile:focus,
#topbar-controls select:focus,
.sidebar-controls select:focus {
  border-color: rgba(231, 199, 143, 0.68);
}

#topbar-gear,
#hamburger,
#mobile-back {
  border-radius: 12px;
  color: #d8cbb8;
}

#topbar-gear:hover,
#hamburger:hover,
#mobile-back:hover {
  background: rgba(67, 57, 47, 0.82);
  color: #fff7eb;
}

#topbar-controls {
  background: #201b17;
  border-color: rgba(231, 199, 143, 0.16);
}

.topbar-label,
.ctrl-label {
  color: #b59f82;
}

#input-area {
  border-top: 1px solid rgba(231, 199, 143, 0.16);
  background: linear-gradient(180deg, #191512 0%, #211c18 100%);
}

#input-area textarea#message {
  border-radius: 18px;
  border-color: rgba(231, 199, 143, 0.22);
  background: #261f1a;
  color: #f7efe3;
}

#input-area textarea#message:focus {
  border-color: rgba(231, 199, 143, 0.7);
  box-shadow: 0 0 0 3px rgba(231, 199, 143, 0.1);
}

#send-btn {
  border-radius: 18px;
  border-color: #d4ac6f;
  background: #d4ac6f;
  color: #261b12;
}

#send-btn:hover {
  border-color: #e7c78f;
  background: #e7c78f;
  color: #261b12;
}

#panelContent {
  background: #191512;
}

.section {
  padding: 30px 44px;
  background: #191512;
  color: #f2e7d8;
}

.section h2,
.admin-page-title {
  margin: 0 0 22px;
  color: #fff7eb;
  font-size: 24px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: 0;
}

.section h2::before,
.admin-page-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 10px 4px 0;
  border-radius: 999px;
  background: #a9652a;
}

.admin-card,
.settings-usage-summary,
.memory-item,
.provider-chain-row {
  border: 1px solid rgba(231, 199, 143, 0.18) !important;
  border-radius: 18px !important;
  background: #241f1a !important;
  box-shadow: 0 18px 48px -34px rgba(0, 0, 0, 0.86);
}

.admin-card {
  padding: 18px 20px;
}

.admin-card h3 {
  color: #ddc39a;
  border-bottom-color: rgba(231, 199, 143, 0.14);
  letter-spacing: 0.12em;
}

.settings-card-primary {
  border-color: rgba(231, 199, 143, 0.28) !important;
}

.settings-card-primary h3 {
  color: #e7c78f;
}

.admin-desc,
.field-hint,
.settings-hint,
.label-hint {
  color: #9f8f7b;
}

.form-group label,
.field label,
.settings-bot-col label,
.admin-rules-label {
  color: #d8cbb8;
  font-weight: 600;
}

.form-group {
  gap: 7px;
  margin-bottom: 18px;
}

.row {
  gap: 10px;
}

.form-group input,
.form-group textarea,
.row input,
.row select,
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field textarea,
.field select,
.settings-bot-col select,
.admin-search,
.admin-rules-textarea {
  border: 1px solid rgba(231, 199, 143, 0.2);
  border-radius: 14px;
  background: rgba(38, 31, 26, 0.95);
  color: #f7efe3;
  font-size: 14px;
}

.form-group input,
.row input,
.row select,
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field select,
.settings-bot-col select,
.admin-search {
  min-height: 42px;
  padding: 9px 12px;
}

.form-group textarea,
.field textarea,
.admin-rules-textarea {
  padding: 12px 14px;
  line-height: 1.55;
}

.form-group input:focus,
.form-group textarea:focus,
.row input:focus,
.row select:focus,
.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field input[type="password"]:focus,
.field textarea:focus,
.field select:focus,
.settings-bot-col select:focus,
.admin-search:focus,
.admin-rules-textarea:focus {
  outline: none;
  border-color: rgba(231, 199, 143, 0.72);
  box-shadow: 0 0 0 3px rgba(231, 199, 143, 0.1);
}

#panelContent button,
.admin-nav-item,
.admin-collapsible-toggle,
.admin-sub-toggle,
.settings-advanced-toggle {
  border-radius: 999px;
}

#container button.primary,
.btn-primary {
  border: 1px solid #d4ac6f;
  background: #d4ac6f;
  color: #261b12;
  font-weight: 700;
  box-shadow: 0 14px 28px -22px rgba(231, 199, 143, 0.8);
}

#container button.primary:hover,
.btn-primary:hover {
  border-color: #e7c78f;
  background: #e7c78f;
  color: #261b12;
}

#panelContent button:not(.primary) {
  border: 1px solid rgba(231, 199, 143, 0.2);
  background: rgba(48, 41, 34, 0.76);
  color: #d8cbb8;
}

#panelContent button:not(.primary):hover {
  border-color: rgba(231, 199, 143, 0.32);
  background: rgba(67, 57, 47, 0.9);
  color: #fff7eb;
}

.btn-danger,
.btn-danger-action {
  border-color: rgba(239, 105, 91, 0.38) !important;
  color: #ff9d8f !important;
  background: transparent !important;
}

.btn-danger:hover,
.btn-danger-action:hover {
  background: rgba(239, 105, 91, 0.1) !important;
}

.settings-divider,
.settings-advanced-body,
.admin-card-collapsible,
.admin-sub-collapsible {
  border-color: rgba(231, 199, 143, 0.14);
}

.settings-usage-label,
.settings-usage-value {
  color: #d8cbb8;
}

/* Lighter in-panel admin navigation */
.admin-shell {
  background: #191512;
}

.admin-nav {
  width: 158px;
  padding: 22px 12px;
  gap: 5px;
  background: #1f1a16;
  border-right: 1px solid rgba(231, 199, 143, 0.12);
}

.admin-nav-title {
  margin: 0 4px 14px;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(231, 199, 143, 0.12);
  color: #b59f82;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.admin-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 36px;
  width: 100%;
  margin: 0;
  padding: 8px 12px 8px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #b9ab98;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.admin-nav-item:hover {
  background: rgba(67, 57, 47, 0.48);
  border-color: rgba(231, 199, 143, 0.1);
  color: #f7efe3;
}

.admin-nav-item.active {
  background: rgba(231, 199, 143, 0.075);
  border-color: rgba(231, 199, 143, 0.12);
  color: #fff7eb;
  font-weight: 700;
}

.admin-nav-item.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: #d4ac6f;
  box-shadow: 0 0 12px rgba(212, 172, 111, 0.36);
  transform: translateY(-50%);
}

.admin-content {
  background: #191512;
}

@media (max-width: 768px) {
  #sidebar {
    width: 260px;
    background: #241f1a;
  }

  #right {
    background: #191512;
  }

  body.topbar-sheet-open #topbar-controls {
    background: #241f1a;
    border-top-color: rgba(231, 199, 143, 0.2);
  }

  .section {
    padding: 22px 16px 28px;
  }

  .section h2,
  .admin-page-title {
    font-size: 21px;
  }

  .field,
  .settings-bot-pair {
    flex-direction: column;
    gap: 8px;
  }

  .field label {
    width: auto;
    padding-top: 0;
  }

  .settings-hint,
  .settings-usage-summary {
    margin-left: 0;
  }

  .admin-shell {
    flex-direction: column;
  }

  .admin-nav {
    width: auto;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(231, 199, 143, 0.12);
  }

  .admin-nav-title {
    display: none;
  }

  .admin-nav-item {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .admin-nav-item.active::before {
    left: 50%;
    top: auto;
    bottom: 3px;
    width: 18px;
    height: 3px;
    transform: translateX(-50%);
  }
}

/* =========================
   CHATBOBA CONVERSATION REFRESH
========================= */

#chat,
#mai-chat {
  gap: 2px;
}

.msg {
  margin: 12px 0;
}

.bubble {
  padding: 13px 16px;
  border: 1px solid rgba(231, 199, 143, 0.14);
  border-radius: 18px;
  color: #f0e4d4;
  line-height: 1.52;
  box-shadow: 0 12px 34px -30px rgba(0, 0, 0, 0.85);
}

.bubble.user {
  border-color: rgba(231, 199, 143, 0.26);
  border-bottom-right-radius: 7px;
  background: linear-gradient(180deg, #3a2d21 0%, #30261d 100%);
  color: #fff3df;
}

.bubble.assistant {
  border-color: rgba(211, 177, 128, 0.18);
  border-bottom-left-radius: 7px;
  background: #241f1a;
  color: #eadfce;
}

.bubble.user .history-label,
.history-item.user .history-label {
  color: #e7c78f;
}

.bubble.assistant .history-label,
.history-item.assistant .history-label {
  color: #d4ac6f;
}

.history-meta {
  gap: 7px;
  margin-bottom: 7px;
  color: #9f8f7b;
}

.history-label {
  color: #d4ac6f;
  font-size: 10px;
  letter-spacing: 0.09em;
}

.history-time {
  color: rgba(216, 203, 184, 0.52);
  font-size: 10px;
}

.history-content {
  color: inherit;
  line-height: 1.55;
}

.typing-indicator {
  color: #b59f82;
}

.history-item {
  border: 1px solid rgba(231, 199, 143, 0.14);
  border-radius: 16px;
  color: #eadfce;
}

.history-item.user {
  border-color: rgba(231, 199, 143, 0.24);
  background: #30261d;
}

.history-item.assistant {
  background: #241f1a;
}

.mai-msg {
  margin-bottom: 13px;
}

.mai-msg-label {
  color: #9f8f7b;
  letter-spacing: 0.09em;
}

.mai-msg-a .mai-msg-label,
.mai-msg-b .mai-msg-label {
  color: #d4ac6f;
}

.mai-msg-user .mai-msg-label {
  color: #e7c78f;
}

.mai-bubble {
  border: 1px solid rgba(231, 199, 143, 0.14);
  border-radius: 18px;
  color: #eadfce;
  box-shadow: 0 12px 34px -30px rgba(0, 0, 0, 0.85);
}

.mai-msg-a .mai-bubble {
  border-color: rgba(211, 177, 128, 0.18);
  border-bottom-left-radius: 7px;
  background: #241f1a;
}

.mai-msg-b .mai-bubble {
  border-color: rgba(231, 199, 143, 0.22);
  border-bottom-right-radius: 7px;
  background: #2a231d;
}

.mai-msg-user .mai-bubble {
  border-color: rgba(231, 199, 143, 0.26);
  background: #30261d;
  color: #fff3df;
}

@media (max-width: 768px) {
  .bubble {
    max-width: 84%;
  }

  .mai-msg {
    max-width: 86%;
  }
}

/* =========================
   AI STUDIO MOBILE UX REFINEMENT
========================= */

.mai-mobile-quick-controls {
  display: none;
}

.mai-mode-btn {
  border-color: rgba(231, 199, 143, 0.2);
  background: rgba(48, 41, 34, 0.76);
  color: #d8cbb8;
}

.mai-mode-btn:hover {
  border-color: rgba(231, 199, 143, 0.32);
  background: rgba(67, 57, 47, 0.9);
  color: #fff7eb;
}

.mai-mode-btn.mai-mode-active {
  border-color: #d4ac6f;
  background: #d4ac6f;
  color: #261b12;
}

/* =========================
   AI STUDIO DESKTOP REFINEMENT
========================= */

.mai-mobile-quick-controls.visible {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid rgba(231, 199, 143, 0.12);
  border-bottom: 1px solid rgba(231, 199, 143, 0.12);
  background: #1f1a16;
}

.mai-mobile-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mai-mobile-control-label {
  flex: 0 0 auto;
  color: #b59f82;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mai-mobile-quick-controls .mai-mode-btn {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.mai-mobile-quick-controls .mai-ctrl-input {
  width: 58px;
  min-height: 32px;
  border-radius: 999px;
}

.mai-settings-panel {
  background: #191512;
}

.mai-settings-toggle {
  border-color: rgba(231, 199, 143, 0.14);
  background: #241f1a;
}

.mai-settings-toggle {
  color: #f2e7d8;
}

.mai-settings-toggle:hover {
  background: rgba(67, 57, 47, 0.58);
  color: #fff7eb;
}

.mai-controls {
  border-color: rgba(231, 199, 143, 0.14);
  background: #191512;
}

.mai-bots-row {
  gap: 12px;
  padding: 14px 16px;
  border-bottom-color: rgba(231, 199, 143, 0.14);
}

.bot-card {
  gap: 10px;
  padding: 14px;
  border-color: rgba(231, 199, 143, 0.18);
  border-radius: 16px;
  background: #241f1a;
  box-shadow: 0 18px 48px -38px rgba(0, 0, 0, 0.9);
}

.bot-card-a,
.bot-card-b {
  border-color: rgba(231, 199, 143, 0.2);
}

.bot-card-header {
  color: #e7c78f;
}

.mai-color-a,
.mai-color-b {
  color: #e7c78f;
}

.bot-field-label,
.mai-ctrl-label {
  color: #b59f82;
}

.bot-field-sep {
  border-top-color: rgba(231, 199, 143, 0.12);
}

.bot-card select,
.mai-ctrl-input {
  border-color: rgba(231, 199, 143, 0.2);
  border-radius: 12px;
  background: rgba(38, 31, 26, 0.95);
  color: #f7efe3;
}

.bot-card select:focus,
.mai-ctrl-input:focus {
  outline: none;
  border-color: rgba(231, 199, 143, 0.72);
  box-shadow: 0 0 0 3px rgba(231, 199, 143, 0.1);
}

.mai-global-controls {
  gap: 14px;
  padding: 12px 16px 14px;
  background: #1f1a16;
}

.mai-ctrl-divider {
  background: rgba(231, 199, 143, 0.16);
}

.mai-session-bar {
  border-top: 1px solid rgba(231, 199, 143, 0.1);
  background: #171310;
  color: #9f8f7b;
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  #sidebar-nav button {
    font-size: 15px;
  }

  #chat,
  #mai-chat {
    padding: 14px;
  }

  .bubble,
  .history-content,
  .mai-bubble {
    font-size: 15px;
    line-height: 1.6;
  }

  .history-label,
  .history-time,
  .mai-msg-label {
    font-size: 11px;
  }

  #input-area textarea#message,
  #send-btn,
  .mai-input-row input[type="text"],
  .mai-input-row button,
  .form-group input,
  .form-group textarea,
  .row input,
  .row select,
  .field input[type="text"],
  .field input[type="number"],
  .field input[type="password"],
  .field select,
  .field textarea,
  .bot-card select,
  .settings-bot-col select {
    font-size: 15px;
  }

  .topbar-label,
  .mai-ctrl-label,
  .bot-field-label {
    font-size: 11px;
  }

  .mai-container {
    min-height: 100%;
  }

  .mai-mobile-quick-controls.visible {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(231, 199, 143, 0.14);
    background: #1f1a16;
  }

  .mai-mobile-control-row {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mai-mobile-control-row::-webkit-scrollbar {
    display: none;
  }

  .mai-mobile-control-label {
    flex: 0 0 auto;
    min-width: 52px;
    color: #b59f82;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .mai-mobile-quick-controls .mai-mode-btn {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
  }

  .mai-mobile-quick-controls .mai-ctrl-input {
    width: 58px;
    min-height: 34px;
    border-radius: 999px;
    font-size: 14px;
  }

  .mai-settings-toggle {
    font-size: 14px;
  }

  .mai-controls {
    max-height: calc(100vh - 112px);
    overflow-y: auto;
  }

  .mai-bots-row {
    flex-direction: column;
  }
}

/* =========================
   AI STUDIO TOOLBAR POLISH
========================= */

.mai-mobile-quick-controls.visible {
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 8px 18px;
}

.mai-mobile-control-row {
  gap: 6px;
  flex-wrap: nowrap;
}

.mai-mobile-control-label {
  min-width: auto;
  margin-right: 3px;
  color: #a99780;
  font-size: 10px;
  letter-spacing: 0.11em;
}

.mai-mobile-quick-controls .mai-mode-btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.mai-mobile-quick-controls .mai-ctrl-input {
  width: 48px;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

#sidebar-nav .chat-session-open {
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  padding: 8px 7px 8px 9px;
}

#sidebar-nav .chat-session-title {
  display: block;
  width: 100%;
  text-align: left;
}

#input-area {
  gap: 10px;
}

#send-btn {
  width: 54px;
  height: 64px;
  border-radius: 16px;
  font-size: 12px;
  box-shadow: 0 12px 24px -20px rgba(231, 199, 143, 0.75);
}

#input-area textarea#message {
  height: 64px;
  min-height: 64px;
}

@media (min-width: 769px) and (max-width: 1120px) {
  .mai-mobile-quick-controls.visible {
    gap: 7px 14px;
    padding-inline: 14px;
  }

  .mai-mobile-control-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .mai-mobile-quick-controls.visible {
    gap: 7px;
    padding: 9px 12px;
  }

  .mai-mobile-control-row {
    gap: 6px;
  }

  .mai-mobile-quick-controls .mai-mode-btn {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 13px;
  }

  .mai-mobile-quick-controls .mai-ctrl-input {
    width: 58px;
    min-height: 34px;
    font-size: 14px;
  }

  #send-btn {
    width: 58px;
    height: 68px;
  }

  #input-area textarea#message {
    height: 68px;
    min-height: 68px;
  }
}

/* AI Studio compact runtime controls - final override */
.mai-mobile-quick-controls.visible {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 16px 6px;
  border-top: 1px solid rgba(231, 199, 143, 0.12);
  background: linear-gradient(180deg, rgba(25, 21, 18, 0.94) 0%, rgba(33, 28, 24, 0.98) 100%);
}

.mai-session-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mai-mobile-control-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: auto;
  margin: 0;
  color: #b59f82;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mai-mobile-control-label .tooltip-wrap {
  color: #8e7d67;
  font-size: 11px;
  line-height: 1;
}

.mai-switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(231, 199, 143, 0.2);
  border-radius: 999px;
  background: rgba(49, 41, 34, 0.92);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.mai-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #d8cbb8;
  transition: transform 0.16s ease, background 0.16s ease;
}

.mai-switch.is-on {
  border-color: rgba(212, 172, 111, 0.6);
  background: #8b6428;
  box-shadow: 0 8px 18px -14px rgba(231, 199, 143, 0.8);
}

.mai-switch.is-on span {
  transform: translateX(16px);
  background: #fff3dc;
}

.mai-round-stepper {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(231, 199, 143, 0.18);
  border-radius: 999px;
  background: rgba(43, 35, 29, 0.85);
}

.mai-round-stepper button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e7d4bd;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.mai-round-stepper button:hover {
  background: rgba(231, 199, 143, 0.1);
}

.mai-session-control-rounds {
  transition: opacity 0.16s ease, filter 0.16s ease;
}

/* Dim the label and stepper individually so the stop button (a sibling of the stepper)
   is not affected by inherited opacity — it manages its own disabled state. */
.mai-session-control-rounds.is-disabled .mai-mobile-control-label,
.mai-session-control-rounds.is-disabled .mai-round-stepper {
  opacity: 0.46;
  filter: saturate(0.75);
}

.mai-session-control-rounds.is-disabled .mai-round-stepper {
  pointer-events: none;
}

.mai-session-control-rounds.is-disabled .mai-round-stepper button,
.mai-session-control-rounds.is-disabled .mai-round-stepper .mai-ctrl-input {
  cursor: not-allowed;
}

.mai-round-stepper .mai-ctrl-input {
  width: 38px;
  min-height: 28px;
  padding: 0 4px;
  border: 0;
  border-left: 1px solid rgba(231, 199, 143, 0.12);
  border-right: 1px solid rgba(231, 199, 143, 0.12);
  border-radius: 0;
  background: transparent;
  color: #f2e7d8;
  font-size: 13px;
  text-align: center;
  appearance: textfield;
}

.mai-round-stepper .mai-ctrl-input::-webkit-outer-spin-button,
.mai-round-stepper .mai-ctrl-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mai-round-stepper select.mai-ctrl-input {
  appearance: auto;
  width: auto;
  min-width: 52px;
  border: 1px solid rgba(231, 199, 143, 0.15);
  border-radius: 3px;
  padding: 0 2px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .mai-mobile-quick-controls.visible {
    gap: 8px 12px;
    padding: 8px 10px;
  }

  .mai-session-control {
    gap: 7px;
  }

  .mai-session-control-rounds {
    flex-basis: 100%;
  }

  .mai-switch {
    width: 42px;
    height: 24px;
  }

  .mai-switch span {
    width: 16px;
    height: 16px;
  }

  .mai-switch.is-on span {
    transform: translateX(17px);
  }

  .mai-round-stepper button,
  .mai-round-stepper .mai-ctrl-input {
    min-height: 34px;
  }

  .mai-round-stepper button {
    width: 34px;
  }

  .mai-round-stepper .mai-ctrl-input {
    width: 44px;
    font-size: 14px;
  }
}

