/* PostZenly — design system
   Light theme · dark sidebar · indigo/violet accent · system fonts */

:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --border: #e6e8f2;
  --border-soft: #eef0f7;
  --text: #1b1d29;
  --text-2: #4b4e63;
  --text-3: #8a8fa8;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-soft: #eef0ff;
  --violet: #8b5cf6;
  --sidebar: #14162b;
  --sidebar-2: #1d2038;
  --sidebar-text: #a7abc7;
  --sidebar-active: #ffffff;
  --green: #16a34a;
  --green-soft: #e7f7ee;
  --amber: #d97706;
  --amber-soft: #fef4e2;
  --red: #dc2626;
  --red-soft: #fdecec;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 43, 0.04), 0 8px 24px -12px rgba(20, 22, 43, 0.12);
  --shadow-lg: 0 2px 4px rgba(20, 22, 43, 0.05), 0 20px 48px -16px rgba(20, 22, 43, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============ App shell ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar) 0%, #101228 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(99, 102, 241, 0.7);
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; stroke: #fff; }
.brand-name { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-text); margin-top: 1px; }

.nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #6b6f94; padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-weight: 500; font-size: 14.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-link svg { width: 19px; height: 19px; stroke: currentColor; flex-shrink: 0; }
.nav-link:hover { background: var(--sidebar-2); color: #dfe1f5; }
.nav-link.active { background: rgba(99, 102, 241, 0.18); color: var(--sidebar-active); }
.nav-link.active svg { stroke: #a5b4fc; }

.sidebar-foot {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: #fff; font-weight: 700; font-size: 14px;
  display: grid; place-items: center; flex-shrink: 0;
}
.who { min-width: 0; flex: 1; }
.who-name { color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 11.5px; color: var(--sidebar-text); text-transform: capitalize; }
.logout-btn {
  color: var(--sidebar-text); padding: 8px; border-radius: 8px;
  display: grid; place-items: center; border: none; background: none; cursor: pointer;
}
.logout-btn:hover { background: var(--sidebar-2); color: #fff; }
.logout-btn svg { width: 18px; height: 18px; stroke: currentColor; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 32px 0;
}
.page-title { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.page-sub { color: var(--text-2); font-size: 14px; margin-top: 2px; }

.content { padding: 22px 32px 48px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform 0.06s, box-shadow 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; stroke: currentColor; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  color: #fff; box-shadow: 0 8px 20px -8px rgba(99, 102, 241, 0.65);
}
.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(99, 102, 241, 0.8); filter: brightness(1.05); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); border-color: #d6d9e8; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #fbdede; }
.btn-ghost { background: none; color: var(--text-2); padding: 8px 12px; }
.btn-ghost:hover { background: var(--border-soft); color: var(--text); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ============ Cards & stats ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card-sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { padding: 20px 22px; position: relative; overflow: hidden; }
.stat::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--stat-color, var(--accent)); border-radius: 4px 0 0 4px;
}
.stat-num { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { color: var(--text-2); font-size: 13.5px; margin-top: 4px; font-weight: 500; }
.stat-icon {
  position: absolute; right: 16px; top: 16px; width: 40px; height: 40px;
  border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--stat-color, var(--accent)) 12%, #fff);
}
.stat-icon svg { width: 20px; height: 20px; stroke: var(--stat-color, var(--accent)); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* ============ Badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 999px;
  letter-spacing: 0.01em; white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; stroke: currentColor; }
.badge-scheduled { background: var(--blue-soft); color: var(--blue); }
.badge-published { background: var(--green-soft); color: var(--green); }
.badge-failed { background: var(--red-soft); color: var(--red); }
.badge-cancelled { background: #eef0f6; color: var(--text-3); }
.badge-type { background: var(--accent-soft); color: var(--accent-dark); }
.badge-business { background: var(--green-soft); color: var(--green); }
.badge-admin { background: #f3e8ff; color: #7c3aed; }
.badge-member { background: #eef0f6; color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ============ Post rows ============ */
.post-row {
  display: flex; gap: 16px; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
  transition: background 0.12s;
}
.post-row:last-child { border-bottom: none; }
.post-row:hover { background: var(--surface-2); }
.thumb {
  width: 64px; height: 64px; border-radius: 12px; flex-shrink: 0;
  overflow: hidden; position: relative; background: var(--border-soft);
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; }
.thumb .ph svg { width: 24px; height: 24px; stroke: rgba(255, 255, 255, 0.9); }
.ph-reel { background: linear-gradient(135deg, #6366f1, #a855f7); }
.ph-photo { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.ph-story { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.ph-cover { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.post-main { flex: 1; min-width: 0; }
.post-cap { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.post-meta .acct { color: var(--text-2); font-weight: 600; }
.post-actions { display: flex; gap: 8px; flex-shrink: 0; }
.post-err { font-size: 12.5px; color: var(--red); margin-top: 6px; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border-soft); margin-bottom: 18px; }
.tab {
  font: inherit; font-weight: 600; font-size: 14px; color: var(--text-3);
  background: none; border: none; padding: 10px 16px; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -2px;
  display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tab .count {
  font-size: 11.5px; font-weight: 700; background: var(--border-soft);
  color: var(--text-2); border-radius: 999px; padding: 1px 8px;
}
.tab.active .count { background: var(--accent-soft); color: var(--accent-dark); }

/* ============ Forms ============ */
.form-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
.field { margin-bottom: 20px; }
.field-label { display: block; font-weight: 650; font-size: 13.5px; margin-bottom: 8px; }
.field-hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 11px 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.14);
}
.textarea { min-height: 132px; resize: vertical; }
.char-wrap { position: relative; }
.char-count {
  position: absolute; right: 12px; bottom: 10px; font-size: 12px;
  color: var(--text-3); background: rgba(255, 255, 255, 0.9);
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border-soft);
}
.char-count.over { color: var(--red); border-color: var(--red); font-weight: 700; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.type-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 6px; }
.type-tab {
  border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 12px; padding: 14px 8px; cursor: pointer; text-align: center;
  transition: all 0.15s; font: inherit;
}
.type-tab svg { width: 22px; height: 22px; stroke: var(--text-3); margin: 0 auto 6px; display: block; transition: stroke 0.15s; }
.type-tab span { font-size: 13px; font-weight: 650; color: var(--text-2); }
.type-tab:hover { border-color: #c9cdf0; }
.type-tab.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.type-tab.active svg { stroke: var(--accent-dark); }
.type-tab.active span { color: var(--accent-dark); }

.hint-box {
  display: flex; gap: 10px; background: var(--accent-soft);
  border: 1px solid #dfe3ff; border-radius: 10px; padding: 12px 14px;
  font-size: 13px; color: #3f42a8; margin-top: 10px;
}
.hint-box svg { width: 17px; height: 17px; stroke: #4f46e5; flex-shrink: 0; margin-top: 1px; }

.dropzone {
  border: 2px dashed #c9cdf0; border-radius: var(--radius);
  background: var(--surface-2); padding: 34px 20px; text-align: center;
  cursor: pointer; transition: all 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 34px; height: 34px; stroke: var(--accent); margin: 0 auto 10px; display: block; }
.dropzone-title { font-weight: 650; font-size: 14.5px; }
.dropzone-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }

.preview-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.preview-item { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--border-soft); box-shadow: var(--shadow); }
.preview-item img, .preview-item video { width: 100%; height: 100%; object-fit: cover; }
.preview-item .file-tag {
  position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; font-weight: 700;
  color: #fff; background: rgba(0,0,0,0.55); padding: 2px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-remove {
  position: absolute; top: 5px; right: 5px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.6); color: #fff;
  cursor: pointer; display: grid; place-items: center; font-size: 13px; line-height: 1;
}
.preview-remove:hover { background: var(--red); }

.side-card { position: sticky; top: 24px; }
.side-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.side-row:last-child { border-bottom: none; }
.side-row .k { color: var(--text-3); }
.side-row .v { font-weight: 650; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); font-weight: 700; padding: 12px 18px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.tbl td { padding: 13px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }

/* ============ Calendar ============ */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-title { font-size: 19px; font-weight: 750; letter-spacing: -0.01em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 0; }
.cal-day {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 12px; min-height: 104px; padding: 8px;
  transition: box-shadow 0.15s;
}
.cal-day:hover { box-shadow: var(--shadow); }
.cal-day.dim { background: transparent; border-color: transparent; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,0.18); }
.cal-num { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.cal-day.today .cal-num { color: var(--accent-dark); }
.cal-event {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 7px; padding: 3px 7px; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default;
}
.cal-event.st-published { background: var(--green-soft); color: var(--green); }
.cal-event.st-failed { background: var(--red-soft); color: var(--red); }
.cal-event.st-cancelled { background: #eef0f6; color: var(--text-3); }
.cal-event .dot { flex-shrink: 0; }

/* ============ Login ============ */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 15% 10%, #2b2f6b 0%, var(--sidebar) 55%, #0c0e20 100%);
}
.login-card {
  width: 400px; max-width: 100%; background: var(--surface);
  border-radius: 20px; padding: 38px 36px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.login-sub { color: var(--text-2); font-size: 13.5px; margin: -18px 0 22px; }
.login-hint {
  margin-top: 18px; font-size: 12.5px; color: var(--text-3); text-align: center;
  background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.login-hint code { background: var(--border-soft); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* ============ Flash / toast / modal ============ */
.flash {
  padding: 13px 18px; border-radius: 12px; margin-bottom: 18px;
  font-size: 14px; font-weight: 550; display: flex; align-items: center; gap: 10px;
}
.flash-error { background: var(--red-soft); color: #991b1b; border: 1px solid #f5c6c6; }
.flash-ok { background: var(--green-soft); color: #166534; border: 1px solid #bbe7cd; }

.toast-zone { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--sidebar); color: #fff; padding: 13px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; max-width: 360px;
  animation: toast-in 0.25s ease;
}
.toast.error { background: #7f1d1d; }
.toast svg { width: 18px; height: 18px; stroke: currentColor; flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.modal-back {
  position: fixed; inset: 0; background: rgba(15, 17, 35, 0.5);
  backdrop-filter: blur(3px); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-back.open { display: flex; }
.modal { background: var(--surface); border-radius: 18px; padding: 28px; width: 420px; max-width: 100%; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 17px; font-weight: 750; margin-bottom: 4px; }
.modal-sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ============ Empty states ============ */
.empty { text-align: center; padding: 52px 24px; color: var(--text-3); }
.empty svg { width: 46px; height: 46px; stroke: #c3c7de; margin: 0 auto 14px; display: block; }
.empty-title { font-weight: 700; color: var(--text-2); font-size: 15.5px; margin-bottom: 4px; }
.empty-sub { font-size: 13.5px; }

/* ============ Settings bits ============ */
.acct-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.acct-row:last-child { border-bottom: none; }
.acct-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #f59e0b, #ef4444, #a855f7);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px;
}
.acct-name { font-weight: 700; font-size: 15px; }
.acct-sub { font-size: 12.5px; color: var(--text-3); }
.status-card { border: 1.5px dashed #c9cdf0; background: var(--surface-2); border-radius: var(--radius); padding: 20px 22px; }
.status-card .row { display: flex; align-items: center; gap: 12px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(217,119,6,0.18); flex-shrink: 0; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.mt { margin-top: 16px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.inline-form .field { margin-bottom: 0; flex: 1; min-width: 150px; }

/* ============ Rebrand additions ============ */
.page-footer {
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
  padding: 28px 32px 36px;
  border-top: 1px solid var(--border-soft);
  margin-top: 10px;
}
.login-byline { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.about-text { margin-top: 10px; font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.about-crafted { margin-top: 12px; font-size: 12.5px; color: var(--text-3); font-weight: 600; }

/* ============ Responsive ============ */
@media (max-width: 1020px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .side-card { position: static; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .type-tabs { grid-template-columns: repeat(2, 1fr); }
  .post-row { flex-wrap: wrap; }
  .post-actions { width: 100%; }
  .cal-day { min-height: 72px; }
  .cal-event span.lbl { display: none; }
}

/* ============ PostZenly additions: nav badge, mode tabs, chips ============ */
.ig-conn {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; margin: 0 12px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px; font-size: 12.5px;
}
.ig-conn-text { color: #dfe1f5; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ig-conn-link { display: flex; align-items: center; gap: 9px; color: var(--sidebar-text); font-weight: 550; }
.ig-conn-link:hover { color: #fff; }
.ig-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ig-dot.ig-on { background: #22c55e; box-shadow: 0 0 0 3.5px rgba(34, 197, 94, 0.22); }
.ig-dot.ig-off { background: #6b6f94; box-shadow: 0 0 0 3.5px rgba(107, 111, 148, 0.2); }

.mode-tabs { display: inline-flex; gap: 6px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; padding: 5px; margin-bottom: 18px; box-shadow: var(--shadow); }
.mode-tab {
  font: inherit; font-weight: 650; font-size: 14px; color: var(--text-3);
  background: none; border: none; border-radius: 10px; padding: 9px 20px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.15s;
}
.mode-tab svg { width: 17px; height: 17px; stroke: currentColor; }
.mode-tab:hover { color: var(--text); }
.mode-tab.active { background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; box-shadow: 0 6px 14px -6px rgba(99, 102, 241, 0.6); }

.form-grid-3 { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 20px; align-items: start; }

.chip-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip-row-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-right: 2px; }
.chip-row-body { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 12.5px; font-weight: 650; color: var(--accent-dark);
  background: var(--accent-soft); border: 1px solid #dfe3ff; border-radius: 999px;
  padding: 6px 13px; cursor: pointer; transition: all 0.14s; white-space: nowrap;
}
.chip:hover { background: #e2e6ff; border-color: var(--accent); transform: translateY(-1px); }
.chip:active { transform: none; }
.chip-loading { cursor: default; color: var(--text-3); background: var(--surface-2); border-color: var(--border); }
.chip-loading:hover { transform: none; background: var(--surface-2); border-color: var(--border); }
.chip .chip-score { opacity: 0.7; font-weight: 700; }

/* ============ AI Studio ============ */
.studio-card { position: sticky; top: 24px; }
.studio-note { font-size: 12.5px; color: var(--text-3); margin: 10px 0 4px; }
.studio-error { font-size: 13px; color: var(--red); background: var(--red-soft); border: 1px solid #f5c6c6; border-radius: 10px; padding: 10px 13px; margin: 10px 0; }
.studio-sec-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin: 16px 0 8px; }
.studio-list { display: flex; flex-direction: column; gap: 10px; }
.studio-cap-card, .studio-tag-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px;
  background: var(--surface-2); font-size: 13.5px;
}
.studio-cap-card p { margin-bottom: 10px; white-space: pre-wrap; }
.studio-tag-card .studio-tag-name { font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--accent-dark); }
.studio-tag-card .studio-tag-tags { color: var(--text-2); font-size: 13px; margin-bottom: 10px; word-break: break-word; }
.studio-use-btn { width: 100%; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Onboarding ============ */
.ob-wrap { max-width: 760px; margin: 0 auto; }
.ob-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.ob-step-dot { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.ob-num {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 750; font-size: 14px; background: var(--surface); border: 2px solid var(--border);
  color: var(--text-3); flex-shrink: 0; transition: all 0.15s;
}
.ob-lbl { font-size: 13.5px; font-weight: 650; color: var(--text-3); white-space: nowrap; }
.ob-step-dot.active .ob-num { background: linear-gradient(135deg, var(--accent), var(--violet)); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -6px rgba(99, 102, 241, 0.6); }
.ob-step-dot.active .ob-lbl { color: var(--text); }
.ob-step-dot.done .ob-num { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.ob-bar { flex: 1; height: 2px; background: var(--border); border-radius: 2px; min-width: 20px; }
.ob-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-soft); }

/* ============ Connection card ============ */
.conn-status { display: flex; align-items: center; gap: 12px; border: 1.5px dashed #c9cdf0; background: var(--surface-2); border-radius: var(--radius); padding: 16px 18px; }
.conn-status-title { font-weight: 700; font-size: 14.5px; }
.conn-status-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.conn-steps { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 14px; counter-reset: conn; }
.conn-step { border: 1px solid var(--border-soft); border-radius: 12px; padding: 15px 17px; background: var(--surface); }
.conn-check { display: flex; gap: 12px; cursor: pointer; align-items: flex-start; }
.conn-check input { position: absolute; opacity: 0; pointer-events: none; }
.conn-check-box {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid #c9cdf0;
  flex-shrink: 0; margin-top: 1px; display: grid; place-items: center;
  transition: all 0.14s; background: var(--surface);
}
.conn-check-box::after { content: ""; width: 10px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translateY(-1px); opacity: 0; }
.conn-check input:checked + .conn-check-box { background: linear-gradient(135deg, var(--accent), var(--violet)); border-color: transparent; }
.conn-check input:checked + .conn-check-box::after { opacity: 1; }
.conn-check input:focus-visible + .conn-check-box { box-shadow: 0 0 0 3px rgba(99,102,241,0.25); }
.conn-step-title { font-weight: 700; font-size: 14px; display: block; }
.conn-step-help { font-size: 13px; color: var(--text-2); display: block; margin-top: 3px; }
.conn-step-help code { background: var(--border-soft); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.conn-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.conn-msg { font-size: 13.5px; border-radius: 10px; padding: 11px 14px; margin-top: 12px; }
.conn-msg.conn-ok { background: var(--green-soft); color: #166534; border: 1px solid #bbe7cd; }
.conn-msg.conn-err { background: var(--red-soft); color: #991b1b; border: 1px solid #f5c6c6; }

/* ============ Insights heatmap ============ */
.heat-cta { display: flex; gap: 16px; align-items: center; border-left: 4px solid var(--accent); }
.heat-cta-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); display: grid; place-items: center; flex-shrink: 0; }
.heat-cta-icon svg { width: 24px; height: 24px; stroke: var(--accent-dark); }
.heat-source { background: var(--accent-soft); color: var(--accent-dark); }
.heat-loading, .heat-error, .strat-loading, .strat-error { padding: 26px; text-align: center; color: var(--text-3); font-size: 14px; }
.heat-error, .strat-error { color: var(--red); }
.heat-wrap { overflow-x: auto; }
.heat-grid { display: grid; grid-template-columns: 64px repeat(4, 1fr); gap: 7px; min-width: 560px; }
.heat-corner { }
.heat-colh { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-2); padding: 4px 0; }
.heat-rowh { display: flex; align-items: center; font-size: 13px; font-weight: 700; color: var(--text-2); }
.heat-cell {
  position: relative; border-radius: 10px; padding: 12px 6px; text-align: center;
  font-weight: 750; font-size: 14px; cursor: default; transition: transform 0.12s;
  min-height: 52px; display: grid; place-items: center;
}
.heat-cell:hover { transform: scale(1.04); z-index: 2; }
.heat-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--sidebar); color: #fff; font-size: 12px; font-weight: 550;
  padding: 8px 12px; border-radius: 10px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: all 0.15s; z-index: 10; box-shadow: var(--shadow-lg);
}
.heat-cell:hover .heat-tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.heat-tip strong { color: #c7d2fe; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-3); }
.heat-legend-bar { width: 130px; height: 10px; border-radius: 999px; background: linear-gradient(90deg, #eef0ff, #6366f1); }

/* ============ Strategy ============ */
.strat-goals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.strat-goal input { position: absolute; opacity: 0; pointer-events: none; }
.strat-goal span {
  display: block; border: 1.5px solid var(--border); border-radius: 12px; padding: 13px 12px;
  cursor: pointer; transition: all 0.14s; text-align: center;
}
.strat-goal span strong { display: block; font-size: 14px; }
.strat-goal span small { color: var(--text-3); font-size: 12px; }
.strat-goal input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.strat-plan-actions { display: flex; gap: 8px; }
.strat-pillars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.strat-pillar { border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); }
.strat-pillar-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.strat-pillar-name { font-weight: 700; font-size: 14.5px; }
.strat-pillar-pct { font-weight: 800; color: var(--accent-dark); font-size: 15px; }
.strat-pillar-bar { height: 8px; border-radius: 999px; background: var(--border-soft); overflow: hidden; margin-bottom: 8px; }
.strat-pillar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--violet)); }
.strat-pillar-desc { font-size: 13px; color: var(--text-2); }
.strat-cadence { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.strat-day { border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px 8px; background: var(--surface-2); min-height: 110px; }
.strat-day-name { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); text-align: center; margin-bottom: 8px; }
.strat-slot { display: block; font-size: 11.5px; font-weight: 650; background: var(--accent-soft); color: var(--accent-dark); border-radius: 7px; padding: 4px 6px; margin-bottom: 5px; text-align: center; }
.strat-day-off { display: block; font-size: 11.5px; color: var(--text-3); text-align: center; padding: 8px 0; }
.strat-tags { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.strat-tagset { border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.strat-tagset-name { font-weight: 700; font-size: 13.5px; color: var(--accent-dark); margin-bottom: 8px; }
.strat-tagset-tags { font-size: 13px; color: var(--text-2); word-break: break-word; line-height: 1.7; }
.strat-checklist { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.strat-checklist li { display: flex; gap: 10px; font-size: 13.5px; align-items: flex-start; }
.strat-checklist li::before { content: ""; width: 18px; height: 18px; border-radius: 6px; border: 2px solid #c9cdf0; flex-shrink: 0; margin-top: 2px; }
.strat-timeline { display: flex; flex-direction: column; gap: 0; }
.strat-ms { display: flex; gap: 12px; padding: 10px 0; }
.strat-ms-dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--violet)); flex-shrink: 0; margin-top: 4px; box-shadow: 0 0 0 4px var(--accent-soft); }
.strat-ms-body { border-left: 2px solid var(--border-soft); margin-left: -18px; padding-left: 24px; padding-bottom: 6px; }
.strat-ms:last-child .strat-ms-body { border-left-color: transparent; }
.strat-ms-at { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-dark); }
.strat-ms-text { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }

/* ============ Empty states ============ */
.empty-hero { text-align: center; padding: 64px 32px !important; }
.empty-hero-icon { width: 72px; height: 72px; border-radius: 22px; background: linear-gradient(135deg, var(--accent), var(--violet)); display: grid; place-items: center; margin: 0 auto 20px; box-shadow: 0 14px 30px -10px rgba(99, 102, 241, 0.6); }
.empty-hero-icon svg { width: 34px; height: 34px; stroke: #fff; }
.empty-hero-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.empty-hero-sub { color: var(--text-2); font-size: 14.5px; max-width: 440px; margin: 0 auto 24px; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; border-radius: 12px; }
.empty-cal-note { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 16px 6px; color: var(--text-3); font-size: 13.5px; }
.empty-cal-note svg { width: 20px; height: 20px; stroke: #c3c7de; flex-shrink: 0; }

/* ============ Bulk upload ============ */
.bulk-dropzone { margin-bottom: 18px; }
.bulk-apply { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.bulk-schedule { border: 1px solid var(--border-soft); border-radius: var(--radius); margin-bottom: 18px; }
.bulk-inline { display: inline-block; width: 76px; padding: 6px 10px; margin: 0 4px; text-align: center; }
.bulk-radio { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.bulk-radio input[type="radio"] { margin-top: 4px; accent-color: var(--accent); width: 17px; height: 17px; flex-shrink: 0; }
#bulk-rows { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.bulk-row { display: flex; gap: 16px; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); transition: border-color 0.15s; }
.bulk-row:hover { border-color: #c9cdf0; }
.bulk-row.done { border-color: #bbe7cd; background: #f6fdf9; }
.bulk-thumb { width: 96px; height: 96px; border-radius: 12px; overflow: hidden; flex-shrink: 0; background: var(--border-soft); display: grid; place-items: center; }
.bulk-thumb img, .bulk-thumb video { width: 100%; height: 100%; object-fit: cover; }
.bulk-body { flex: 1; min-width: 0; }
.bulk-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bulk-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-remove { border: none; background: var(--border-soft); color: var(--text-2); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; flex-shrink: 0; }
.bulk-remove:hover { background: var(--red-soft); color: var(--red); }
.bulk-grid { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 12px; }
.bulk-grid .field { margin-bottom: 8px; }
.bulk-note { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.bulk-when-label { font-size: 12.5px; color: var(--accent-dark); font-weight: 650; margin-top: 6px; }
.bulk-status { font-size: 13px; font-weight: 650; margin-top: 8px; min-height: 20px; }
.bulk-status-run { color: var(--accent-dark); }
.bulk-status-ok { color: var(--green); }
.bulk-status-err { color: var(--red); font-weight: 550; }
.bulk-empty { text-align: center; padding: 34px 20px; color: var(--text-3); border: 1.5px dashed var(--border); border-radius: var(--radius); margin-bottom: 18px; }
.bulk-empty svg { width: 38px; height: 38px; stroke: #c3c7de; margin: 0 auto 10px; display: block; }
.bulk-summary { margin-top: 14px; font-size: 14px; font-weight: 650; text-align: center; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); }

/* ============ New-component responsive ============ */
@media (max-width: 1280px) {
  .form-grid-3 { grid-template-columns: 1.3fr 1fr; }
  .studio-card { grid-column: 1 / -1; position: static; }
  .studio-list { display: grid; grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1020px) {
  .form-grid-3 { grid-template-columns: 1fr; }
  .studio-list { display: flex; }
  .strat-cadence { grid-template-columns: repeat(7, minmax(120px, 1fr)); overflow-x: auto; }
  .strat-tags { grid-template-columns: 1fr; }
  .bulk-apply { grid-template-columns: 1fr; }
  .bulk-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .ob-lbl { display: none; }
  .ob-progress { justify-content: center; }
  .strat-pillars { grid-template-columns: 1fr; }
  .strat-goals { grid-template-columns: 1fr; }
  .bulk-row { flex-direction: column; }
  .bulk-thumb { width: 100%; height: 150px; }
  .bulk-grid { grid-template-columns: 1fr; }
  .heat-cta { flex-direction: column; text-align: center; }
  .strat-plan-actions { width: 100%; }
  .empty-hero { padding: 44px 20px !important; }
}
