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

body {
  width: 320px;
  max-height: 500px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  color: #1f2937;
  background: #f9fafb;
  overflow-y: auto;
}

#app {
  width: 320px;
  max-height: 500px;
  overflow-y: auto;
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  max-height: 500px;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

/* Login */
.login-header {
  text-align: center;
  padding: 24px 20px 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #7c3aed;
  color: white;
  font-size: 24px;
  font-weight: 700;
  border-radius: 12px;
  margin-bottom: 8px;
}

.login-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.login-header .subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

#login-form {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

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

.btn-primary {
  background: #7c3aed;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #6d28d9;
}

.btn-success {
  background: #10b981;
  color: white;
  flex: 1;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: #ef4444;
  color: white;
  flex: 1;
}

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

.btn-warning {
  background: #f59e0b;
  color: white;
  flex: 1;
}

.btn-warning:hover:not(:disabled) {
  background: #d97706;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #6b7280;
  transition: background 0.15s;
}

.btn-icon:hover {
  background: #e5e7eb;
  color: #374151;
}

.btn-back {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #7c3aed;
  padding: 4px 0;
}

.btn-back:hover {
  color: #6d28d9;
}

/* Google Button */
.btn-google {
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-google:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-google .google-icon {
  flex-shrink: 0;
}

.btn-google .spinner {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: #374151;
}

/* Login Divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9ca3af;
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

/* Error */
.error {
  color: #ef4444;
  font-size: 12px;
  text-align: center;
  padding: 4px;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.loading .spinner {
  border-color: rgba(124, 58, 237, 0.2);
  border-top-color: #7c3aed;
  width: 24px;
  height: 24px;
}

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

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.hidden {
  display: none !important;
}

/* Screen Header */
.screen-header {
  padding: 12px 16px 0;
  border-bottom: 1px solid #e5e7eb;
  background: white;
  flex-shrink: 0;
}

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

.client-name {
  font-weight: 700;
  font-size: 14px;
  color: #111827;
}

.header-actions {
  display: flex;
  gap: 2px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
}

.tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab.active {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
}

.tab:hover:not(.active) {
  color: #374151;
}

/* Tab Content */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
}

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

/* Client List */
.client-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.client-item:hover {
  border-color: #7c3aed;
  background: #faf5ff;
}

.client-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7c3aed;
  flex-shrink: 0;
}

.client-item-name {
  font-weight: 600;
  font-size: 13px;
}

.client-item-platform {
  font-size: 11px;
  color: #6b7280;
}

/* Post List */
.post-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-item {
  padding: 10px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.post-item:hover {
  border-color: #7c3aed;
}

.post-item-content {
  font-size: 12px;
  color: #374151;
  line-height: 1.4;
  margin-bottom: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.post-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #9ca3af;
}

.post-groups-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: #f3f4f6;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.post-groups-badge.has-pending {
  background: #fef3c7;
  color: #92400e;
}

.post-status-badge {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-SCHEDULED { background: #dbeafe; color: #1e40af; }
.status-IN_PROGRESS { background: #fef3c7; color: #92400e; }
.status-COMPLETED { background: #d1fae5; color: #065f46; }
.status-PARTIALLY_COMPLETED { background: #fef3c7; color: #92400e; }
.status-FAILED { background: #fee2e2; color: #991b1b; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #9ca3af;
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* Detail */
.detail-content {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.detail-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 4px;
  display: block;
}

.detail-text {
  font-size: 13px;
  line-height: 1.5;
  color: #1f2937;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.spintax-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}

.spintax-toggle label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.indicator {
  font-size: 10px;
  padding: 1px 6px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  font-weight: 600;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.meta-date {
  font-size: 11px;
  color: #6b7280;
}

.meta-status {
  font-size: 11px;
}

/* Group list in detail */
.group-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
}

.group-item-name {
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-left: 8px;
}

.group-status-PENDING { background: #f3f4f6; color: #6b7280; }
.group-status-POSTED { background: #d1fae5; color: #065f46; }
.group-status-FAILED { background: #fee2e2; color: #991b1b; }
.group-status-SKIPPED { background: #fef3c7; color: #92400e; }

/* Publishing */
.publishing-content {
  padding: 16px;
  flex: 1;
}

.progress-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-bottom: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #7c3aed;
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  padding-bottom: 8px;
}

.current-group-card {
  background: white;
  border: 2px solid #7c3aed;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  text-align: center;
}

.group-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}

.pub-group-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.copied-notice {
  text-align: center;
  font-size: 12px;
  color: #059669;
  font-weight: 600;
  padding: 8px;
  background: #ecfdf5;
  border-radius: 6px;
  margin-bottom: 12px;
}

.pub-instruction {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
}

.pub-actions {
  display: flex;
  gap: 6px;
}

.pub-actions .btn {
  padding: 10px 8px;
  font-size: 12px;
}

/* Summary */
.publishing-summary {
  padding: 20px 16px;
  text-align: center;
}

.publishing-summary h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #111827;
}

.summary-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  justify-content: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  min-width: 70px;
}

.stat-success { background: #d1fae5; }
.stat-danger { background: #fee2e2; }
.stat-warning { background: #fef3c7; }

.stat-num {
  font-size: 24px;
  font-weight: 800;
}

.stat-success .stat-num { color: #065f46; }
.stat-danger .stat-num { color: #991b1b; }
.stat-warning .stat-num { color: #92400e; }

.stat-label {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
