/* Composer: a workspace sheet. What you say on the left, how each account will receive it on the right. */

.sheet.composer-sheet { width: min(1180px, 100%); height: min(920px, calc(100dvh - 48px)); max-height: none; }
.composer { position: relative; flex: 1; grid-template-rows: auto 1fr auto; padding-bottom: 0 !important; min-height: 0; }
/* Desktop: what you say (top left), then when (bottom left); the account cards stay beside both. */
.cmp-grid {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); grid-template-rows: auto 1fr;
  grid-template-areas: "main side" "when side"; gap: 24px 28px; align-items: start;
}
.cmp-col { display: grid; gap: 22px; align-content: start; min-width: 0; }
.cmp-main { grid-area: main; }
.cmp-when { grid-area: when; }
.cmp-side {
  grid-area: side; position: sticky; top: 0; display: grid; gap: 12px; min-width: 0;
  padding: 16px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line);
}
.cmp-side-head h3 { font-size: 0.8125rem; font-weight: 550; padding: 2px 2px 0; }
.composer .sheet-foot { margin-top: 8px; }
.composer .sheet-foot .status { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; line-height: 1.45; }
.composer .sheet-foot .status.bad { color: var(--danger); }
.composer .sheet-foot .status .btn.link { flex: none; min-height: 26px; padding: 0 8px; margin-left: -8px; }

.acc-chip { padding-right: 12px; }
.body-input { min-height: 180px; font-size: 1rem; line-height: 1.6; }
.template-box .input.inline { min-height: 30px; font-size: 0.8125rem; max-width: 220px; }
.template-fields { display: grid; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--accent-soft); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }

/* files */
.dropzone {
  appearance: none; display: grid; justify-items: center; gap: 4px; width: 100%; padding: 26px 18px; cursor: pointer; text-align: center;
  border-radius: var(--r); border: 1.5px dashed var(--line-strong); background: var(--surface); color: var(--text);
  transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.dropzone:hover { border-color: var(--accent-text); background: var(--accent-soft); }
.dz-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 6px; }
.dz-title { font-weight: 550; font-size: 0.875rem; }
.dz-sub { font-size: 0.8125rem; color: var(--text-2); }
.upload-progress { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.upload-progress > i { display: block; height: 100%; width: 0; background: var(--accent-text); border-radius: inherit; transition: width 160ms linear; }

.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.tile, .gtile {
  position: relative; flex: none; width: 116px; height: 116px; border-radius: 14px; overflow: hidden; scroll-snap-align: start;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
.tile img, .tile video, .gtile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-ph { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--text-2); font-size: 0.75rem; font-weight: 550; }
.tile-n {
  position: absolute; top: 7px; left: 7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  background: var(--brg); color: var(--ivory); font-size: 0.75rem; font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.tile-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 6px; font-size: 0.6875rem; color: #fff;
  background: linear-gradient(transparent, rgba(4, 18, 10, 0.72)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity var(--t-fast) ease; }
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }
@media (hover: none) { .tile-actions { opacity: 1; } }
.mini {
  appearance: none; border: 0; cursor: pointer; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(6, 22, 13, 0.62); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.mini:hover { background: rgba(6, 22, 13, 0.85); }
.tile.add { appearance: none; border: 1.5px dashed var(--line-strong); background: transparent; box-shadow: none; display: grid; place-items: center; color: var(--text-2); cursor: pointer; }
.tile.add:hover { border-color: var(--accent-text); color: var(--accent-text); background: var(--accent-soft); }

.library { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; max-height: 300px; background: var(--surface); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.gtile { appearance: none; border: 0; padding: 0; width: auto; height: auto; aspect-ratio: 1; cursor: pointer; transition: box-shadow var(--t-fast) ease; }
.gtile:hover { box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 2px var(--accent-soft-2); }
.gtile.on { box-shadow: 0 0 0 2.5px var(--accent-text); }

/* per-account cards */
.targets, .cmp-side, .tcard, .topts > .stack { grid-template-columns: minmax(0, 1fr); }
.targets { display: grid; gap: 12px; }
.opts .hint { overflow-wrap: anywhere; }
.targets-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 18px; text-align: center; color: var(--text-2); border: 1.5px dashed var(--line-strong); border-radius: var(--r); }
.targets-empty .ic { color: var(--text-3); margin-bottom: 4px; }
.targets-empty p:first-of-type { color: var(--text); font-weight: 550; }
.tcard {
  display: grid; gap: 12px; padding: 14px 14px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-sm); transition: border-color var(--t) ease, box-shadow var(--t) ease;
}
.tcard[data-state="bad"] { border-color: color-mix(in srgb, var(--danger) 42%, var(--line)); }
.tcard:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.tcard-head { display: flex; align-items: center; gap: 10px; }
.tcard-head .pglyph { align-self: flex-start; margin-top: 2px; }
.tcard-name { font-weight: 600; line-height: 1.3; }
.tcard-sub { font-size: 0.75rem; line-height: 1.4; color: var(--text-2); }
.tcard-sub .sep { margin: 0 5px; color: var(--text-3); }

/* ready / needs fixing: one quiet pill, readable from across the room */
.tstate {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
  transition: background-color var(--t) ease, color var(--t) ease;
}
.tstate.ok { background: var(--ok-soft); color: var(--ok); }
.tstate.warn { background: var(--warn-soft); color: var(--warn); }
.tstate.bad { background: var(--danger-soft); color: var(--danger); }

.tcard-format { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.tfmt { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 10px; }
.tfmt-label { flex: none; font-size: 0.8125rem; font-weight: 550; color: var(--text-2); }
.tcard select.input, .tcard .opts select.input { min-height: 38px; padding-block: 6px; font-size: 0.875rem; }
.tcard-format .btn.link { flex: none; margin-left: auto; }
.counter { color: var(--text-2); }
.tcount { white-space: nowrap; }
.counter.over { color: var(--danger); font-weight: 650; }
.checks { display: grid; gap: 6px; }
.checks:empty, .opts:empty { display: none; }
.checks > .hint { padding: 0 2px; }
.tcard-when { display: flex; align-items: center; gap: 7px; font-size: 0.8125rem; color: var(--text-2); padding: 0 2px; }
.tcard-when .ic { color: var(--accent-text); }

/* per-account settings: closed by default, one line */
.opts { border-top: 1px solid var(--line); margin: 0 -14px; padding: 2px 14px 0; }
.topts > summary { display: flex; width: 100%; min-height: 34px; color: var(--text); font-size: 0.8125rem; }
.topts > summary .ic { color: var(--text-3); }
.topts > summary:hover .ic { color: var(--text); }
.more-count { margin-left: auto; font-weight: 500; color: var(--text-3); }
.topts[open] > summary .more-count { visibility: hidden; }
.topts > .stack { padding: 6px 0 4px; gap: 14px; }
.hint.indent { padding-left: 28px; }
.results { display: grid; gap: 2px; max-height: 240px; }
.result { appearance: none; display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.result:hover { background: var(--surface-2); }
.result .grow { display: grid; }
.result .ic { margin-top: 2px; color: var(--text-2); }
.tags-field .input.inline { min-width: 120px; flex: 1 1 120px; max-width: 220px; }

/* drop target */
.drop-hint {
  position: absolute; inset: -1px -1px 0; z-index: 10; display: none; place-items: center; align-content: center; gap: 12px;
  border-radius: var(--r-lg); border: 2px dashed var(--accent-text); background: color-mix(in srgb, var(--accent-soft-2) 70%, var(--surface));
  color: var(--accent-text); font-weight: 600; font-size: 1.0625rem; pointer-events: none;
}
.composer.dropping .drop-hint { display: grid; }

/* One column: say it, check each account, then pick when. */
@media (max-width: 1000px) {
  .sheet.composer-sheet { height: auto; max-height: calc(100dvh - 48px); }
  .cmp-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "main" "side" "when"; gap: 24px; }
  .cmp-side { position: static; }
}
/* Phone: a tall bottom sheet; the footer keeps one clear action. */
@media (max-width: 640px) {
  .sheet.composer-sheet { height: 94dvh; max-height: 94dvh; }
  .cmp-side { padding: 0; border: 0; background: transparent; gap: 10px; }
  .cmp-side-head h3 { padding: 0; }
  .tile { width: 96px; height: 96px; }
  .when-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .when-seg button { padding: 0 4px; }
  .composer .sheet-foot { gap: 8px; }
  .composer .sheet-foot .cmp-cancel { display: none; }
  .composer .sheet-foot .btn.ghost { flex: 0 0 auto; padding: 0 12px; }
  .composer .sheet-foot .btn.primary { flex: 1 1 auto; min-height: 44px; }
  .tcount { display: block; }
  .tcount .sep { display: none; }
  .tfmt { flex-basis: 0; }
  .tfmt-label { display: none; }
  .tcard-format .btn.link { padding: 0 6px; }
}
