/* TCH Design Library — picker, My Designs and gallery. Everything is scoped to .tch-lib so theme
   and Elementor styles don't leak in (same lesson as the gang sheet builder).
   ":is(.tch-lib,#tch-lib-scope)" gives each rule ID strength (that #id never has to exist), so the
   Elementor kit's "button" and "input:not(...):not(...)" rules can't override ours. */

.tch-lib {
	--lib-espresso: var(--tch-espresso, #352923);
	--lib-ivory: var(--tch-ivory, #f3ede4);
	--lib-tan: var(--tch-tan, #c7aa7c);
	--lib-tan-h: #b39363;
	--lib-tan-d: var(--tch-tan-deep, #8a6a3c);
	--lib-ink: var(--tch-ink, #25211e);
	--lib-muted: var(--tch-muted, #655b53);
	--lib-line: var(--tch-line, #ddd5c9);
	--lib-soft: #ebe4d8;
	--lib-bad: #b3261e;
	--lib-ok: #2e7d4f;
	--lib-display: var(--tch-font-display, Anton, Impact, "Arial Narrow Bold", sans-serif);
	--lib-body: var(--tch-font-body, Arimo, Arial, Helvetica, sans-serif);
	font-family: var(--lib-body); font-size: 14px; line-height: 1.4; color: var(--lib-ink);
}
:is(.tch-lib,#tch-lib-scope) *, :is(.tch-lib,#tch-lib-scope) *::before, :is(.tch-lib,#tch-lib-scope) *::after { box-sizing: border-box; }
:is(.tch-lib,#tch-lib-scope) [hidden] { display: none !important; }
:is(.tch-lib,#tch-lib-scope) button, :is(.tch-lib,#tch-lib-scope) input {
	margin: 0; font-family: inherit; font-size: inherit; line-height: 1.2; text-transform: none; letter-spacing: normal;
	box-shadow: none; text-shadow: none; min-height: 0; min-width: 0; width: auto;
}
:is(.tch-lib,#tch-lib-scope) a.tch-lib__btn, :is(.tch-lib,#tch-lib-scope) a.tch-lib__mini {
	margin: 0; font-family: inherit; line-height: 1.2; text-transform: none; letter-spacing: normal; text-decoration: none; box-shadow: none;
}
:is(.tch-lib,#tch-lib-scope) button { background: transparent; color: inherit; border: 0; padding: 0; border-radius: 0; cursor: pointer; }
:is(.tch-lib,#tch-lib-scope) h2, :is(.tch-lib,#tch-lib-scope) h3, :is(.tch-lib,#tch-lib-scope) p, :is(.tch-lib,#tch-lib-scope) ul, :is(.tch-lib,#tch-lib-scope) li { margin: 0; padding: 0; text-transform: none; letter-spacing: normal; }
:is(.tch-lib,#tch-lib-scope) ul { list-style: none; }
:is(.tch-lib,#tch-lib-scope) img { max-width: none; border: 0; box-shadow: none; border-radius: 0; }
:is(.tch-lib,#tch-lib-scope) svg { flex: none; }

/* Buttons */
:is(.tch-lib,#tch-lib-scope) .tch-lib__btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	height: 40px; padding: 0 16px; border: 1px solid var(--lib-espresso); border-radius: 6px;
	background: #fff; color: var(--lib-espresso); font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
	transition: background .15s, color .15s, border-color .15s;
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__btn:hover:not(:disabled) { background: var(--lib-ivory); color: var(--lib-espresso); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__btn:disabled { opacity: .45; cursor: not-allowed; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__btn--dark { background: var(--lib-espresso); color: var(--lib-ivory); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__btn--dark:hover:not(:disabled) { background: var(--lib-ink); color: #fff; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__btn--primary { background: var(--lib-tan); border-color: var(--lib-tan); color: var(--lib-ink); text-transform: uppercase; letter-spacing: .05em; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__btn--primary:hover:not(:disabled) { background: var(--lib-tan-h); border-color: var(--lib-tan-h); color: var(--lib-ink); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__link { color: var(--lib-tan-d); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__mini {
	display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 10px;
	border: 1px solid var(--lib-line); border-radius: 5px; background: #fff; color: var(--lib-ink);
	font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__mini:hover { border-color: var(--lib-espresso); color: var(--lib-espresso); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__mini--dark { background: var(--lib-espresso); border-color: var(--lib-espresso); color: var(--lib-ivory); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__mini--dark:hover { background: var(--lib-ink); color: #fff; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__mini--danger { color: var(--lib-bad); border-color: #e6bdb9; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__mini--danger:hover { background: var(--lib-bad); border-color: var(--lib-bad); color: #fff; }

/* Tabs */
:is(.tch-lib,#tch-lib-scope) .tch-lib__tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--lib-line); margin-bottom: 14px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__tab {
	display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px 11px; margin-bottom: -1px;
	border-bottom: 3px solid transparent; font-weight: 700; font-size: 14px; color: var(--lib-muted);
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__tab:hover { color: var(--lib-ink); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__tab.is-on { color: var(--lib-ink); border-bottom-color: var(--lib-tan); }

/* Tools row */
:is(.tch-lib,#tch-lib-scope) .tch-lib__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__search {
	flex: 1 1 240px; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px;
	border: 1px solid var(--lib-line); border-radius: 6px; background: #fff; color: var(--lib-muted);
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__search:focus-within { border-color: var(--lib-espresso); box-shadow: 0 0 0 3px rgba(199,170,124,.35); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__search input {
	flex: 1; min-width: 0; height: 40px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--lib-ink); font-size: 15px;
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__usage { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--lib-muted); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__meter { display: inline-block; width: 90px; height: 7px; border-radius: 6px; background: #ddd2c0; overflow: hidden; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__meter i { min-width: 3px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__meter i { display: block; height: 100%; background: var(--lib-tan); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__usage.is-full .tch-lib__meter i { background: var(--lib-bad); }

/* Category chips */
:is(.tch-lib,#tch-lib-scope) .tch-lib__chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chips--sub { padding-top: 0; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip {
	display: inline-flex; align-items: center; gap: 5px; flex: none; height: 34px; padding: 0 14px;
	border: 1px solid var(--lib-line); border-radius: 999px; background: #fff; color: var(--lib-ink); font-weight: 700; font-size: 13px; white-space: nowrap;
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip:hover { border-color: var(--lib-espresso); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip.is-on { background: var(--lib-espresso); border-color: var(--lib-espresso); color: var(--lib-ivory); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip--feat { color: var(--lib-tan-d); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip--feat.is-on { color: var(--lib-tan); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip--sm { height: 30px; padding: 0 12px; font-size: 12.5px; background: var(--lib-ivory); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip--sm span { font-weight: 400; opacity: .7; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__chip--sm.is-on { background: var(--lib-tan); border-color: var(--lib-tan); color: var(--lib-ink); }

/* Privacy note (My designs) */
:is(.tch-lib,#tch-lib-scope) .tch-lib__privacy { margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; background: #eef4ee; border: 1px solid #cfe0d2; color: #24452f; font-size: 13.5px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__privacy-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__privacy-line svg { color: var(--lib-ok); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__privacy .tch-lib__link { color: #24452f; font-weight: 700; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__privacy-list { margin-top: 8px; padding-left: 20px; list-style: disc; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__privacy-list li { margin: 3px 0; }

:is(.tch-lib,#tch-lib-scope) .tch-lib__drop-hint { margin-bottom: 12px; padding: 22px; border: 2px dashed var(--lib-tan); border-radius: 10px; background: #f6efe3; text-align: center; font-weight: 700; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__status { padding: 18px 4px; color: var(--lib-muted); text-align: center; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__status.is-error { color: var(--lib-bad); font-weight: 700; }

/* Grid */
:is(.tch-lib,#tch-lib-scope) .tch-lib__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__item { position: relative; min-width: 0; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__card {
	position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; padding: 8px; gap: 3px;
	border: 2px solid transparent; border-radius: 10px; background: #fff; text-align: left; color: var(--lib-ink);
	box-shadow: 0 1px 2px rgba(37,33,30,.08), 0 0 0 1px var(--lib-line);
	transition: box-shadow .15s, border-color .15s, transform .15s;
}
:is(.tch-lib,#tch-lib-scope) button.tch-lib__card:hover { box-shadow: 0 4px 14px rgba(37,33,30,.14), 0 0 0 1px var(--lib-line); transform: translateY(-1px); }
:is(.tch-lib,#tch-lib-scope) button.tch-lib__card:focus-visible { outline: 3px solid var(--lib-tan); outline-offset: 2px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__card[aria-pressed="true"] { border-color: var(--lib-espresso); box-shadow: 0 0 0 1px var(--lib-espresso); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__img {
	display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; margin-bottom: 4px; overflow: hidden;
	border-radius: 7px; background: repeating-conic-gradient(#ece6dc 0% 25%, #fbf9f5 0% 50%) 50% / 16px 16px;
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__img img { width: 88%; height: 88%; object-fit: contain; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__name { display: block; overflow: hidden; font-weight: 700; font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__meta { display: block; font-size: 12px; color: var(--lib-muted); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__meta em { font-style: normal; color: #a15c00; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__tick {
	position: absolute; top: 14px; right: 14px; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px;
	border-radius: 50%; border: 2px solid #fff; background: rgba(255,255,255,.85); color: transparent; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
:is(.tch-lib,#tch-lib-scope) .tch-lib__card[aria-pressed="true"] .tch-lib__tick { background: var(--lib-espresso); color: #fff; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__actions .tch-lib__mini { flex: 1 1 auto; height: auto; min-height: 30px; padding: 6px 10px; white-space: normal; text-align: center; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__confirm { width: 100%; font-size: 12.5px; font-weight: 700; color: var(--lib-bad); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__rename { display: flex; flex-wrap: wrap; gap: 6px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__rename input { flex: 1 1 100%; height: 32px; padding: 0 8px; border: 1px solid var(--lib-espresso); border-radius: 5px; font-size: 13.5px; background: #fff; color: var(--lib-ink); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__item.is-busy { opacity: .5; pointer-events: none; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__item.is-new .tch-lib__card { animation: tch-lib-pop .5s ease; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__item.is-error .tch-lib__meta { color: var(--lib-bad); font-weight: 700; white-space: normal; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__item.is-uploading .tch-lib__img { background: var(--lib-ivory); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__bar { display: block; height: 5px; margin-top: 4px; border-radius: 5px; background: var(--lib-soft); overflow: hidden; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__bar i { display: block; width: 0; height: 100%; background: var(--lib-tan); transition: width .2s; }
@keyframes tch-lib-pop { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }

:is(.tch-lib,#tch-lib-scope) .tch-lib__more { display: flex; justify-content: center; padding: 18px 0 4px; }

/* Signed-out card */
:is(.tch-lib,#tch-lib-scope) .tch-lib__signin { grid-column: 1 / -1; max-width: 460px; margin: 10px auto; padding: 28px 24px; text-align: center; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--lib-line); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__signin h3 { margin-bottom: 6px; font-family: var(--lib-display); font-size: 22px; font-weight: 400; text-transform: uppercase; letter-spacing: .01em; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__signin p { margin-bottom: 16px; color: var(--lib-muted); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__signin-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-bottom: 10px; border-radius: 50%; background: var(--lib-ivory); color: var(--lib-espresso); }
:is(.tch-lib,#tch-lib-scope) .tch-lib__signin-icon svg { width: 22px; height: 22px; }
:is(.tch-lib,#tch-lib-scope) .tch-lib__muted { margin-top: 12px !important; font-size: 12.5px; color: var(--lib-muted); }

/* ---------- Modal ---------- */
html.tch-lib-locked, html.tch-lib-locked body { overflow: hidden !important; }
.tch-lib-modal { position: fixed; inset: 0; z-index: 1000010; display: flex; align-items: center; justify-content: center; padding: 24px; }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__backdrop { position: absolute; inset: 0; background: rgba(37,33,30,.62); }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__dialog {
	position: relative; display: flex; flex-direction: column; width: min(1080px, 100%); height: min(820px, 100%);
	border-radius: 14px; background: var(--lib-ivory); box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden;
}
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__head { position: relative; padding: 18px 64px 12px 24px; background: var(--lib-espresso); color: var(--lib-ivory); }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__head h2 { font-family: var(--lib-display); font-size: 26px; font-weight: 400; line-height: 1.1; letter-spacing: .02em; text-transform: uppercase; color: var(--lib-ivory); }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__sub { margin-top: 3px; font-size: 13.5px; color: rgba(243,237,228,.75); }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__x { position: absolute; top: 14px; right: 14px; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; color: var(--lib-ivory); }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__x:hover { background: rgba(243,237,228,.12); }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 24px 20px; }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__tabs { position: sticky; top: -8px; z-index: 2; margin: 0 -24px 14px; padding: 8px 24px 0; background: var(--lib-ivory); }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__foot { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--lib-line); background: #fff; }
:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__count { margin-right: auto; color: var(--lib-muted); font-size: 13.5px; }

@media (max-width: 700px) {
	.tch-lib-modal { padding: 0; }
	:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__dialog { width: 100%; height: 100%; border-radius: 0; }
	:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__head { padding: 14px 60px 10px 16px; }
	:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__head h2 { font-size: 22px; }
	:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__body { padding: 6px 14px 16px; }
	:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__tabs { margin: 0 -14px 12px; padding: 6px 14px 0; }
	:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
	:is(.tch-lib-modal,#tch-lib-scope) .tch-lib__foot [data-close] { display: none; }
	:is(.tch-lib,#tch-lib-scope) .tch-lib__grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
	:is(.tch-lib,#tch-lib-scope) .tch-lib__usage { flex-basis: 100%; }
}

/* ---------- Inline (My Account manager, public gallery) ---------- */
.tch-lib-inline { margin: 10px 0 30px; }
.tch-lib-account__intro { margin: 0 0 12px; }
.tch-lib-privacy { margin: 0 0 18px; padding: 12px 16px; border-radius: 8px; background: #eef4ee; border: 1px solid #cfe0d2; color: #24452f; font-size: 14px; }
.tch-lib-privacy summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
.tch-lib-privacy summary::-webkit-details-marker { display: none; }
.tch-lib-privacy__lock { display: inline-block; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3' fill='none' stroke='black' stroke-width='2'/%3E%3Crect x='4.5' y='10' width='15' height='11' rx='2'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3' fill='none' stroke='black' stroke-width='2'/%3E%3Crect x='4.5' y='10' width='15' height='11' rx='2'/%3E%3C/svg%3E") center / contain no-repeat; }
.tch-lib-privacy ul { margin: 8px 0 0 20px; padding: 0; list-style: disc; }
.tch-lib-privacy li { margin: 4px 0; }
.tch-lib-inline--manager .tch-lib__privacy { display: none !important; } /* the page already shows the full note */
.tch-lib-signin { padding: 18px; border: 1px solid #ddd5c9; border-radius: 8px; background: #fff; }
