/* The spreadsheet part of the wizard, in one card: what to sync and which sheet, then (for a sheet of one's own) each
   field with the column it comes from. Rows, choice cards and field tables are the wizard's own; this adds the rest. */

.sheet-card { overflow: visible; }

/* Our template next to a sheet of one's own, as the wizard's choice cards. */
.sheet-pick .dircard { display: flex; flex-direction: column; cursor: default; }
.sheet-pick .dircard .dd { flex: 1; }
.sheet-pick .dircard .pill { margin-left: 2px; }
.sheet-pick .dircard.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand-text) 6%, var(--panel)); }
.sheet-dt-ic { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: var(--r-m); background: var(--brand-soft); color: var(--brand-text); }
.sheet-dt-ic svg { width: 15px; height: 15px; }
.sheet-act { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.sheet-act .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.sheet-act .sheet-example { width: auto; min-width: 190px; }
.sheet-file { display: flex; align-items: center; gap: 10px; flex: 1 1 220px; min-width: 0; }
.sheet-file-ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--r-m); background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.sheet-file-ic svg { width: 16px; height: 16px; }
.sheet-file-t { display: grid; min-width: 0; }
.sheet-file-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-s); font-weight: 600; color: var(--ink); }
.sheet-file-t span { font-size: var(--fs-xs); color: var(--ink-4); }
.sheet-done { display: grid; gap: 10px; flex: 1 1 100%; min-width: 0; }
.sheet-done-act { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-left: 42px; }
.sheet-done-act .sheet-currency { margin-left: auto; }
.sheet-pick .dircard.fresh { animation: sb-fresh 1.4s ease; }
.sheet-currency { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.sheet-currency select.input { width: auto; min-width: 90px; }
.sheet-privacy { margin: 12px 2px 0; }
.sheet-busy { padding: 18px; border: 1px dashed var(--line-strong); border-radius: var(--r-l); background: var(--panel-2); }

/* One shimmer for everything that waits on the sheet. */
.sheet-skeleton span, .sb-hc::after, .sb-tab::after { background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: sheet-shimmer 1.2s linear infinite; }
.sb-hc::after, .sb-tab::after { content: ""; position: absolute; border-radius: 3px; transition: opacity .25s ease; }

/* The sheet being made: an empty window while the file is made, then its tabs and headers fill in and the steps tick. */
.sheet-build {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr); gap: 26px; align-items: center; padding: 22px;
  border: 1px solid var(--line); border-radius: var(--r-l);
  background: radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--ok) 9%, var(--panel)) 0, var(--panel) 62%);
}
.sb-win { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); box-shadow: var(--sh-card); animation: sb-in .5s cubic-bezier(.2, .8, .2, 1) both; }
.sb-win::before { content: ""; position: absolute; top: 0; left: 0; z-index: 1; width: 38%; height: 2px; background: var(--ok); animation: sb-progress 1.1s ease-in-out infinite; }
.sheet-build.tabs-in .sb-win::before { opacity: 0; transition: opacity .2s; }
.sb-bar { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.sb-file-ic { display: inline-flex; color: var(--ok); }
.sb-file-ic svg { width: 16px; height: 16px; }
.sb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-made { margin-left: auto; opacity: 0; transform: scale(.85); transition: opacity .25s ease, transform .25s ease; }
.sheet-build.done .sb-made { opacity: 1; transform: none; }
.sb-grid { display: grid; grid-template-columns: 26px repeat(var(--cols), minmax(0, 1fr)); font-size: 10.5px; }
.sb-grid > span { position: relative; display: flex; align-items: center; min-width: 0; height: 24px; padding: 0 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.sb-grid > .sb-n { justify-content: center; padding: 0; background: var(--panel-2); color: var(--ink-5); font-weight: 500; }
.sb-grid > .sb-hc { display: block; line-height: 24px; font-weight: 650; color: transparent; transition: color .3s ease, background-color .3s ease; transition-delay: calc(var(--i) * 110ms); }
.sb-hc::after { inset: 8px 7px; transition-delay: calc(var(--i) * 110ms); }
.sheet-build.cells-in .sb-hc { color: var(--ink); }
.sheet-build.cells-in .sb-hc::after { opacity: 0; }
.sheet-build.cells-in .sb-hc.req { color: var(--on-brand); background-color: var(--brand); }
.sheet-build.cells-in .sb-hc.more { color: var(--ink-4); font-weight: 500; }
.sb-tabs { display: flex; gap: 5px; padding: 6px 8px 0; border-top: 1px solid var(--line-soft); background: var(--panel-2); }
.sb-tab {
  position: relative; min-width: 70px; height: 22px; padding: 0 10px; line-height: 22px; overflow: hidden; white-space: nowrap;
  border-radius: 5px 5px 0 0; font-size: 10.5px; font-weight: 650; color: transparent; background-color: var(--panel);
  transition: color .3s ease, background-color .3s ease, box-shadow .3s ease, transform .3s ease; transition-delay: calc(var(--i) * 160ms);
}
.sb-tab::after { inset: 7px 9px; transition-delay: calc(var(--i) * 160ms); }
.sheet-build.tabs-in .sb-tab { color: color-mix(in srgb, var(--rtc, var(--brand)) 72%, var(--ink)); background-color: color-mix(in srgb, var(--rtc, var(--brand)) 14%, var(--panel)); box-shadow: inset 0 -2px 0 var(--rtc, var(--brand)); }
.sheet-build.tabs-in .sb-tab::after { opacity: 0; }
.sb-steps { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.sb-step { display: flex; align-items: center; gap: 11px; font-size: var(--fs-s); color: var(--ink-4); transition: color .25s ease; }
.sb-st { position: relative; display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--panel); transition: border-color .25s ease, background-color .25s ease; }
.sb-st svg { position: absolute; width: 13px; height: 13px; opacity: 0; transition: opacity .2s ease; }
.sb-step.on { color: var(--ink); font-weight: 600; }
.sb-step.on .sb-st { border-color: var(--brand); }
.sb-step.on .sb-wait { opacity: 1; color: var(--brand-text); animation: sheet-spin .9s linear infinite; }
.sb-step.done { color: var(--ink-2); }
.sb-step.done .sb-st { border-color: var(--ok); background-color: var(--ok); animation: sb-pop .35s ease; }
.sb-step.done .sb-ok { opacity: 1; color: var(--on-ok); }
@keyframes sb-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sb-progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(270%); } }
@keyframes sb-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes sb-fresh { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

.sheet-skeleton { display: grid; gap: 8px; margin-bottom: 12px; }
.sheet-skeleton span { display: block; height: 12px; border-radius: var(--r-s); }
.sheet-skeleton span:nth-child(2) { width: 82%; }
.sheet-skeleton span:nth-child(3) { width: 64%; }
@keyframes sheet-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* One record type in the matching: its heading, how a row is found again, then its fields. */
.sheet-type + .sheet-type { margin-top: 4px; }
.sheet-type .sect-t b .pill { margin-left: 8px; }
.sheet-ctl { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 12px; }
.sheet-ctl:empty { display: none; }
.sheet-key { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sheet-key select.input { width: auto; min-width: 170px; }
.sheet-label { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.sheet-label .itip svg { width: 14px; height: 14px; }

table.data.fieldrows col.sheet-col { width: 36%; }
table.data.fieldrows col.sheet-st { width: 120px; }
.sheet-fields td select.input { width: 100%; max-width: 320px; }
.sheet-fields .sheet-target-name { display: block; margin-top: 1px; font-weight: 400; }
.sheet-fields .sheet-set { margin-left: 6px; }
.sheet-fields .sheet-unset td select.input { color: var(--ink-4); }
.sheet-fields .sheet-unset td.mono { color: var(--ink-3); }
.sheet-more {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--brand-text);
}
.sheet-more svg { width: 13px; height: 13px; }

.sheet-values-row td { background: var(--panel-2); }
.sheet-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.sheet-value { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr); align-items: center; gap: 8px; font-size: var(--fs-s); }
.sheet-value span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-row-problems { margin-top: 8px; }
.sheet-row-problems summary { cursor: pointer; color: var(--warn); }

.spin { animation: sheet-spin 1s linear infinite; }
@keyframes sheet-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .sheet-skeleton span, .spin, .sheet-build *, .sheet-build *::before, .sheet-build *::after, .sheet-pick .dircard.fresh { animation: none !important; transition: none !important; }
}

@media (max-width: 760px) {
  .sheet-build { grid-template-columns: 1fr; }
  .sheet-done-act { padding-left: 0; }
  .sheet-key select.input { min-width: 140px; }
  .sheet-ctl { gap: 10px; }
}
