.panel{
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  background:linear-gradient(180deg, rgba(255,255,255,0.92), rgba(250,244,235,0.92));
  box-shadow:0 16px 32px rgba(48, 38, 30, 0.06);
}

.panel-section,
.compact-panel,
.canvas-card{
  padding:20px;
}

.panel-hero{
  padding:24px;
  background:
    linear-gradient(145deg, rgba(20, 32, 43, 0.96), rgba(49, 37, 28, 0.96)),
    url("../public/weave-grid.svg");
  background-size:cover;
  color:#f7efe2;
}

.panel-hero p,
.panel-hero .metric-label,
.panel-hero .eyebrow{
  color:rgba(247, 239, 226, 0.76);
}

.panel-hero h2{
  margin-top:10px;
  font-size:1.45rem;
}

.brand-mark{
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  border-radius:16px;
  background:linear-gradient(145deg, #17202a, #8b5e3c);
  color:#fff;
  font-family:"Space Grotesk", "Segoe UI", sans-serif;
  font-weight:700;
  letter-spacing:0.08em;
}

.brand-mark img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}

.eyebrow,
.panel-kicker,
.card-kicker,
.summary-label,
.output-label,
.metric-label{
  display:inline-block;
  font-size:0.76rem;
  font-weight:600;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
}

.panel-heading{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:16px;
}

.panel-heading h3,
.card-header h3{
  font-size:1.05rem;
}

.hero-metrics{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
  margin-top:20px;
}

.metric-card,
.summary-card,
.output-card{
  padding:16px;
  border:1px solid rgba(216, 208, 194, 0.8);
  border-radius:18px;
  background:rgba(255,255,255,0.68);
}

.summary-card + .summary-card{
  margin-top:12px;
}

.summary-card strong,
.metric-card strong,
.output-card strong{
  display:block;
  margin:8px 0 6px;
  color:var(--text);
  font-size:1rem;
}

.topnav-link,
.stack-item,
.ghost-button,
.primary-button{
  border:none;
  transition:transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.topnav-link{
  padding:10px 16px;
  border-radius:999px;
  background:transparent;
  color:var(--muted);
  font-weight:600;
}

.topnav-link.is-active{
  background:var(--surface-contrast);
  color:#f8f2e8;
}

.ghost-button,
.primary-button{
  padding:12px 16px;
  border-radius:14px;
  font-weight:600;
}

.ghost-button[hidden],
.primary-button[hidden]{
  display:none !important;
}

.ghost-button{
  background:rgba(255,255,255,0.7);
  color:var(--text);
  border:1px solid var(--line);
}

a.ghost-button,
a.primary-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}

.primary-button{
  background:linear-gradient(135deg, var(--accent-deep), var(--accent));
  color:#fff8f0;
}

.ghost-button:hover,
.primary-button:hover,
.topnav-link:hover,
.stack-item:hover{
  transform:translateY(-1px);
}

.account-pill{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:160px;
  padding:10px 14px;
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(255,255,255,0.76);
}

.account-pill-label{
  font-size:0.72rem;
  font-weight:700;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
}

.account-pill strong{
  font-size:0.95rem;
  color:var(--text);
}

.stack-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.stack-item{
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:flex-start;
  width:100%;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--surface);
  color:var(--text);
}

.stack-item span{
  font-weight:700;
}

.stack-item small{
  color:var(--muted);
}

.stack-item.is-active{
  border-color:var(--line-strong);
  background:linear-gradient(180deg, #fffdf7, #f2e7d8);
}

.signal-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.signal-list li{
  padding:12px 14px;
  border-radius:16px;
  background:rgba(248, 244, 236, 0.9);
  border:1px solid rgba(216, 208, 194, 0.8);
  color:var(--muted);
  line-height:1.5;
}

.signal-list.compact li{
  padding:10px 12px;
}

.auth-panel{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.auth-summary{
  padding:16px;
  border:1px solid rgba(216, 208, 194, 0.8);
  border-radius:18px;
  background:linear-gradient(180deg, rgba(255,255,255,0.88), rgba(248,244,236,0.94));
}

.auth-summary.is-authenticated{
  border-color:rgba(45, 106, 79, 0.28);
  background:linear-gradient(180deg, rgba(234,247,239,0.96), rgba(248,252,249,0.96));
}

.auth-actions{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
}

.auth-actions .ghost-button,
.auth-actions .primary-button{
  width:100%;
}

.reset-link-button{
  min-height:46px;
}

.auth-status{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(216, 208, 194, 0.8);
  background:rgba(255,255,255,0.76);
  color:var(--muted);
  line-height:1.5;
}

.auth-status.is-success{
  border-color:rgba(45, 106, 79, 0.28);
  color:var(--success);
}

.auth-status.is-error{
  border-color:rgba(127, 29, 29, 0.24);
  color:#991b1b;
}

.card-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}

.status-badge{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(45, 106, 79, 0.12);
  color:var(--success);
  font-weight:700;
  font-size:0.8rem;
}

.status-badge.muted{
  background:rgba(23, 32, 42, 0.08);
  color:var(--muted);
}

.canvas-card-large{
  padding:20px;
}

.tool-row{
  display:flex;
  align-items:end;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.tool-row-tight{
  margin-bottom:18px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:160px;
  flex:1 1 180px;
}

.field.field-wide{
  flex-basis:280px;
}

.field span{
  color:var(--muted);
  font-size:0.88rem;
  font-weight:600;
}

.field input,
.field select{
  width:100%;
  min-height:46px;
  padding:0 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,0.88);
  color:var(--text);
}

.fabric-stage{
  position:relative;
  min-height:420px;
  overflow:hidden;
  border-radius:22px;
  border:1px solid rgba(186, 169, 140, 0.65);
  background:linear-gradient(180deg, rgba(20, 32, 43, 0.96), rgba(25, 36, 48, 0.96));
}

.rich-stage{
  min-height:600px;
}

.fabric-preview-canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}

.fabric-grid{
  position:absolute;
  inset:0;
  background:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(135deg, rgba(202, 165, 127, 0.18), rgba(44, 68, 87, 0.2));
  background-size:28px 28px, 28px 28px, cover;
  mask-image:radial-gradient(circle at center, black 68%, transparent 100%);
}

.fabric-overlay{
  position:relative;
  display:flex;
  flex-direction:column;
  justify-content:end;
  min-height:420px;
  padding:28px;
  background:linear-gradient(180deg, transparent 35%, rgba(8, 12, 18, 0.82) 100%);
}

.fabric-overlay-top{
  justify-content:flex-start;
  min-height:auto;
  padding:24px;
  background:linear-gradient(180deg, rgba(8, 12, 18, 0.74), transparent 65%);
}

.fabric-overlay strong{
  color:#f8f1e6;
  font-size:1.3rem;
}

.fabric-overlay p{
  max-width:460px;
  margin-top:10px;
  color:rgba(248, 241, 230, 0.78);
}

.parameter-list{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.parameter-list div{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:12px 0;
  border-bottom:1px solid rgba(216, 208, 194, 0.8);
}

.parameter-list div:last-child{
  border-bottom:none;
  padding-bottom:0;
}

.parameter-list span{
  color:var(--muted);
}

.muted-copy{
  max-width:52ch;
}

.draft-preview{
  display:grid;
  grid-template-columns:320px minmax(0, 1fr);
  gap:22px;
  align-items:center;
}

.draft-canvas{
  width:100%;
  max-width:420px;
  aspect-ratio:1;
  border-radius:18px;
  border:1px solid rgba(186, 169, 140, 0.72);
  background:linear-gradient(180deg, #f9f6ef, #ebe1d3);
  cursor:crosshair;
}

.draft-copy{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.draft-guides{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.guide-pill{
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(186, 169, 140, 0.72);
  background:rgba(255,255,255,0.74);
  color:var(--muted);
  font-size:0.84rem;
  line-height:1.3;
}

.local-projects-status{
  margin-bottom:12px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(216, 208, 194, 0.82);
  background:rgba(255,255,255,0.72);
  color:var(--muted);
  font-size:0.92rem;
}

.local-projects-status.is-success{
  border-color:rgba(45, 106, 79, 0.35);
  color:#2d6a4f;
}

.local-projects-status.is-error{
  border-color:rgba(146, 64, 14, 0.35);
  color:#92400e;
}

.local-projects-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.cloud-save-panel{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.cloud-save-group{
  padding-top:14px;
  border-top:1px solid rgba(216, 208, 194, 0.72);
}

.cloud-save-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  margin-bottom:12px;
}

.cloud-save-head strong{
  display:block;
  margin-top:4px;
  color:var(--text);
}

.cloud-records-list{
  max-height:360px;
  overflow:auto;
  padding-right:4px;
}

.local-project-card{
  padding:14px;
  border-radius:16px;
  border:1px solid rgba(216, 208, 194, 0.82);
  background:rgba(255,255,255,0.78);
}

.local-project-card-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
}

.local-project-card strong{
  display:block;
  color:var(--text);
}

.local-project-card small{
  display:block;
  margin-top:4px;
  color:var(--muted);
}

.local-project-card-meta{
  margin-top:10px;
  color:var(--muted);
  font-size:0.86rem;
}

.local-project-card-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}

.local-project-card-actions .tiny-button{
  flex:0 0 auto;
}

.tiny-button{
  padding:9px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,0.84);
  color:var(--text);
  font-weight:600;
}

.tiny-button.is-danger{
  border-color:rgba(146, 64, 14, 0.25);
  color:#92400e;
}

.saved-cloud-color-line{
  display:flex;
  align-items:center;
  gap:12px;
}

.saved-cloud-color-swatch{
  width:38px;
  height:38px;
  flex:0 0 auto;
  border-radius:8px;
  border:1px solid rgba(17,24,39,0.18);
}

.mini-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.swatch-card{
  min-height:148px;
  padding:18px;
  border-radius:20px;
  display:flex;
  flex-direction:column;
  justify-content:end;
  gap:8px;
  color:#fff;
}

.swatch-card span{
  opacity:0.8;
  font-size:0.85rem;
}

.swatch-card strong{
  font-size:1.12rem;
}

.swatch-card-dark{background:linear-gradient(160deg, #1d3045, #0f1720);}
.swatch-card-light{background:linear-gradient(160deg, #e8decf, #bca98c); color:#1c2329;}
.swatch-card-warm{background:linear-gradient(160deg, #8b5e3c, #543725);}
.swatch-card-cool{background:linear-gradient(160deg, #43657d, #203949);}

.palette-swatch{
  position:relative;
  min-height:158px;
  padding:18px;
  border-radius:20px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:16px;
  color:#fff;
  overflow:hidden;
}

.palette-swatch label,
.color-picker-open{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  font-size:0.82rem;
  opacity:0.88;
}

.palette-swatch input{
  width:44px;
  height:32px;
  padding:0;
  border:none;
  background:transparent;
}

.color-picker-open{
  width:100%;
  min-height:42px;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,0.22);
  border-radius:14px;
  background:rgba(8,14,20,0.28);
  color:inherit;
  cursor:pointer;
}

.color-picker-open strong{
  font-family:"IBM Plex Sans", "Segoe UI", sans-serif;
  font-size:0.82rem;
  letter-spacing:0.02em;
}

.palette-swatch strong{
  font-size:1.06rem;
}

.palette-swatch .swatch-code{
  font-size:0.85rem;
  opacity:0.82;
}

.output-card{
  min-height:180px;
}

.output-card p{
  margin-top:10px;
}

.report-preview-wrap{
  display:flex;
  justify-content:center;
  padding:12px 0 6px;
}

.report-sheet{
  width:min(100%, 820px);
  min-height:1120px;
  padding:44px 48px;
  border-radius:20px;
  border:1px solid #d8dde5;
  background:#ffffff;
  box-shadow:0 28px 60px rgba(17, 24, 39, 0.10);
  color:#111827;
}

.report-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  padding-bottom:18px;
  border-bottom:1px solid #e5e7eb;
}

.report-brand{
  display:flex;
  align-items:center;
  gap:14px;
}

.report-brand-mark{
  display:grid;
  place-items:center;
  width:52px;
  height:52px;
  border-radius:16px;
  background:linear-gradient(145deg, #17202a, #8b5e3c);
  color:#fff;
  font-family:"Space Grotesk", "Segoe UI", sans-serif;
  font-weight:700;
  letter-spacing:0.08em;
}

.report-brand-eyebrow,
.report-label{
  display:inline-block;
  font-size:0.74rem;
  font-weight:700;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:#6b7280;
}

.report-brand h4{
  margin-top:6px;
  font-size:1.3rem;
  color:#111827;
}

.report-meta{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:220px;
  text-align:right;
}

.report-meta-row{
  display:flex;
  justify-content:flex-end;
  gap:12px;
  font-size:0.92rem;
}

.report-meta-row span{
  color:#6b7280;
}

.report-meta-row strong{
  color:#111827;
}

.report-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  padding:28px 0 24px;
}

.report-hero h2{
  margin-top:8px;
  font-size:2rem;
  color:#111827;
}

.report-status-chip{
  display:inline-flex;
  align-items:center;
  padding:10px 14px;
  border-radius:999px;
  background:#f4efe8;
  border:1px solid #ddcdb7;
  color:#7a5838;
  font-weight:700;
}

.report-grid{
  display:grid;
  grid-template-columns:1.15fr 0.85fr;
  gap:18px;
}

.report-grid-bottom{
  margin-top:18px;
}

.report-grid-tech{
  margin-top:18px;
}

.report-block{
  padding:20px;
  border:1px solid #e5e7eb;
  border-radius:18px;
  background:#fcfcfb;
}

.report-block-primary{
  min-height:250px;
}

.report-block-visual{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.report-kv{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
  margin-top:16px;
}

.report-kv-item{
  padding:14px;
  border-radius:14px;
  background:#f4f6f8;
  border:1px solid #e5e7eb;
}

.report-kv-item span{
  display:block;
  color:#6b7280;
  font-size:0.85rem;
}

.report-kv-item strong{
  display:block;
  margin-top:6px;
  color:#111827;
  font-size:1rem;
}

#reportFabricCanvas{
  width:100%;
  border-radius:14px;
  border:1px solid #d1d5db;
  background:#f9fafb;
}

#reportDraftMatrixCanvas,
#reportThreadingCanvas{
  width:100%;
  border-radius:14px;
  border:1px solid #d1d5db;
  background:#f9fafb;
}

.report-stack{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:16px;
}

.report-code-row{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.report-code-row span{
  color:#6b7280;
  font-size:0.86rem;
}

.report-code-row code{
  display:block;
  padding:12px 14px;
  border-radius:12px;
  background:#f4f6f8;
  border:1px solid #e5e7eb;
  color:#111827;
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:0.92rem;
  word-break:break-word;
}

.report-draft-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-bottom:1px solid #eceff3;
}

.report-draft-row:last-child{
  border-bottom:none;
}

.report-draft-row span{
  color:#6b7280;
}

.report-draft-row strong{
  color:#111827;
  text-align:right;
}

.report-block-colors{
  margin-top:18px;
}

.report-color-list{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
  margin-top:16px;
}

.report-color-chip{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  border-radius:14px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
}

.report-color-swatch{
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid rgba(17,24,39,0.08);
}

.report-color-copy{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.report-color-copy strong{
  color:#111827;
  font-size:0.95rem;
}

.report-color-copy span{
  color:#6b7280;
  font-size:0.82rem;
}

.report-footer{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:28px;
  padding-top:18px;
  border-top:1px solid #e5e7eb;
  color:#6b7280;
  font-size:0.88rem;
}

.report-details-list{
  margin-top:18px;
}

.view-panel{
  display:none;
  gap:18px;
  flex-direction:column;
}

.view-panel.is-active{
  display:flex;
}

.material-tile{
  overflow:hidden;
  border-radius:20px;
  border:1px solid var(--line);
  background:var(--surface-strong);
}

.inset-panel{
  border-radius:22px;
  background:linear-gradient(180deg, rgba(251, 247, 239, 0.95), rgba(245, 238, 228, 0.95));
}

#footerMeta{
  text-align:right;
}

@media (max-width:940px){
  .draft-preview{
    grid-template-columns:1fr;
  }

  .hero-metrics{
    grid-template-columns:1fr;
  }

  .field,
  .field.field-wide{
    flex-basis:100%;
  }

  .report-grid,
  .report-color-list,
  .report-kv{
    grid-template-columns:1fr;
  }

  .report-sheet{
    padding:24px 20px;
  }

  .report-header,
  .report-hero,
  .report-footer{
    flex-direction:column;
    align-items:flex-start;
  }

  .report-meta{
    min-width:0;
    text-align:left;
  }

  .report-meta-row{
    justify-content:flex-start;
  }
}
