/* Kynd Kit Dashboard — Styles */

.kkd-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: #1a1a1a;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 0 3rem;
}

/* Loading */
.kkd-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 0;
    color: #888;
    font-size: 14px;
}
.kkd-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid #e0e0e0;
    border-top-color: #555;
    border-radius: 50%;
    animation: kkd-spin 0.7s linear infinite;
    margin-bottom: 12px;
}
@keyframes kkd-spin { to { transform: rotate(360deg); } }

/* Error */
.kkd-error {
    background: #fff5f5;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #b91c1c;
    font-size: 14px;
}

/* Header */
.kkd-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.kkd-page-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #111;
}
.kkd-page-subtitle {
    font-size: 13px;
    color: #777;
    margin: 0;
}
.kkd-cta-strip {
    width: 100%;
    margin-bottom: 1.25rem;
}
.kkd-header-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
}

/* Group bars */
.kkd-cta-strip {
    display: flex;
    align-items: stretch;
    border-radius: 12px;
    border: 0.5px solid #e5e5e5;
    background: #fff;
    overflow: hidden;
}
.kkd-cta-half {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
}
.kkd-cta-divider {
    width: 0.5px;
    background: #e5e5e5;
    align-self: stretch;
    flex-shrink: 0;
}
.kkd-cta-info { flex: 1; }
.kkd-cta-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
}
.kkd-cta-role {
    font-size: 11px;
    color: #888;
    margin-top: 1px;
}
.kkd-cta-btn {
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    border: 0.5px solid;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    display: inline-block;
}
.kkd-cta-btn-teal {
    border-color: #5DCAA5;
    color: #085041;
    background: #E1F5EE;
}
.kkd-cta-btn-teal:hover { background: #9FE1CB; }
.kkd-cta-btn-purple {
    border-color: #AFA9EC;
    color: #3C3489;
    background: #EEEDFE;
}
.kkd-cta-btn-purple:hover { background: #CECBF6; }

/* Keep old group-bar for any remaining references */
.kkd-group-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid #e5e5e5;
    background: #fff;
}
.kkd-group-bar-info { flex: 1; }
.kkd-group-bar-name { font-size: 13px; font-weight: 600; color: #111; }
.kkd-group-bar-sub { font-size: 11px; color: #888; }

/* Avatars */
.kkd-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.kkd-avatar-purple { background: #ede9fe; color: #6d28d9; }
.kkd-avatar-teal   { background: #d1fae5; color: #065f46; }

/* Stats */
.kkd-stats-row {
    display: flex;
    align-items: stretch;
    border-radius: 12px;
    border: 0.5px solid #e5e5e5;
    background: #fff;
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.kkd-stat {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 3px solid transparent;
}
.kkd-stat + .kkd-stat {
    border-left: 0.5px solid #e5e5e5;
}
.kkd-stat:nth-child(1) { border-bottom-color: #5DCAA5; }
.kkd-stat:nth-child(2) { border-bottom-color: #AFA9EC; }
.kkd-stat:nth-child(3) { border-bottom-color: #85B7EB; }
.kkd-stat-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 6px;
    color: #0F6E56;
}
.kkd-stat:nth-child(2) .kkd-stat-label { color: #534AB7; }
.kkd-stat:nth-child(3) .kkd-stat-label { color: #185FA5; }
.kkd-stat-value {
    font-size: 26px;
    font-weight: 500;
    color: #085041;
}
.kkd-stat:nth-child(2) .kkd-stat-value { color: #3C3489; }
.kkd-stat:nth-child(3) .kkd-stat-value { color: #0C447C; }

/* Tabs */
.kkd-tabs {
    display: flex !important;
    gap: 4px !important;
    margin-bottom: 1rem !important;
    list-style: none !important;
    padding: 0 !important;
}
.kkd-tab {
    font-size: 13px !important;
    padding: 6px 14px !important;
    border-radius: 7px !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    color: #666 !important;
    cursor: pointer !important;
    font-family: inherit !important;
    font-weight: normal !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: normal !important;
    box-shadow: none !important;
    display: inline-block !important;
    width: auto !important;
}
.kkd-tab:hover { background: #f0f0f0 !important; color: #333 !important; }
.kkd-tab-active {
    background: #fff !important;
    border-color: #ddd !important;
    color: #111 !important;
    font-weight: 600 !important;
}

/* Cards */
.kkd-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.kkd-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.kkd-muted {
    font-size: 12px;
    color: #888;
}

/* Section labels */
.kkd-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #aaa;
}

/* Source tags */
.kkd-source-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    letter-spacing: 0;
    text-transform: none;
}
.kkd-tag-notion  { background: #ede9fe; color: #6d28d9; }
.kkd-tag-shopify { background: #d1fae5; color: #065f46; }
.kkd-tag-bill    { background: #fef3c7; color: #92400e; }
.kkd-tag-bb      { background: #dbeafe; color: #1e40af; }

/* Badges */
.kkd-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
}
.kkd-badge-active    { background: #d1fae5; color: #065f46; }
.kkd-badge-completed { background: #dbeafe; color: #1e40af; }
.kkd-badge-due       { background: #fef3c7; color: #92400e; }
.kkd-badge-overdue   { background: #fee2e2; color: #991b1b; }
.kkd-badge-paid      { background: #d1fae5; color: #065f46; }
.kkd-badge-pending   { background: #f3f4f6; color: #6b7280; }

/* Program rows */
.kkd-program-group-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #bbb;
    padding: 10px 0 4px;
    border-top: 1px solid #f0f0f0;
    margin-top: 4px;
}
.kkd-program-group-label:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}
.kkd-program-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.kkd-program-row:last-child { border-bottom: none; }
.kkd-program-row.kkd-unlocked { cursor: pointer; }
.kkd-program-row.kkd-unlocked:hover .kkd-program-name { color: #1d4ed8; }
.kkd-program-row.kkd-locked { opacity: 0.45; }
.kkd-program-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #111;
}
.kkd-program-id {
    font-size: 11px;
    color: #bbb;
    font-weight: 400;
    margin-left: 5px;
}
.kkd-program-date {
    font-size: 12px;
    color: #888;
    min-width: 85px;
    text-align: right;
}
.kkd-program-action {
    font-size: 12px;
    color: #1d4ed8;
    white-space: nowrap;
}
.kkd-program-locked-label {
    font-size: 11px;
    color: #bbb;
    white-space: nowrap;
}

/* Invoices table */
.kkd-inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}
.kkd-inv-table th {
    text-align: left;
    font-size: 11px;
    color: #aaa;
    font-weight: 600;
    padding: 4px 0 8px;
    border-bottom: 1px solid #f0f0f0;
}
.kkd-inv-table td {
    padding: 8px 0;
    border-bottom: 1px solid #f7f7f7;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kkd-inv-table tr:last-child td { border-bottom: none; }
.kkd-inv-table { table-layout: fixed; }
.kkd-inv-table .kkd-col-num   { width: 80px; }
.kkd-inv-table .kkd-col-prog  { width: auto; }
.kkd-inv-table .kkd-col-amt   { width: 100px; font-weight: 600; }
.kkd-inv-table .kkd-col-stat  { width: 90px; }
.kkd-inv-table .kkd-col-due   { width: 100px; color: #888; }

/* Orders table */
.kkd-order-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}
.kkd-order-table th {
    text-align: left;
    font-size: 11px;
    color: #aaa;
    font-weight: 600;
    padding: 4px 0 8px;
    border-bottom: 1px solid #f0f0f0;
}
.kkd-order-table td {
    padding: 7px 0;
    border-bottom: 1px solid #f7f7f7;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kkd-order-table tr:last-child td { border-bottom: none; }
.kkd-order-table .kkd-col-order  { width: 80px; }
.kkd-order-table .kkd-col-prod   { }
.kkd-order-table .kkd-col-cust   { width: 110px; }
.kkd-order-table .kkd-col-status { width: 90px; }
.kkd-order-table .kkd-col-track  { width: 120px; color: #1d4ed8; }

/* Stub notice */
.kkd-stub-notice {
    font-size: 13px;
    color: #aaa;
    font-style: italic;
    padding: 8px 0;
}

/* Resources */
.kkd-resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}
.kkd-resource-link {
    display: block;
    font-size: 13px;
    color: #1d4ed8;
    padding: 9px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    text-decoration: none;
}
.kkd-resource-link:hover { background: #f7f8ff; }

/* Detail view */
.kkd-back-link { margin-bottom: 1rem; }
.kkd-back-link a {
    font-size: 13px;
    color: #666;
    text-decoration: none;
}
.kkd-back-link a:hover { color: #111; }
.kkd-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}
.kkd-detail-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 3px;
    color: #111;
}
.kkd-detail-sub {
    font-size: 12px;
    color: #888;
    margin: 0;
}
.kkd-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin-top: 8px;
}
.kkd-full-col { grid-column: 1 / -1; }
.kkd-field-label {
    font-size: 11px;
    color: #aaa;
    margin-bottom: 2px;
}
.kkd-field-value {
    font-size: 13px;
    font-weight: 600;
    color: #111;
}
.kkd-field-note {
    font-size: 13px;
    color: #666;
    line-height: 1.55;
    margin: 0;
}

/* Buttons */
.kkd-btn-sm {
    font-size: 12px;
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 7px;
    background: transparent;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
    white-space: nowrap;
}
.kkd-btn-sm:hover { background: #f5f5f5; color: #111; }

/* Responsive */
@media (max-width: 600px) {
    .kkd-header { flex-direction: column; }
    .kkd-header-right { min-width: 100%; }
    .kkd-detail-grid { grid-template-columns: 1fr; }
    .kkd-stats-row { flex-direction: column; }
    .kkd-inv-table .kkd-col-prog { display: none; }
}

/* Remove inner border from invoice and order table containers */
#kkd-invoices-table,
#kkd-detail-orders,
#kkd-detail-invoice {
    border: none;
    padding: 0;
}

/* Option A banner cards for group + PM */
.kkd-banner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1.25rem;
}
.kkd-banner {
    border-radius: 12px;
    padding: 16px 20px;
    border: 0.5px solid;
    display: flex;
    flex-direction: column;
}
.kkd-banner-teal { background: #E1F5EE; border-color: #5DCAA5; }
.kkd-banner-purple { background: #EEEDFE; border-color: #AFA9EC; }
.kkd-banner-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.kkd-banner-icon-teal { background: #9FE1CB; }
.kkd-banner-icon-purple { background: #CECBF6; }
.kkd-banner-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}
.kkd-banner-teal .kkd-banner-title { color: #085041; }
.kkd-banner-purple .kkd-banner-title { color: #3C3489; }
.kkd-banner-sub {
    font-size: 12px;
    margin-bottom: 14px;
    flex: 1;
}
.kkd-banner-teal .kkd-banner-sub { color: #0F6E56; }
.kkd-banner-purple .kkd-banner-sub { color: #534AB7; }
.kkd-banner-btn {
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    display: inline-block;
    align-self: flex-start;
    text-decoration: none;
}
.kkd-banner-teal .kkd-banner-btn { background: #085041; color: #E1F5EE; }
.kkd-banner-teal .kkd-banner-btn:hover { background: #0F6E56; color: #E1F5EE; }
.kkd-banner-purple .kkd-banner-btn { background: #3C3489; color: #EEEDFE; }
.kkd-banner-purple .kkd-banner-btn:hover { background: #534AB7; color: #EEEDFE; }
@media (max-width: 600px) {
    .kkd-banner-grid { grid-template-columns: 1fr; }
}

/* Invoice pill buttons */
.kkd-pill-btn {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    border: 0.5px solid;
    text-decoration: none;
    margin-left: 6px;
    white-space: nowrap;
    cursor: pointer;
}
.kkd-pill-btn-teal {
    background: #E1F5EE;
    border-color: #5DCAA5;
    color: #085041;
}
.kkd-pill-btn-teal:hover { background: #9FE1CB; color: #085041; }
.kkd-pill-btn-gray {
    background: #f5f5f5;
    border-color: #ddd;
    color: #444;
}
.kkd-pill-btn-gray:hover { background: #e8e8e8; color: #111; }

/* Two-line invoice rows — no border between line 1 and 2, only between invoice groups */
.kkd-inv-row td {
    padding-top: 14px;
    padding-bottom: 4px;
    padding-left: 16px;
    border-bottom: none !important;
}
.kkd-inv-row td:first-child { padding-left: 16px; }
.kkd-inv-row-sub td {
    background: #fafafa;
    border-bottom: 1px solid #f3f3f3 !important;
    padding: 7px 16px 11px;
}
.kkd-inv-row-sub:last-child td { border-bottom: none !important; }

/* Events table */
.kkd-event-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.kkd-event-table th {
    text-align: left;
    font-size: 11px;
    color: #aaa;
    font-weight: 500;
    padding: 4px 0 8px;
    border-bottom: 1px solid #f0f0f0;
}
.kkd-event-table td {
    padding: 8px 0;
    border-bottom: 1px solid #f7f7f7;
    vertical-align: top;
}
.kkd-event-table tr:last-child td { border-bottom: none; }

/* Kit Instructions */
.kkd-kit-instruction-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
}
.kkd-kit-instruction-row:last-child { border-bottom: none; }
.kkd-kit-instruction-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    margin-bottom: 2px;
}
.kkd-kit-instruction-meta {
    font-size: 12px;
    color: #888;
}
.kkd-kit-instruction-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Kit Instructions manual selector */
.kkd-kit-manual-select {
    margin-top: 12px;
}
.kkd-kit-manual-select label {
    font-size: 12px;
    color: #888;
    display: block;
    margin-bottom: 6px;
}
.kkd-kit-select-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.kkd-kit-select {
    flex: 1;
    min-width: 200px;
    font-size: 13px;
    padding: 6px 10px;
    border: 0.5px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #111;
    font-family: inherit;
}
.kkd-kit-select:focus {
    outline: none;
    border-color: #5DCAA5;
}

/* Invoice card — remove padding so sub-row gray goes edge to edge */
#kkd-invoices-card {
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
}
#kkd-invoices-card .kkd-card-header {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
.kkd-inv-table th:first-child,
.kkd-inv-row td:first-child,
.kkd-inv-row-sub td:first-child { padding-left: 1.25rem; }
.kkd-inv-table th:last-child,
.kkd-inv-row td:last-child,
.kkd-inv-row-sub td:last-child { padding-right: 1.25rem; }

/* Bottom row — balance + resources side by side */
.kkd-bottom-row {
    display: flex !important;
    gap: 1rem !important;
    align-items: flex-start !important;
}
.kkd-balance-card {
    flex: 0 0 40% !important;
    min-width: 0 !important;
    padding: 1.25rem !important;
}
.kkd-resources-card {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 1.25rem !important;
}

/* Account Summary Block */
.kkd-summary-value {
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: #111 !important;
    margin-top: 8px !important;
}
.kkd-balance-due { color: #dc2626 !important; }
.kkd-balance-clear { color: #16a34a !important; }
