/* ===== Taller en papel ===== */
:root{
  --paper-line: #d8cdb2;
  --hand: 'Caveat', cursive;
}

.taller{
  position:relative; z-index:1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 28px 80px;
}

/* top bar */
.tbar{
  display:flex; align-items:center; gap:14px;
  margin-bottom: 22px;
}
.tbar .home{
  display:inline-flex; align-items:center; gap:8px;
  text-decoration:none; color:inherit; font-weight:600; font-size:14px;
  background: white; border:3px solid var(--line); border-radius:999px;
  padding: 8px 14px; box-shadow: var(--shadow);
}
.tbar .home:hover{ transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--line); }
.tbar .crumb{
  background:white; border:3px solid var(--line); border-radius:999px;
  padding: 8px 14px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow);
}
.tbar .actions{ margin-left:auto; display:flex; gap:10px; }

/* paper sheet */
.sheet{
  background:
    repeating-linear-gradient(0deg, transparent, transparent 31px, var(--paper-line) 31px, var(--paper-line) 32px),
    #fffdf3;
  border: 3px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 44px 48px;
  position: relative;
  background-attachment: local;
}
.sheet::before{
  /* red margin line */
  content:""; position:absolute; left:78px; top:0; bottom:0;
  width: 0; border-left: 2px dashed rgba(217, 77, 58, .25);
}
.sheet::after{
  /* holes */
  content:""; position:absolute; left:24px; top:24px; bottom:24px;
  width: 20px;
  background:
    radial-gradient(circle, var(--bg) 7px, transparent 8px) 0 0/20px 80px repeat-y;
  border-right: none;
  z-index: 0;
}
.sheet > *{ position:relative; z-index: 1; }

.sheet h1{
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(38px, 5vw, 56px);
  margin: 0 0 6px;
  letter-spacing: .005em;
}
.sheet .sub{
  color: var(--ink-soft); font-size: 17px; line-height:1.5;
  max-width: 760px; margin: 0 0 26px;
}

.section{
  margin-top: 36px;
  padding-top: 26px;
  border-top: 2px dashed rgba(34,34,59,.18);
}
.section:first-of-type{ border-top: none; padding-top: 0; }

.sec-head{
  display:flex; align-items:center; gap:14px;
  margin-bottom: 18px;
}
.sec-num{
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--sun); border:3px solid var(--line);
  display:grid; place-items:center;
  font-weight:700; font-size: 20px;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}
.sec-num.coral{ background: var(--coral); }
.sec-num.mint{ background: var(--mint); }
.sec-num.sky{ background: var(--sky); }
.sec-num.lav{ background: var(--lav); }
.sec-head h2{
  margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.01em;
}
.sec-head .hint{
  font-family: var(--hand); font-size: 20px; color: var(--coral-deep);
  transform: rotate(-2deg);
  margin-left: auto;
}

/* theme picker */
.theme-grid{
  display:grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
@media (max-width: 720px){ .theme-grid{ grid-template-columns:1fr } }
.theme-card{
  background: white; border:3px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s;
  text-align:left;
  font-family: inherit;
  font-size: 14px;
}
.theme-card:hover{ transform: translate(-2px,-2px); }
.theme-card.active{ background: var(--sun); }
.theme-card .big{ font-size: 38px; line-height: 1; }
.theme-card .name{ font-weight: 700; font-size: 18px; margin-top: 6px; }
.theme-card .desc{ color: var(--ink-soft); margin-top: 4px; font-size: 13px; }

/* entity bubbles */
.bubbles{
  display:flex; flex-wrap:wrap; gap:10px;
  margin-bottom: 14px;
}
.bubble{
  background: white; border: 3px solid var(--line);
  border-radius: 999px; padding: 6px 12px 6px 6px;
  display:inline-flex; align-items:center; gap:8px;
  font-weight: 600; font-size: 14px;
  box-shadow: 2px 2px 0 var(--line);
}
.bubble .dot{
  width: 22px; height: 22px; border-radius:50%;
  background: var(--mint); border: 2px solid var(--line);
  display:grid; place-items:center; font-size: 11px; font-weight:800;
}
.bubble button{
  background:transparent; border:none; cursor:pointer;
  color: var(--coral-deep); font-weight:700; font-size: 16px;
  padding: 0 4px;
}
.bubble.add{
  background: var(--sun);
  cursor: text;
}
.bubble.add input{
  background: transparent; border: none; outline: none;
  font-family: inherit; font-size: 14px; font-weight: 600;
  width: 140px;
}

.suggest{
  font-size: 13px; color: var(--ink-soft);
  margin-bottom: 10px;
}
.suggest button{
  display:inline-block; margin: 0 6px 6px 0;
  background: white; border:2px dashed var(--ink-soft);
  border-radius: 999px; padding: 4px 10px;
  font-family: inherit; cursor: pointer; font-size: 13px;
}
.suggest button:hover{ background: var(--sun); border-style: solid; border-color: var(--line); }

/* tables grid */
.tables-grid{
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
@media (max-width: 820px){ .tables-grid{ grid-template-columns: 1fr } }

.table-card{
  background: white; border:3px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.table-card .head{
  background: var(--mint); border-bottom: 3px solid var(--line);
  padding: 10px 14px;
  display:flex; align-items:center; gap:10px;
  font-weight: 700; font-size: 16px;
}
.table-card.lav  .head{ background: var(--lav); }
.table-card.sky  .head{ background: var(--sky); }
.table-card.coral .head{ background: var(--coral); }
.table-card.sun  .head{ background: var(--sun); }
.table-card.rose .head{ background: var(--rose); }
.table-card .head .ico{
  width:24px; height:24px; border-radius:6px;
  border:2px solid var(--line); background: white;
  display:grid; place-items:center; font-size: 13px;
}
.table-card .body{ padding: 8px 0 6px; }

.col-row{
  display: grid;
  grid-template-columns: 22px 1fr 100px 28px;
  gap: 8px; align-items:center;
  padding: 4px 12px;
}
.col-row .pk-toggle{
  width: 22px; height: 22px; border-radius:6px;
  border:2px solid var(--line); background: white;
  cursor:pointer; padding:0;
  font-size: 13px; line-height: 1;
  display:grid; place-items:center;
}
.col-row .pk-toggle.on{ background: var(--sun); }
.col-row input{
  background: transparent; border:none; border-bottom: 1.5px dotted var(--ink-soft);
  font-family: var(--mono); font-size: 14px;
  padding: 4px 2px; outline: none; min-width: 0;
}
.col-row input:focus{ border-bottom-color: var(--coral-deep); }
.col-row select{
  font-family: var(--mono); font-size: 12px;
  border:2px solid var(--line); border-radius:8px;
  padding: 3px 6px; background: white; cursor: pointer;
}
.col-row .del{
  background:transparent; border:none; cursor:pointer;
  color: var(--coral-deep); font-weight:700; font-size: 16px;
  padding: 0;
}
.col-row.head-row{
  font-size: 11px; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: .04em; padding: 6px 12px;
  border-bottom: 1px dashed rgba(34,34,59,.15);
}
.col-add{
  margin: 6px 12px; padding: 6px 10px;
  border: 2px dashed var(--ink-soft); border-radius: 10px;
  background: transparent; cursor: pointer; font-family: inherit;
  font-size: 13px; color: var(--ink-soft); width: calc(100% - 24px);
}
.col-add:hover{ background: #fff5d6; border-style: solid; border-color: var(--line); color: var(--ink); }
.table-card .foot{
  padding: 6px 12px 10px; display:flex; gap:8px;
  border-top: 1px dashed rgba(34,34,59,.12);
}
.table-card .foot button{
  font-family: inherit; font-size: 12px;
  background: white; border: 2px solid var(--line); border-radius: 999px;
  padding: 3px 10px; cursor: pointer;
}
.table-card .foot .rename{
  background: transparent; border:none; border-bottom: 1.5px dotted var(--ink-soft);
  font-family: inherit; font-weight:700; font-size:16px; outline:none;
  background: transparent; min-width: 0; flex:1;
}

.add-table{
  border:3px dashed var(--ink-soft); border-radius: var(--r-md);
  background: rgba(255,255,255,.5);
  padding: 28px; text-align:center;
  cursor:pointer; font-family: inherit; font-size:16px; font-weight:600;
  color: var(--ink-soft);
  min-height: 140px;
}
.add-table:hover{ background: white; border-style: solid; border-color: var(--line); color: var(--ink); }

/* relations */
.rel-list{
  display: flex; flex-direction: column; gap: 10px;
}
.rel-row{
  display: grid;
  grid-template-columns: 1fr 60px 1fr 28px;
  gap: 10px; align-items: center;
  background: white; border: 3px solid var(--line); border-radius: var(--r-md);
  padding: 10px 14px;
  box-shadow: 2px 2px 0 var(--line);
}
.rel-row select{
  font-family: var(--mono); font-size: 13px;
  border:2px solid var(--line); border-radius:8px;
  padding: 6px 8px; background: white; cursor: pointer;
}
.rel-row .arr{
  text-align:center; font-weight:700; font-size: 20px; color: var(--coral-deep);
}
.add-rel{
  margin-top: 10px;
}

/* SQL slots */
.sql-grid{
  display:grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
@media (max-width: 820px){ .sql-grid{ grid-template-columns: 1fr } }
.sql-slot{
  background: white; border:3px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 14px;
}
.sql-slot .q{
  display: flex; gap: 8px; align-items:center;
  margin-bottom: 8px;
}
.sql-slot .q-num{
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--lav); border:2px solid var(--line);
  display:grid; place-items:center; font-weight: 700; font-size: 13px;
  flex: 0 0 auto;
}
.sql-slot .q input{
  flex:1; background:transparent; border:none;
  border-bottom: 1.5px dotted var(--ink-soft);
  font-family: inherit; font-size: 15px; padding:4px 2px;
  outline:none;
}
.sql-slot .q input:focus{ border-bottom-color: var(--coral-deep); }
.sql-slot textarea{
  width:100%; min-height: 80px; resize: vertical;
  background: #fffdf3;
  border: 2px dashed var(--ink-soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--mono); font-size: 13px;
  line-height: 1.6;
  outline: none;
}
.sql-slot textarea:focus{ background: white; border-style: solid; border-color: var(--line); }

.tip{
  background: #fff5d6;
  border: 3px dashed var(--sun-deep);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 16px;
}
.tip .ico{
  flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--sun); border:2px solid var(--line);
  display:grid; place-items:center; font-weight:700;
}

.handnote{
  font-family: var(--hand); font-size: 22px;
  color: var(--coral-deep);
  transform: rotate(-1.5deg);
  display: inline-block;
}

.scribble{ text-decoration: line-through; text-decoration-color: var(--coral-deep); text-decoration-thickness: 2px; }

.btn.print{ background: var(--mint); }
.btn.clear{ background: var(--coral); }

/* print rules */
@media print {
  @page { size: A4; margin: 12mm; }
  body{ background: white; }
  .no-print, .tbar, .add-table, .col-add, .add-rel, .theme-grid, .suggest, .col-row .del, .col-row .pk-toggle, .col-row select{ display: none !important; }
  .col-row{ grid-template-columns: 1fr 100px; }
  .col-row input{ border-bottom: 1px solid #999; }
  .sheet{ box-shadow: none; border: none; padding: 0; }
  .sheet::after{ display: none; }
  .sheet::before{ display: none; }
  .table-card, .rel-row, .sql-slot{ box-shadow: none; break-inside: avoid; }
  textarea, input{ color: #000; }
}
