/* Instagram Auto Poster - Modern SaaS style */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces */
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --sidebar-bg-active: rgba(99, 102, 241, 0.15);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  /* Text */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f8fafc;

  /* Brand & Actions */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-muted: rgba(99, 102, 241, 0.12);
  --border: #e2e8f0;
  --border-focus: #6366f1;

  /* Semantic */
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-muted: #fef2f2;
  --success: #22c55e;
  --success-muted: #f0fdf4;
  --warn: #f59e0b;
  --warn-muted: #fffbeb;
  --info: #3b82f6;
  --info-muted: #eff6ff;

  /* Effects */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --transition: 0.15s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ----- Layout ----- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  padding: 1.5rem 1.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--sidebar-text-active);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-tenant {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-tenant-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.35rem;
}

.sidebar-tenant-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sidebar-tenant-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--primary-muted);
  color: #a5b4fc;
  flex-shrink: 0;
}

.sidebar-tenant-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-tenant-current .sidebar-tenant-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sidebar-text-active);
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.sidebar-tenant-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  white-space: nowrap;
}

.sidebar-tenant-switch {
  display: block;
  margin-top: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.8rem;
  color: #a5b4fc;
  text-decoration: none;
  border-top: 1px solid var(--sidebar-border);
  transition: color var(--transition);
}

.sidebar-tenant-switch:hover {
  color: var(--sidebar-text-active);
}

.sidebar-nav {
  padding: 0.75rem 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.5rem;
  margin: 0 0.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav a:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
}

.sidebar-nav a.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
  font-weight: 500;
  border-left: 3px solid var(--primary);
  margin-left: 0.5rem;
  padding-left: calc(1.5rem - 3px);
}

/* 顧客管理＋SNS接続のサブメニュー */
.sidebar-nav-group {
  margin: 0 0.5rem 0.25rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sidebar-nav-group-label {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  font-weight: 500;
}

.sidebar-nav-group-label:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
}

.sidebar-nav-group-label.active,
.sidebar-nav-group.is-open .sidebar-nav-group-label {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
}

.sidebar-nav-group-label.active {
  border-left: 3px solid var(--primary);
  padding-left: calc(1.5rem - 3px);
}

.sidebar-nav-sub {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.5rem;
  border-left: 1px solid var(--sidebar-border);
  margin-left: 1.5rem;
  padding-left: 0.5rem;
}

.sidebar-nav-sub li {
  margin: 0;
}

.sidebar-nav-sub a {
  display: flex;
  align-items: center;
  padding: 0.45rem 1rem;
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav-sub a:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
}

.sidebar-nav-sub a.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
  font-weight: 500;
  border-left: 3px solid var(--primary);
  margin-left: 0;
  padding-left: calc(1rem - 3px);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-footer-email {
  font-size: 0.8rem;
  opacity: 0.9;
  word-break: break-all;
  color: var(--sidebar-text);
}

.sidebar-footer a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.9;
  transition: opacity var(--transition);
}

.sidebar-footer a:hover {
  opacity: 1;
}

.main {
  flex: 1;
  padding: 1.75rem 2rem;
  overflow: auto;
}

.page-title {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ----- Cards ----- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.35rem;
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 0, 0, 0.06);
}

.card-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.card-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-value.success { color: var(--success); }
.card-value.danger { color: var(--danger); }
.card-value.warn { color: var(--warn); }

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ----- Tables ----- */
.table-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.col-check { width: 2.5rem; text-align: center; }

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: #f8fafc;
}

/* 顧客一覧：表示中（アクティブ）の行を背景色で強調 */
tbody tr.tenant-row-current {
  background: var(--success-muted);
  box-shadow: inset 3px 0 0 var(--success);
}
tbody tr.tenant-row-current:hover {
  background: #dcfce7;
}

tr:last-child td { border-bottom: 0; }

/* Status badges */
.status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status.connected { background: var(--success-muted); color: #15803d; }
.status.expired { background: var(--warn-muted); color: #b45309; }
.status.error { background: var(--danger-muted); color: #b91c1c; }
.status.draft { background: #f1f5f9; color: var(--text-secondary); }
.status.scheduled { background: var(--info-muted); color: #1d4ed8; }
.status.posted { background: var(--success-muted); color: #15803d; }
.status.failed { background: var(--danger-muted); color: #b91c1c; }
.status.processing { background: var(--info-muted); color: #1d4ed8; }
.status.canceled { background: #f1f5f9; color: var(--text-muted); }
.status.info { background: var(--info-muted); color: #1d4ed8; }
.status.warn { background: var(--warn-muted); color: #b45309; }
.status.running { background: var(--info-muted); color: #1d4ed8; }
.status.idle { background: var(--success-muted); color: #15803d; }

/* ----- Buttons & Forms ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

a.btn { color: inherit; }
a.btn:visited, a.btn:hover, a.btn:focus { color: inherit; }

.btn-primary {
  background: var(--primary);
  color: #fff !important;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  color: #fff !important;
}

a.btn-primary, a.btn-primary:visited, a.btn-primary:hover, a.btn-primary:focus {
  color: #fff !important;
}

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

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger);
  color: #fff !important;
  font-weight: 600;
}

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

a.btn-danger, a.btn-danger:visited, a.btn-danger:hover, a.btn-danger:focus {
  color: #fff !important;
}

.btn-sm, .btn-small {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-delete-ig, .btn-delete-fb { white-space: nowrap; }

td.actions { white-space: nowrap; }
td.actions form { display: inline; margin-right: 0.25rem; }

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

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

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.35rem;
}

.form-hint-tenant { margin-bottom: 0.5rem; }

.form-control {
  width: 100%;
  max-width: 400px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

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

/* ----- Login ----- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  padding: 2.25rem;
  border: 1px solid var(--border);
}

.login-card h1 {
  margin: 0 0 1.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-card .error {
  background: var(--danger-muted);
  color: #b91c1c;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  border: 1px solid #fecaca;
}

.login-card .form-group { margin-bottom: 1.25rem; }

.login-card .form-control { max-width: none; }

.login-card .btn {
  width: 100%;
  padding: 0.7rem;
  margin-top: 0.5rem;
  font-size: 1rem;
}

/* ----- Alerts ----- */
.alert {
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
}

.alert-info {
  background: var(--info-muted);
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.alert-warn {
  background: var(--warn-muted);
  color: #b45309;
  border-color: #fde68a;
}

.alert-danger {
  background: var(--danger-muted);
  color: #b91c1c;
  border-color: #fecaca;
}

.alert-success {
  background: var(--success-muted);
  color: #15803d;
  border-color: #bbf7d0;
}

/* ----- Settings ----- */
.settings-section { margin-bottom: 1.75rem; }

.settings-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.settings-section-desc {
  color: var(--text-muted);
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.55;
}

.settings-note {
  font-size: 0.875rem;
  margin-top: 1rem;
  margin-bottom: 0;
}

.text-muted { color: var(--text-muted); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.code-sm { font-size: 0.8rem; }

.cell-truncate {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-nowrap { white-space: nowrap; }

/* ----- Connect steps ----- */
.connect-steps { margin: 0 0 0 1.25rem; padding-left: 0.5rem; }
.connect-steps li { margin-bottom: 1rem; line-height: 1.6; }
.connect-steps li:last-child { margin-bottom: 0; }

/* 接続方法2つを同等のカードで表示 */
.connect-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.connect-option {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.connect-option-title {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.connect-option-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

.connect-option-action {
  margin-top: 1.25rem;
}

.connect-option-action form { margin: 0; }

.connect-option-help {
  margin-top: 1rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.connect-option-help summary {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  list-style: none;
}

.connect-option-help summary::-webkit-details-marker { display: none; }

.connect-option-help summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s ease;
}

.connect-option-help[open] summary::before {
  transform: rotate(90deg);
}

.connect-option-help-body {
  padding: 0 0.75rem 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

.connect-option-help-body ul {
  margin: 0.35rem 0 0 1.25rem;
  padding: 0;
}

.connect-block {
  margin-top: 1rem;
  padding: 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.connect-block--user { background: var(--bg-elevated); }
.connect-block--admin { margin-top: 1rem; }

.connect-block--admin summary {
  cursor: pointer;
  list-style: none;
  padding: 0.5rem 0;
}

.connect-block--admin summary::-webkit-details-marker { display: none; }

.connect-block-title { margin: 0; font-size: 0.95rem; font-weight: 600; }

.connect-steps code { font-size: 0.85em; }

.step-sublist { margin: 0 0 0 1.25rem; padding-left: 0.5rem; }
.step-sublist li { margin-bottom: 0.35rem; }

.code-block {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.45rem 0.65rem;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  word-break: break-all;
}

.ui-label {
  padding: 0.2rem 0.45rem;
  background: #e2e8f0;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-weight: normal;
  white-space: nowrap;
}

/* ----- Calendar ----- */
.calendar-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.calendar-table { width: 100%; border-collapse: collapse; table-layout: fixed; }

.calendar-table thead th {
  padding: 0.6rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.calendar-table tbody td {
  vertical-align: top;
  padding: 0.25rem;
  border: 1px solid var(--border);
  min-height: 100px;
  height: 120px;
}

.calendar-cell { font-size: 0.85rem; }

.calendar-cell--blank { background: #f8fafc; }
.calendar-cell--past { background: #f1f5f9 !important; }
.calendar-cell--today {
  background: #fffbeb !important;
  box-shadow: inset 0 0 0 2px var(--warn);
}

.calendar-cell--sun .calendar-day-num { color: var(--danger); }
.calendar-cell--sat .calendar-day-num { color: var(--primary); }

.calendar-day-num {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

/* カレンダー上部: 月ナビ＋アクション */
.calendar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.calendar-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.calendar-nav-btn:hover {
  background: var(--primary-muted);
  color: var(--primary-hover);
  border-color: var(--primary);
}
.calendar-title {
  margin: 0;
  min-width: 120px;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}
.calendar-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-event {
  display: block;
  padding: 0.3rem 0.4rem;
  margin-bottom: 0.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid var(--primary);
  background: var(--info-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background var(--transition);
}

.calendar-event:hover { background: #dbeafe; }

.calendar-event.status-draft { border-left-color: #94a3b8; background: #f1f5f9; }
.calendar-event.status-scheduled { border-left-color: var(--primary); background: var(--info-muted); }
.calendar-event.status-posted { border-left-color: var(--success); background: var(--success-muted); }
.calendar-event.status-failed { border-left-color: var(--danger); background: var(--danger-muted); }
.calendar-event.status-processing { border-left-color: #8b5cf6; background: #f5f3ff; }
.calendar-event.status-canceled {
  border-left-color: var(--text-muted);
  background: #f1f5f9;
  opacity: 0.85;
}

.calendar-event-status {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-bottom: 0.15rem;
  background: rgba(0, 0, 0, 0.06);
}

.calendar-event.status-scheduled .calendar-event-status { background: rgba(99, 102, 241, 0.2); color: var(--primary-hover); }
.calendar-event.status-posted .calendar-event-status { background: rgba(34, 197, 94, 0.2); color: #15803d; }
.calendar-event.status-failed .calendar-event-status { background: rgba(239, 68, 68, 0.2); color: #b91c1c; }
.calendar-event.status-canceled .calendar-event-status { background: rgba(100, 116, 139, 0.2); color: var(--text-muted); }

.calendar-event-time {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.calendar-event-caption {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 日付セル: ホバーで「新規投稿を追加」を表示・クリックで実行 */
.calendar-cell-add {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px dashed transparent;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.calendar-cell-add:hover {
  background: var(--primary-muted);
  border-color: var(--primary);
  color: var(--primary-hover);
}
.calendar-cell-add .calendar-day-num {
  font-weight: 600;
  margin-bottom: 0;
  font-size: 0.9rem;
}
.calendar-cell-add-icon {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.7;
}
.calendar-cell-add:hover .calendar-cell-add-icon {
  opacity: 1;
}
.calendar-cell-add-label {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 500;
  transition: max-width 0.2s ease, opacity 0.15s ease;
}
.calendar-cell-add:hover .calendar-cell-add-label {
  max-width: 8em;
  opacity: 1;
}

/* ----- Post create wizard (steps) ----- */
.post-create-wizard {
  max-width: 560px;
  margin: 0 auto;
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 0 0.25rem;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.wizard-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(50% + 22px);
  right: calc(-50% + 22px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.wizard-step.is-done:not(:last-child)::after,
.wizard-step.is-active:not(:last-child)::after {
  background: var(--primary);
  opacity: 0.4;
}

.wizard-step.is-done:not(:last-child)::after {
  opacity: 0.7;
}

.wizard-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.wizard-step.is-active .wizard-step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.wizard-step.is-done .wizard-step-num {
  background: var(--success-muted);
  border-color: var(--success);
  color: var(--success);
}

.wizard-step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  max-width: 90px;
  line-height: 1.3;
}

.wizard-step.is-active .wizard-step-label {
  color: var(--primary);
}

.wizard-step.is-done .wizard-step-label {
  color: var(--text-secondary);
}

.wizard-panels {
  position: relative;
  min-height: 200px;
}

.wizard-panel {
  display: none;
  animation: wizardFadeIn 0.25s ease;
}

.wizard-panel.is-active {
  display: block;
}

@keyframes wizardFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.wizard-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.wizard-actions .btn-primary { min-width: 120px; }

.wizard-actions .btn-secondary:first-of-type { margin-right: auto; }

/* ----- Media preview (post create/edit) ----- */
.media-preview-wrap { margin-top: 0.5rem; }

.media-preview-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.media-preview {
  display: inline-block;
  max-width: 100%;
  padding: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 80px;
}

.media-preview-placeholder {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem;
}

.media-preview img,
.media-preview video { display: block; border-radius: var(--radius-sm); }
