:root {
    --km-ink-900: #111827;
    --km-ink-800: #1f2937;
    --km-ink-700: #334155;
    --km-ink-500: #64748b;
    --km-paper: #f7f8fb;
    --km-white: #ffffff;
    --km-brand: #f59e0b;
    --km-brand-strong: #d97706;
    --km-accent: #0f766e;
    --km-line: #e5e7eb;
    --km-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body.km-shell {
    font-family: "Manrope", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 14% 4%, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0) 34%),
        radial-gradient(circle at 88% 10%, rgba(15, 118, 110, 0.1) 0%, rgba(15, 118, 110, 0) 30%),
        var(--km-paper);
    color: var(--km-ink-900);
    min-height: 100vh;
}

.km-topbar {
    background: linear-gradient(120deg, #0f172a 0%, #1e293b 44%, #172554 100%);
    color: var(--km-white);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.km-topbar-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem 1.25rem;
}

.km-topbar-actions {
    flex: 1 1 560px;
    min-width: 280px;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.65rem;
    padding-top: 0.45rem;
}

.km-brand {
    display: inline-flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    color: var(--km-white);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.01em;
}

.km-brand-logo {
    width: 168px;
    height: 168px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 7px;
}

@media (max-width: 576px) {
    .km-brand-logo {
        width: 128px;
        height: 128px;
        padding: 5px;
    }
}

.km-brand:hover {
    color: #fde68a;
}

.km-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: var(--km-white);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    text-decoration: none;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

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

.km-search {
    position: relative;
    width: min(100%, 760px);
    min-width: 220px;
}

.km-search-row {
    width: 100%;
    margin-top: 0.75rem;
}

.km-chip-set {
    justify-content: flex-end;
}

@media (max-width: 992px) {
    .km-topbar-actions {
        flex-basis: 100%;
        min-width: 0;
        padding-top: 0;
        align-items: flex-start;
    }

    .km-chip-set {
        justify-content: flex-start;
    }
}

.km-search input {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 0.66rem 0.85rem;
    width: 100%;
    background: rgba(255, 255, 255, 0.96);
}

.km-search button {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    color: #1f2937;
    font-weight: 700;
    padding: 0 0.95rem;
}

.km-public-actions {
    justify-content: flex-start;
}

.km-subnav {
    background: rgba(17, 24, 39, 0.86);
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.km-footer {
    border-top: 1px solid var(--km-line);
    background: rgba(255, 255, 255, 0.7);
}

.km-footer a {
    color: var(--km-ink-700);
    text-decoration: none;
}

.km-footer a:hover {
    color: var(--km-brand-strong);
}

.km-public-hero {
    border-radius: 20px;
    color: var(--km-white);
    background: linear-gradient(135deg, #0b1220 0%, #0f2f45 48%, #14532d 100%);
    box-shadow: var(--km-shadow);
}

.km-public-hero h1 {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    line-height: 1.2;
}

.km-public-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(253, 230, 138, 0.5);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fde68a;
}

.km-public-highlight {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.35);
}

.km-public-highlight h5 {
    color: #fef3c7;
}

.km-public-highlight ul {
    margin: 0;
    padding-left: 1rem;
}

.km-public-highlight li {
    margin-bottom: 0.45rem;
}

.km-plan-table thead th {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
    border-bottom-width: 1px;
}

.km-plan-table tbody tr:hover {
    background: rgba(15, 118, 110, 0.05);
}

.km-plan-yes,
.km-plan-no {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
}

.km-plan-yes {
    background: #dcfce7;
    color: #166534;
}

.km-plan-no {
    background: #fee2e2;
    color: #991b1b;
}

.km-subnav .nav-link {
    color: #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 0.36rem 0.72rem;
    transition: all 0.2s ease;
}

.km-subnav .nav-link:hover {
    color: #fff;
    background: rgba(148, 163, 184, 0.2);
}

.km-main {
    max-width: 1240px;
}

.km-flash {
    border-radius: 12px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.km-catalog-hero {
    border-radius: 18px;
    background: linear-gradient(140deg, #0f172a 0%, #1e293b 58%, #115e59 100%);
    color: var(--km-white);
    box-shadow: var(--km-shadow);
}

.km-catalog-hero h2 {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-weight: 700;
    margin: 0;
}

.km-catalog-meta {
    color: #d1fae5;
    font-size: 0.92rem;
}

.km-filter-box {
    border: 1px solid var(--km-line);
    border-radius: 14px;
    background: var(--km-white);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.km-filter-box h5 {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 1.02rem;
}

.km-filter-box .form-control {
    border-radius: 10px;
}

.km-btn-brand {
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    border: 1px solid #f59e0b;
    color: #1f2937;
    font-weight: 700;
}

.km-btn-brand:hover {
    background: linear-gradient(180deg, #f59e0b, #d97706);
    border-color: #d97706;
    color: #111827;
}

.km-main form button.btn[type="submit"]:not(.btn-sm):not(.km-chip),
.km-main form input.btn[type="submit"]:not(.btn-sm):not(.km-chip) {
    width: auto !important;
    min-width: 160px;
    max-width: 320px;
    padding: 0.48rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.km-main form .d-grid > button.btn[type="submit"]:not(.btn-sm),
.km-main form .d-grid > input.btn[type="submit"]:not(.btn-sm) {
    width: auto !important;
    justify-self: start;
}

.km-main form .col-12 > button.btn[type="submit"]:not(.btn-sm),
.km-main form .col-12 > input.btn[type="submit"]:not(.btn-sm) {
    margin-top: 0.25rem;
}

.km-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.km-product-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    background: var(--km-white);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.km-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.12);
}

.km-product-media {
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.95)),
        repeating-linear-gradient(45deg, rgba(203, 213, 225, 0.22) 0, rgba(203, 213, 225, 0.22) 8px, rgba(255, 255, 255, 0.72) 8px, rgba(255, 255, 255, 0.72) 16px);
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.km-product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.km-product-empty {
    font-size: 0.85rem;
    color: var(--km-ink-500);
    font-weight: 600;
}

.km-product-body {
    padding: 0.85rem;
}

.km-product-name {
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.35rem;
}

.km-product-meta {
    color: #475569;
    font-size: 0.86rem;
    margin-bottom: 0.2rem;
}

.km-pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.18rem 0.58rem;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.km-product-actions {
    margin-top: 0.65rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.km-link-btn {
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    color: var(--km-ink-700);
    padding: 0.35rem 0.68rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.km-link-btn:hover {
    border-color: #f59e0b;
    color: #92400e;
}

.km-pagination .page-link {
    border-radius: 8px;
    color: var(--km-ink-700);
}

.km-pagination .active .page-link {
    background: var(--km-ink-800);
    border-color: var(--km-ink-800);
}

.km-queue .list-group-item {
    border-left: 3px solid #e2e8f0;
}

.km-queue .km-queue-high {
    border-left-color: #dc2626;
}

.km-queue .km-queue-medium {
    border-left-color: #d97706;
}

.km-queue .km-queue-low {
    border-left-color: #64748b;
}

@media (max-width: 991.98px) {
    .km-topbar .km-chip-set {
        width: 100%;
        justify-content: flex-start;
    }

    .km-main {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .km-product-media {
        height: 150px;
    }
}

.km-auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.km-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--km-white);
    border: 1px solid var(--km-line);
    border-radius: 14px;
    box-shadow: var(--km-shadow);
    padding: 2rem;
}

.km-auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.km-auth-logo img {
    height: 48px;
    width: auto;
}

.km-auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.km-auth-card label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--km-ink-700);
}

.km-auth-card .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.km-auth-card .form-check label {
    display: inline;
    margin-bottom: 0;
}

.km-auth-card .form-control,
.km-auth-card .form-select {
    margin-bottom: 0.85rem;
}

.km-auth-card .mb-3 .form-control,
.km-auth-card .mb-3 .form-select {
    margin-bottom: 0;
}

.km-auth-card .form-text {
    font-size: 0.78rem;
    margin-top: 0.25rem;
}

.km-auth-links {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.km-auth-links a {
    color: var(--km-accent);
    text-decoration: none;
}

.km-auth-links a:hover {
    color: var(--km-brand-strong);
}

.km-auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--km-ink-500);
}

/* Structured, card-based form sections (product create/edit, labels, etc.) */
.km-form-section {
    border: 1px solid var(--km-line);
    border-radius: 14px;
    background: var(--km-white);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.km-form-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--km-line);
}

.km-form-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(140deg, #0f172a 0%, #115e59 100%);
    color: var(--km-white);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.km-form-section-header h5 {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    margin: 0;
}

.km-form-section-header p {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
}

.km-form-section .form-label,
.km-form-section label.form-label {
    font-weight: 600;
    font-size: 0.83rem;
    color: #334155;
}

.km-form-section .form-control,
.km-form-section .form-select {
    border-radius: 10px;
}

.km-nutrition-group {
    border: 1px solid var(--km-line);
    border-radius: 12px;
    background: #f8fafc;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.km-nutrition-group:last-child {
    margin-bottom: 0;
}

.km-nutrition-group h6 {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #115e59;
    margin-bottom: 0.85rem;
}

.km-nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.85rem;
}

.km-nutrition-grid .input-group .form-control {
    border-radius: 10px 0 0 10px;
}

.km-nutrition-grid .input-group-text {
    border-radius: 0 10px 10px 0;
    background: #eef2f7;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Stat list (e.g. company profile summary) */
.km-stat-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.km-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.9rem;
    background: #f8fafc;
    border: 1px solid var(--km-line);
    border-radius: 10px;
}

.km-stat-row .km-stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.km-stat-row .km-stat-value {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
}

/* Tables inside form-section cards */
.km-form-section table {
    margin-bottom: 0;
}

.km-form-section table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 2px solid var(--km-line);
    font-weight: 700;
}

.km-form-section table td,
.km-form-section table th {
    vertical-align: middle;
}
