/* ==========================================================================
   TechIncome tools kit — shared styles for /tools/ pages (loaded only there).
   Builds on main.css variables; light theme only.
   ========================================================================== */

.tk-badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 18px 0 0; padding: 0; }
.tk-badges li { padding: 5px 13px; border-radius: 999px; background: var(--ti-primary-soft); color: var(--ti-primary-dark); font-size: .8rem; font-weight: 700; }
.tk-badges li::before { content: "\2713"; margin-right: 6px; font-weight: 800; }

.tk-main { padding-top: clamp(20px, 3vw, 36px); }
.tk { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); padding: clamp(16px, 2.6vw, 28px); min-width: 0; }
.tk-privacy { margin: 14px 4px 0; color: var(--muted); font-size: .88rem; }
.tk-note { color: var(--muted); font-size: .9rem; }

/* Toolbar */
.tk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 16px; }
.tk-spacer { flex: 1 1 auto; }
.tk .btn { min-height: 0; }
.tk .btn--sm { padding: .55em 1.05em; font-size: .9rem; }
.tk .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.tk-linkbtn { background: none; border: 0; padding: 2px 4px; color: var(--ti-primary); font-weight: 700; font-size: .88rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tk-linkbtn:hover { color: var(--ti-primary-dark); }

/* Fields */
.tk label { display: block; }
.tk-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tk-field > span, .tk-label { font-weight: 700; font-size: .88rem; color: var(--ti-ink); }
.tk-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 6px; }
.tk-label small { font-weight: 600; color: var(--muted); }
.tk input[type="text"], .tk input[type="number"], .tk input[type="search"], .tk input[type="url"], .tk input[type="datetime-local"], .tk select, .tk textarea {
	width: 100%; padding: 11px 13px; font: inherit; font-size: .98rem; color: var(--text); background: var(--bg);
	border: 1.5px solid var(--line); border-radius: 12px; box-sizing: border-box; min-width: 0;
}
.tk select { padding-right: 32px; }
.tk input:focus, .tk select:focus, .tk textarea:focus { outline: 0; border-color: var(--ti-primary); box-shadow: 0 0 0 4px var(--ti-primary-soft); }
.tk input[type="checkbox"], .tk input[type="radio"] { width: 18px; height: 18px; accent-color: var(--ti-primary); flex: none; margin: 0; }
.tk-check { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; cursor: pointer; }
.tk-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; margin: 0 0 16px; align-items: end; }
.tk-opts--checks { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.tk-inline { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 700; font-size: .88rem; }
.tk-inline select, .tk-inline input { width: auto !important; padding: 8px 30px 8px 11px !important; }
.tk-hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }

/* Panes + code areas */
.tk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.tk-grid--wide-left { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.tk-pane { min-width: 0; }
.tk-actions { display: inline-flex; gap: 10px; }
.tk .tk-code {
	display: block; width: 100%; min-height: 300px; padding: 14px; resize: vertical;
	font-family: var(--mono); font-size: .86rem; line-height: 1.6; tab-size: 2; white-space: pre; overflow: auto;
	background: var(--bg); color: var(--text); border: 1.5px solid var(--line); border-radius: 12px;
}
.tk .tk-code--sm { min-height: 130px; }
.tk .tk-code--wrap { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.tk .tk-code--out { background: #f7f5ee; }
.tk-out { margin: 0; padding: 14px; background: #f7f5ee; border: 1.5px solid var(--line); border-radius: 12px; font-family: var(--mono); font-size: .86rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; min-height: 60px; max-height: 520px; overflow: auto; }

/* Status + stats */
.tk-status { margin: 14px 0 0; padding: 11px 14px; border-radius: 12px; font-size: .92rem; font-weight: 600; background: var(--surface-2); color: var(--muted); min-height: 1.5em; overflow-wrap: anywhere; }
.tk-status:empty { display: none; }
.tk-status.is-ok { background: var(--ti-primary-soft); color: var(--ti-primary-dark); }
.tk-status.is-err { background: #fdecea; color: #8a1c13; }
.tk-status.is-warn { background: #fff4de; color: #7a4a00; }
.tk-status code { background: rgba(0, 0, 0, .06); padding: 1px 5px; border-radius: 4px; }
.tk-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.tk-stats li { padding: 4px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--muted); }
.tk-stats b { color: var(--ti-ink); }

/* Segmented tabs */
.tk-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 0 0 16px; background: var(--surface-2); border-radius: 14px; border: 1px solid var(--line); }
.tk-tabs button { padding: 8px 15px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-weight: 700; font-size: .9rem; color: var(--muted); }
.tk-tabs button:hover { color: var(--ti-ink); }
.tk-tabs button.is-active, .tk-tabs button[aria-selected="true"] { background: var(--ti-primary); color: #fff; }

/* Cards / fieldsets */
.tk-box { padding: 16px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); min-width: 0; }
.tk-box > h3, .tk-box > legend { margin: 0 0 12px; font-size: 1.02rem; font-family: var(--font); font-weight: 800; letter-spacing: 0; padding: 0; }
fieldset.tk-box { min-inline-size: 0; }
.tk-box--out { background: #f7f5ee; }

/* Dynamic rows */
.tk-rows { display: grid; gap: 10px; margin: 0 0 10px; }
.tk-row { display: grid; gap: 8px; align-items: center; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)) auto; }
.tk-row .tk-x { width: 38px; height: 38px; padding: 0; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 1.2rem; line-height: 1; }
.tk-row .tk-x:hover { color: #8a1c13; border-color: #8a1c13; }

/* CREATE TABLE column rows */
.tk-row--col { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .6fr) minmax(0, 1fr) auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.tk-flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.tk .tk-row--col input:disabled { opacity: .5; }
.tk-row .tk-x { align-self: center; }
legend small { font-weight: 600; color: var(--muted); }

/* Tables */
.tk-table-wrap { overflow: auto; max-height: 460px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.tk-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tk-table th, .tk-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tk-table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 800; color: var(--ti-ink); white-space: nowrap; }
.tk-table td { font-family: var(--mono); font-size: .82rem; overflow-wrap: anywhere; }

/* Highlight output (regex) */
.tk-hl { margin: 0; padding: 14px; min-height: 120px; max-height: 420px; overflow: auto; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; font-family: var(--mono); font-size: .86rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-hl mark { background: #ffe58f; color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px #e0b400 inset; }
.tk-hl mark:nth-of-type(even) { background: #c9ecd5; box-shadow: 0 0 0 1px #5bb97d inset; }

/* Chips as buttons (presets) */
.tk-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.tk-chips button, .tk-chip { padding: 6px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .84rem; font-weight: 700; color: var(--ti-ink); }
.tk-chips button:hover { border-color: var(--ti-primary); color: var(--ti-primary); }
.tk-chips--sm button { padding: 3px 10px; font-size: .78rem; }

/* Big result (uuid, cron description) */
.tk-big { margin: 0 0 14px; padding: 16px 18px; border-radius: 16px; background: linear-gradient(160deg, var(--ti-primary-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--ti-primary) 25%, var(--line)); font-family: var(--font-display); font-size: clamp(1.15rem, 2.6vw, 1.6rem); line-height: 1.3; color: var(--ti-ink); font-weight: 600; overflow-wrap: anywhere; }
.tk-big code { font-family: var(--mono); font-size: .9em; color: var(--ti-primary-dark); }

/* Cron field grid */
.tk-cron { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 8px; }
.tk-cron .tk-field input { font-family: var(--mono); text-align: center; font-size: 1.05rem; }
.tk-cron .tk-field small { color: var(--muted); font-size: .76rem; text-align: center; }
.tk-runs { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .92rem; }
.tk-runs li { padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-variant-numeric: tabular-nums; }

/* Content under the tool */
.tk-content h2 { margin-top: 1.6em; }
.tk-content h2:first-child { margin-top: 0; }
.tk-content code, .faq code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.tk-steps, .tk-uses { padding-left: 1.3em; margin: 0 0 1.3em; }
.tk-steps li, .tk-uses li { margin-bottom: .6em; padding-left: .2em; }
.tk-steps li::marker { font-weight: 800; color: var(--ti-primary); }
.tk-all { margin: 20px 0 0; font-weight: 700; }

/* Hub */
.tk-hub__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0 0 18px; }
.tk-hub__search { flex: 1 1 280px; max-width: 520px; padding: 13px 18px; font: inherit; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); }
.tk-hub__search:focus { outline: 0; border-color: var(--ti-primary); box-shadow: 0 0 0 4px var(--ti-primary-soft); }
.tk-hub__count { color: var(--muted); font-weight: 700; font-size: .9rem; }
.tk-hub__jump { margin: 0 0 8px; }
.tk-hub__jump .chips { justify-content: flex-start; }
.tk-hub__section { margin: 0 0 clamp(28px, 4vw, 48px); scroll-margin-top: 100px; }
.tk-hub__section h2 { margin-bottom: .25em; }
.tk-hub__desc { color: var(--muted); margin: 0 0 18px; }
.tk-hub__empty { padding: 24px; text-align: center; color: var(--muted); background: var(--surface-2); border-radius: 16px; }

@media (max-width: 860px) {
	.tk-grid, .tk-grid--wide-left { grid-template-columns: 1fr; }
	.tk-cron { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tk .tk-code { min-height: 220px; }
}
@media (max-width: 560px) {
	.tk-row, .tk-row--col { grid-template-columns: minmax(0, 1fr) auto; }
	.tk-row > * { grid-column: 1; }
	.tk-row > .tk-x { grid-column: 2; grid-row: 1; }
	.tk-row { padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
	.tk-bar .btn { flex: 1 1 auto; justify-content: center; }
	.tk-tabs { display: flex; }
	.tk-tabs button { flex: 1 1 auto; }
}
.tk-muted { color: var(--muted); }
.tk-cron .tk-chips { justify-content: center; margin: 4px 0 0; gap: 4px; }
.tk-cron input[aria-invalid="true"] { border-color: #b3261e; box-shadow: 0 0 0 4px #fdecea; }
@media (min-width: 861px) { .tk-sticky { position: sticky; top: 96px; } }

/* Regex tester */
.tk-rx { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); padding: 0 12px; }
.tk-rx:focus-within { border-color: var(--ti-primary); box-shadow: 0 0 0 4px var(--ti-primary-soft); }
.tk-rx__slash { font-family: var(--mono); font-size: 1.25rem; color: var(--muted); padding: 0 4px; }
.tk .tk-rx input[type="text"] { border: 0; box-shadow: none; background: transparent; font-family: var(--mono); font-size: 1rem; padding: 12px 4px; }
.tk .tk-rx input[type="text"]:focus { box-shadow: none; }
.tk-hl mark.tk-empty { display: inline-block; width: 2px; padding: 0; background: #e0b400; }
.tk-field--inline { display: inline-flex; align-items: center; gap: 8px; flex-direction: row; }
.tk-field--inline select { width: auto; }
