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

:root {
  --primary-blue: #1e3a5f;
  --accent-blue: #3b82f6;
  --success-green: #10b981;
  --danger-red: #ef4444;
  --warning-orange: #f97316;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-light: #f8fafc;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  
  /* Spacing system */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
  min-height: 100vh;
  color: var(--text-primary);
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Login Screen */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  fill: var(--accent-blue);
}

.login-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.alert-box {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-box.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-red);
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
}

.login-footer p {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.login-footer a {
  color: var(--accent-blue);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

.login-footer span {
  color: var(--text-primary);
  font-weight: 500;
}

.btn-block {
  width: 100%;
}

/* Dashboard Layout */
#app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, var(--primary-blue) 0%, #2d4a6f 100%);
  display: flex;
  flex-direction: column;
  padding: 24px;
  color: white;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}

.user-info h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.role-badge {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.nav-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.quota-sidebar-panel {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel-header {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.progress-bar-container {
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: var(--success-green);
  transition: width 0.3s;
}

.quota-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}

.quota-percent-badge {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn {
  width: 100%;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-footer .btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.footer-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.main-content {
  flex: 1;
  background: var(--bg-light);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content-header {
  background: white;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.content-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.org-context-pill {
  background: var(--bg-light);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.tab-pane {
  display: none;
  padding: 32px;
}

.tab-pane.active {
  display: block;
}

/* Card Styles */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.icon-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-circle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.bg-blue {
  background: var(--accent-blue);
  color: white;
}

.bg-dark {
  background: var(--text-primary);
  color: white;
}

.description-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Simulator */
.simulator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.card-flex {
  display: flex;
  flex-direction: column;
}

.console-card {
  background: #1e1e1e;
  color: #d4d4d4;
}

.console-card .card-header {
  background: #2d2d2d;
  padding: 12px 16px;
  margin: -24px -24px 24px -24px;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #404040;
}

.console-body {
  flex: 1;
  background: #1e1e1e;
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  overflow-y: auto;
  max-height: 400px;
}

.console-line {
  margin-bottom: 4px;
}

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

/* Local Files */
.local-files-container {
  margin: 16px 0;
}

.local-files-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.local-files-table th,
.local-files-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.local-files-table th {
  background: var(--bg-light);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.add-file-form {
  background: var(--bg-light);
  padding: 16px;
  border-radius: 8px;
}

.add-file-form h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-control-compact {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.simulator-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.api-key-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: 8px;
}

.api-key-box .label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.value-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent-blue);
  background: white;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.btn-success {
  background: var(--success-green);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-light);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.data-table th.text-right {
  text-align: right;
}

.data-table th.text-center {
  text-align: center;
}

.data-table tbody tr:hover {
  background: var(--bg-light);
}

/* Settings */
.settings-form-layout {
  max-width: 700px;
}

.settings-section {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-title h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.section-icon {
  width: 24px;
  height: 24px;
  fill: var(--accent-blue);
}

.info-alert {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 20px;
}

.alert-icon {
  width: 20px;
  height: 20px;
  fill: var(--accent-blue);
  flex-shrink: 0;
}

.info-alert div {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

.info-alert code {
  background: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.form-checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.form-checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin-top: 2px;
}

.form-checkbox-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

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

.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-light);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.status-badge.connected {
  background: #ecfdf5;
  color: var(--success-green);
  border-color: #a7f3d0;
}

.status-badge.disconnected {
  background: #fef2f2;
  color: var(--danger-red);
  border-color: #fecaca;
}

.status-badge.checking {
  background: #eff6ff;
  color: var(--accent-blue);
  border-color: #bfdbfe;
}

/* Modals */
.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;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: white;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary-blue);
}

.close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-light);
  border-radius: 8px;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.modal-footer-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* User Modal Specific Styles */
#user-modal .modal-card {
  max-width: 560px;
}

#user-modal .form-group {
  margin-bottom: 20px;
}

#user-modal .form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

#user-modal .form-group input,
#user-modal .form-group select {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  color: var(--text-primary);
  transition: all 0.2s;
}

#user-modal .form-group input:focus,
#user-modal .form-group select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#user-modal .form-group input::placeholder {
  color: var(--text-muted);
}

#user-modal .hint-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

#user-modal .form-group[style*="display: flex"] {
  gap: 8px;
}

#user-modal .form-group[style*="display: flex"] input {
  flex: 1;
}

#user-modal .form-group[style*="display: flex"] select {
  width: 100px;
  flex-shrink: 0;
}

/* Organization Filter Dropdown */
#users-org-filter-group {
  margin-bottom: 20px;
}

#users-org-filter-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

#users-org-filter {
  max-width: 350px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  color: var(--text-primary);
  transition: all 0.2s;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

#users-org-filter:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#users-org-filter:hover {
  border-color: #d1d5db;
}

/* User Modal Organization Selector */
#user-modal-org-select-group {
  margin-bottom: 20px;
}

#user-modal-org-select-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

#user-modal-org {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  color: var(--text-primary);
  transition: all 0.2s;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

#user-modal-org:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#user-modal-org:hover {
  border-color: #d1d5db;
}

/* Notifications */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

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

.form-group select {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  color: var(--text-primary);
  transition: all 0.2s;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-group select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group select:hover {
  border-color: #d1d5db;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

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

.btn-primary:hover {
  background: #2563eb;
}

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

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-compact {
  padding: 6px 12px;
  font-size: 12px;
}

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

.btn-loader {
  display: inline-flex;
  align-items: center;
}

.spinner {
  animation: spin 1s linear infinite;
  width: 20px;
  height: 20px;
}

.spinner circle {
  stroke: currentColor;
  stroke-dasharray: 90, 150;
  stroke-dashoffset: 0;
  stroke-linecap: round;
}

@keyframes spin {
  to {
    stroke-dashoffset: -240;
  }
}

.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-red);
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 16px;
}

/* Dashboard */
.dashboard-container {
  width: 100%;
  max-width: 1200px;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.dashboard-header {
  background: linear-gradient(135deg, var(--primary-blue) 0%, #2d4a6f 100%);
  color: white;
  padding: var(--spacing-lg) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.logo-small svg {
  display: block;
}

.dashboard-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.header-nav {
  display: flex;
  gap: var(--spacing-sm);
}

.nav-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.user-email {
  font-size: 0.875rem;
  opacity: 0.9;
}

.dashboard-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-xl);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--spacing-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.card-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Account Card */
.account-details {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-row .label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.detail-row .value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: var(--accent-blue);
  color: white;
}

.badge.success {
  background: var(--success-green);
}

.badge.danger {
  background: var(--danger-red);
}

.badge.warning {
  background: var(--warning-orange);
}

.progress-bar {
  height: 8px;
  background: var(--bg-light);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-blue);
  transition: width 0.3s;
  border-radius: 4px;
}

/* Folder Card */
.folder-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.folder-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.folder-item:hover {
  border-color: var(--accent-blue);
  background: var(--bg-light);
}

.folder-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.folder-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.folder-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.folder-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

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

/* Explorer Folder Sidebar */
.explorer-folders-sidebar {
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  padding: 16px;
  min-width: 200px;
}

.folder-tree-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.folder-node {
  margin-bottom: 4px;
}

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

.folder-link:hover {
  background: var(--border);
}

.folder-link.active {
  background: var(--accent-blue);
  color: white;
}

.folder-icon-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.folder-children {
  list-style: none;
  padding-left: 20px;
  margin-top: 4px;
}

/* Sync Card */
.sync-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: 8px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.status-indicator.idle {
  background: var(--text-muted);
}

.status-indicator.syncing {
  background: var(--accent-blue);
  animation: pulse 1.5s infinite;
}

.status-indicator.success {
  background: var(--success-green);
}

.status-indicator.error {
  background: var(--danger-red);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.status-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.sync-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-progress .progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}

.sync-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
  background: var(--bg-light);
  border-radius: 8px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-value.error {
  color: var(--danger-red);
}

/* Activity Card */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: 8px;
}

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.activity-message {
  font-size: 14px;
  color: var(--text-primary);
}

/* Files Table */
.files-list-card {
  grid-column: 1 / -1;
}

.files-explorer-card {
  grid-column: 1 / -1;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-select-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.user-select-container label {
  color: var(--text-secondary);
  font-weight: 500;
}

.user-select-container select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: white;
  color: var(--text-primary);
}

/* Explorer Toolbar */
.explorer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.breadcrumb-item {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.breadcrumb-item:hover {
  background: #e5e7eb;
  color: var(--accent-blue);
}

.breadcrumb-item::after {
  content: "/";
  margin-left: 8px;
  color: var(--text-muted);
}

.breadcrumb-item:last-child::after {
  content: "";
}

.breadcrumb-item:last-child {
  color: var(--accent-blue);
  font-weight: 600;
  cursor: default;
  background: none;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  width: 250px;
  background: white;
  color: var(--text-primary);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.search-box svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Explorer Grid */
.explorer-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  border-top: 1px solid var(--border);
  flex-grow: 1;
  overflow: hidden;
  height: 500px;
}

.explorer-folders-sidebar {
  border-right: 1px solid var(--border);
  background: white;
  overflow-y: auto;
  padding: 16px 8px;
}

.explorer-files-panel {
  background: white;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Folder Tree */
.folder-tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder-node {
  margin-bottom: 4px;
}

.folder-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.folder-link:hover {
  background: var(--bg-light);
}

.folder-link.active {
  background: #eff6ff;
  color: var(--accent-blue);
  font-weight: 600;
}

.folder-icon-svg {
  width: 18px;
  height: 18px;
  fill: #eab308;
  flex-shrink: 0;
}

.folder-children {
  list-style: none;
  padding-left: 20px;
  margin-top: 4px;
  border-left: 1px dashed var(--border);
}

/* Explorer Table */
.explorer-table {
  width: 100%;
  border-collapse: collapse;
}

.explorer-table thead {
  background: var(--bg-light);
}

.explorer-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.explorer-table th.text-right {
  text-align: right;
}

.explorer-table th.text-center {
  text-align: center;
}

.explorer-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.explorer-table tbody tr:hover {
  background: var(--bg-light);
}

.explorer-table .loading {
  text-align: center;
  color: var(--text-secondary);
  padding: var(--spacing-lg);
}

.explorer-table .file-name {
  font-weight: 500;
  color: var(--accent-blue);
}

.explorer-table .file-path {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-table .file-size {
  font-family: monospace;
  color: var(--text-secondary);
}

.explorer-table .file-sha1 {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.explorer-table .file-date {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.explorer-table .actions {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
}

.action-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--bg-light);
  border-color: var(--accent-blue);
}

.action-btn.download {
  color: var(--accent-blue);
}

.action-btn.delete {
  color: var(--danger-red);
}

.action-btn.delete:hover {
  background: #fef2f2;
  border-color: var(--danger-red);
}

.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

/* Settings Styles */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
}

.settings-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 48px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  transition: background 0.3s;
}

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

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
  background: var(--accent-blue);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-content {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .dashboard-header {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }

  .header-nav {
    display: none;
  }

  .files-table {
    font-size: 12px;
  }

  .files-table th,
  .files-table td {
    padding: 8px 12px;
  }
}

/* Billing & Subscription Styles */
.billing-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 24px;
}

.billing-tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.billing-tab-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.billing-tab-btn.active {
  background: white;
  color: #3b82f6;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.billing-tab-content {
  display: none;
}

.billing-tab-content.active {
  display: block;
}

.subscription-status-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.status-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary-blue);
}

.status-badge {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.status-active {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.status-trial {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.status-expired,
.status-badge.status-suspended {
  background: #fee2e2;
  color: #991b1b;
}

.status-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.detail-row .label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.detail-row .value {
  font-weight: 600;
  color: var(--text-primary);
}

.status-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.invoices-section {
  margin-top: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary-blue);
}

.invoice-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.invoice-status.status-paid {
  background: #d1fae5;
  color: #065f46;
}

.invoice-status.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.invoice-status.status-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.invoice-status.status-cancelled {
  background: #f3f4f6;
  color: #6b7280;
}
