/* MarketTech Applications: tool page styles. Uses the storefront tokens from /styles.css. */
.tk-page { background: var(--paper, #f7f5f0); color: var(--ink, #202a23); min-height: 100vh; }
.tk-main { max-width: 1040px; margin: 0 auto; padding: 22px 20px 56px; }
.tk-main.wide { max-width: 1480px; }
.tk-crumbs { font-size: 13px; margin: 0 0 14px; }
.tk-crumbs a { color: var(--olive-dark, #344535); font-weight: 650; text-decoration: none; }
.tk-crumbs a:hover { text-decoration: underline; }
.tk-head h1 { font-size: clamp(30px, 4.6vw, 46px); line-height: 1.05; letter-spacing: -.035em; margin: 4px 0 10px; }
.tk-head p { margin: 0; color: var(--muted, #72776c); max-width: 62ch; font-size: 15.5px; line-height: 1.55; }
.tk-privacy { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 7px 12px; border: 1px solid var(--line, #dedbd1); border-radius: 999px; background: #eef2ea; color: var(--olive-dark, #344535); font-size: 12.5px; font-weight: 650; }
.tk-privacy::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3f7f4f; }
#tool-root { display: grid; gap: 16px; margin-top: 22px; }
.tk-panel { background: var(--white, #fffefa); border: 1px solid var(--line, #dedbd1); border-radius: 12px; padding: 20px; min-width: 0; }
.tk-panel > h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted, #72776c); margin: 0 0 14px; font-weight: 750; }
.tk-note { color: var(--muted, #72776c); font-size: 13.5px; line-height: 1.55; margin: 8px 0 0; }
.tk-intro { margin: 0; padding: 12px 14px; background: #f1efe7; border-radius: 10px; color: var(--ink, #202a23); }
.tk-meta { font-size: 12.5px; color: var(--muted, #72776c); margin: 0 0 8px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:where(.tk-page) :focus-visible { outline: 2px solid var(--olive, #4f624b); outline-offset: 2px; }

.tk-drop { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; border: 2px dashed #c9c5b8; border-radius: 12px; padding: 30px 18px; cursor: pointer; background: #fbfaf6; transition: border-color .12s, background-color .12s; }
.tk-drop strong { font-size: 16px; }
.tk-drop span { color: var(--muted, #72776c); font-size: 13px; }
.tk-drop.over, .tk-drop:focus-within { border-color: var(--olive, #4f624b); background: #eef2ea; }

.tk-files { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.tk-file { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line, #dedbd1); border-radius: 10px; padding: 9px 12px; background: #fff; }
.tk-file[draggable="true"] { cursor: grab; }
.tk-badge, .tk-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.tk-badge { display: grid; place-items: center; background: #e9ede5; color: var(--olive-dark, #344535); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.tk-file-info { min-width: 0; display: grid; }
.tk-file-name { font-weight: 650; overflow-wrap: anywhere; }
.tk-file small, .tk-outputs small { color: var(--muted, #72776c); font-size: 12px; }
.tk-file-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.tk-btn, .tk-mini { font: inherit; border: 1px solid var(--line, #dedbd1); border-radius: 8px; background: #fff; color: var(--ink, #202a23); cursor: pointer; }
.tk-btn { padding: 9px 14px; font-weight: 600; min-height: 40px; }
.tk-mini { padding: 5px 9px; font-size: 13px; min-height: 32px; }
.tk-btn:hover:not(:disabled), .tk-mini:hover:not(:disabled) { border-color: var(--olive, #4f624b); }
.tk-btn:disabled, .tk-mini:disabled { opacity: .45; cursor: not-allowed; }
.tk-btn.primary { background: var(--olive-dark, #344535); border-color: var(--olive-dark, #344535); color: #fff; font-weight: 700; }
.tk-btn.primary:hover:not(:disabled) { background: #26352a; }
.tk-wide { width: 100%; }
.tk-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tk-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tk-options { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tk-field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.tk-field > label, .tk-inline { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #72776c); }
.tk-field small { color: var(--muted, #72776c); font-size: 12px; line-height: 1.4; }
.tk-field.check { grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.tk-field.check > label { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink, #202a23); font-weight: 600; }
.tk-field.check small { grid-column: 2; }
.tk-page input[type=text], .tk-page input[type=number], .tk-page input[type=password], .tk-page select, .tk-page textarea { font: inherit; width: 100%; min-width: 0; padding: 9px 11px; min-height: 40px; border: 1px solid var(--line, #dedbd1); border-radius: 8px; background: #fff; color: var(--ink, #202a23); }
.tk-page input[type=file] { font: inherit; font-size: 13px; max-width: 100%; }
.tk-page input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--line, #dedbd1); border-radius: 8px; background: #fff; }
.tk-page input[type=range] { width: 100%; accent-color: var(--olive, #4f624b); }
.tk-readout { font-variant-numeric: tabular-nums; color: var(--ink, #202a23); }
.tk-inline { display: inline-flex; align-items: center; gap: 8px; }
.tk-jump { width: 72px !important; }

.tk-actions { display: grid; gap: 12px; }
.tk-progress { width: 100%; height: 8px; accent-color: var(--olive, #4f624b); }
.tk-status { min-height: 22px; margin: 0; font-size: 14px; color: var(--muted, #72776c); overflow-wrap: anywhere; }
.tk-status.ok { color: #1f6f43; } .tk-status.error { color: #b3261e; } .tk-status.warn { color: #8a5a00; }
.tk-results { border-color: #b9ccb9; background: #f7faf5; }
.tk-outputs { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.tk-outputs li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line, #dedbd1); border-radius: 10px; padding: 9px 12px; }

.tk-dialog { border: 1px solid var(--line, #dedbd1); border-radius: 14px; padding: 22px; max-width: min(420px, calc(100vw - 32px)); background: var(--white, #fffefa); color: var(--ink, #202a23); }
.tk-dialog::backdrop { background: rgba(25, 31, 26, .5); }
.tk-dialog h2 { margin: 0 0 8px; font-size: 20px; } .tk-dialog p { margin: 0 0 12px; color: var(--muted, #72776c); } .tk-dialog label { display: block; margin-bottom: 4px; font-weight: 650; } .tk-dialog .tk-row { margin-top: 14px; }

.tk-diff { max-height: 460px; overflow: auto; border: 1px solid var(--line, #dedbd1); border-radius: 10px; background: #fff; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.tk-diff > div { display: grid; grid-template-columns: 22px minmax(0, 1fr); padding: 2px 10px; overflow-wrap: anywhere; }
.tk-diff-add { background: #e5f4e8; } .tk-diff-del { background: #fbe7e5; text-decoration: line-through; text-decoration-color: rgba(179, 38, 30, .5); } .tk-diff-same { color: var(--muted, #72776c); }

/* Page stage */
.tk-stagewrap { margin: 12px 0; }
.tk-stage { position: relative; width: 100%; margin: 0 auto; background: #fff; border: 1px solid var(--line, #dedbd1); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.tk-stage-canvas { display: block; width: 100%; height: 100%; }
.tk-overlay { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.tk-rect { position: absolute; border: 2px solid var(--olive, #4f624b); box-shadow: 0 0 0 9999px rgba(10, 14, 11, .5); cursor: move; touch-action: none; }
.tk-rect.sel { border-color: #1d4fd7; }
.tk-rect.place { box-shadow: none; background: rgba(29, 79, 215, .06); border-style: dashed; }
.tk-rect.redact { box-shadow: none; background: rgba(0, 0, 0, .86); border: 2px solid #b3261e; }
.tk-rect.redact.sel { border-color: #e8a317; }
.tk-rect img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; display: block; }
.tk-overlay:has(.tk-rect:not(.redact)) .tk-rect + .tk-rect { box-shadow: none; }
.tk-hd { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--olive-dark, #344535); border-radius: 3px; }
@media (pointer: coarse) { .tk-hd { width: 24px; height: 24px; } }
.tk-hd[data-h=nw] { left: -9px; top: -9px; cursor: nwse-resize; } .tk-hd[data-h=ne] { right: -9px; top: -9px; cursor: nesw-resize; }
.tk-hd[data-h=sw] { left: -9px; bottom: -9px; cursor: nesw-resize; } .tk-hd[data-h=se] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.tk-hd[data-h=n] { left: calc(50% - 7px); top: -9px; cursor: ns-resize; } .tk-hd[data-h=s] { left: calc(50% - 7px); bottom: -9px; cursor: ns-resize; }
.tk-hd[data-h=w] { top: calc(50% - 7px); left: -9px; cursor: ew-resize; } .tk-hd[data-h=e] { top: calc(50% - 7px); right: -9px; cursor: ew-resize; }
.tk-nav { justify-content: space-between; } .tk-pagelabel { font-weight: 650; font-variant-numeric: tabular-nums; }
.tk-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }

/* Organize grid */
.tk-grid { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tk-gitem { position: relative; display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line, #dedbd1); border-radius: 10px; background: #fff; cursor: grab; }
.tk-gframe { height: 170px; display: grid; place-items: center; background: #f1efe7; border-radius: 6px; overflow: hidden; }
.tk-gthumb { max-width: 92%; max-height: 92%; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); background: #fff; }
.tk-blank { width: 70%; height: 80%; display: grid; place-items: center; background: #fff; color: var(--muted, #72776c); font-size: 12px; border: 1px dashed #c9c5b8; }
.tk-gnum { position: absolute; top: 12px; left: 12px; background: var(--olive-dark, #344535); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.tk-gbtns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.tk-gbtns .tk-mini { padding: 3px 7px; min-height: 30px; }

/* Signature maker */
.tk-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tk-tab { font: inherit; font-weight: 650; padding: 8px 14px; border: 1px solid var(--line, #dedbd1); border-radius: 999px; background: #fff; cursor: pointer; }
.tk-tab[aria-selected=true] { background: var(--olive-dark, #344535); color: #fff; border-color: var(--olive-dark, #344535); }
.tk-pane { display: grid; gap: 10px; }
.tk-pad { width: 100%; max-width: 560px; aspect-ratio: 3 / 1; border: 1px dashed #b7b3a4; border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.tk-typed { max-width: 100%; max-height: 90px; }

/* Label crop layout */
.tk-lc { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1040px) { .tk-lc { grid-template-columns: 300px minmax(0, 1fr) 290px; } }
.tk-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
.tk-lc-thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; max-height: 340px; overflow: auto; }
.tk-lc-thumb { display: grid; gap: 4px; min-width: 0; }
.tk-lc-pick { border: 2px solid var(--line, #dedbd1); border-radius: 4px; padding: 0; background: #fff; cursor: pointer; line-height: 0; display: block; }
.tk-lc-thumb.on .tk-lc-pick { border-color: #1d4fd7; } .tk-lc-thumb.off .tk-lc-pick { opacity: .4; }
.tk-lc-mini { position: relative; display: block; } .tk-lc-mini img { display: block; width: 100%; height: auto; }
.tk-lc-mini i { position: absolute; border: 1.5px solid #1d4fd7; background: rgba(29, 79, 215, .14); }
.tk-lc-inc { display: flex; gap: 5px; align-items: center; font-size: 11px; color: var(--muted, #72776c); min-width: 0; }
.tk-lc-inc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-lc-prevwrap { background: #eceae2; border: 1px solid var(--line, #dedbd1); padding: 12px; display: flex; justify-content: center; margin-bottom: 10px; }
.tk-lc-prev { display: block; width: 100%; max-width: 230px; height: auto; background: #fff; box-shadow: 0 1px 0 var(--line, #dedbd1), 0 6px 14px rgba(0, 0, 0, .18); }

@media (max-width: 640px) {
  .tk-main { padding-inline: 14px; } .tk-panel { padding: 15px; }
  .tk-file { grid-template-columns: 38px minmax(0, 1fr); } .tk-file-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .tk-outputs li { grid-template-columns: minmax(0, 1fr) auto; } .tk-outputs li small { display: none; }
  .tk-nums { grid-template-columns: 1fr 1fr; } .tk-two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .tk-drop { transition: none; } }

.tk-more { margin-top: 34px; } .tk-more h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted, #72776c); margin: 0 0 10px; }
#more-tools { display: flex; flex-wrap: wrap; gap: 8px; }
#more-tools a { padding: 7px 12px; border: 1px solid var(--line, #dedbd1); border-radius: 999px; background: #fff; color: var(--ink, #202a23); text-decoration: none; font-size: 13px; font-weight: 600; }
#more-tools a:hover { border-color: var(--olive, #4f624b); }
