/* CSS Variables - Updated 2025-10-25 */
:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #8b5cf6;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base Styles */
html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  /* Enable pull-to-refresh on mobile */
  overscroll-behavior-y: auto;
}

/* Hide scrollbars everywhere while keeping scroll functionality */
body::-webkit-scrollbar,
#app::-webkit-scrollbar,
*::-webkit-scrollbar {
  display: none;
}

body,
#app,
* {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Loading Screen */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: var(--spacing-md);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 0.8s linear infinite;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--spacing-sm);
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Card */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  gap: var(--spacing-xs);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #4f7df3 0%, #6f8ef5 50%, #8b9ff7 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4066d4 0%, #5a7ae6 50%, #7b8fe8 100%);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--border-color);
}

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

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.btn-full {
  width: 100%;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .agent-config-card {
    padding-bottom: 1rem !important;
  }
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  background-color: var(--bg-secondary);
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  margin-top: var(--spacing-xs);
  font-size: 0.75rem;
  color: var(--error-color);
}

.form-help {
  margin-top: var(--spacing-xs);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Alert */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  border-left: 4px solid;
  position: fixed;
  bottom: 70px; /* Position above bottom nav (60px nav + 10px spacing) */
  left: 1rem;
  right: 1rem;
  z-index: 1100; /* Above bottom nav (z-index: 1000) */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.alert-success {
  background-color: #d1fae5;
  border-color: var(--success-color);
  color: #065f46;
}

.alert-error {
  background-color: #fee2e2;
  border-color: var(--error-color);
  color: #991b1b;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: var(--warning-color);
  color: #92400e;
}

.alert-info {
  background-color: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--text-secondary);
}

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.hidden {
  display: none !important;
}

.mobile-only {
  display: none !important;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  margin-left: -0.5rem;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-btn:hover {
  color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-sm);
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }
}

/* Mobile Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.5rem 0;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  min-width: 60px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.75rem;
}

.bottom-nav-item:hover {
  color: var(--primary-color);
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  margin-bottom: 0.25rem;
}

.bottom-nav-item span {
  font-size: 0.625rem;
  font-weight: 500;
}

.nav-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--error-color);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Add padding to content to account for bottom nav */
.with-bottom-nav {
  padding-bottom: 70px !important;
}

/* Hide desktop-only sections on mobile by default */
.nav-logo-section,
.nav-plan-section,
.nav-user-section,
.nav-user-modal {
  display: none;
}

/* Desktop: Left sidebar navigation */
@media (min-width: 769px) {
  .bottom-nav {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 240px;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem 0;
    padding-top: max(1rem, env(safe-area-inset-top));
    border-top: none;
    border-right: 1px solid var(--border-color);
    box-shadow: none;
  }

  .nav-items-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
  }

  .bottom-nav-item {
    display: flex;
    width: calc(100% - 1.5rem);
    margin: 0.125rem 0.75rem;
    padding: 0.75rem 1rem;
    min-width: auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s, color 0.2s;
  }

  .bottom-nav-item:hover {
    background-color: var(--bg-secondary);
  }

  .bottom-nav-item.active {
    background-color: var(--bg-secondary);
  }

  .bottom-nav-item.desktop-only {
    display: flex;
  }

  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 0;
  }

  .bottom-nav-item span {
    font-size: 0.875rem;
  }

  .with-bottom-nav {
    padding-bottom: 0 !important;
    margin-left: 240px !important;
    padding-left: 2rem !important;
  }

  /* Adjust container max-width to account for sidebar */
  .container {
    max-width: calc(1200px - 240px);
  }


  /* Agent page - account for sidebar (uses fixed positioning) */
  .agent-page {
    left: 240px;
    bottom: 0;
  }

  /* Logo Section - matches nav-item alignment */
  .nav-logo-section {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
  }

  .nav-logo {
    display: block;
    width: calc(100% - 1.5rem);
    margin: 0.125rem 0.75rem;
    padding: 0.75rem 1rem;
  }

  .nav-logo img {
    max-width: 140px;
    height: auto;
    object-fit: contain;
  }

  /* Plan Summary Section */
  .nav-plan-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    margin-bottom: 0.5rem;
  }

  .nav-plan-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin: 0 12px;
    width: calc(100% - 24px);
    box-sizing: border-box;
  }

  .nav-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
  }

  .nav-plan-usage {
    font-size: 11px;
    color: var(--text-secondary);
  }

  .nav-plan-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
  }

  .nav-plan-progress {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
  }

  .nav-plan-progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s ease;
  }

  .nav-plan-upgrade-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.2s;
  }

  .nav-plan-upgrade-btn:hover {
    background: rgba(99, 102, 241, 0.2);
  }

  /* User Profile Section */
  .nav-user-section {
    display: block;
    padding: 0.75rem;
    position: relative;
  }

  .nav-user-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s;
  }

  .nav-user-button:hover {
    background-color: var(--bg-secondary);
  }

  .nav-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
  }

  .nav-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .nav-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-user-chevron {
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s;
  }

  .nav-user-button.open .nav-user-chevron {
    transform: rotate(180deg);
  }

  /* User Modal */
  .nav-user-modal {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 12px;
    width: 216px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    z-index: 1001;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  }

  .nav-user-modal.open {
    display: block;
  }

  .nav-modal-section {
    padding: 0.25rem 0;
  }

  .nav-modal-section-title {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
  }

  .nav-modal-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: left;
    transition: background-color 0.2s;
  }

  .nav-modal-item:hover {
    background-color: var(--bg-secondary);
  }

  .nav-modal-item.active {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
  }

  .nav-modal-item.active svg {
    color: var(--primary-color);
  }

  .nav-modal-item svg {
    color: var(--text-secondary);
    flex-shrink: 0;
  }

  .nav-modal-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
  }

  .nav-modal-logout {
    color: var(--error-color);
  }

  .nav-modal-logout svg {
    color: var(--error-color);
  }
}

/* Contact Modal */
.contact-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.contact-modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.contact-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.contact-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.contact-modal-header .close-modal-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s, color 0.2s;
}

.contact-modal-header .close-modal-btn:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.contact-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.contact-modal-body .form-group {
  margin-bottom: 1rem;
}

.contact-modal-body .form-group:last-child {
  margin-bottom: 0;
}

.contact-modal-body label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.contact-modal-body input,
.contact-modal-body textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-modal-body input:focus,
.contact-modal-body textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.contact-modal-body textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.contact-modal-footer .btn {
  min-width: 100px;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* Mobile: Bottom navigation (default) */
@media (max-width: 768px) {
  .with-bottom-nav {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Ensure desktop-only sections are always hidden on mobile */
  .nav-logo-section,
  .nav-plan-section,
  .nav-user-section,
  .nav-user-section.open,
  .nav-user-modal,
  .nav-user-modal.open {
    display: none !important;
  }

  /* Ensure bottom nav stays at bottom on mobile */
  .bottom-nav {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    flex-direction: row !important;
    border-right: none !important;
    border-top: 1px solid var(--border-color) !important;
  }

  .nav-items-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    width: 100% !important;
  }

  .bottom-nav-item {
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    width: auto !important;
    min-width: 60px !important;
  }

  .bottom-nav-item svg {
    margin-bottom: 0.25rem !important;
  }

  .bottom-nav-item span {
    font-size: 0.625rem !important;
  }

  .bottom-nav-item.desktop-only {
    display: none !important;
  }

  .bottom-nav-item.mobile-only {
    display: flex !important;
  }

  .mobile-only {
    display: block !important;
  }
}

/* Contacts Page */
.contacts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.contacts-list {
  display: flex;
  flex-direction: column;
}

.contact-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.contact-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.whitelisted-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--success-color);
  color: white;
  border-radius: 9999px;
  font-size: 0.75rem;
}

.edit-btn-desktop {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.edit-btn-desktop:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Desktop: Contacts grid layout */
@media (min-width: 769px) {
  .contacts-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
  }

  .contacts-header {
    margin-bottom: 1.5rem;
  }

  .contacts-header h1 {
    font-size: 1.75rem;
  }

  .contacts-search {
    max-width: 400px;
    margin-bottom: 1.5rem;
  }

  .contacts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
  }

  .contact-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: box-shadow 0.2s, border-color 0.2s;
  }

  .contact-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
  }
}

/* Phone Page Desktop Layout */
.phone-page-desktop {
  max-width: 1400px;
  margin: 0 auto;
}

.phone-page-desktop .phone-left-column {
  padding-right: 1rem;
}

.phone-page-desktop .phone-left-column::-webkit-scrollbar {
  width: 6px;
}

.phone-page-desktop .phone-left-column::-webkit-scrollbar-track {
  background: transparent;
}

.phone-page-desktop .phone-left-column::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.phone-page-desktop .phone-left-column::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.phone-page-desktop .phone-right-column {
  box-shadow: var(--shadow-md);
}

/* Inbox / Messaging UI */
.inbox-container {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

.conversation-list {
  border-right: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-header {
  padding: calc(0.8rem * 0.94) calc(1.5rem * 1.05);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#conversations {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* Inbox Filter Tabs */
.inbox-filters {
  display: flex;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.inbox-filter-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.inbox-filter-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.inbox-filter-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.conversation-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

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

.conversation-item.selected {
  background: #EEF2FF;
  border-left: 3px solid var(--primary-color);
}

.conversation-item.selected:hover {
  background: #E0E7FF;
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  position: relative;
}

.unread-badge {
  background: var(--primary-color);
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.conversation-content {
  flex: 1;
  min-width: 0;
}

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.conversation-name {
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

/* Unread conversation items - bold name and preview */
.conversation-item.unread .conversation-name {
  font-weight: 600;
}

.conversation-item.unread .conversation-preview {
  font-weight: 500;
  color: var(--text-primary);
}

.conversation-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.conversation-unread-badge {
  background: var(--primary-color);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.conversation-preview {
  font-size: 0.875rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sentiment Labels */
.sentiment-label {
  font-size: 0.65rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-weight: 500;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.sentiment-positive {
  background: #dcfce7;
  color: #22c55e;
}

.sentiment-neutral {
  background: #f3f4f6;
  color: #6b7280;
}

.sentiment-negative {
  background: #fee2e2;
  color: #ef4444;
}

.message-thread {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  overflow: hidden;
}

.thread-header {
  padding: calc(1.13rem * 0.8 * 1.10) 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}


.message-bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1.125rem;
  word-wrap: break-word;
}

.message-bubble.inbound {
  align-self: flex-start;
  background: var(--bg-primary);
  border-bottom-left-radius: 0.375rem;
  box-shadow: var(--shadow-sm);
}

.message-bubble.outbound {
  align-self: flex-end;
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 0.375rem;
}

.message-content {
  font-size: 0.9375rem;
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.message-time {
  font-size: 0.6875rem;
  opacity: 0.7;
}

.message-bubble.outbound .message-time {
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

/* SMS Delivery Status Indicators */
.delivery-status {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
}

.delivery-status.delivered svg {
  color: rgba(255, 255, 255, 0.9);
}

.delivery-status.sent svg {
  color: rgba(255, 255, 255, 0.7);
}

.delivery-status.pending svg {
  color: rgba(255, 255, 255, 0.5);
}

.delivery-status.failed svg {
  color: #ff6b6b;
}

.message-bubble.ai-message {
  position: relative;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border: 1px solid rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
}

.message-bubble.ai-message .message-content {
  color: var(--text-primary);
}

.message-bubble.ai-message .message-time {
  color: var(--text-secondary);
  opacity: 0.7;
}

.ai-badge {
  position: absolute;
  top: -6px;
  left: 12px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.ai-badge svg {
  width: 11px;
  height: 11px;
}

.call-indicator {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: white;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.call-icon {
  font-size: 1rem;
}

/* Call Bubble Styles */
.call-bubble {
  max-width: 75%;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.call-bubble.inbound {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--border-color);
}

.call-bubble.outbound {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.call-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.call-direction-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-bubble.outbound .call-direction-icon svg {
  stroke: white;
}

.call-type {
  flex: 1;
}

.call-duration {
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 0.8125rem;
  padding: 0.125rem 0.375rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
}

.call-bubble.outbound .call-duration {
  background: rgba(255, 255, 255, 0.2);
}

.call-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 0.375rem;
}

.call-bubble.outbound .call-status {
  background: rgba(255, 255, 255, 0.15);
}

.call-status-icon {
  font-weight: 700;
}

.call-status.status-completed {
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.1);
}

.call-bubble.outbound .call-status.status-completed {
  color: #a7f3d0;
  background: rgba(167, 243, 208, 0.2);
}

.call-status.status-missed,
.call-status.status-failed,
.call-status.status-busy {
  color: var(--error-color);
  background: rgba(239, 68, 68, 0.1);
}

.call-bubble.outbound .call-status.status-missed,
.call-bubble.outbound .call-status.status-failed,
.call-bubble.outbound .call-status.status-busy {
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.2);
}

.call-status.status-progress {
  color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.call-bubble.outbound .call-status.status-progress {
  color: #c7d2fe;
  background: rgba(199, 210, 254, 0.2);
}

.call-transcript-preview {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
}

.call-bubble.outbound .call-transcript-preview {
  background: rgba(255, 255, 255, 0.15);
}

.call-transcript-label {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.call-transcript-content {
  line-height: 1.5;
  font-size: 0.8125rem;
}

.call-recording {
  margin-top: 0.25rem;
}

.call-recording audio {
  width: 100%;
  height: 32px;
  border-radius: 0.375rem;
}

.call-bubble.outbound audio::-webkit-media-controls-panel {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Call Avatar */
.call-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-avatar svg {
  stroke: white;
}

/* SMS Avatar */
.sms-avatar {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sms-avatar svg {
  stroke: white;
}

/* Chat Avatar */
.chat-avatar {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-avatar svg {
  stroke: white;
}

.call-status-indicator {
  display: inline-flex;
  align-items: center;
  margin-right: 0.25rem;
  font-size: 0.875rem;
  vertical-align: middle;
}

.call-status-indicator svg {
  display: inline-block;
  vertical-align: middle;
}

.call-detail-recording {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
}

.recording-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.call-detail-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sentiment-positive {
  color: var(--success-color);
}

.sentiment-neutral {
  color: var(--text-secondary);
}

.sentiment-negative {
  color: var(--error-color);
}

.call-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.call-info-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.call-info-value {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 500;
}

.call-detail-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.transcript-header {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transcript-bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1.125rem;
  word-wrap: break-word;
}

.transcript-bubble.agent {
  align-self: flex-start;
  background: var(--primary-color);
  color: white;
  border-bottom-left-radius: 0.375rem;
}

.transcript-bubble.user {
  align-self: flex-end;
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom-right-radius: 0.375rem;
  box-shadow: var(--shadow-sm);
}

.transcript-content {
  font-size: 0.9375rem;
  line-height: 1.5;
}

.call-detail-no-transcript {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .call-detail-content {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
  }

  .call-detail-info {
    grid-template-columns: 1fr;
  }
}

.call-time {
  font-size: 0.75rem;
  opacity: 0.7;
  align-self: flex-end;
}

.empty-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  padding: 2rem;
  text-align: center;
}

.message-input-container {
  padding: 1rem 1rem 0.87rem 1rem;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.message-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  font-size: 0.9375rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

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

.message-input:disabled {
  background: var(--bg-secondary);
  opacity: 0.6;
}

.send-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.send-button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.agent-reply-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.agent-reply-button:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border-color: transparent;
}

.agent-reply-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .inbox-container {
    grid-template-columns: 1fr;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px)); /* Position above bottom nav */
    height: auto;
    max-height: none;
  }

  .conversation-list {
    border-right: none;
  }

  .message-thread {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .message-thread.show {
    transform: translateX(0);
  }

  .thread-header {
    display: flex;
    align-items: center;
    padding: calc(1rem * 0.8) 1rem !important;
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  .thread-header h2 {
    font-size: 0.95rem !important;
  }

  .thread-header > div:last-child {
    font-size: 0.75rem !important;
    flex-wrap: wrap;
  }

  .back-button {
    display: block !important;
  }

  .thread-messages {
    flex: 1;
    min-height: 0; /* Important for flex child scrolling */
    padding: 1rem !important;
    padding-bottom: 1rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .call-detail-info,
  .call-detail-transcript {
    padding: 1rem !important;
  }

  .call-detail-transcript {
    padding-bottom: 2rem !important;
  }

  .message-input-container {
    padding: 0.75rem 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 0;
    flex-shrink: 0;
    background: var(--bg-primary);
  }

  .message-bubble {
    max-width: 85%;
    padding-bottom: calc(0.75rem + 4px);
  }

  .transcript-bubble {
    max-width: 85%;
    padding-bottom: calc(0.75rem + 4px);
  }
}

/* Desktop-only styles */
@media (min-width: 769px) {
  .message-bubble {
    padding: 0.5rem 0.5625rem;
  }

  .transcript-bubble {
    padding: 0.5rem 0.5625rem;
  }

  /* Inbox - fixed positioning on desktop to fill viewport */
  .inbox-container {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin-left: 0;
    width: auto;
  }

  /* Remove bottom margin on message input */
  .message-input-container {
    margin-bottom: 0;
  }
}

/* Toggle Switch Styles */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.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: #ccc;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

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

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

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

/* Settings Section Styles */
.settings-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.settings-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 1rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.toggle-row > div {
  flex: 1;
}

/* Position Selector */
.position-option {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-primary);
}

.position-option:hover {
  border-color: var(--primary-color);
  background: var(--bg-secondary);
}

.position-option.selected {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.position-option input[type="radio"] {
  display: none;
}

.position-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.position-option.selected .position-label {
  color: var(--primary-color);
  font-weight: 500;
}

/* Swipe-to-delete styles (iOS style) */
.swipe-container {
  position: relative;
  overflow: hidden;
}

.swipe-delete-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: #ff3b30;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  cursor: pointer;
  z-index: 1;
}

.swipe-delete-btn svg {
  stroke: white;
  width: 20px;
  height: 20px;
}

.swipe-content {
  position: relative;
  background: var(--bg-primary);
  transform: translateX(0);
  transition: transform 0.3s ease;
  z-index: 2;
}

.swipe-container.swiped .swipe-content {
  transform: translateX(-80px);
}

.swipe-container.swiped .swipe-delete-btn {
  transform: translateX(0);
}

/* Delete confirmation modal */
.delete-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

.delete-confirm-modal {
  background: var(--bg-primary);
  border-radius: 14px;
  width: calc(100% - 40px);
  max-width: 300px;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.delete-confirm-header {
  padding: 1.25rem 1rem 0.75rem;
  text-align: center;
}

.delete-confirm-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.delete-confirm-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

.delete-confirm-actions {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
}

.delete-confirm-btn {
  padding: 1rem;
  border: none;
  background: none;
  font-size: 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}

.delete-confirm-btn:last-child {
  border-bottom: none;
}

.delete-confirm-btn.danger {
  color: #ff3b30;
  font-weight: 600;
}

.delete-confirm-btn.cancel {
  color: var(--primary-color);
  font-weight: 400;
}

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

/* Hide swipe on desktop */
@media (min-width: 769px) {
  .swipe-delete-btn {
    display: none;
  }
}

/* Agent Schedule Styles */
.schedule-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.schedule-section-header h3 {
  margin: 0;
}

.schedule-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.schedule-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  transition: opacity 0.2s;
}

.schedule-day-row.disabled {
  opacity: 0.5;
}

.schedule-day-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  min-width: 140px;
}

.schedule-day-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.schedule-day-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.schedule-time-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.schedule-time-input {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  background: white;
  width: 130px;
}

.schedule-time-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.schedule-time-input:disabled {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.schedule-time-separator {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.btn-apply-time {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-apply-time:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Confirmation Modal */
#confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.confirm-modal {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-modal-title {
  margin: 0 0 0.75rem 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.confirm-modal-message {
  margin: 0 0 1.5rem 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Generic Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 450px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.2s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

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

.schedule-clear-row {
  margin-top: 1rem;
  text-align: center;
}

.schedule-clear-row .btn {
  color: var(--text-secondary);
}

.schedule-clear-row .btn:hover {
  color: var(--error-color);
  border-color: var(--error-color);
}

@media (max-width: 600px) {
  .schedule-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .schedule-day-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .schedule-day-toggle {
    min-width: auto;
  }

  .schedule-time-inputs {
    width: 100%;
    justify-content: flex-start;
  }

  .schedule-time-input {
    flex: 1;
    max-width: 140px;
  }
}