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

:root {
  --bg: #0a0a0a;
  --card: #141414;
  --border: #2a2a2a;
  --text: #e5e5e5;
  --text-dim: #888;
  --accent: #fff;
  --danger: #e74c3c;
  --success: #27ae60;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Login */
.login-card {
  max-width: 420px;
  margin: 80px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.login-card h1 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 4px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 24px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  cursor: pointer;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header h1 {
  font-size: 18px;
  font-weight: 700;
}

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

.rate-info {
  font-size: 12px;
  color: var(--text-dim);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.user-badge img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Form */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
  resize: vertical;
}

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

.form-group.compact {
  flex: 1;
}

.options-row {
  display: flex;
  gap: 12px;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.char-count.warning { color: #f39c12; }
.char-count.danger { color: var(--danger); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover { background: #ddd; }
.btn-primary:disabled { background: #555; cursor: not-allowed; color: #999; }

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover { background: #3a3a3a; }

.btn-danger { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 20px; font-size: 15px; }
.btn-full { width: 100%; }

/* Post Type Tabs */
.post-type-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.pt-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.pt-tab.active {
  background: var(--accent);
  color: #000;
}

/* Image modes */
.img-input-modes {
  display: flex;
  gap: 0;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.img-mode {
  flex: 1;
  padding: 5px 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.img-mode.active {
  background: var(--accent);
  color: #000;
}

/* Upload Area */
.upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.03);
}

.file-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #555;
  pointer-events: none;
}

.upload-label span { font-size: 13px; }
.upload-label .hint { font-size: 11px; color: #444; }

/* Image Preview */
.img-preview-wrap {
  position: relative;
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.img-preview-wrap img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.btn-remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Progress */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

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

.progress-wrap span {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Carousel item */
.carousel-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.carousel-row select {
  width: 90px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.carousel-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.carousel-row .btn-rm {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2.5px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Status */
.status {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 12px;
  display: none;
}

.status.success {
  display: block;
  background: rgba(39,174,96,0.15);
  color: var(--success);
  border: 1px solid rgba(39,174,96,0.3);
}

.status.error {
  display: block;
  background: rgba(231,76,60,0.15);
  color: var(--danger);
  border: 1px solid rgba(231,76,60,0.3);
}

.status.info {
  display: block;
  background: rgba(52,152,219,0.15);
  color: #3498db;
  border: 1px solid rgba(52,152,219,0.3);
}

/* History */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h2 { margin-bottom: 0; }

.history-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.history-item {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.history-item .h-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.history-item .h-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #000;
}

.history-item .h-time {
  font-size: 11px;
  color: var(--text-dim);
}

.history-item .h-text {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
  margin-top: 4px;
}

.history-item .h-status {
  font-size: 11px;
  margin-top: 4px;
  font-weight: 600;
}

.history-item .h-status.ok { color: var(--success); }
.history-item .h-status.fail { color: var(--danger); }

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px 0;
  font-size: 13px;
}

/* Media section label */
.media-section {
  margin-bottom: 14px;
}

.media-section > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.media-section input[type="url"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

/* Schedule */
.schedule-section {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.schedule-section .checkbox-row {
  margin-bottom: 0;
}

.schedule-section .options-row {
  margin-top: 10px;
}

.schedule-section input[type="date"],
.schedule-section input[type="time"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.schedule-section input[type="date"]::-webkit-calendar-picker-indicator,
.schedule-section input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
}

/* Scheduled item */
.scheduled-item {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.scheduled-item .s-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.scheduled-item .s-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: #3498db;
  color: #fff;
}

.scheduled-item .s-time {
  font-size: 11px;
  color: #3498db;
  font-weight: 600;
}

.scheduled-item .s-preview {
  margin: 6px 0;
}

.scheduled-item .s-preview img {
  max-width: 100%;
  max-height: 120px;
  border-radius: 6px;
  object-fit: cover;
}

.scheduled-item .s-video-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-dim);
}

.scheduled-item .s-text {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
  margin: 4px 0;
}

.scheduled-item .s-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.scheduled-item .s-actions button {
  padding: 3px 8px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.scheduled-item .s-cancel {
  background: var(--danger);
  color: #fff;
}

.scheduled-item .s-posting {
  font-size: 11px;
  color: #f39c12;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 800px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-right {
    flex-wrap: wrap;
  }

  .options-row {
    flex-direction: column;
    gap: 0;
  }

  .login-card {
    margin: 20px auto;
  }
}
