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

:root {
  --bg-primary: #FFFDF9;
  --bg-secondary: #FAF8F5;
  --bg-tertiary: #F5F3EF;
  --text-primary: #1A1A1A;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --accent: #FF6719;
  --accent-hover: #E85A14;
  --accent-light: #FFF4ED;
  --border: #E8E6E1;
  --border-light: #F0EEE9;
  --success: #10B981;
  --error: #EF4444;
  --font-serif: 'Newsreader', Georgia, serif;
  --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: var(--space-lg) 0;
  margin-bottom: var(--space-xl);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.logo svg {
  color: var(--accent);
}

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

.api-key-section {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

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

.api-key-display {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--accent);
  background: var(--bg-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tab-content {
  display: none;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 103, 25, 0.3);
}

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

.btn-secondary:hover {
  background: var(--border-light);
}

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

/* Notes Grid */
.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.notes-header h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.note-card {
  padding: var(--space-lg);
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: pointer;
}

.note-card:hover {
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.note-content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-actions {
  display: flex;
  gap: var(--space-xs);
  justify-content: flex-end;
}

.note-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.note-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

.note-action-btn.delete:hover {
  color: var(--error);
  border-color: var(--error);
  background: #FEF2F2;
}

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

.note-action-btn.restore:hover {
  color: var(--success);
  border-color: var(--success);
  background: #ECFDF5;
}

/* Used Notes Section */
.used-notes-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.used-notes-header {
  margin-bottom: var(--space-lg);
}

.used-notes-header h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.used-notes-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
}

.used-notes-grid {
  opacity: 0.7;
}

.note-card.used {
  background: var(--bg-tertiary);
  border-color: var(--border);
  opacity: 0.85;
}

.note-card.used:hover {
  transform: none;
  box-shadow: none;
}

.note-used-badge {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state svg {
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state p {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay.visible {
  display: flex;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.schedule-modal {
  max-width: 1000px;
}

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

.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

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

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.form-textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Rich Text Editor */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.15s ease;
}

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

.toolbar-btn.active {
  background: var(--accent-light);
  color: var(--accent);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 var(--space-xs);
}

.rich-editor {
  border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
  min-height: 180px;
}

.rich-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
}

.rich-editor strong,
.rich-editor b {
  font-weight: 600;
}

.rich-editor em,
.rich-editor i {
  font-style: italic;
}

.rich-editor a {
  color: var(--accent);
  text-decoration: underline;
}

.rich-editor ul,
.rich-editor ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.rich-editor li {
  margin: 0.25em 0;
}

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

/* Schedule Sections */
.schedule-section {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.schedule-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.recurring-schedule-section {
  margin-top: var(--space-xl);
}

/* Schedule Section */
.schedule-section {
  margin-bottom: var(--space-xl);
}

.schedule-page {
  padding: var(--space-md);
}

.week-grid-container {
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.week-grid {
  min-width: 400px;
  font-size: 14px;
}

.week-grid-header {
  display: grid;
  grid-template-columns: 110px repeat(7, 1fr) 40px;
  gap: 1px;
  background: var(--border-light);
  padding: var(--space-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.week-grid-body {
  display: flex;
  flex-direction: column;
}

.week-slot-row {
  display: grid;
  grid-template-columns: 110px repeat(7, 1fr) 40px;
  gap: 1px;
  background: var(--border-light);
  align-items: center;
}

.week-slot-row > * {
  background: var(--bg-primary);
  padding: var(--space-sm);
}

.col-time input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
}

.col-day label {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.col-day input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.slot-delete-btn {
  background: transparent !important;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-delete-btn:hover {
  color: var(--error);
}

/* Slot lines (part 2) */
.slot-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.slot-line {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.slot-line-day {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 40px;
}

.slot-line-time {
  font-weight: 500;
  color: var(--accent);
  min-width: 70px;
}

.slot-line-days {
  min-width: 140px;
  color: var(--text-secondary);
  font-size: 13px;
}

.slot-line-notes {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  min-height: 28px;
  align-items: center;
}

.slot-line-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--accent-light);
  border-radius: 4px;
  font-size: 13px;
  max-width: 200px;
}

.slot-line-note span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-note-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s;
  flex-shrink: 0;
}

.slot-note-remove:hover {
  background: var(--error);
  color: white;
}

.slot-line-empty {
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
}

.slot-line-add-btn {
  padding: 6px 12px;
  font-size: 13px;
  flex-shrink: 0;
}

/* Scheduled posts section */
.scheduled-posts-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.scheduled-posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.schedule-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.schedule-section-header h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-xs);
}

.timezone-label {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: normal;
}

/* Calendar line-by-line */
.calendar-line-list {
  display: none;
  flex-direction: column;
  margin-bottom: var(--space-md);
}

.calendar-date-group {
  margin-bottom: var(--space-lg);
}

.calendar-date-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-light);
}

.calendar-line-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: 14px;
}

.calendar-line-item:last-child {
  border-bottom: none;
}

.calendar-time {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--accent);
  min-width: 52px;
}

.calendar-content {
  flex: 1;
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-content:hover {
  white-space: normal;
}

.calendar-line-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.calendar-line-delete:hover {
  background: #FEF2F2;
  color: var(--error);
}


.scheduled-post-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.scheduled-post-item:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.scheduled-post-time {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 140px;
  flex-shrink: 0;
}

.scheduled-post-time svg {
  color: var(--accent);
  flex-shrink: 0;
}

.scheduled-post-date {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.scheduled-post-time-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.scheduled-post-content {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scheduled-post-delete {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  flex-shrink: 0;
}

.scheduled-post-delete:hover {
  background: var(--error);
  color: white;
}

/* Add Scheduled Post Modal */
.add-scheduled-post-modal {
  max-width: 500px;
}

.form-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--space-lg) 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-light);
}

.form-divider:not(:empty)::before {
  margin-right: .5em;
}

.form-divider:not(:empty)::after {
  margin-left: .5em;
}

.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-help {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.datetime-inputs-inline {
  display: flex;
  gap: var(--space-sm);
}

.input-group-inline {
  flex: 1;
  position: relative;
}

.input-group-inline input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.input-group-inline input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Schedule Grid */
.schedule-grid-container {
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

.schedule-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.schedule-grid thead {
  background: var(--bg-secondary);
}

.schedule-grid th {
  padding: var(--space-sm) var(--space-xs);
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.schedule-grid th.time-col {
  text-align: left;
  padding-left: var(--space-sm);
  min-width: 80px;
}

.schedule-grid th.notes-col {
  min-width: 150px;
  text-align: left;
  padding-left: var(--space-sm);
}

.schedule-grid th.delete-col {
  width: 40px;
}

.schedule-grid td {
  padding: var(--space-sm) var(--space-xs);
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.schedule-grid tbody tr:hover {
  background: var(--bg-secondary);
}

.schedule-time-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
}

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

.schedule-checkbox {
  width: 24px;
  height: 24px;
  cursor: pointer;
  appearance: none;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  transition: all 0.2s;
  background: var(--bg-primary);
}

.schedule-checkbox:hover {
  border-color: var(--accent);
}

.schedule-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.schedule-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.schedule-notes-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
}

.schedule-notes-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent);
}

.schedule-delete-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.schedule-delete-btn:hover {
  background: var(--error);
  color: white;
}

.schedule-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  padding: var(--space-xs) 0;
  transition: color 0.2s;
}

.link-btn:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.btn-add-slot {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-slot:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent);
}

.schedule-timezone {
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

/* Setup Steps */
.setup-content {
  max-width: 600px;
  margin: 0 auto;
}

.setup-description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.step {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
}

.step-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  flex-shrink: 0;
}

.step-content h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  margin-bottom: var(--space-xs);
}

.step-content p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.api-key-input-section {
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.api-key-input-section label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.api-key-input-group {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.api-key-input-group input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.help-text {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px var(--space-lg);
  background: var(--text-primary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

/* Compose Tab */
.compose-area {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
}

.compose-textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: var(--space-md);
}

.compose-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.compose-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.compose-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: var(--space-xs);
}

/* Note Selector Modal */
.note-selector-modal {
  max-width: 600px;
}

.note-selector-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.note-selector-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.note-selector-item:hover {
  border-color: var(--accent);
  background: var(--bg-secondary);
}

.note-selector-item.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.note-selector-checkbox {
  flex-shrink: 0;
  margin-top: 2px;
}

.note-selector-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.note-selector-content {
  flex: 1;
}

.note-selector-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  word-wrap: break-word;
}

.note-selector-media {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
}

.note-selector-media svg {
  color: var(--accent);
}

.notes-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: var(--space-xs);
}

/* Formatting Help */
.formatting-help {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.formatting-help code {
  background: var(--bg-tertiary);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

/* Media Upload */
.compose-media-upload {
  margin-bottom: var(--space-md);
}

.upload-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.upload-label:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.media-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.media-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.media-preview-item img,
.media-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

.media-remove-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.compose-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Schedule Modal - Two Part Design */
.schedule-part {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.schedule-part:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.schedule-part h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  margin-bottom: var(--space-xs);
}

.schedule-part-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: var(--space-lg);
}

/* Time Slots List */
.time-slots-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.time-slot-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.time-slot-time {
  min-width: 100px;
}

.time-slot-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.time-slot-days {
  display: flex;
  gap: var(--space-xs);
  flex: 1;
}

.day-checkbox-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
}

.day-checkbox {
  width: 32px;
  height: 32px;
  cursor: pointer;
  accent-color: var(--accent);
}

.day-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.day-checkbox:checked + .day-label {
  color: var(--accent);
}

.time-slot-delete {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.time-slot-delete:hover {
  background: var(--error);
  color: white;
}

/* Draft Assignments */
.draft-assignments {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.draft-assignment-item {
  padding: var(--space-md);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.assignment-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.assignment-time {
  font-weight: 600;
  color: var(--accent);
  min-width: 80px;
}

.assignment-days {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.assignment-select-btn {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.assignment-select-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.assignment-drafts {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-light);
}

.assigned-draft {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
}

.empty-message {
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--space-lg);
}

/* Save Schedule Button and Status */
.schedule-actions-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.save-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.save-status .save-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.save-status.unsaved .save-indicator {
  background: var(--accent);
}

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

.save-status.saving .save-indicator {
  background: var(--accent);
  animation: pulse 1s infinite;
}

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

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

/* Media Upload Styles */
.media-upload-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.upload-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.2s;
}

.upload-label:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.media-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.media-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.media-preview-item img,
.media-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.media-remove-btn:hover {
  background: var(--error);
}

.note-media-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
  padding: 2px 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.note-content.note-media-only {
  color: var(--text-tertiary);
  font-style: italic;
}

/* ============================================================================
   AUTH STYLES
   ============================================================================ */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: var(--space-lg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: var(--space-xl);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-logo svg {
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.auth-logo h1 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-form h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  text-align: center;
  color: var(--text-primary);
}

.auth-form .form-group {
  margin-bottom: var(--space-md);
}

.auth-form .form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form .form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Password Toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .form-input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: var(--text-primary);
}

.password-toggle:focus {
  outline: none;
  color: var(--accent);
}

.auth-form .form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: var(--space-md);
}

.auth-switch {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* User section in header */
.user-section {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

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

/* ============================================================================
   ADMIN STYLES
   ============================================================================ */

.admin-content {
  max-width: 900px;
  margin: 0 auto;
}

.admin-section {
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.admin-section h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.admin-actions {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.reset-password-form .form-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.reset-password-form .form-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
}

.admin-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.reset-result {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: #ECFDF5;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
}

.reset-result code {
  background: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--accent);
  user-select: all;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

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

.admin-table td code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-available {
  background: #ECFDF5;
  color: var(--success);
}

.status-used {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.status-expired {
  background: #FEF2F2;
  color: var(--error);
}

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

.btn-danger:hover {
  background: #DC2626;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-md);
}

.stat-card {
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Auth Back Link */
.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: var(--space-lg);
  transition: color 0.2s;
}

.auth-back-link:hover {
  color: var(--accent);
}

/* Screenshot Images */
.screenshot-image {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.screenshot-image img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
  object-fit: contain;
  background: var(--bg-secondary);
}
