/* ═══════════════════════════════════════════════════════════════════════════
   Centro de Trabajo Comunicación UNSL-VM — Main Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Custom properties ───────────────────────────────────────────────────── */
:root {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --surface-2: #242424;
  --surface-3: #2e2e2e;
  --border:    #333333;
  --border-l:  #444444;

  --accent:       #e63946;
  --accent-dark:  #b52530;
  --accent-glow:  rgba(230, 57, 70, .25);

  --gold:    #ffd166;
  --success: #2ec4b6;
  --warning: #ff9f1c;

  --txt:   #f0f0f0;
  --txt-2: #a0a0a0;
  --txt-3: #666666;

  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 4px 20px rgba(0,0,0,.5);
  --shadow-sm: 0 2px 8px  rgba(0,0,0,.4);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .85em;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-8   { margin-top: 8px; }

/* ══════════════════════════════════════════════════════════ LOGIN SCREEN ══ */
#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(230,57,70,.12) 0%, var(--bg) 70%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.login-logo {
  font-size: 3rem;
  margin-bottom: 8px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

.login-sub {
  color: var(--txt-2);
  font-size: .9rem;
  text-align: center;
  margin-bottom: 20px;
}

#login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-error {
  color: #f87171;
  font-size: .85rem;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════ APP HEADER ══ */
#screen-app { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  justify-content: flex-end;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
}

.header-icon { font-size: 1.4rem; }

.brand-title {
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-sub {
  font-size: .75rem;
  color: var(--txt-2);
  line-height: 1.2;
}

.btn-back {
  background: transparent;
  border: 1px solid var(--border-l);
  color: var(--txt-2);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .85rem;
  white-space: nowrap;
  transition: all .15s;
}
.btn-back:hover { background: var(--surface-2); color: var(--txt); }

/* Compact toggle button */
.btn-compact {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-3);
  padding: 5px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  transition: all .15s;
}
.btn-compact:hover { border-color: var(--accent); color: var(--accent); }
body.compact .btn-compact { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* History button */
.btn-history {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-3);
  padding: 5px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  transition: all .15s;
}
.btn-history:hover { border-color: var(--gold); color: var(--gold); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-3);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8rem;
  white-space: nowrap;
  transition: all .15s;
  text-align: right;
}
.btn-logout:hover { border-color: var(--accent); color: var(--accent); }

/* ══════════════════════════════════════════════════════════ APP MAIN ══ */
.app-main {
  flex: 1;
  padding: 32px 28px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════ SCREEN TRANSITIONS ══ */
@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-enter {
  animation: screenFadeIn 0.3s ease forwards;
}

/* ══════════════════════════════════════════════════════════ HOME SCREEN ══ */
.home-question {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 36px;
  color: var(--txt);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  cursor: pointer;
  transition: all .2s;
  color: var(--txt);
  font-family: var(--font);
}

.option-card:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.option-icon { font-size: 2.2rem; }

.option-label {
  font-size: .9rem;
  font-weight: 600;
  text-align: center;
}

.option-card--otro {
  border-style: dashed;
  border-color: var(--border-l);
}

.option-card--otro:hover {
  border-style: solid;
  border-color: var(--gold);
  box-shadow: 0 6px 24px rgba(255,209,102,.2);
}

.option-card--otro .option-icon { color: var(--gold); }

/* ══════════════════════════════════════════════════════════ SUBCHOICE ══ */
.subchoice-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 40px 0;
}

.subchoice-screen h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.subchoice-grid {
  display: flex;
  gap: 20px;
}

.subchoice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 36px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--txt);
  transition: all .2s;
}

.subchoice-card:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.subchoice-card .sc-icon { font-size: 2rem; }
.subchoice-card .sc-label { font-size: .95rem; font-weight: 600; }

/* ══════════════════════════════════════════════════════════ WORK HEADER ══ */
.work-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.work-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.work-badge {
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: .05em;
}

/* ══════════════════════════════════════════════════════════ WORK LAYOUT ══ */
.work-layout {
  display: grid;
  grid-template-columns: 300px 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.controls-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  position: sticky;
  top: 76px;
}

/* ══════════════════════════════════════════════════════════ PREVIEW PANEL ══ */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: var(--txt-2);
  padding: 0 2px;
}

.preview-bar span:first-child { font-weight: 600; color: var(--txt); }

.px-label { color: var(--txt-3); font-size: .75rem; }

/* ── Canvas wrapper ──────────────────────────────────────────────────────── */
.canvas-wrap {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.canvas-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: 520px;
  width: auto;
  height: auto;
}

.canvas-wrap canvas.has-photo  { cursor: grab; user-select: none; }
.canvas-wrap canvas.grabbing   { cursor: grabbing !important; }

/* Canvas activo en modo desacoplado */
.canvas-wrap.editing-active {
  box-shadow: 0 0 0 2px var(--accent);
}

.edit-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 99px;
  pointer-events: none;
}

/* ── Couple / Decouple row ───────────────────────────────────────────────── */
.couple-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.btn-secondary.decoupled {
  border-color: var(--gold);
  color: var(--gold);
}

.edit-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--txt-2);
}

.edit-pills {
  display: flex;
  gap: 3px;
  background: var(--surface-3);
  border-radius: var(--radius);
  padding: 3px;
}

.edit-pill {
  background: transparent;
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: .78rem;
  font-family: var(--font);
  color: var(--txt-2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.edit-pill.active {
  background: var(--surface);
  color: var(--txt);
  box-shadow: var(--shadow-sm);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--txt-3);
  pointer-events: none;
  padding: 24px;
}

.canvas-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 2px dashed var(--border-l);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  width: 100%;
  max-width: 280px;
}

.canvas-placeholder span { font-size: 2.4rem; opacity: .45; }
.canvas-placeholder p    { font-size: .82rem; text-align: center; color: var(--txt-3); line-height: 1.5; }
.canvas-placeholder p strong { color: var(--txt-2); font-weight: 600; }

/* Download row under canvases */
.dl-row {
  display: flex;
  gap: 8px;
}

.dl-row .btn-primary { flex: 1; font-size: .82rem; padding: 10px 8px; }

/* ── Panel action buttons (copy, share, download per canvas) ─────────────── */
.panel-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.panel-actions .btn-sm {
  flex: 1;
  font-size: .78rem !important;
  padding: 7px 6px !important;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════ FIELD GROUPS ══ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group > label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--txt-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.field-group textarea,
.field-group input[type="text"],
.field-group input[type="password"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--txt);
  font-family: var(--font);
  font-size: .9rem;
  padding: 9px 12px;
  width: 100%;
  resize: vertical;
  transition: border-color .15s;
}

.field-group textarea:focus,
.field-group input[type="text"]:focus,
.field-group input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

.field-group textarea { min-height: 72px; }

.sub-label {
  font-size: .75rem;
  color: var(--txt-2);
  display: block;
  margin-bottom: 2px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
}

.range-val {
  font-size: .75rem;
  color: var(--txt-2);
  min-width: 36px;
  text-align: right;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════ RESIZE HANDLES ══ */
.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .1s;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.canvas-wrap.has-media .resize-handle {
  opacity: 1;
  pointer-events: auto;
}
.canvas-wrap.has-media:hover .resize-handle {
  transform: scale(1.2);
}
.resize-handle--tl { top: 6px;    left: 6px;    cursor: nw-resize; }
.resize-handle--tr { top: 6px;    right: 6px;   cursor: ne-resize; }
.resize-handle--bl { bottom: 6px; left: 6px;    cursor: sw-resize; }
.resize-handle--br { bottom: 6px; right: 6px;   cursor: se-resize; }

/* canvas drag hint */
.canvas-drag-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  color: rgba(255,255,255,.8);
  font-size: .65rem;
  padding: 3px 8px;
  border-radius: 99px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
  z-index: 15;
}
.canvas-wrap.has-media:hover .canvas-drag-hint { opacity: 1; }

/* Number input for font size */
.fs-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--txt);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 600;
  padding: 7px 10px;
  width: 100%;
  transition: border-color .15s;
}
.fs-input:focus { outline: none; border-color: var(--accent); }
.fs-input::-webkit-inner-spin-button { opacity: 1; cursor: pointer; }

/* Text section header (Texto 1 / Texto 2) */
.text-section {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.text-section-header {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

input[type="color"].color-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  padding: 3px 4px;
}

.field-hint {
  font-size: .75rem;
  color: var(--txt-3);
  line-height: 1.4;
}

/* Check label */
.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: .88rem;
  color: var(--txt-2);
}

.check-label input[type="checkbox"] { accent-color: var(--accent); }

/* ── Adjust controls ─────────────────────────────────────────────────────── */
.adjust-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

/* ── Template upload slots (OTRO) ───────────────────────────────────────── */
.tpl-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tpl-upload-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  align-items: flex-start;
}

.tpl-status {
  font-size: .72rem;
  color: var(--success);
  word-break: break-all;
}

/* ══════════════════════════════════════════════════════════ BUTTONS ══ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-weight: 600;
  font-size: .9rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-align: center;
}

.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-3);
  color: var(--txt);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-weight: 500;
  font-size: .88rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
}

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

.btn-danger {
  background: rgba(230,57,70,.15);
  color: var(--accent);
  border: 1px solid rgba(230,57,70,.3);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
  font-size: .88rem;
}

.btn-danger:hover { background: rgba(230,57,70,.25); }

.btn-sm { padding: 6px 12px !important; font-size: .8rem !important; }

.full-width { width: 100%; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════ DROP ZONES ══ */
.drop-zone {
  border: 2px dashed var(--border-l);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  color: var(--txt-2);
  font-size: .85rem;
}

.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--txt);
}

.drop-zone.has-file {
  border-color: var(--success);
  background: rgba(46,196,182,.06);
}

.dz-icon { font-size: 1.6rem; display: block; margin-bottom: 4px; }
.dz-hint { font-size: .75rem; color: var(--txt-3); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════ REEL TABS ══ */
.reel-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 0;
}

.reel-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--txt-2);
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.reel-tab-btn.active {
  background: var(--surface-3);
  color: var(--txt);
}

.reel-tab-pane { display: none; }
.reel-tab-pane.active { display: flex; flex-direction: column; gap: 14px; }

/* ══════════════════════════════════════════════════════════ PROGRESS ══ */
.progress-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.progress-label { font-size: .82rem; color: var(--txt-2); }
.progress-track { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.progress-pct   { font-size: .78rem; color: var(--txt-3); text-align: right; }

/* ══════════════════════════════════════════════════════════ TIME INPUT ══ */
.time-input {
  font-family: 'JetBrains Mono', monospace !important;
  text-align: center;
  letter-spacing: .1em;
}

/* ══════════════════════════════════════════════════════════ TOAST ══ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-3);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  padding: 12px 22px;
  font-size: .875rem;
  color: var(--txt);
  z-index: 999;
  opacity: 0;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.toast.show          { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success       { border-color: var(--success); color: var(--success); }
.toast.error         { border-color: var(--accent);  color: #f87171; }

/* ══════════════════════════════════════════════════════════ SCROLLBAR ══ */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-l); }

/* ══════════════════════════════════════════════════════════ RESPONSIVE ══ */
@media (max-width: 1100px) {
  .work-layout {
    grid-template-columns: 280px 1fr 1fr;
    gap: 14px;
  }
}

@media (max-width: 860px) {
  .work-layout {
    grid-template-columns: 1fr;
  }
  .controls-col {
    position: static;
    max-height: none;
  }
  .app-main { padding: 20px 16px; }
}

/* ══════════════════════════════════════════════════════════════════ HOME REDESIGN ══ */
.home-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 32px;
  gap: 20px;
}

.home-greeting {
  font-size: .85rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.home-tagline {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--txt);
}

.home-welcome-stats {
  display: flex;
  gap: 24px;
}

.home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  min-width: 80px;
}

.home-stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.home-stat-label {
  font-size: .7rem;
  color: var(--txt-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
}

.home-section {
  margin-bottom: 28px;
}

.home-section-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--txt-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hs-icon { font-size: 1rem; }

/* Home: recent thumbs */
.home-recent-thumbs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.home-recent-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}

.home-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-recent-thumb:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

/* Option card description */
.option-desc {
  font-size: .72rem;
  color: var(--txt-3);
  text-align: center;
  margin-top: -4px;
}

/* ══════════════════════════════════════════════════ TEXT ALIGN/WEIGHT BTNS ══ */
.text-controls-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.align-btns, .weight-btns {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.align-btn, .weight-btn {
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: .78rem;
  font-family: var(--font);
  color: var(--txt-2);
  cursor: pointer;
  transition: all .12s;
  line-height: 1;
}

.align-btn.active, .weight-btn.active {
  background: var(--accent);
  color: #fff;
}

.align-btn:hover:not(.active), .weight-btn:hover:not(.active) {
  background: var(--surface-3);
  color: var(--txt);
}

/* ══════════════════════════════════════════════════════ DATE INSERT BTN ══ */
.date-insert-btn {
  margin-top: 4px;
  font-size: .75rem !important;
}

/* ══════════════════════════════════════════════════════ UNDO INDICATOR ══ */
.undo-indicator {
  display: flex;
  gap: 8px;
  font-size: .72rem;
  color: var(--txt-3);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  align-items: center;
}

.undo-indicator span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ══════════════════════════════════════════════════ FULLSCREEN PREVIEW ══ */
.btn-fs-preview {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-3);
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  transition: all .15s;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}
.btn-fs-preview:hover { border-color: var(--accent); color: var(--accent); }

.img-fullscreen-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.img-fullscreen-modal.hidden {
  display: none !important;
}

.img-fullscreen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.9);
  backdrop-filter: blur(4px);
}

.img-fullscreen-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-fullscreen-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
}

.img-fullscreen-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--txt);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  transition: all .15s;
}
.img-fullscreen-close:hover { background: var(--accent); border-color: var(--accent); }

/* kbd shortcut hint */
kbd {
  font-size: .65rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: var(--font);
}

/* ══════════════════════════════════════════════════════ HISTORY ACTIONS ══ */
.history-drawer-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.history-thumb-date {
  font-size: .65rem;
  color: var(--txt-3);
  display: block;
  text-align: center;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

/* ══════════════════════════════════════════════════════ RESPONSIVE TABLET ══ */
@media (max-width: 1024px) {
  .work-layout {
    grid-template-columns: 260px 1fr;
  }
  .work-layout > .preview-panel:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .app-main { padding: 16px; }
  .work-layout { grid-template-columns: 1fr; }
  .home-welcome { flex-direction: column; align-items: flex-start; }
  .option-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .controls-col { max-height: none; position: static; }
  .app-header { padding: 0 12px; }
  .header-center .brand-sub { display: none; }
}

/* ══════════════════════════════════════════════════ COMPACT MODE ══ */
body.compact .app-main {
  padding: 16px 14px;
}

body.compact .controls-col {
  gap: 8px;
  padding: 12px;
  width: 240px;
}

body.compact .work-layout {
  grid-template-columns: 240px 1fr 1fr;
  gap: 12px;
}

body.compact .field-group > label {
  font-size: .72rem;
}

body.compact .field-group textarea,
body.compact .field-group input[type="text"] {
  font-size: .82rem;
  padding: 7px 10px;
}

body.compact .btn-primary,
body.compact .btn-secondary {
  padding: 8px 14px;
  font-size: .82rem;
}

body.compact .work-header {
  margin-bottom: 14px;
  padding-bottom: 10px;
}

body.compact .option-card {
  padding: 20px 14px;
  gap: 8px;
}

body.compact .option-icon { font-size: 1.8rem; }

body.compact .home-question {
  font-size: 1.3rem;
  margin-bottom: 24px;
}

/* ══════════════════════════════════════════════════ HISTORY DRAWER ══ */
.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,.5);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.history-drawer:not(.hidden) {
  transform: translateX(0);
}

/* Override .hidden to allow transform animation — we use a JS class instead */
.history-drawer.hidden {
  display: flex !important; /* keep in DOM for transition */
  transform: translateX(100%);
  pointer-events: none;
}

.history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.history-drawer-title {
  font-size: .95rem;
  font-weight: 700;
}

.history-drawer-close {
  background: transparent;
  border: none;
  color: var(--txt-3);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: all .15s;
}
.history-drawer-close:hover { background: var(--surface-2); color: var(--txt); }

.history-drawer-sub {
  font-size: .75rem;
  color: var(--txt-3);
  padding: 8px 20px 0;
  flex-shrink: 0;
}

.history-thumbs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.history-empty {
  grid-column: 1 / -1;
  color: var(--txt-3);
  font-size: .82rem;
  text-align: center;
  padding: 24px 0;
}

.history-thumb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: default;
}

.history-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.history-thumb-label {
  font-size: .7rem;
  color: var(--txt-3);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════ DRAWER BACKDROP ══ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 499;
  transition: opacity .3s;
}

.drawer-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════ PRESET CHIPS ══ */
.presets-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 0 2px;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border-l);
  border-radius: 99px;
  padding: 3px 10px 3px 12px;
  font-size: .75rem;
  color: var(--txt-2);
  cursor: pointer;
  transition: all .15s;
  max-width: 180px;
}

.preset-chip:hover {
  border-color: var(--accent);
  color: var(--txt);
}

.preset-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-del {
  background: transparent;
  border: none;
  color: var(--txt-3);
  font-size: .75rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color .15s;
}
.preset-del:hover { color: var(--accent); }

.preset-save-btn {
  background: transparent;
  border: 1px dashed var(--border-l);
  border-radius: 99px;
  color: var(--txt-3);
  font-size: .72rem;
  padding: 3px 10px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.preset-save-btn:hover { border-color: var(--success); color: var(--success); }

/* ══════════════════════════════════════════════════ CHARACTER COUNTER ══ */
.char-counter {
  font-size: .72rem;
  color: var(--txt-3);
  text-align: right;
  margin-top: 2px;
  transition: color .15s;
}

.char-counter.ok   { color: var(--success); }
.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--accent); font-weight: 600; }

/* ══════════════════════════════════════════════════ VIDEO MODAL ══ */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.video-modal.hidden {
  display: none !important;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.75);
  cursor: pointer;
}

.video-modal-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 600;
}

.video-modal-header button {
  background: transparent;
  border: none;
  color: var(--txt-3);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: all .15s;
}
.video-modal-header button:hover { background: var(--surface-2); color: var(--txt); }

.video-modal-video {
  width: 100%;
  display: block;
  background: #000;
  max-height: 60vh;
}

.video-modal-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.video-modal-actions .btn-primary  { flex: 2; }
.video-modal-actions .btn-secondary { flex: 1; }

/* ══════════════════════════════════════════════════ INSTAGRAM FRAME ══ */
.ig-frame {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.ig-frame-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.ig-frame-user {
  flex: 1;
  margin-left: 10px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--txt);
}

.ig-frame-more {
  color: var(--txt-3);
  font-size: .9rem;
  letter-spacing: .1em;
}

.ig-frame-canvas-area {
  line-height: 0;
}

.ig-frame-canvas-area .canvas-wrap {
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.ig-frame-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
}

.ig-frame-actions-left {
  display: flex;
  gap: 14px;
  font-size: 1.2rem;
}

.ig-frame-actions-left span,
.ig-frame-actions-right span {
  cursor: default;
  opacity: .6;
}

/* ══════════════════════════════════════════════════ PHONE FRAME ══ */
.phone-frame {
  background: #111;
  border: 3px solid #2a2a2a;
  border-radius: 40px;
  box-shadow: 0 0 0 1px #3a3a3a, 0 12px 48px rgba(0,0,0,.7);
  overflow: hidden;
  position: relative;
  padding: 14px 6px 10px;
}

.phone-frame-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 26px;
  background: #111;
  border-radius: 0 0 18px 18px;
  z-index: 10;
  border: 3px solid #2a2a2a;
  border-top: none;
}

.phone-frame-notch::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1e1e1e;
  border: 1px solid #333;
}

.phone-frame-canvas-area {
  border-radius: 32px;
  overflow: hidden;
  line-height: 0;
}

.phone-frame-canvas-area .canvas-wrap {
  border-radius: 0;
  border: none;
}

/* ══════════════════════════════════════════════════ VIDEO PREVIEW CONTROLS ══ */
.video-preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.vp-btn {
  background: var(--surface-3);
  border: 1px solid var(--border-l);
  color: var(--txt);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.vp-btn:hover { background: var(--border); }

.vp-seek {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
}

#rv-timecode {
  font-size: .72rem;
  color: var(--txt-3);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  min-width: 80px;
  text-align: right;
}

/* ══════════════════════════════════════════════════════ LIGHT THEME ══ */
body.light-theme {
  --bg:        #f0f2f5;
  --surface:   #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #eaedf1;
  --border:    #d4d8df;
  --border-l:  #b8bfc9;
  --txt:       #1a1d23;
  --txt-2:     #50566b;
  --txt-3:     #8a93a6;
  --shadow:    0 4px 20px rgba(0,0,0,.10);
  --shadow-sm: 0 2px 8px  rgba(0,0,0,.07);
  --accent-glow: rgba(230,57,70,.15);
}

body.light-theme .phone-frame {
  background: #e0e0e0;
  border-color: #c0c0c0;
  box-shadow: 0 0 0 1px #b0b0b0, 0 12px 48px rgba(0,0,0,.15);
}
body.light-theme .phone-frame-notch {
  background: #e0e0e0;
  border-color: #c0c0c0;
}
body.light-theme .phone-frame-notch::before { background: #ccc; border-color: #bbb; }

/* Theme toggle button */
.btn-theme {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-3);
  padding: 5px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  transition: all .15s;
}
.btn-theme:hover { border-color: var(--gold); color: var(--gold); }

/* ══════════════════════════════════════════════ HOME SECTION CATEGORIES ══ */
/* Each section gets a left-accent color for its cards */
.home-section--noticia .option-card {
  border-left: 3px solid #4361ee;
}
.home-section--noticia .option-card:hover {
  border-color: #4361ee;
  box-shadow: 0 6px 24px rgba(67,97,238,.22);
}
.home-section--noticia .home-section-title .hs-icon { color: #6c8aff; }

.home-section--video .option-card {
  border-left: 3px solid var(--success);
}
.home-section--video .option-card:hover {
  border-color: var(--success);
  box-shadow: 0 6px 24px rgba(46,196,182,.22);
}
.home-section--video .home-section-title .hs-icon { color: var(--success); }

.home-section--custom .option-card {
  border-left: 3px solid var(--gold);
}
.home-section--custom .option-card:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 24px rgba(255,209,102,.22);
}
.home-section--custom .home-section-title .hs-icon { color: var(--gold); }

/* ══════════════════════════════════════════════ GALLERY STAT IN HOME ══ */
.home-stat.stat-gallery { cursor: pointer; transition: all .15s; }
.home-stat.stat-gallery:hover { border-color: var(--gold); }
.home-stat.stat-gallery .home-stat-num { color: var(--gold); }

/* ══════════════════════════════════════════════════════ GALLERY MODAL ══ */
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gallery-modal.hidden { display: none !important; }

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
}

.gallery-modal-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gallery-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 10px;
}
.gallery-modal-header h3 { font-size: 1rem; font-weight: 700; flex: 1; }
.gallery-modal-header .gallery-hint {
  font-size: .75rem;
  color: var(--txt-3);
}
.gallery-modal-header button {
  background: transparent;
  border: none;
  color: var(--txt-3);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: all .15s;
}
.gallery-modal-header button:hover { background: var(--surface-2); color: var(--txt); }

.gallery-modal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gallery-count {
  font-size: .78rem;
  color: var(--txt-3);
  margin-left: auto;
}

.gallery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  align-content: start;
}

.gallery-item {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid transparent;
  transition: all .15s;
  aspect-ratio: 1;
  background: var(--surface-2);
}
.gallery-item:hover {
  border-color: var(--accent);
  transform: scale(1.03);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-item-name {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: .62rem;
  padding: 4px 6px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1.3;
}
.gallery-item-del {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0,0,0,.65);
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s;
}
.gallery-item:hover .gallery-item-del { opacity: 1; }
.gallery-item-del:hover { background: var(--accent) !important; }

.gallery-empty {
  grid-column: 1 / -1;
  color: var(--txt-3);
  font-size: .85rem;
  text-align: center;
  padding: 48px 20px;
  line-height: 1.7;
}
.gallery-empty strong { color: var(--txt-2); }

/* Gallery button near dropzone */
.dz-gallery-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  justify-content: center;
}

.btn-gallery {
  background: transparent;
  border: 1px solid var(--border-l);
  color: var(--txt-2);
  padding: 4px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .75rem;
  font-family: var(--font);
  transition: all .15s;
  white-space: nowrap;
}
.btn-gallery:hover { border-color: var(--gold); color: var(--gold); }

/* ══════════════════════════════════════════════ HISTORY FILTER CHIPS ══ */
.history-filters {
  display: flex;
  gap: 5px;
  padding: 8px 20px 0;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.history-filter-chip {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 12px;
  font-size: .7rem;
  font-family: var(--font);
  color: var(--txt-2);
  cursor: pointer;
  transition: all .15s;
}
.history-filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.history-filter-chip:hover:not(.active) {
  border-color: var(--border-l);
  color: var(--txt);
}

/* ══════════════════════════════════════════════ PANEL SHORTCUTS FOOTER ══ */
.panel-shortcuts {
  border-top: 1px solid var(--border);
  padding: 8px 0 2px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

.panel-shortcut {
  font-size: .68rem;
  color: var(--txt-3);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════ SERIE / NUEVA NOTA BTN ══ */
.btn-serie {
  background: transparent;
  border: 1px dashed var(--border-l);
  color: var(--txt-3);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: .82rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
  width: 100%;
  text-align: center;
}
.btn-serie:hover {
  border-style: solid;
  border-color: var(--success);
  color: var(--success);
  background: rgba(46,196,182,.06);
}

/* ══════════════════════════════════════════════ WIDE SCREEN LAYOUT ══ */
@media (min-width: 1500px) {
  .work-layout {
    grid-template-columns: 265px 1fr 1fr;
    gap: 24px;
  }
  .controls-col { padding: 18px; }
}

/* ══════════════════════════════════════════════ PANEL SECTION DIVIDERS ══ */
.panel-section-title {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--txt-3);
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
}

/* ══════════════════════════════════════════════ TEMPLATE CHIP SUGGESTIONS ══ */
.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.template-chip {
  background: var(--surface-3);
  border: 1px dashed var(--border-l);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: .7rem;
  color: var(--txt-3);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-chip:hover {
  border-style: solid;
  border-color: var(--accent);
  color: var(--txt);
}

/* ══════════════════════════════════════════════════════ CAPTION BOT FAB ══ */
.caption-bot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #6c8aff 0%, #a855f7 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 20px 12px 16px;
  cursor: pointer;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(108,138,255,.4), 0 2px 8px rgba(0,0,0,.3);
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  user-select: none;
}
.caption-bot-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 28px rgba(108,138,255,.5), 0 4px 12px rgba(0,0,0,.3);
}
.caption-bot-fab.active {
  background: linear-gradient(135deg, #a855f7 0%, #6c8aff 100%);
  box-shadow: 0 0 0 3px rgba(168,85,247,.3), 0 4px 20px rgba(108,138,255,.4);
}
.caption-fab-icon { font-size: 1.1rem; line-height: 1; }
.caption-fab-label { white-space: nowrap; }

/* ══════════════════════════════════════════════════ CAPTION BOT PANEL ══ */
.caption-bot-panel {
  position: fixed;
  bottom: 90px;
  right: 28px;
  z-index: 601;
  width: 380px;
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 48px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* initial state: hidden & scaled down */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.34,1.56,.64,1);
}
.caption-bot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.caption-bot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, rgba(108,138,255,.12) 0%, rgba(168,85,247,.08) 100%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.caption-bot-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.caption-bot-icon {
  font-size: 1.3rem;
  line-height: 1;
}
.caption-bot-title strong {
  display: block;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(90deg, #6c8aff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.caption-bot-sub {
  font-size: .68rem;
  color: var(--txt-3);
  display: block;
}
.caption-bot-close {
  background: transparent;
  border: none;
  color: var(--txt-3);
  font-size: .95rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: all .15s;
}
.caption-bot-close:hover { background: var(--surface-2); color: var(--txt); }

/* Profile row */
.caption-profile-row {
  display: flex;
  gap: 6px;
  padding: 12px 14px 0;
  flex-shrink: 0;
}
.caption-profile-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: .82rem;
  font-family: var(--font);
  font-weight: 500;
  color: var(--txt-2);
  cursor: pointer;
  transition: all .15s;
}
.caption-profile-btn.active {
  background: linear-gradient(135deg, rgba(108,138,255,.18) 0%, rgba(168,85,247,.12) 100%);
  border-color: #6c8aff;
  color: var(--txt);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(108,138,255,.3);
}
.caption-profile-btn:hover:not(.active) {
  background: var(--surface-3);
  border-color: var(--border-l);
}
.caption-profile-hint {
  font-size: .68rem;
  color: var(--txt-3);
  padding: 6px 14px 0;
  flex-shrink: 0;
  font-style: italic;
}

/* Context area */
.caption-context-wrap {
  padding: 10px 14px 0;
  flex-shrink: 0;
}
.caption-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.caption-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--txt-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.caption-ctx-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-3);
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .68rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.caption-ctx-btn:hover { border-color: #6c8aff; color: #6c8aff; }

.caption-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--txt);
  font-family: var(--font);
  font-size: .85rem;
  padding: 9px 11px;
  resize: vertical;
  min-height: 88px;
  max-height: 160px;
  transition: border-color .15s;
  line-height: 1.5;
}
.caption-textarea:focus {
  outline: none;
  border-color: #6c8aff;
}
.caption-kbd-hint {
  font-size: .65rem;
  color: var(--txt-3);
  margin-top: 4px;
  text-align: right;
}

/* Actions */
.caption-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  flex-shrink: 0;
}
.caption-generate-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #6c8aff 0%, #a855f7 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.caption-generate-btn:hover { opacity: .92; }
.caption-generate-btn:active { transform: scale(.98); }
.caption-generate-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Spinner */
.caption-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Output */
.caption-output-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px;
  min-height: 60px;
}
.caption-output {
  font-size: .83rem;
  color: var(--txt-3);
  line-height: 1.6;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  transition: all .2s;
  min-height: 52px;
}
.caption-output.has-content {
  color: var(--txt);
  border-color: rgba(108,138,255,.3);
  background: linear-gradient(135deg, rgba(108,138,255,.05) 0%, var(--surface-2) 100%);
}
.caption-output.has-error {
  color: #f87171;
  border-color: rgba(230,57,70,.3);
  background: rgba(230,57,70,.05);
}

/* Copy row */
.caption-copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 14px;
  flex-shrink: 0;
}
.caption-char-count {
  font-size: .68rem;
  color: var(--txt-3);
}
.caption-copy-btns {
  display: flex;
  gap: 6px;
}

/* ═══════════════════════════════════ RESPONSIVE CAPTION BOT ══ */
@media (max-width: 480px) {
  .caption-bot-panel {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
  }
  .caption-bot-fab {
    right: 16px;
    bottom: 20px;
  }
  .caption-fab-label { display: none; }
  .caption-bot-fab { padding: 14px; border-radius: 50%; }
}

/* ══════════════════════════════════════════════ HOME WELCOME IMPROVEMENTS ══ */
/* Make the home welcome banner gradient more vivid */
.home-welcome {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(230,57,70,.06) 100%);
}
/* Improve card grid responsiveness */
.option-grid {
  max-width: 100%;
}
/* Slightly reduce card padding for better density */
.option-card {
  padding: 26px 18px;
}
body.compact .option-card { padding: 16px 12px; }
