/* =========================================================
   Utility Platform — Tool Pages
   ========================================================= */

.tool-page {
    padding: 45px 0 80px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 35px;
    color: var(--text-muted);
    font-size: 13px;
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.tool-intro {
    /*max-width: 750px;*/
    max-width:100%;
    margin-bottom: 30px;
}

.tool-intro-icon {
    width: 50px;
    height: 50px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 18px;

    border-radius: 13px;

    background: var(--primary-soft);
    color: var(--primary);

    font-weight: 800;
}

.tool-intro h1 {
    margin: 0;

    font-size: clamp(32px, 5vw, 46px);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.tool-intro p {
    margin: 14px 0 0;

    color: var(--text-muted);
    font-size: 17px;
}

.tool-workspace {
    overflow: hidden;

    background: white;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-md);
}

.tool-content {
    max-width: 780px;

    margin: 50px auto 0;
}

.tool-content h2 {
    margin: 40px 0 12px;

    font-size: 25px;
    letter-spacing: -0.025em;
}

.tool-content h2:first-child {
    margin-top: 0;
}

.tool-content h3 {
    margin: 25px 0 8px;

    font-size: 18px;
}

.tool-content p,
.tool-content li {
    color: var(--text-muted);
    font-size: 15px;
}

.tool-content ol,
.tool-content ul {
    padding-left: 22px;
}

.related-tools {
    margin-top: 65px;
}

.related-tools h2 {
    margin-bottom: 22px;
}


/* ---------------------------------------------------------
   Generic Tool Editor
   --------------------------------------------------------- */

.tool-editor {
    padding: 20px;
}

.tool-editor textarea {
    display: block;

    width: 100%;
    min-height: 360px;

    padding: 20px;

    resize: vertical;

    border: 1px solid var(--border);
    border-radius: 12px;

    outline: none;

    color: var(--text);
    background: #fbfdff;

    font-size: 16px;
    line-height: 1.7;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.tool-editor textarea:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 4px rgba(37, 99, 235, 0.1);
}


/* ---------------------------------------------------------
   Statistics
   --------------------------------------------------------- */

.tool-stats {
    display: grid;

    /*grid-template-columns:
        repeat(5, minmax(0, 1fr));*/
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));

    border-top: 1px solid var(--border);

    background: var(--surface-soft);
}

.stat {
    padding: 20px;

    text-align: center;

    border-right: 1px solid var(--border);
}

.stat:last-child {
    border-right: 0;
}

.stat-value {
    display: block;

    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.03em;
}

.stat-label {
    display: block;

    margin-top: 3px;

    color: var(--text-muted);

    font-size: 12px;
}


/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 700px) {

    .tool-stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .stat {
        border-right: 1px solid var(--border);
    }

    .stat:nth-child(even) {
        border-right: 0;
    }

    .stat:nth-child(n + 3) {
        border-top: 1px solid var(--border);
    }

}


@media (max-width: 520px) {

    .tool-page {
        padding-top: 30px;
    }

    .tool-intro p {
        font-size: 16px;
    }

    .tool-editor {
        padding: 12px;
    }

    .tool-editor textarea {
        min-height: 300px;
        padding: 15px;
    }

}

/* Tool pages */

.tool-page {
    padding: 56px 0 80px;
}

.tool-page-header {
    max-width: 760px;
    margin-bottom: 32px;
}

.tool-page-header h1 {
    margin: 8px 0 14px;
}

.tool-page-intro {
    margin: 0;
    font-size: 18px;
    line-height: 1.7;
    color: #666;
}

.tool-interface {
    margin: 32px auto;
    max-width: 900px;
}

.tool-content {
    max-width: 800px;
    margin: 56px auto 0;
}

@media (max-width: 768px) {

    .tool-page {
        padding: 40px 0 60px;
    }

    .tool-page-intro {
        font-size: 16px;
    }

}
/* Word Counter */

.word-counter {
    width: 100%;
}

.word-counter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 10px;
}

.word-counter-hint {
    font-size: 13px;
    color: #777;
}

.word-counter-toolbar-actions {
    display: flex;
    gap: 8px;
}

.word-counter-input {
    display: block;
    width: 100%;
    min-height: 320px;
    padding: 22px;
    box-sizing: border-box;

    border: 1px solid #ddd;
    border-radius: 12px;

    background: #fff;

    font: inherit;
    font-size: 16px;
    line-height: 1.7;

    resize: vertical;
    outline: none;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.word-counter-input:focus {
    border-color: #999;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.word-counter-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.word-counter-stat {
    padding: 18px 12px;

    border: 1px solid #e5e5e5;
    border-radius: 10px;

    background: #fff;

    text-align: center;
}

.word-counter-stat span {
    display: block;

    font-size: 25px;
    font-weight: 700;
    line-height: 1.2;
}

.word-counter-stat small {
    display: block;

    margin-top: 7px;

    color: #777;

    font-size: 13px;
    line-height: 1.35;
}

.tool-button {
    padding: 9px 15px;

    border: 1px solid #ddd;
    border-radius: 8px;

    background: #fff;

    font: inherit;
    font-size: 14px;

    cursor: pointer;

    transition:
        background 0.2s,
        border-color 0.2s;
}

.tool-button:hover {
    background: #f5f5f5;
    border-color: #ccc;
}


/*
|--------------------------------------------------------------------------
| Tool Content
|--------------------------------------------------------------------------
*/

.tool-content h2 {
    margin-top: 42px;
    margin-bottom: 14px;

    font-size: 24px;
}

.tool-content h3 {
    margin-top: 28px;
    margin-bottom: 8px;

    font-size: 18px;
}

.tool-content p,
.tool-content li {
    font-size: 16px;
    line-height: 1.75;
    color: #555;
}

.tool-content ol {
    padding-left: 24px;
}


/*
|--------------------------------------------------------------------------
| Word Counter Responsive
|--------------------------------------------------------------------------
*/

@media (max-width: 700px) {

    .word-counter-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .word-counter-toolbar-actions {
        width: 100%;
    }

    .word-counter-toolbar-actions .tool-button {
        flex: 1;
    }

    .word-counter-stats {
        grid-template-columns: repeat(2, 1fr);
    }

}


@media (max-width: 420px) {

    .word-counter-input {
        min-height: 260px;
        padding: 16px;
    }

    .word-counter-stat {
        padding: 15px 8px;
    }

    .word-counter-stat span {
        font-size: 22px;
    }

    .word-counter-stat small {
        font-size: 12px;
    }

}

/* Character Counter */
.tool-page {
        padding: 35px 0 80px;
    }

    .tool-breadcrumb {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 30px;
        font-size: 14px;
        color: #777;
    }

    .tool-breadcrumb a {
        color: inherit;
        text-decoration: none;
    }

    .tool-breadcrumb a:hover {
        text-decoration: underline;
    }

    .tool-heading {
        display: flex;
        align-items: center;
        gap: 18px;
        margin-bottom: 30px;
    }

    .tool-heading-icon {
        width: 64px;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 16px;
        background: #f3f4f6;
        font-size: 28px;
        font-weight: 700;
    }

    .tool-heading h1 {
        margin: 0 0 6px;
    }

    .tool-heading p {
        margin: 0;
        color: #6b7280;
    }

    .tool-workspace {
        max-width: 1000px;
        margin: 0 auto;
    }

    .character-counter {
        border: 1px solid #e5e7eb;
        border-radius: 16px;
        background: #fff;
        overflow: hidden;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
    }

    .counter-stats {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        border-bottom: 1px solid #e5e7eb;
    }

    .counter-stat {
        padding: 18px 12px;
        text-align: center;
        border-right: 1px solid #e5e7eb;
    }

    .counter-stat:last-child {
        border-right: 0;
    }

    .counter-stat strong {
        display: block;
        font-size: 24px;
        line-height: 1.2;
    }

    .counter-stat span {
        display: block;
        margin-top: 5px;
        font-size: 12px;
        color: #6b7280;
    }

    .counter-editor textarea {
        display: block;
        width: 100%;
        min-height: 380px;
        padding: 24px;
        border: 0;
        outline: none;
        resize: vertical;
        font: inherit;
        font-size: 16px;
        line-height: 1.7;
        box-sizing: border-box;
    }

    .counter-editor textarea:focus {
        box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.05);
    }

    .editor-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        border-top: 1px solid #e5e7eb;
        color: #6b7280;
        font-size: 13px;
    }

    .tool-button {
        border: 0;
        border-radius: 8px;
        padding: 9px 16px;
        cursor: pointer;
        font: inherit;
    }
    
    .tool-button.primary {
        background: #198754;
        color: #fff;
    }
    
    .tool-button.secondary {
        background: #f3f4f6;
        color: #333;
    }

    .tool-button.secondary:hover {
        background: #e5e7eb;
    }

    .tool-information {
        max-width: 900px;
        margin: 50px auto 0;
    }

    .tool-information h2 {
        margin-top: 35px;
        margin-bottom: 12px;
    }

    .tool-information h2:first-child {
        margin-top: 0;
    }

    .tool-information p,
    .tool-information li {
        color: #555;
        line-height: 1.7;
    }

    .tool-information ul {
        padding-left: 22px;
    }

    @media (max-width: 800px) {

        .counter-stats {
            grid-template-columns: repeat(3, 1fr);
        }

        .counter-stat:nth-child(3) {
            border-right: 0;
        }

        .counter-stat:nth-child(n + 4) {
            border-top: 1px solid #e5e7eb;
        }

    }

    @media (max-width: 500px) {

        .tool-page {
            padding-top: 20px;
        }

        .tool-heading {
            align-items: flex-start;
        }

        .tool-heading-icon {
            width: 50px;
            height: 50px;
            font-size: 22px;
        }

        .tool-heading h1 {
            font-size: 26px;
        }

        .counter-stats {
            grid-template-columns: repeat(2, 1fr);
        }

        .counter-stat {
            border-right: 0;
        }

        .counter-stat:nth-child(n + 3) {
            border-top: 1px solid #e5e7eb;
        }

        .counter-editor textarea {
            min-height: 300px;
            padding: 18px;
        }

    }
    
    .calculator-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.calculator-actions .btn {
   margin-right: 20px;
  margin-bottom: 20px;
}
.calculator-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.calculator-card {
    padding: 28px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #fff;
}

.calculator-card-header h2 {
    margin: 0 0 8px;
    font-size: 21px;
}

.calculator-card-header p {
    margin: 0 0 24px;
    color: var(--text-muted);
}

.calculator-result {
    margin-top: 24px;
    padding: 18px 20px;
    border-radius: 12px;
    background: var(--surface-muted);
}

.result-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.calculator-result strong {
    font-size: 26px;
}

.formula-box {
    margin: 20px 0;
    padding: 16px 20px;
    border-radius: 10px;
    background: var(--surface-muted);
    font-family: monospace;
    font-size: 16px;
}

@media (max-width: 768px) {

    .calculator-layout {
        grid-template-columns: 1fr;
    }

    .calculator-card {
        padding: 22px;
    }

}

/* Input with suffix */
/* Input with suffix */

.input-with-suffix {
    position: relative;
    width: 100%;
}

.input-with-suffix input {
    width: 100%;
    padding-right: 50px;
}

.input-with-suffix span {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);

    font-size: 15px;
    font-weight: 600;
    color: #6b7280;

    pointer-events: none;
}

/* QR Code Generator */

.qr-generator {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.qr-input-section,
.qr-output-section,
.base64-tool,
.password-generator {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.qr-input-section textarea,
.base64-tool textarea {
    width: 100%;
    resize: vertical;
}

.qr-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
}

.qr-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qr-control select {
    padding: 10px 12px;
}

.qr-output-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}

.qr-placeholder {
    text-align: center;
}

.qr-placeholder span {
    display: block;
    font-size: 64px;
    margin-bottom: 12px;
}

.qr-result {
    text-align: center;
}

.qr-result canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto 20px;
}


/* Base64 */

.base64-tool {
    max-width: 100%;
}

.base64-input,
.base64-output {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.base64-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.tool-status {
    margin-top: 15px;
    min-height: 20px;
}

.tool-status.error {
    font-weight: 600;
}


/* Password Generator */

.password-generator {
    max-width: 800px;
    margin: 0 auto;
}

.password-output {
    display: flex;
    gap: 10px;
}

.password-output input {
    flex: 1;
    min-width: 0;
    font-family: monospace;
    font-size: 18px;
    padding: 12px;
}

.password-strength {
    margin-top: 20px;
}

.strength-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.strength-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}


.password-options {
    display: grid;
    gap: 14px;
    margin: 25px 0;
}

.password-length {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.password-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-generate-button {
    width: 100%;
}


/* Responsive */

@media (max-width: 768px) {

    .qr-generator {
        grid-template-columns: 1fr;
    }

    .qr-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .password-output {
        flex-direction: column;
    }

}

/* =========================================================
   New Developer Tools
   QR Code / Base64 / Password Generator
   ========================================================= */


/* ---------------------------------------------------------
   Shared form controls
   --------------------------------------------------------- */

.qr-generator input,
.qr-generator textarea,
.qr-generator select,
.base64-tool input,
.base64-tool textarea,
.base64-tool select,
.password-generator input,
.password-generator textarea,
.password-generator select {
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
}

.qr-generator label,
.base64-tool label,
.password-generator label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}


/* ---------------------------------------------------------
   QR Code Generator
   --------------------------------------------------------- */

.qr-generator {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 32px;
    align-items: stretch;
}

.qr-input-section,
.qr-output-section {
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.qr-input-section textarea {
    display: block;
    width: 100%;
    min-height: 150px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}

.qr-input-section textarea:focus {
    border-color: #9ca3af;
}

.qr-controls {
    display: flex;
    align-items: end;
    gap: 16px;
    margin-top: 20px;
}

.qr-control {
    flex: 1;
}

.qr-control select {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
}

.qr-controls .tool-button {
    min-height: 44px;
    white-space: nowrap;
}

.qr-output-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}

.qr-placeholder {
    width: 100%;
    text-align: center;
    color: #6b7280;
}

.qr-placeholder span {
    display: block;
    font-size: 64px;
    line-height: 1;
    margin-bottom: 16px;
}

.qr-placeholder p {
    margin: 0;
}

.qr-result {
    width: 100%;
    text-align: center;
}

.qr-result canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto 20px;
}

.qr-result .tool-button {
    display: inline-block;
}


/* ---------------------------------------------------------
   Base64 Encoder / Decoder
   --------------------------------------------------------- */

.base64-tool {
    box-sizing: border-box;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.base64-input,
.base64-output {
    width: 100%;
}

.base64-tool textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 220px;
    padding: 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}

.base64-tool textarea:focus {
    border-color: #9ca3af;
}

.base64-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.base64-actions .tool-button {
    min-height: 42px;
}

.tool-status {
    min-height: 22px;
    margin-top: 15px;
}

.tool-status.error {
    font-weight: 600;
}


/* ---------------------------------------------------------
   Strong Password Generator
   --------------------------------------------------------- */

.password-generator {
    box-sizing: border-box;
    width: 100%;
    max-width: 800px;
    margin: 45px auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.password-output {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.password-output input {
    box-sizing: border-box;
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #111827;
    font-family: monospace;
    font-size: 16px;
    outline: none;
}

.password-output input:focus {
    border-color: #9ca3af;
}

.password-output .tool-button {
    flex: 0 0 auto;
    min-height: 46px;
}


/* Strength */

.password-strength {
    margin-top: 22px;
}

.strength-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 9px;
}

.strength-label span {
    font-weight: 600;
}

.strength-label strong {
    font-size: 14px;
}

.strength-bar {
    width: 100%;
    height: 8px;
    overflow: hidden;
    background: #e5e7eb;
    border-radius: 999px;
}

.strength-bar div {
    width: 0;
    height: 100%;
    background: #22c55e;
    border-radius: 999px;
    transition: width 0.2s ease;
}


/* Options */

.password-options {
    display: grid;
    gap: 16px;
    margin: 26px 0;
}

.password-length {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.password-length label {
    margin-bottom: 0;
}

.password-length input[type="range"] {
    width: 100%;
}

.password-option {
    display: flex !important;
    align-items: center;
    gap: 9px;
    margin: 0 !important;
    font-weight: 400 !important;
    cursor: pointer;
}

.password-option input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    flex: 0 0 auto;
}

.password-generate-button {
    width: 100%;
    min-height: 46px;
}


/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 768px) {

    .qr-generator {
        grid-template-columns: 1fr;
    }

    .qr-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .qr-control {
        width: 100%;
    }

    .qr-output-section {
        min-height: 280px;
    }

    .password-output {
        flex-direction: column;
    }

    .password-output input,
    .password-output .tool-button {
        width: 100%;
    }

}


@media (max-width: 480px) {

    .qr-input-section,
    .qr-output-section,
    .base64-tool,
    .password-generator {
        padding: 18px;
    }

    .base64-actions {
        flex-direction: column;
    }

    .base64-actions .tool-button {
        width: 100%;
    }

}

.tool-category{
    margin-top:30px;
}
.related-tools {
    max-width: 900px;
    margin: 50px auto 0;
}

.related-tools-heading {
    margin-bottom: 24px;
}

.related-tools-heading h2 {
    margin: 0;
}

.related-tools-heading p {
    margin: 8px 0 0;
}

/* =========================================================
   Tool kit — shared building blocks for tool interfaces
   ========================================================= */

.tk {
    padding: 26px;
}

.tk + .tk {
    border-top: 1px solid var(--border);
}

.tk-heading {
    margin-bottom: 18px;
}

.tk-heading h2 {
    margin: 0 0 4px;
    font-size: 20px;
    letter-spacing: -0.01em;
}

.tk-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.tk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
}

.tk-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.tk-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tk-field > label,
.tk-label {
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
}

.tk-field small {
    color: var(--text-muted);
    font-size: 12px;
}

.tk-input,
.tk-select,
.tk-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tk-input:focus,
.tk-select:focus,
.tk-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tk-textarea {
    min-height: 220px;
    line-height: 1.6;
    resize: vertical;
}

.tk-mono,
.tk-textarea.tk-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13.5px;
}

.tk-input-group {
    display: flex;
    align-items: stretch;
}

.tk-input-group .tk-input {
    border-radius: 10px 0 0 10px;
}

.tk-input-group .tk-addon {
    display: flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 14px;
}

.tk-input-group .tk-addon.is-prefix {
    order: -1;
    border: 1px solid #d1d5db;
    border-right: 0;
    border-radius: 10px 0 0 10px;
}

.tk-input-group .tk-addon.is-prefix + .tk-input,
.tk-input-group .tk-addon.is-prefix ~ .tk-input {
    border-radius: 0 10px 10px 0;
}

.tk-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.tk-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.tk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.tk-actions .tool-button {
    font-weight: 600;
}

.tool-button.primary:hover {
    background: #157347;
}

.tool-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.tk-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tk-chip {
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.tk-chip:hover {
    transform: translateY(-1px);
    border-color: #cbd5e1;
}

.tk-chip.is-active,
.tk-chip[aria-pressed="true"] {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tk-output {
    min-height: 160px;
    max-height: 520px;
    margin: 0;
    padding: 14px 16px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.tk-status {
    margin: 14px 0 0;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    font-size: 14px;
}

.tk-status:empty {
    display: none;
}

.tk-status.is-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.tk-status.is-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.tk-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.tk-stat {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.tk-stat span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tk-stat strong {
    display: block;
    margin-top: 4px;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    word-break: break-word;
}

.tk-stat small {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
}

.tk-stat.is-highlight {
    border-color: #bbf7d0;
    background: linear-gradient(160deg, #f0fdf4, #fff);
}

.tk-stat.is-highlight strong {
    color: #166534;
}

.tk-table-wrap {
    overflow-x: auto;
}

.tk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tk-table th,
.tk-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.tk-table th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tk-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 38px 20px;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    background: #f8fafc;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.tk-dropzone.is-dragging {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.tk-dropzone-icon {
    font-size: 36px;
    line-height: 1;
}

.tk-dropzone h2 {
    margin: 4px 0 0;
    font-size: 19px;
}

.tk-dropzone p,
.tk-dropzone small {
    margin: 0;
    color: var(--text-muted);
}

.tk-file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.tk-file {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.tk-file img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 10px;
    background:
        repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}

.tk-file-name {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tk-file-meta {
    color: var(--text-muted);
    font-size: 13px;
}

.tk-file-meta .is-saving {
    color: #166534;
    font-weight: 700;
}

.tk-file-meta .is-bigger {
    color: #92400e;
    font-weight: 700;
}

.tk-disclaimer {
    margin: 18px 0 0;
    padding: 12px 14px;
    border: 1px solid #fde68a;
    border-radius: 12px;
    background: #fffbeb;
    color: #78350f;
    font-size: 13px;
    line-height: 1.55;
}

.tk-note {
    color: var(--text-muted);
    font-size: 13px;
}

.tk-hl {
    border-radius: 3px;
    background: #fde68a;
    box-shadow: 0 0 0 1px #f59e0b inset;
}

.tk-hl:nth-of-type(even) {
    background: #bfdbfe;
    box-shadow: 0 0 0 1px #3b82f6 inset;
}

@media (max-width: 760px) {
    .tk {
        padding: 18px;
    }

    .tk-split {
        grid-template-columns: 1fr;
    }

    .tk-file {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .tk-file img {
        width: 52px;
        height: 52px;
    }

    .tk-file .tk-file-actions {
        grid-column: 1 / -1;
    }
}


/* ---------------------------------------------------------
   How it works & FAQ
   --------------------------------------------------------- */

.tool-guide {
    max-width: 900px;
    margin: 50px auto 0;
}

.tool-guide h2 {
    margin: 0 0 16px;
}

.how-it-works {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 0 0 40px;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.how-it-works li {
    position: relative;
    padding: 18px 18px 18px 58px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: #334155;
    font-size: 14px;
    line-height: 1.55;
    counter-increment: step;
}

.how-it-works li::before {
    content: counter(step);
    position: absolute;
    left: 16px;
    top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}

.tool-faq details {
    border-bottom: 1px solid var(--border);
}

.tool-faq details:first-of-type {
    border-top: 1px solid var(--border);
}

.tool-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 2px;
    font-size: 16px;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
}

.tool-faq summary::-webkit-details-marker {
    display: none;
}

.tool-faq summary::after {
    content: "+";
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 20px;
    transition: transform 0.2s ease;
}

.tool-faq details[open] summary::after {
    transform: rotate(45deg);
}

.tool-faq details p {
    margin: 0 0 16px;
    color: #475569;
    line-height: 1.7;
}


/* ---------------------------------------------------------
   Category colour on tool page icons & inline code
   --------------------------------------------------------- */

.tool-heading-icon[data-category] {
    background: var(--cat-soft, #f3f4f6);
    color: var(--cat, inherit);
}

.tool-information code,
.tool-guide code {
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--surface-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
}


/* ---------------------------------------------------------
   PDF tools
   --------------------------------------------------------- */

.pdf-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 14px;
    max-height: 560px;
    margin-top: 16px;
    padding: 4px;
    overflow-y: auto;
}

.pdf-thumb {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.pdf-thumb:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pdf-thumb.is-selected {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.pdf-thumb.is-selected::after {
    content: "✓";
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.pdf-thumb-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 140px;
    color: var(--text-muted);
}

.pdf-thumb-canvas {
    max-width: 100%;
    max-height: 140px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
    transition: transform 0.25s ease;
}

.pdf-thumb-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.pdf-file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.pdf-file {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.pdf-file-order {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--cat-pdf-soft);
    color: var(--cat-pdf);
    font-weight: 800;
}

.pdf-file-actions {
    display: flex;
    gap: 6px;
}

.pdf-file-actions button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}

.pdf-file-actions button:disabled {
    opacity: 0.35;
    cursor: default;
}


/* ---------------------------------------------------------
   Declarative calculators
   --------------------------------------------------------- */

.calc-wide {
    grid-column: 1 / -1;
}

.calc-breakdown {
    margin-top: 18px;
}

.calc-breakdown-bar {
    display: flex;
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-soft);
}

.calc-breakdown-bar span {
    height: 100%;
    transition: width 0.3s ease;
}

.calc-breakdown-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.calc-breakdown-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 3px;
}

.calc-gauge {
    position: relative;
    margin: 22px 0 6px;
}

.calc-gauge-bands {
    display: flex;
    overflow: hidden;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    color: #1f2937;
}

.calc-gauge-bands span {
    padding: 4px 0;
}

.calc-gauge-marker {
    position: absolute;
    top: -8px;
    width: 4px;
    height: calc(100% + 16px);
    margin-left: -2px;
    border-radius: 2px;
    background: #0f172a;
    transition: left 0.3s ease;
}

.calc-table {
    margin-top: 18px;
}

.calc-table summary {
    font-weight: 700;
    cursor: pointer;
}

.calc-table .tk-table-wrap {
    max-height: 420px;
    margin-top: 10px;
    overflow: auto;
}
