/* ================================================================
   TEGA Publisher — styles.css
   Vanilla CSS, sin frameworks
   ================================================================ */

/* ---- Reset & Variables --------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:      #ffffff;
  --bg2:     #f6f5f2;
  --bg3:     #eeedea;
  --text:    #1a1918;
  --text2:   #56544e;
  --text3:   #8a8880;
  --border:  rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --blue:    #185FA5;
  --blue-bg: #E6F1FB;
  --blue-t:  #0C447C;
  --green:   #3B6D11;
  --green-bg:#EAF3DE;
  --amber:   #BA7517;
  --amber-bg:#FAEEDA;
  --red:     #A32D2D;
  --red-bg:  #FCEBEB;
  --radius:  8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #1c1b19;
    --bg2:     #242320;
    --bg3:     #2c2b28;
    --text:    #e8e6e0;
    --text2:   #a8a69e;
    --text3:   #6a6860;
    --border:  rgba(255,255,255,0.08);
    --border2: rgba(255,255,255,0.14);
    --blue-bg: #0c2a4a;
    --blue:    #5ba3e0;
    --blue-t:  #8fc3f0;
    --green-bg:#1a2e0a;
    --green:   #7dbf4a;
    --amber-bg:#2e1e04;
    --amber:   #e8a84a;
    --red-bg:  #2e0a0a;
    --red:     #e87070;
  }
}

html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); }
#app { height: 100%; }

/* ---- Login --------------------------------------------------- */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg2);
}
.login-card {
  background: var(--bg); border: 0.5px solid var(--border2);
  border-radius: var(--radius-lg); padding: 40px;
  width: 100%; max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.login-logo { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.login-sub  { font-size: 12px; color: var(--text3); margin-bottom: 32px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; }
.form-group input {
  width: 100%; padding: 9px 12px; border: 0.5px solid var(--border2);
  border-radius: var(--radius); background: var(--bg2); color: var(--text);
  font-size: 14px; font-family: var(--font); outline: none; transition: border-color .15s;
}
.form-group input:focus { border-color: var(--blue); }
.btn-login {
  width: 100%; padding: 10px; background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; margin-top: 8px; font-family: var(--font); transition: opacity .15s;
}
.btn-login:hover { opacity: .88; }
.btn-login:disabled { opacity: .5; cursor: default; }
.login-error {
  background: var(--red-bg); color: var(--red); border-radius: var(--radius);
  padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}

/* ---- App Shell ----------------------------------------------- */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* ---- Sidebar ------------------------------------------------- */
.sidebar {
  width: 200px; flex-shrink: 0; background: var(--bg2);
  border-right: 0.5px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-logo { padding: 16px; border-bottom: 0.5px solid var(--border); }
.sidebar-logo-title { font-size: 13px; font-weight: 600; color: var(--text); }
.sidebar-logo-sub   { font-size: 11px; color: var(--text3); margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 13px; color: var(--text2);
  cursor: pointer; border-right: 2px solid transparent;
  transition: background .12s, color .12s;
  user-select: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--bg3); color: var(--text); font-weight: 500; border-right-color: var(--blue); }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.nav-dot.blue  { background: var(--blue); }
.nav-dot.green { background: var(--green); }
.nav-dot.amber { background: var(--amber); }
.nav-badge {
  margin-left: auto; background: var(--amber-bg); color: var(--amber);
  font-size: 10px; padding: 1px 6px; border-radius: 100px; font-weight: 600;
}
.sidebar-user {
  padding: 12px 16px; border-top: 0.5px solid var(--border);
  font-size: 11px; color: var(--text3);
  display: flex; align-items: center; justify-content: space-between;
}
.btn-logout {
  font-size: 11px; color: var(--text3); background: none;
  border: none; cursor: pointer; padding: 2px 6px;
  border-radius: 4px; font-family: var(--font);
}
.btn-logout:hover { color: var(--red); background: var(--red-bg); }

/* ---- Main area ---------------------------------------------- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  padding: 12px 20px; border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 500; }
.topbar-actions { display: flex; gap: 8px; }

/* ---- Buttons ------------------------------------------------- */
.btn {
  font-size: 12px; padding: 7px 14px; border-radius: var(--radius);
  cursor: pointer; border: 0.5px solid var(--border2); background: var(--bg);
  color: var(--text); font-family: var(--font); transition: background .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg2); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-t); border-color: var(--blue-t); }
.btn-sm { font-size: 11px; padding: 5px 10px; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

/* ---- Stats row ---------------------------------------------- */
.stats-row {
  display: flex; gap: 10px; padding: 12px 20px;
  border-bottom: 0.5px solid var(--border); flex-shrink: 0;
}
.stat-card {
  flex: 1; background: var(--bg2); border-radius: var(--radius);
  padding: 10px 14px;
}
.stat-label { font-size: 11px; color: var(--text3); margin-bottom: 3px; }
.stat-val   { font-size: 22px; font-weight: 500; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--text2); margin-top: 2px; }
.stat-val.amber { color: var(--amber); }
.stat-val.blue  { color: var(--blue); }

/* ---- Content split ------------------------------------------ */
.content-split { flex: 1; display: flex; overflow: hidden; }

/* ---- Video list --------------------------------------------- */
.video-list {
  width: 310px; flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.list-header {
  padding: 8px 14px; border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; background: var(--bg);
}
.list-header-label { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; }
.search-wrap { padding: 8px 14px; border-bottom: 0.5px solid var(--border); flex-shrink: 0; }
.search-input {
  width: 100%; padding: 7px 10px; border: 0.5px solid var(--border2);
  border-radius: var(--radius); background: var(--bg2); color: var(--text);
  font-size: 13px; font-family: var(--font); outline: none;
}
.search-input:focus { border-color: var(--blue); }
.video-items { flex: 1; overflow-y: auto; }
.video-row {
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  border-bottom: 0.5px solid var(--border); cursor: pointer;
  transition: background .1s;
}
.video-row:hover    { background: var(--bg2); }
.video-row.selected { background: var(--blue-bg); }
.thumb {
  width: 56px; height: 40px; border-radius: 5px;
  background: #1a1a1a; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-play {
  width: 0; height: 0;
  border-left: 9px solid rgba(255,255,255,.85);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  margin-left: 2px;
  position: relative; z-index: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
.video-info { flex: 1; min-width: 0; }
.video-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ---- Badges -------------------------------------------------- */
.badge {
  font-size: 10px; padding: 2px 8px; border-radius: 100px;
  flex-shrink: 0; font-weight: 500; white-space: nowrap;
}
.badge-new       { background: var(--bg3); color: var(--text3); border: 0.5px solid var(--border2); }
.badge-transcribed { background: var(--blue-bg); color: var(--blue); }
.badge-generating{ background: var(--amber-bg); color: var(--amber); }
.badge-ready     { background: var(--green-bg); color: var(--green); }
.badge-scheduled { background: var(--blue-bg); color: var(--blue); }
.badge-error     { background: var(--red-bg); color: var(--red); }

/* ---- Detail panel ------------------------------------------- */
.detail-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.detail-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 13px; flex-direction: column; gap: 10px;
}
.detail-top {
  padding: 14px 20px; border-bottom: 0.5px solid var(--border); flex-shrink: 0;
}
.detail-title { font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.detail-meta  { font-size: 12px; color: var(--text3); margin-bottom: 12px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Tabs ---------------------------------------------------- */
.tabs {
  display: flex; border-bottom: 0.5px solid var(--border);
  flex-shrink: 0; padding: 0 20px; gap: 2px;
}
.tab {
  font-size: 13px; padding: 10px 14px; color: var(--text2);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .12s; white-space: nowrap;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }
.tab-content { flex: 1; overflow-y: auto; }

/* ---- Posts tab ---------------------------------------------- */
.posts-list { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.post-card {
  border: 0.5px solid var(--border2); border-radius: var(--radius);
  padding: 12px 14px;
}
.post-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.platform-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.platform-name { font-size: 11px; font-weight: 500; color: var(--text2); flex: 1; }
.post-body {
  font-size: 13px; color: var(--text); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.post-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--border);
}
.post-chars  { font-size: 11px; color: var(--text3); }
.post-sched  { font-size: 11px; color: var(--blue); }
.post-edit-area {
  width: 100%; border: 0.5px solid var(--border2); border-radius: var(--radius);
  padding: 8px 10px; font-size: 13px; line-height: 1.6; color: var(--text);
  background: var(--bg2); font-family: var(--font); resize: vertical;
  min-height: 80px; outline: none; transition: border-color .15s;
}
.post-edit-area:focus { border-color: var(--blue); }

/* ---- Images tab --------------------------------------------- */
.images-section { padding: 14px 20px; }
.img-section-title { font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 10px; }
.prompts-row { display: flex; gap: 8px; margin-bottom: 18px; }
.prompt-card {
  flex: 1; border: 0.5px solid var(--border2); border-radius: var(--radius);
  padding: 10px; min-width: 0;
}
.prompt-label {
  font-size: 10px; font-weight: 500; color: var(--text3);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.prompt-preview {
  width: 100%; background: var(--bg3); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text3);
}
.prompt-preview.sq { height: 64px; }
.prompt-preview.hz { height: 40px; }
.prompt-preview.vt { height: 88px; }
.prompt-text {
  font-size: 11px; color: var(--text2); line-height: 1.4; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.prompt-copy {
  margin-top: 6px; font-size: 10px; cursor: pointer; color: var(--blue);
  background: none; border: none; font-family: var(--font); padding: 0;
}
.prompt-copy:hover { text-decoration: underline; }

/* ---- YouTube tab -------------------------------------------- */
.yt-section { padding: 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.yt-field label { font-size: 11px; color: var(--text2); display: block; margin-bottom: 4px; }
.yt-field input, .yt-field textarea {
  width: 100%; border: 0.5px solid var(--border2); border-radius: var(--radius);
  padding: 8px 10px; font-size: 13px; color: var(--text); background: var(--bg2);
  font-family: var(--font); outline: none; transition: border-color .15s;
}
.yt-field input:focus, .yt-field textarea:focus { border-color: var(--blue); }
.yt-field textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

/* ---- Transcript modal --------------------------------------- */
.transcript-area {
  width: 100%; min-height: 200px; border: 0.5px solid var(--border2);
  border-radius: var(--radius); padding: 10px 12px; font-size: 13px;
  color: var(--text); background: var(--bg2); font-family: var(--mono);
  line-height: 1.6; resize: vertical; outline: none;
}
.transcript-area:focus { border-color: var(--blue); }

/* ---- Calendar ---------------------------------------------- */
.calendar-wrap { flex: 1; overflow-y: auto; padding: 20px; }
.cal-nav {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
}
.cal-title { font-size: 15px; font-weight: 500; flex: 1; }
.cal-grid  { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-head  {
  background: var(--bg2); padding: 8px 6px;
  font-size: 11px; font-weight: 500; color: var(--text3);
  text-align: center; text-transform: uppercase;
}
.cal-day {
  background: var(--bg); padding: 8px 6px; min-height: 80px;
  cursor: pointer; transition: background .1s;
}
.cal-day:hover    { background: var(--bg2); }
.cal-day.empty    { background: var(--bg2); cursor: default; }
.cal-day.today    { background: var(--blue-bg); }
.cal-day-num      { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.cal-day.today .cal-day-num { color: var(--blue); font-weight: 600; }
.cal-dots         { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dot          { width: 8px; height: 8px; border-radius: 50%; }

/* ---- Settings ---------------------------------------------- */
.settings-wrap { flex: 1; overflow-y: auto; padding: 20px; }
.settings-section { margin-bottom: 28px; }
.settings-title { font-size: 13px; font-weight: 500; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 0.5px solid var(--border); }
.settings-row { margin-bottom: 12px; }
.settings-row label { font-size: 12px; color: var(--text2); display: block; margin-bottom: 4px; }
.settings-row input, .settings-row textarea, .settings-row select {
  width: 100%; border: 0.5px solid var(--border2); border-radius: var(--radius);
  padding: 8px 10px; font-size: 13px; color: var(--text); background: var(--bg2);
  font-family: var(--font); outline: none; transition: border-color .15s;
}
.settings-row input:focus, .settings-row textarea:focus { border-color: var(--blue); }
.settings-row textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
.settings-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ---- Schedule config --------------------------------------- */
.schedule-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.schedule-table th, .schedule-table td {
  padding: 6px 10px; text-align: left;
  border-bottom: 0.5px solid var(--border); font-size: 12px;
}
.schedule-table th { color: var(--text3); font-weight: 500; }
.schedule-table select, .schedule-table input[type="time"] {
  border: 0.5px solid var(--border2); border-radius: 4px;
  padding: 4px 6px; font-size: 12px; background: var(--bg2); color: var(--text);
  font-family: var(--font);
}

/* ---- Modal -------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal {
  background: var(--bg); border-radius: var(--radius-lg);
  border: 0.5px solid var(--border2);
  width: 100%; max-width: 520px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.16);
}
.modal-header {
  padding: 18px 20px 14px; border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title    { font-size: 15px; font-weight: 500; }
.modal-close    { font-size: 18px; cursor: pointer; color: var(--text3); background: none; border: none; font-family: var(--font); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body     { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-footer   { padding: 14px 20px; border-top: 0.5px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ---- Upload ------------------------------------------------- */
.upload-zone {
  border: 1.5px dashed var(--border2); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s; margin-bottom: 14px;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--blue); background: var(--blue-bg); }
.upload-zone-icon  { font-size: 28px; margin-bottom: 8px; }
.upload-zone-text  { font-size: 13px; color: var(--text2); }
.upload-zone-sub   { font-size: 11px; color: var(--text3); margin-top: 4px; }
.upload-progress-wrap { margin: 14px 0; }
.progress-bar-bg {
  height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden;
}
.progress-bar {
  height: 100%; background: var(--blue); border-radius: 3px;
  transition: width .3s; width: 0%;
}
.progress-label { font-size: 12px; color: var(--text2); margin-top: 6px; }
.upload-file-name {
  font-size: 12px; color: var(--text); background: var(--bg2);
  padding: 8px 12px; border-radius: var(--radius); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.upload-file-icon { color: var(--blue); }

/* ---- Transcript section in upload ------------------------- */
.transcript-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text2); cursor: pointer;
  margin-bottom: 10px; user-select: none;
}
.transcript-toggle input { cursor: pointer; }

/* ---- Today panel ------------------------------------------ */
.today-wrap { flex: 1; overflow-y: auto; padding: 20px; }
.today-item {
  border: 0.5px solid var(--border2); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: flex-start; gap: 14px;
}
.today-platform-badge {
  width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 13px;
  font-weight: 600; color: #fff; flex-shrink: 0;
}
.today-content { flex: 1; min-width: 0; }
.today-video-name { font-size: 12px; font-weight: 500; margin-bottom: 3px; }
.today-time       { font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.today-text       { font-size: 13px; color: var(--text); line-height: 1.5; white-space: pre-wrap; }

/* ---- Spinner ----------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border2);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin .6s linear infinite; display: inline-block;
}
.spinner-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--text3); gap: 10px; font-size: 13px;
}

/* ---- Toast ------------------------------------------------- */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 2000;
}
.toast {
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: slide-in .2s ease;
  max-width: 340px;
}
.toast.error { background: var(--red); color: #fff; }
.toast.success { background: var(--green); color: #fff; }
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Misc -------------------------------------------------- */
.divider { height: 0.5px; background: var(--border); margin: 14px 0; }
.text-sm { font-size: 12px; color: var(--text2); }
.text-muted { color: var(--text3); }
.gap { display: flex; gap: 8px; align-items: center; }
.flex-1 { flex: 1; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }

/* ---- Mobile hamburger --------------------------------------- */
.mobile-header {
  display: none; padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  align-items: center; gap: 10px; background: var(--bg);
  position: sticky; top: 0; z-index: 100;
}
.hamburger {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--text); padding: 4px 8px; line-height: 1; font-family: var(--font);
}
.mobile-header-title { font-size: 14px; font-weight: 500; color: var(--text); }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ================================================================
   RESPONSIVE — Tablet (≤900px)
   ================================================================ */
@media (max-width: 900px) {
  .content-split { flex-direction: column; }
  .video-list { width: 100%; max-height: 200px; border-right: none; border-bottom: 0.5px solid var(--border); }
  .detail-panel { min-height: 0; }
  .stats-row { flex-wrap: wrap; }
  .stat-card { min-width: calc(50% - 8px); }
  .cal-grid { font-size: 11px; }
  .cal-day { min-height: 60px; padding: 5px 4px; }
  .prompts-row { flex-direction: column; }
}

/* ================================================================
   RESPONSIVE — Mobile (≤640px)
   ================================================================ */
@media (max-width: 640px) {
  /* Show mobile header, hide sidebar */
  .mobile-header { display: flex; }
  .sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0;
    width: 240px; z-index: 200;
    transition: left .25s ease;
    box-shadow: none;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.15); }
  .shell { flex-direction: column; }
  .main { width: 100%; }

  /* Topbar */
  .topbar { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .topbar-title { font-size: 14px; width: 100%; }
  .topbar-actions { width: 100%; justify-content: flex-end; }

  /* Stats */
  .stats-row { padding: 8px 12px; gap: 6px; flex-wrap: wrap; }
  .stat-card { flex: 1 1 calc(50% - 6px); min-width: 0; padding: 8px 10px; }
  .stat-val { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .stat-sub { font-size: 10px; }

  /* Content split — stack */
  .content-split { flex-direction: column; }
  .video-list { width: 100%; max-height: 180px; border-right: none; border-bottom: 0.5px solid var(--border); }
  .search-wrap { padding: 6px 10px; }
  .video-row { padding: 8px 10px; }

  /* Detail panel */
  .detail-top { padding: 12px 14px; }
  .detail-title { font-size: 13px; }
  .detail-actions { flex-wrap: wrap; gap: 6px; }
  .detail-actions .btn { font-size: 11px; padding: 5px 8px; }

  /* Tabs */
  .tabs { padding: 0 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { font-size: 12px; padding: 8px 10px; white-space: nowrap; }
  .tab-content { overflow-x: hidden; }

  /* Posts */
  .posts-list { padding: 10px 12px; }
  .post-card { padding: 10px; }
  .post-body { font-size: 12px; }
  .post-edit-area { font-size: 12px; min-height: 60px; }

  /* Images tab */
  .images-section { padding: 10px 12px; }
  .img-section-title { font-size: 12px; }
  .images-section .prompt-card { min-width: calc(50% - 6px) !important; }

  /* Calendar */
  .calendar-wrap { padding: 12px; }
  .cal-nav { flex-wrap: wrap; gap: 8px; }
  .cal-title { font-size: 13px; }
  .cal-grid { gap: 0.5px; }
  .cal-head { padding: 5px 2px; font-size: 10px; }
  .cal-day { min-height: 48px; padding: 4px 3px; }
  .cal-day-num { font-size: 11px; }
  .cal-dot { width: 6px; height: 6px; }

  /* Settings */
  .settings-wrap { padding: 12px; }
  .settings-row input, .settings-row textarea, .settings-row select { font-size: 14px; }
  .schedule-table { font-size: 11px; }
  .schedule-table th, .schedule-table td { padding: 5px 4px; }

  /* Today */
  .today-wrap { padding: 12px; }
  .today-item { padding: 10px 12px; gap: 10px; }
  .today-text { font-size: 12px; }

  /* Modal */
  .modal-overlay { padding: 8px; }
  .modal { max-height: 95vh; }
  .modal-header { padding: 12px 14px 10px; }
  .modal-title { font-size: 14px; }
  .modal-body { padding: 12px 14px; }
  .modal-footer { padding: 10px 14px; }

  /* Upload */
  .upload-zone { padding: 20px 14px; }
  .upload-zone-icon { font-size: 22px; }
  .upload-zone-text { font-size: 12px; }

  /* Login */
  .login-card { padding: 28px 20px; margin: 0 12px; }

  /* Buttons */
  .btn { font-size: 11px; padding: 6px 10px; }
  .btn-primary { font-size: 11px; }

  /* Toast */
  .toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { max-width: none; font-size: 12px; }
}
