/* =================================================================
   SHARED PANEL STYLES - iOS-Inspired Design
   Used by Features and Settings panels
================================================================= */

/* Panel Container - Slides in from right */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease-out,
    visibility 0.2s ease-out;
}

.panel-overlay.active {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.25s ease-out,
    visibility 0.25s ease-out;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100%;
  height: 100dvh;
  background: var(--bg-secondary);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease-out;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  will-change: transform;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.panel.active {
  transform: translateX(0);
  transition: transform 0.3s ease-out;
}

/* Swipe Handle - Visual indicator for swipe zone */
.panel::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 40px;
  background: var(--border);
  border-radius: 2px;
  opacity: 0.5;
  z-index: 10;
}
/* Hide swipe handle on settings full panel (its a swipe-panel, not an overlay panel) */
.settings-panel-full.panel::before {
  display: none;
}

@media (min-width: 769px) {
  .panel::before {
    display: none;
  }
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.panel-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-back-btn {
  background: none;
  border: none;
  color: var(--text-muted, #72767d);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-back-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary, #b5bac1);
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.panel-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Panel Content - wrapper inside panel that holds views */
#featuresPanelContent,
#featuresPanelContentDesktop,
#settingsPanelContent,
#settingsPanelContentDesktop {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.panel-content-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  min-height: 0;
}

/* Panel Views (for navigation within panel) */
.panel-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.panel-view.active {
  display: flex;
}

.panel-view > .panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

/* =================================================================
   LIST ITEMS - iOS Style
================================================================= */

.panel-list {
  padding: 0 12px;
}

.panel-list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  margin: 4px 0;
  background: var(--bg-tertiary);
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.1s ease;
  user-select: none;
}

.panel-list-item:hover {
  background: var(--bg-hover);
}

.panel-list-item:active {
  transform: scale(0.98);
}

.panel-list-item-icon {
  font-size: 24px;
  margin-right: 14px;
  flex-shrink: 0;
}

.panel-list-item-content {
  flex: 1;
  min-width: 0;
}

.panel-list-item-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.panel-list-item-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-list-item-action {
  margin-left: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Chevron for navigation items */
.panel-chevron {
  color: var(--text-muted);
  font-size: 18px;
}

/* =================================================================
   iOS-STYLE TOGGLE SWITCH
================================================================= */

.toggle-switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  border: 2px solid var(--border);
  transition: 0.3s;
  border-radius: 31px;
}

.toggle-slider:before {
  position: absolute;
  content: '';
  height: 25px;
  width: 25px;
  left: 1px;
  top: 1px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--success);
  border-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =================================================================
   SECTION HEADERS
================================================================= */

.panel-section-header {
  padding: 20px 20px 8px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =================================================================
   FORM ELEMENTS INSIDE PANELS
================================================================= */

.panel-form-group {
  padding: 0 20px;
  margin-bottom: 20px;
}

.panel-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.panel-form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color 0.2s;
}

.panel-form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.panel-form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.panel-form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* =================================================================
   BUTTONS INSIDE PANELS
================================================================= */

.panel-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
  text-align: center;
}

.panel-btn:active {
  transform: scale(0.98);
}

.panel-btn-primary {
  background: var(--accent);
  color: white;
}

.panel-btn-primary:hover {
  background: var(--accent-hover);
}

.panel-btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.panel-btn-secondary:hover {
  background: var(--bg-hover);
}

.panel-btn-danger {
  background: var(--danger);
  color: white;
}

.panel-btn-danger:hover {
  background: #c92a2f;
}

.panel-btn-group {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =================================================================
   FEATURE STATUS BADGES
================================================================= */

.feature-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.feature-badge-beta {
  background: rgba(250, 166, 26, 0.2);
  color: #faa61a;
}

.feature-badge-new {
  background: rgba(88, 101, 242, 0.2);
  color: var(--accent);
}

.feature-badge-coming {
  background: rgba(128, 132, 142, 0.2);
  color: var(--text-muted);
}

/* =================================================================
   MOBILE ADJUSTMENTS
================================================================= */

@media (max-width: 480px) {
  .panel {
    width: 100vw;
  }

  .panel-list-item {
    padding: 12px 14px;
  }

  .panel-list-item-icon {
    font-size: 22px;
  }

  .panel-list-item-title {
    font-size: 15px;
  }
}

/* =================================================================
   UPLOAD AREA (for Voice Debrief)
================================================================= */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--bg-tertiary);
}

.upload-area:hover {
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.05);
}

.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.1);
}

.upload-area input[type='file'] {
  display: none;
}

.upload-area-label {
  cursor: pointer;
  display: block;
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.upload-text {
  color: var(--text-primary);
  font-size: 15px;
  margin-bottom: 8px;
}

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

/* =================================================================
   FILES FEATURE - Apple Finder Style
================================================================= */

/* Files Panel Container */
.files-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 !important;
  overflow: hidden;
}

/* Search Bar */
.files-search-bar {
  padding: 12px 16px 8px;
  flex-shrink: 0;
}

.files-search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.2s;
}

.files-search-input-wrap:focus-within {
  border-color: var(--accent);
}

.files-search-icon {
  font-size: 14px;
  margin-right: 8px;
  opacity: 0.6;
}

.files-search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 10px 0;
  outline: none;
}

.files-search-input::placeholder {
  color: var(--text-muted);
}

.files-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  line-height: 1;
}

.files-search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Filter Pills */
.files-filter-bar {
  display: flex;
  gap: 6px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.files-filter-bar::-webkit-scrollbar {
  display: none;
}

.files-filter-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.files-filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.files-filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.files-filter-icon {
  font-size: 13px;
}

.files-filter-label {
  font-size: 12px;
}

/* Breadcrumbs */
.files-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 16px 8px;
  font-size: 13px;
  flex-wrap: wrap;
  flex-shrink: 0;
  min-height: 28px;
}

.files-crumb {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}

.files-crumb:hover {
  background: var(--bg-hover);
  text-decoration: underline;
}

.files-crumb-current {
  color: var(--text-primary);
  font-weight: 500;
  padding: 2px 4px;
}

.files-crumb-sep {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 1px;
}

/* Actions Bar */
.files-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.files-upload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
}

.files-upload-btn:hover {
  background: var(--accent-hover);
}

.files-upload-btn:active {
  transform: scale(0.97);
}

/* File List */
.files-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 12px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* File Item Row */
.files-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.files-item:hover {
  background: var(--bg-hover);
}

.files-item:active {
  background: rgba(88, 101, 242, 0.15);
}

.files-item-icon {
  font-size: 28px;
  margin-right: 12px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.files-item-folder .files-item-icon {
  font-size: 30px;
}

.files-item-info {
  flex: 1;
  min-width: 0;
}

.files-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.files-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.files-item-menu {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  transition:
    opacity 0.15s,
    background 0.15s;
  flex-shrink: 0;
}

.files-item:hover .files-item-menu {
  opacity: 1;
}

.files-item-menu:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Always show menu on touch devices */
@media (hover: none) {
  .files-item-menu {
    opacity: 0.6;
  }
}

/* Rename Input (inline) */
.files-rename-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  padding: 2px 6px;
  outline: none;
}

/* Empty State */
.files-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Loading State */
.files-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.files-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Storage Bar */
.files-storage-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.files-storage-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.files-storage-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.files-storage-value {
  font-size: 12px;
  color: var(--text-secondary);
}

.files-storage-track {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
}

.files-storage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  min-width: 0;
}

/* Warn when storage > 80% */
.files-storage-fill[style*='width: 8'],
.files-storage-fill[style*='width: 9'] {
  background: #faa61a;
}

/* Context Menu */
.files-context-menu {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: filesMenuFadeIn 0.12s ease-out;
}

@keyframes filesMenuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.files-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.12s;
}

.files-ctx-item:hover {
  background: var(--bg-hover);
}

.files-ctx-danger {
  color: var(--danger);
}

.files-ctx-danger:hover {
  background: rgba(218, 55, 60, 0.15);
}

.files-ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

/* Preview Modal */
.files-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: filesModalFadeIn 0.2s ease-out;
}

@keyframes filesModalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.files-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.files-preview-content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 14px;
  width: min(90vw, 700px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.files-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.files-preview-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-preview-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.files-preview-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.files-preview-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.files-preview-img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.files-preview-text {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

/* Mobile adjustments for Files */
@media (max-width: 480px) {
  .files-filter-pill {
    padding: 5px 10px;
  }

  .files-item {
    padding: 9px 10px;
  }

  .files-item-icon {
    font-size: 24px;
    margin-right: 10px;
    width: 30px;
  }

  .files-preview-content {
    width: 95vw;
    max-height: 90vh;
    border-radius: 12px;
  }
}

/* =================================================================
   END FILES FEATURE
================================================================= */

/* Processing Status */
.processing-status {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  display: none;
}

.processing-status.active {
  display: block;
}

.processing-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--text-muted);
}

.processing-step.active {
  color: var(--accent);
}

.processing-step.complete {
  color: var(--success);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* =================================================================
   ABOUT VIEW - Update Badge & Button
================================================================= */

.panel-list-item.static {
  cursor: default;
}

.panel-list-item.static:hover {
  background: transparent;
}

.about-update-badge {
  background: #007aff;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  animation: pulse-badge 2s ease-in-out infinite;
}

.about-update-badge:hover {
  background: #0066dd;
}

@keyframes pulse-badge {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.about-update-btn {
  background: #007aff;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.about-update-btn:hover {
  background: #0066dd;
}

.about-update-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

/* Fix toggle clipping in feature detail views */
.panel-list-item > div > .toggle-switch,
.panel-list-item > div:has(.toggle-switch) {
  flex-shrink: 0;
  margin-left: 12px;
}
/* =============================================================================
   iOS-INSPIRED THEME - Settings Panel
   Appended to panels.css for the new settings migration
   ============================================================================= */

/* CSS Variables */
.settings-panel,
#settingsPanel,
#settingsFullPanel {
  --ios-bg: #1a1a1e;
  --ios-bg-grouped: #2c2c2e;
  --ios-bg-hover: #3a3a3c;
  --ios-separator: rgba(255, 255, 255, 0.08);
  --ios-text: #f2f2f7;
  --ios-text-secondary: #98989e;
  --ios-accent: #5865f2;
  --ios-red: #ff453a;
  --ios-orange: #ff9f0a;
  --ios-green: #30d158;
  --ios-blue: #0a84ff;
  --ios-purple: #bf5af2;
  --ios-pink: #ff375f;
  --ios-teal: #64d2ff;
  --ios-radius: 12px;
}

/* Light theme variable overrides for settings panel (must match element-level specificity) */
[data-theme='light'] .settings-panel,
[data-theme='light'] #settingsPanel,
[data-theme='light'] #settingsFullPanel {
  --ios-bg: #f2f2f7;
  --ios-bg-grouped: #ffffff;
  --ios-bg-hover: #e5e5ea;
  --ios-separator: rgba(0, 0, 0, 0.08);
  --ios-text: #1c1c1e;
  --ios-text-secondary: #8e8e93;
  --ios-red: #ff3b30;
  --ios-text-primary: #1c1c1e;
  --ios-tint: #5865f2;
  --ios-bg-secondary: #f2f2f7;
  --ios-bg-tertiary: rgba(0, 0, 0, 0.04);
  --ios-system-fill: rgba(0, 0, 0, 0.08);
}

/* iOS Profile Card (top-level) */
.ios-profile-card {
  margin: 0 12px 12px;
  background: var(--ios-bg-grouped);
  border-radius: var(--ios-radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.ios-profile-card:hover {
  background: var(--ios-bg-hover);
}
.ios-profile-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865f2, #bf5af2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.ios-profile-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865f2, #bf5af2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
}
.ios-profile-info {
  flex: 1;
  min-width: 0;
}
.ios-profile-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--ios-text);
}
.ios-profile-email {
  font-size: 13px;
  color: var(--ios-text-secondary);
  margin-top: 1px;
}

/* iOS Grouped Section */
.ios-group {
  margin: 0 12px 12px;
  background: var(--ios-bg-grouped);
  border-radius: var(--ios-radius);
  overflow: hidden;
}

/* iOS Section Label */
.ios-section-label {
  font-size: 12px;
  color: var(--ios-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 16px 4px 16px;
  font-weight: 500;
}

/* iOS Row */
.ios-row {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  gap: 10px;
  min-height: 42px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.ios-row:focus,
.ios-row:focus-visible {
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
.ios-row[data-settings]:focus,
.ios-row[data-settings]:focus-visible {
  outline: none;
  box-shadow: none;
}
.ios-row:hover {
  background: var(--ios-bg-hover);
}
.ios-row + .ios-row {
  border-top: 0.5px solid var(--ios-separator);
}

/* iOS Row Icon */
.ios-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* iOS Row Content */
.ios-row-content {
  flex: 1;
  min-width: 0;
}
.ios-row-title {
  font-size: 15px;
  color: var(--ios-text);
}
.ios-row-subtitle {
  font-size: 12px;
  color: var(--ios-text-secondary);
  margin-top: 1px;
}
.ios-row-value {
  color: var(--ios-text-secondary);
  font-size: 14px;
  margin-right: 2px;
}

/* iOS Section Footer */
.ios-section-footer {
  padding: 4px 16px 0;
  font-size: 11px;
  color: var(--ios-text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

/* iOS Badges */
.ios-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.ios-badge-beta {
  background: rgba(88, 101, 242, 0.2);
  color: #818cf8;
}
.ios-badge-soon {
  background: rgba(255, 159, 10, 0.15);
  color: #ff9f0a;
}
.ios-badge-new {
  background: rgba(48, 209, 88, 0.2);
  color: #30d158;
}

/* Panel chevron (keep consistent with existing) */
.panel-chevron {
  color: rgba(255, 255, 255, 0.2);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Back button styling to match mockup */
#settingsPanelBackBtn,
#settingsPanelBackBtnDesktop {
  color: var(--ios-accent, #5865f2);
  font-size: 15px;
  font-weight: 400;
}
.back-chevron {
  font-size: 20px;
  line-height: 1;
  margin-right: 2px;
}

/* Fix: Settings panel needs darker bg so ios-group cards are visible */
.settings-panel,
#settingsPanel,
#settingsFullPanel {
  background: var(--ios-bg, #1a1a1e) !important;
}

/* Fix: Settings panel darker bg so ios-group cards are visible */
.settings-panel,
.settings-panel-full,
#settingsPanel,
#settingsFullPanel {
  background: var(--ios-bg, #1a1a1e) !important;
}
/* Settings panel title - iOS style large */
.settings-panel .panel-title,
#settingsPanel .panel-title,
#settingsFullPanel .panel-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ios-text, #f2f2f7);
}
/* iOS panel subtitle (Profile, About, etc.) */
.ios-panel-subtitle {
  font-size: 18px;
  font-weight: 600;
  padding: 12px 16px 10px;
  letter-spacing: -0.2px;
  color: var(--ios-text, #f2f2f7);
}

/* Inline editing for Agent view */
.ios-inline-input {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--ios-accent, #5865f2);
  color: var(--ios-text, #f2f2f7);
  font-size: 15px;
  padding: 2px 4px;
  outline: none;
  text-align: right;
  min-width: 60px;
  max-width: 180px;
}
.ios-inline-input:focus {
  border-bottom-color: var(--ios-accent, #5865f2);
}
.ios-inline-select {
  background: transparent;
  border: none;
  color: var(--ios-accent, #5865f2);
  font-size: 15px;
  padding: 2px 4px;
  outline: none;
  text-align: right;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  direction: rtl;
}
.ios-inline-select option {
  background: var(--ios-bg-grouped, #2c2c2e);
  color: var(--ios-text, #f2f2f7);
  direction: ltr;
}
.ios-inline-select optgroup {
  background: var(--ios-bg-grouped, #2c2c2e);
  color: var(--ios-text-secondary, #98989e);
  direction: ltr;
}
.ios-context-num {
  border-bottom: none !important;
  font-weight: 500;
  color: var(--ios-accent, #5865f2);
  width: 42px;
  min-width: 42px;
  max-width: 42px;
}
.ios-context-slider-wrap {
  background: var(--ios-bg-grouped, #2c2c2e);
  border-top: 0.5px solid var(--ios-separator, #38383a);
}
.ios-context-slider-wrap input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--ios-separator, #38383a);
  outline: none;
}
.ios-context-slider-wrap input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ios-accent, #5865f2);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Always-visible inline value input (looks like row value until focused) */
.ios-inline-value {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  color: var(--ios-text-secondary, #98989e);
  font-size: 15px;
  padding: 2px 4px;
  outline: none;
  text-align: right;
  min-width: 80px;
  max-width: 200px;
  transition:
    border-color 0.2s,
    color 0.2s;
  cursor: text;
}
.ios-inline-value:hover {
  color: var(--ios-text, #f2f2f7);
}
.ios-inline-value:focus {
  border-bottom-color: var(--ios-accent, #5865f2);
  color: var(--ios-text, #f2f2f7);
}

/* ===== iOS Theme Variables ===== */
:root,
[data-theme='dark'] {
  --ios-bg: #1a1a1e;
  --ios-bg-grouped: #2c2c2e;
  --ios-bg-elevated: #3a3a3c;
  --ios-text: #f2f2f7;
  --ios-text-muted: #98989e;
  --ios-separator: #3a3a3c;
  --ios-separator-alpha: rgba(255, 255, 255, 0.08);
  --ios-accent: #5865f2;
  --ios-danger: #ff453a;
  --ios-row-hover: rgba(255, 255, 255, 0.05);
}

[data-theme='light'] {
  --ios-bg: #f2f2f7;
  --ios-bg-grouped: #ffffff;
  --ios-bg-elevated: #e5e5ea;
  --ios-text: #1c1c1e;
  --ios-text-muted: #8e8e93;
  --ios-separator: #c6c6c8;
  --ios-separator-alpha: rgba(0, 0, 0, 0.08);
  --ios-accent: #5865f2;
  --ios-danger: #ff3b30;
  --ios-row-hover: rgba(0, 0, 0, 0.04);
  --ios-text-primary: #1c1c1e;
  --ios-tint: #5865f2;
  --ios-bg-secondary: #f2f2f7;
  --ios-bg-tertiary: rgba(0, 0, 0, 0.04);
  --ios-system-fill: rgba(0, 0, 0, 0.08);
}

/* Light theme settings panel overrides */
[data-theme='light'] .settings-panel,
[data-theme='light'] .settings-panel-full,
[data-theme='light'] .panel-content,
[data-theme='light'] .panel {
  background: var(--ios-bg) !important;
  color: var(--ios-text) !important;
}

[data-theme='light'] .ios-group:not(.ios-group-gradient) {
  background: var(--ios-bg-grouped) !important;
}

[data-theme='light'] .ios-section-label {
  color: var(--ios-text-muted) !important;
}

[data-theme='light'] .ios-row-title {
  color: var(--ios-text) !important;
}

[data-theme='light'] .ios-row-subtitle {
  color: var(--ios-text-muted) !important;
}

[data-theme='light'] .ios-row {
  border-bottom-color: var(--ios-separator-alpha) !important;
}

[data-theme='light'] .ios-row:hover {
  background: var(--ios-row-hover) !important;
}

[data-theme='light'] .ios-panel-subtitle {
  color: var(--ios-text) !important;
}

[data-theme='light'] .ios-section-footer {
  color: var(--ios-text-muted) !important;
}

[data-theme='light'] .panel-chevron {
  color: var(--ios-text-muted) !important;
}

[data-theme='light'] .ios-profile-card {
  background: var(--ios-bg-grouped) !important;
}

[data-theme='light'] .ios-profile-name {
  color: var(--ios-text) !important;
}

[data-theme='light'] .ios-profile-email {
  color: var(--ios-text-muted) !important;
}

[data-theme='light'] .panel-back-btn {
  color: var(--ios-accent) !important;
}

[data-theme='light'] .settings-panel-title {
  color: var(--ios-text) !important;
}

/* Light theme toggle switch */
[data-theme='light'] .toggle-switch input:not(:checked) + .toggle-slider {
  background: #e5e5ea;
}

/* Light theme scrollbar */
[data-theme='light'] .settings-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

/* Light theme: comprehensive panel + inline style overrides */
[data-theme='light'] .settings-panel-full,
[data-theme='light'] .settings-panel-full .panel-content {
  background: var(--ios-bg) !important;
  color: var(--ios-text) !important;
}

[data-theme='light'] .swipe-panel.panel {
  background: var(--ios-bg) !important;
}

/* Fix: Font Size / Message Density row text */
[data-theme='light'] .ios-row .ios-row-title,
[data-theme='light'] .ios-row-content .ios-row-title {
  color: var(--ios-text) !important;
}

/* Fix: section labels in light mode */
[data-theme='light'] .ios-section-label {
  color: var(--ios-text-muted) !important;
}

/* Light theme: settings panel ID-level specificity override */
[data-theme='light'] #settingsPanel,
[data-theme='light'] #settingsFullPanel,
[data-theme='light'] .settings-panel,
[data-theme='light'] .settings-panel-full {
  background: var(--ios-bg) !important;
  color: var(--ios-text) !important;
}

[data-theme='light'] #settingsPanel .panel-content,
[data-theme='light'] #settingsFullPanel .panel-content,
[data-theme='light'] .settings-panel .panel-content,
[data-theme='light'] .settings-panel-full .panel-content {
  background: var(--ios-bg) !important;
  color: var(--ios-text) !important;
}

/* Light theme header */
[data-theme='light'] #settingsPanel .panel-header,
[data-theme='light'] #settingsFullPanel .panel-header {
  background: var(--ios-bg) !important;
  border-bottom-color: var(--ios-separator-alpha) !important;
}

/* Light theme: panel-content-scroll */
[data-theme='light'] #settingsPanel .panel-content-scroll,
[data-theme='light'] #settingsFullPanel .panel-content-scroll {
  background: var(--ios-bg) !important;
}

/* ===== Files: Enhanced Action Buttons ===== */
.files-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.files-action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent, #6366f1);
}

/* ===== Files: Drag & Drop ===== */
.files-item[draggable='true'] {
  cursor: grab;
  transition:
    transform 0.2s,
    opacity 0.2s,
    box-shadow 0.2s;
}
.files-item[draggable='true']:active {
  cursor: grabbing;
}
.files-item-dragging {
  opacity: 0.4;
  transform: scale(0.95);
}
.files-item-dragover {
  background: rgba(99, 102, 241, 0.15) !important;
  border: 2px dashed var(--accent, #6366f1) !important;
  border-radius: 12px;
  transform: scale(1.02);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

/* ===== Files: Move To Modal (iOS Action Sheet) ===== */
.files-move-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.files-move-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s;
}
.files-move-modal-visible .files-move-backdrop {
  opacity: 1;
}
.files-move-sheet {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 60vh;
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.files-move-modal-visible .files-move-sheet {
  transform: translateY(0);
}
@media (min-width: 600px) {
  .files-move-modal {
    align-items: center;
  }
  .files-move-sheet {
    border-radius: 16px;
    max-height: 50vh;
    transform: scale(0.9);
    opacity: 0;
    transition:
      transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
      opacity 0.2s;
  }
  .files-move-modal-visible .files-move-sheet {
    transform: scale(1);
    opacity: 1;
  }
}
.files-move-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.files-move-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.files-move-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.files-move-list {
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}
.files-move-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.files-move-item:hover {
  background: var(--bg-hover);
}
.files-move-item:active {
  background: var(--bg-active, var(--bg-hover));
  transform: scale(0.98);
}
.files-move-item-icon {
  font-size: 20px;
}
.files-move-item-name {
  flex: 1;
  font-size: 15px;
  color: var(--text-primary);
}
.files-move-item-arrow {
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ===== Files: Info Modal (iOS Style) ===== */
.files-info-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.files-info-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s;
}
.files-info-modal-visible .files-info-backdrop {
  opacity: 1;
}
.files-info-sheet {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.files-info-modal-visible .files-info-sheet {
  transform: translateY(0);
}
@media (min-width: 600px) {
  .files-info-modal {
    align-items: center;
  }
  .files-info-sheet {
    border-radius: 16px;
    transform: scale(0.9);
    opacity: 0;
    transition:
      transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
      opacity 0.2s;
  }
  .files-info-modal-visible .files-info-sheet {
    transform: scale(1);
    opacity: 1;
  }
}
.files-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.files-info-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}
.files-info-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.files-info-body {
  padding: 12px 20px 20px;
}
.files-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.files-info-row:last-child {
  border-bottom: none;
}
.files-info-label {
  font-size: 14px;
  color: var(--text-secondary);
}
.files-info-value {
  font-size: 14px;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Files: Context Menu iOS Enhancement ===== */
.files-context-menu {
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  padding: 4px !important;
  min-width: 180px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: filesMenuFadeIn 0.15s ease-out !important;
}
.files-ctx-item {
  border-radius: 8px !important;
  padding: 11px 14px !important;
  font-size: 14px !important;
  gap: 10px !important;
}
