.npk-app {
    --npk-primary: #174a73;
    --npk-primary-dark: #103652;
    --npk-accent: #2f7db4;
    --npk-soft: #eef5fa;
    --npk-border: #c8d6e2;
    --npk-text: #1d2730;
    --npk-muted: #5c6872;
    --npk-success: #17643a;
    --npk-error: #a61b1b;
    --npk-error-bg: #fff1f1;
    --npk-warning: #8a5200;
    --npk-warning-bg: #fff7e6;
    --npk-radius: 12px;
    color: var(--npk-text);
    font-family: inherit;
    line-height: 1.55;
    max-width: 980px;
    margin: 1.5rem auto;
    border: 1px solid var(--npk-border);
    border-radius: var(--npk-radius);
    background: #fff;
    box-shadow: 0 8px 28px rgba(20, 54, 80, 0.08);
    overflow: hidden;
}

.npk-app *,
.npk-app *::before,
.npk-app *::after {
    box-sizing: border-box;
}

.npk-header {
    padding: 1.35rem 1.5rem;
    color: #fff;
    background: linear-gradient(135deg, var(--npk-primary-dark), var(--npk-primary));
}

.npk-title,
.npk-module-title,
.npk-output-title {
    margin-top: 0;
}

.npk-title {
    margin-bottom: 0.35rem;
    color: #fff;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.npk-lead {
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
}

.npk-module-picker {
    padding: 0.9rem 1.5rem;
    background: #f6f9fb;
    border-bottom: 1px solid var(--npk-border);
}

.npk-module-picker-inner {
    max-width: 620px;
}

.npk-button:focus-visible,
.npk-input:focus,
.npk-select:focus {
    outline: 3px solid rgba(47, 125, 180, 0.25);
    outline-offset: 2px;
}

.npk-panel {
    padding: 1.25rem 1.5rem 1.5rem;
}

.npk-module-intro {
    margin-bottom: 1rem;
}

.npk-module-title {
    margin-bottom: 0.25rem;
    color: var(--npk-primary-dark);
    font-size: 1.35rem;
}

.npk-module-description {
    margin: 0;
    color: var(--npk-muted);
}

.npk-field {
    min-width: 0;
}

.npk-field--wide {
    margin: 1rem 0;
}

.npk-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.npk-select,
.npk-input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #aebfcd;
    border-radius: 8px;
    background: #fff;
    color: var(--npk-text);
    font: inherit;
    padding: 0.65rem 0.75rem;
}

.npk-control {
    display: flex;
    align-items: stretch;
}

.npk-control .npk-input,
.npk-control .npk-select {
    border-radius: 8px 0 0 8px;
}

.npk-control .npk-input:only-child,
.npk-control .npk-select:only-child {
    border-radius: 8px;
}

.npk-suffix {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 3.2rem;
    border: 1px solid #aebfcd;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: var(--npk-soft);
    color: var(--npk-primary-dark);
    font-weight: 700;
    padding: 0.5rem 0.65rem;
}

.npk-help {
    margin-top: 0.25rem;
    color: var(--npk-muted);
    font-size: 0.88rem;
}

.npk-formula-summary {
    display: grid;
    gap: 0.55rem;
    margin: 1rem 0;
    padding: 0.9rem;
    border-left: 4px solid var(--npk-accent);
    border-radius: 0 9px 9px 0;
    background: var(--npk-soft);
}

.npk-formula-line {
    display: grid;
    grid-template-columns: minmax(150px, 0.42fr) minmax(0, 1fr);
    gap: 0.8rem;
    align-items: start;
}

.npk-formula-label {
    color: var(--npk-muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.npk-formula {
    display: block;
    overflow-wrap: anywhere;
    background: transparent;
    color: var(--npk-primary-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 1rem;
    font-weight: 700;
    padding: 0;
}

.npk-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.npk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 1.1rem 0 0;
}

.npk-button {
    appearance: none;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0.65rem 1rem;
}

.npk-button--primary {
    background: var(--npk-primary);
    color: #fff;
}

.npk-button--primary:hover {
    background: var(--npk-primary-dark);
}

.npk-button--secondary {
    border-color: var(--npk-primary);
    background: #fff;
    color: var(--npk-primary);
}

.npk-button--ghost {
    border-color: var(--npk-border);
    background: #f7f9fa;
    color: var(--npk-text);
}

.npk-message {
    margin-top: 1rem;
    border-radius: 8px;
    padding: 0.8rem 0.9rem;
}

.npk-message--error,
.npk-notice--error {
    border: 1px solid #efb2b2;
    background: var(--npk-error-bg);
    color: var(--npk-error);
}

.npk-message--warning {
    border: 1px solid #e7bd70;
    background: var(--npk-warning-bg);
    color: var(--npk-warning);
}

.npk-output {
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--npk-border);
}

.npk-output-title {
    color: var(--npk-primary-dark);
    font-size: 1.25rem;
}

.npk-result-card {
    padding: 1rem 1.1rem;
    border: 1px solid #9fc0d8;
    border-radius: 10px;
    background: linear-gradient(135deg, #f2f8fc, #fff);
}

.npk-result-label {
    color: var(--npk-muted);
    font-weight: 700;
}

.npk-result-value {
    margin-top: 0.15rem;
    color: var(--npk-success);
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.npk-result-card--warning {
    border-color: #e7bd70;
    background: linear-gradient(135deg, #fff8e9, #fff);
}

.npk-result-value--warning {
    color: var(--npk-warning);
}

.npk-extras {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem 1rem;
    margin: 0.9rem 0;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: #f7f9fa;
}

.npk-extras dt,
.npk-extras dd {
    margin: 0;
}

.npk-extras dt {
    color: var(--npk-muted);
}

.npk-extras dd {
    font-weight: 700;
    text-align: right;
}

.npk-steps {
    display: grid;
    gap: 0.7rem;
    margin-top: 1rem;
}

.npk-step {
    border: 1px solid var(--npk-border);
    border-radius: 8px;
    overflow: hidden;
}

.npk-step-title {
    background: var(--npk-soft);
    color: var(--npk-primary-dark);
    font-weight: 800;
    padding: 0.55rem 0.75rem;
}

.npk-step-content {
    overflow-wrap: anywhere;
    padding: 0.7rem 0.75rem;
}

.npk-disclaimer {
    padding: 0.95rem 1.5rem;
    border-top: 1px solid var(--npk-border);
    background: #fff9e9;
    color: #5b4a15;
    font-size: 0.9rem;
}

[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    .npk-app {
        margin: 1rem 0;
        border-radius: 9px;
    }

    .npk-header,
    .npk-module-picker,
    .npk-panel,
    .npk-disclaimer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .npk-fields,
    .npk-formula-line {
        grid-template-columns: 1fr;
    }

    .npk-formula-line {
        gap: 0.15rem;
    }

    .npk-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .npk-button {
        width: 100%;
    }

    .npk-extras {
        grid-template-columns: 1fr;
    }

    .npk-extras dd {
        margin-bottom: 0.4rem;
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .npk-app * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}


.npk-textarea {
    min-height: 86px;
    resize: vertical;
    line-height: 1.45;
}

.npk-control .npk-textarea:only-child {
    border-radius: 8px;
}


.npk-table-wrap {
    margin-top: 1.25rem;
    overflow-x: auto;
    border: 1px solid var(--npk-border);
    border-radius: 10px;
    background: #fff;
}

.npk-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.npk-table-caption {
    padding: 0.85rem 1rem;
    text-align: left;
    color: var(--npk-primary-dark);
    font-weight: 800;
    background: var(--npk-soft);
}

.npk-table th,
.npk-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #dde6ed;
    text-align: right;
    white-space: nowrap;
}

.npk-table th:first-child,
.npk-table td:first-child {
    text-align: center;
}

.npk-table thead th {
    color: var(--npk-primary-dark);
    background: #f6f9fb;
    font-size: 0.9rem;
}

.npk-table tbody tr:nth-child(even) {
    background: #fafcfd;
}

.npk-table tbody tr:last-child td {
    border-bottom: 0;
    font-weight: 700;
}
