:root {
  --green: #075a49;
  --green-dark: #103b34;
  --green-soft: #e8f4f0;
  --mint: #d8eee6;
  --coral: #f05d55;
  --coral-soft: #fce9e6;
  --gold: #e6b64a;
  --gold-soft: #fbf2d9;
  --blue: #4a7f94;
  --blue-soft: #e7f0f4;
  --ink: #17211f;
  --muted: #5f706b;
  --line: #c8d8d3;
  --paper: #f7faf9;
  --white: #fff;
  --shadow: 0 14px 36px rgba(17,59,52,.11);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(18px,4vw,58px);
  color: white;
  background:
    radial-gradient(circle at 88% -40%, rgba(255,255,255,.18), transparent 42%),
    linear-gradient(115deg, #064d40, #08705a);
  box-shadow: 0 3px 12px rgba(4,45,37,.16);
}
.brand-mark { width: 54px; flex: 0 0 54px; display: grid; gap: 4px; transform: rotate(-4deg); }
.brand-mark span { display: block; height: 9px; border-radius: 100% 0 100% 0; background: #d4aa46; }
.brand-mark span:nth-child(2) { width: 80%; margin-left: 10%; }
.brand-mark span:nth-child(3) { width: 62%; margin-left: 20%; }
.topbar h1 { margin: 2px 0 0; font-size: clamp(24px,3vw,38px); line-height: 1; }
.eyebrow { margin: 0; color: #d6eee8; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; }
.save-pill { margin-left: auto; padding: 9px 14px; border: 1px solid rgba(255,255,255,.42); border-radius: 999px; background: rgba(255,255,255,.1); font-size: 14px; white-space: nowrap; }
.save-pill.saving { background: rgba(230,182,74,.24); }

.main-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 11px clamp(18px,4vw,58px);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
}
.nav-btn { flex: 0 0 auto; padding: 10px 15px; color: var(--green-dark); border: 0; border-radius: 999px; background: transparent; font-weight: 700; }
.nav-btn:hover, .nav-btn.active { color: white; background: var(--green); }

main { min-height: 70vh; }
.view { display: none; }
.view.active { display: block; }

.story-selector {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px;
  max-width: 1500px;
  margin: 24px auto 14px;
  padding: 0 clamp(16px,3vw,36px);
}
.story-tab { position: relative; display: flex; align-items: center; gap: 13px; min-height: 72px; padding: 14px 18px; text-align: left; color: var(--green-dark); border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 5px 18px rgba(17,59,52,.05); }
.story-tab strong { display: block; font-size: 17px; }
.story-tab small { display: block; color: var(--muted); margin-top: 2px; }
.story-tab .story-number { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; color: white; background: var(--green); font-weight: 800; }
.story-tab[data-color="coral"] .story-number { background: var(--coral); }
.story-tab[data-color="gold"] .story-number { background: var(--gold); color: var(--green-dark); }
.story-tab.active { border-color: var(--green); outline: 3px solid rgba(7,90,73,.12); }
.story-tab .pending-tag { position: absolute; top: 8px; right: 9px; padding: 3px 7px; color: #765b16; border-radius: 999px; background: var(--gold-soft); font-size: 11px; font-weight: 800; text-transform: uppercase; }

.story-hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 24px;
  max-width: 1500px;
  margin: 0 auto 18px;
  padding: 25px clamp(24px,3vw,38px);
  color: white;
  border-radius: 22px;
  background:
    linear-gradient(110deg, rgba(3,47,39,.97), rgba(7,90,73,.91)),
    linear-gradient(45deg, #075a49, #113b34);
  box-shadow: var(--shadow);
}
.story-kicker, .section-label { margin: 0 0 5px; color: #2d7567; font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.story-hero .story-kicker { color: #f3ce74; }
.story-hero h2 { margin: 0 0 10px; font-size: clamp(25px,3vw,38px); }
.story-hero p { max-width: 1000px; margin: 0; font-size: 17px; line-height: 1.48; }
.hero-actions { display: flex; flex-direction: column; justify-content: center; gap: 10px; min-width: 200px; }

.primary-btn, .secondary-btn, .small-btn {
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 11px;
  font-weight: 750;
}
.primary-btn { color: white; border: 1px solid var(--green); background: var(--green); box-shadow: 0 5px 14px rgba(7,90,73,.16); }
.primary-btn:hover { background: #064b3e; }
.secondary-btn { color: var(--green); border: 1px solid var(--line); background: white; }
.small-btn { min-height: 38px; padding: 8px 11px; color: var(--green); border: 1px solid var(--line); background: white; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(330px, 31%) minmax(0, 1fr);
  gap: 18px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 clamp(16px,3vw,36px) 34px;
  align-items: start;
}
.deck-panel, .canvas-panel, .content-page, .worksheet-header, .participant-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 8px 26px rgba(17,59,52,.06);
}
.deck-panel { position: sticky; top: 74px; max-height: calc(100vh - 92px); overflow: auto; padding: 18px; }
.canvas-panel { min-width: 0; padding: 20px; }
.panel-heading, .section-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading h3, .section-heading-row h3 { margin: 0; color: var(--green-dark); font-size: 24px; }
.canvas-heading { align-items: end; padding-bottom: 13px; }
.canvas-heading > p, .section-heading-row > p { max-width: 430px; margin: 0; color: var(--muted); line-height: 1.4; }
.count-badge { padding: 6px 10px; color: white; border-radius: 999px; background: var(--green); font-size: 13px; font-weight: 800; }
.deck-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 7px; margin: 15px 0 10px; }
.search-box { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.search-box input { width: 100%; min-width: 0; height: 38px; border: 0; outline: 0; background: transparent; }
.deck-help { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.35; }

.card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; min-height: 120px; }
.task-card { min-width: 0; padding: 0 0 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: 0 4px 11px rgba(17,59,52,.08); transition: transform .17s ease, box-shadow .17s ease; }
.task-card:hover { transform: translateY(-2px); box-shadow: 0 9px 18px rgba(17,59,52,.14); }
.task-card.dragging { opacity: .45; transform: rotate(2deg) scale(.98); }
.card-image-btn { display: block; width: 100%; padding: 0; border: 0; border-radius: 10px 10px 0 0; overflow: hidden; background: transparent; }
.card-image-btn img { display: block; width: 100%; aspect-ratio: 584/842; object-fit: cover; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 7px 7px 5px; }
.card-actions button { padding: 6px 4px; color: var(--green); border: 0; background: transparent; font-size: 13px; font-weight: 800; text-decoration: underline; }
.card-destination { width: calc(100% - 14px); margin: 0 7px; padding: 6px 5px; color: var(--green-dark); border: 1px solid var(--line); border-radius: 7px; background: white; font-size: 12px; }
.dropzone.drop-active { outline: 3px dashed var(--gold); outline-offset: 3px; }
.empty-state { padding: 24px 16px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 12px; background: var(--paper); }

.eisenhower-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.quadrant { min-width: 0; min-height: 300px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; }
.q-do { background: var(--coral-soft); }
.q-plan { background: var(--green-soft); }
.q-delegate { background: var(--gold-soft); }
.q-remove { background: var(--blue-soft); }
.q-title { display: flex; align-items: center; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid rgba(17,59,52,.13); }
.q-title > span { display: grid; place-items: center; width: 37px; height: 37px; flex: 0 0 37px; color: white; border-radius: 11px; background: var(--green); font-size: 13px; font-weight: 800; }
.q-do .q-title > span { background: var(--coral); }
.q-delegate .q-title > span { background: var(--gold); color: var(--green-dark); }
.q-remove .q-title > span { background: var(--blue); }
.q-title h4 { margin: 0; color: var(--green-dark); font-size: 19px; }
.q-title p { margin: 2px 0 0; color: var(--muted); }
.zone-cards { display: grid; grid-template-columns: repeat(4,minmax(90px,1fr)); gap: 8px; min-height: 210px; padding-top: 11px; }
.zone-cards:empty::after { content: "Soltá aquí las cartas"; display: grid; place-items: center; min-height: 125px; grid-column: 1/-1; color: #78918b; border: 2px dashed rgba(7,90,73,.2); border-radius: 12px; font-weight: 700; }
.zone-cards .card-destination { font-size: 11px; }
.zone-cards .card-actions button { font-size: 11px; }
.decision-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 20px; }
.decision-heading p { margin-bottom: 8px; }
.decision-heading > p:last-child { color: var(--muted); text-align: right; }
.decision-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.extra-quadrant { min-height: 220px; }
.q-notdo { background: #fcece7; }
.q-notdo .q-title > span { background: var(--coral); }
.q-later { background: #fff9e9; }
.q-later .q-title > span { color: var(--green-dark); background: var(--gold); }
.decision-zone { grid-template-columns: repeat(3,minmax(85px,1fr)); min-height: 160px; }

.auction-section, .resolution-section { margin-top: 17px; padding-top: 18px; border-top: 1px solid var(--line); }
.auction-table-wrap { overflow-x: auto; margin-top: 13px; border: 1px solid var(--line); border-radius: 12px; }
.auction-table { width: 100%; border-collapse: collapse; background: white; }
.auction-table th, .auction-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.auction-table th { color: var(--green-dark); background: var(--green-soft); }
.auction-table tr:last-child td { border-bottom: 0; }
.auction-table select, .auction-table input { width: 100%; min-height: 40px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.auction-placeholder { color: var(--muted); text-align: center !important; padding: 20px !important; }
.resolution-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; margin-top: 13px; }
.resolution-grid label, .form-field { display: grid; gap: 7px; }
.resolution-grid label > span, .form-field > span { color: var(--green-dark); font-weight: 800; }
textarea, input[type="text"] { width: 100%; padding: 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: #fcfefd; outline: 0; }
textarea:focus, input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7,90,73,.1); }
.resolution-grid textarea { min-height: 110px; resize: vertical; }

.worksheet-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1300px; margin: 28px auto 14px; padding: 24px 28px; }
.worksheet-header h2, .content-page h2 { margin: 0 0 7px; color: var(--green-dark); font-size: clamp(28px,4vw,44px); }
.worksheet-header p { margin: 0; color: var(--muted); }
.participant-form { max-width: 1300px; margin: 0 auto 36px; padding: 25px; }
.form-section { margin-bottom: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.form-section:nth-child(4n+1) { border-top: 6px solid var(--green); }
.form-section:nth-child(4n+2) { border-top: 6px solid var(--gold); }
.form-section:nth-child(4n+3) { border-top: 6px solid var(--coral); }
.form-section:nth-child(4n) { border-top: 6px solid var(--blue); }
.form-section h3 { margin: 0 0 7px; color: var(--green-dark); font-size: 23px; }
.form-section > p { margin: 0 0 14px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-grid.cols-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-field textarea { min-height: 95px; resize: vertical; }
.form-table { width: 100%; border-collapse: collapse; }
.form-table th, .form-table td { padding: 8px; border: 1px solid var(--line); vertical-align: top; }
.form-table th { color: var(--green-dark); background: var(--green-soft); }
.form-table textarea, .form-table input { min-height: 60px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }

.content-page { max-width: 1250px; margin: 28px auto 36px; padding: clamp(24px,4vw,44px); }
.guide-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 26px 0; }
.guide-grid article, .guide-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); }
.guide-grid article > span { display: grid; place-items: center; width: 39px; height: 39px; color: white; border-radius: 12px; background: var(--green); font-weight: 900; }
.guide-grid h3, .guide-card h3 { margin: 12px 0 8px; color: var(--green-dark); }
.guide-grid p, .guide-card p, .guide-card li { color: var(--muted); line-height: 1.45; }
.guide-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.guide-card blockquote { margin: 12px 0 0; padding: 16px; color: var(--green-dark); border-left: 5px solid var(--gold); background: white; font-size: 20px; font-weight: 700; }
.fib-list { padding-left: 0; list-style: none; }
.fib-list b { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 7px; color: white; border-radius: 9px; background: var(--green); }

.downloads-page > p { color: var(--muted); }
.download-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; margin-top: 24px; }
.download-grid a { display: grid; grid-template-columns: auto 1fr; gap: 2px 13px; padding: 20px; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); transition: transform .2s, box-shadow .2s; }
.download-grid a:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.download-grid a > span { grid-row: 1/3; display: grid; place-items: center; width: 52px; height: 52px; color: white; border-radius: 13px; background: var(--green); font-size: 12px; font-weight: 900; }
.download-grid strong { align-self: end; color: var(--green-dark); font-size: 18px; }
.download-grid small { color: var(--muted); }

footer { padding: 22px 20px 30px; text-align: center; border-top: 1px solid var(--line); background: white; }
footer img { width: 185px; height: auto; }
footer p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }

.card-modal { width: min(92vw, 620px); max-height: 94vh; padding: 18px; border: 0; border-radius: 20px; background: white; box-shadow: 0 25px 80px rgba(0,0,0,.35); }
.card-modal::backdrop { background: rgba(8,28,24,.76); backdrop-filter: blur(5px); }
.modal-close { position: absolute; top: 11px; right: 11px; z-index: 2; display: grid; place-items: center; width: 39px; height: 39px; color: var(--green-dark); border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 27px; }
.modal-card-wrap { display: grid; place-items: center; padding: 6px; }
.modal-card-wrap img { width: auto; max-width: 100%; max-height: 76vh; border-radius: 14px; box-shadow: var(--shadow); }
.modal-actions { display: flex; justify-content: center; padding-top: 12px; }
.toast { position: fixed; z-index: 60; right: 22px; bottom: 22px; max-width: 320px; padding: 12px 16px; color: white; border-radius: 12px; background: var(--green-dark); box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1150px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .deck-panel { position: static; max-height: none; }
  .card-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .zone-cards { grid-template-columns: repeat(4,minmax(80px,1fr)); }
}
@media (max-width: 820px) {
  .save-pill { display: none; }
  .story-selector { grid-template-columns: 1fr; }
  .story-hero { grid-template-columns: 1fr; margin-inline: 14px; }
  .hero-actions { flex-direction: row; flex-wrap: wrap; }
  .workspace-grid { padding-inline: 14px; }
  .eisenhower-grid, .decision-grid, .resolution-grid, .form-grid, .guide-columns, .download-grid { grid-template-columns: 1fr; }
  .decision-heading { align-items: flex-start; flex-direction: column; }
  .decision-heading > p:last-child { text-align: left; }
  .card-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .zone-cards { grid-template-columns: repeat(3,minmax(80px,1fr)); }
  .guide-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .worksheet-header { margin-inline: 14px; flex-direction: column; align-items: flex-start; }
  .participant-form, .content-page { margin-inline: 14px; }
}
@media (max-width: 520px) {
  .topbar { padding: 15px; }
  .brand-mark { width: 42px; flex-basis: 42px; }
  .topbar h1 { font-size: 24px; }
  .eyebrow { font-size: 11px; }
  .main-nav { padding-inline: 10px; }
  .deck-toolbar { grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1/-1; }
  .card-grid, .zone-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .guide-grid { grid-template-columns: 1fr; }
  .panel-heading, .section-heading-row { flex-direction: column; }
  .canvas-panel, .deck-panel { padding: 14px; }
}

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: white; font-size: 11pt; }
  .topbar, .main-nav, footer, .story-selector, .hero-actions, .deck-toolbar, .deck-help, .card-actions, .card-destination, .toast { display: none !important; }
  .view { display: none !important; }
  body[data-print="story"] #storiesView { display: block !important; }
  body[data-print="participant"] #participantView { display: block !important; }
  .story-hero, .workspace-grid, .worksheet-header, .participant-form { max-width: none; margin: 0; padding: 0; box-shadow: none; border: 0; }
  .story-hero { color: var(--ink); background: white; padding-bottom: 6mm; }
  .story-hero .story-kicker { color: var(--green); }
  .workspace-grid { display: block; }
  .deck-panel { display: none; }
  .canvas-panel { padding: 0; border: 0; box-shadow: none; }
  .quadrant { min-height: 54mm; break-inside: avoid; }
  .zone-cards { grid-template-columns: repeat(6,minmax(0,1fr)); min-height: 34mm; }
  .zone-cards:empty::after { min-height: 25mm; }
  .task-card { box-shadow: none; }
  .decision-grid, .extra-quadrant, .auction-section, .resolution-section { break-inside: avoid; }
  .auction-table input, .auction-table select, textarea, input { border: 0; background: transparent; }
  .resolution-grid textarea { min-height: 28mm; }
  .worksheet-header { padding-bottom: 7mm; }
  .participant-form { display: block; }
  .form-section { break-inside: avoid; margin-bottom: 5mm; }
}
