.ksm-floating-launcher {
    bottom: 18px !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .28);
    position: fixed !important;
    right: 18px !important;
    z-index: 10000 !important;
    white-space: nowrap;
}

.ksm-menu-button {
    align-items: center;
    background: #155eef;
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    margin-inline: 6px;
    min-height: 34px;
    padding: 6px 12px;
}

.ksm-menu-button:hover { background: #0d47c9; }

.ksm-app-overlay {
    align-items: stretch;
    background: #f8fafc;
    overflow: auto;
}

.ksm-app-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    height: 100vh;
    max-height: none;
    max-width: none;
    min-height: 100vh;
    min-width: 0;
    width: 100vw;
}

.ksm-overlay,
.ksm-editor-overlay {
    align-items: center;
    background: rgba(15, 23, 42, .62);
    display: flex;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 10000;
}

.ksm-panel,
.ksm-editor-panel {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .35);
    color: #0f172a;
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-height: min(94vh, 1040px);
    max-width: min(1500px, 96vw);
    min-height: min(680px, 94vh);
    min-width: min(760px, 94vw);
    overflow: hidden;
    width: 96vw;
}

.ksm-heading,
.ksm-editor-header {
    align-items: center;
    background: #0f172a;
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 14px 20px;
}

.ksm-title { display: flex; flex-direction: column; gap: 3px; }
.ksm-title strong { font-size: 19px; }
.ksm-title small { color: #cbd5e1; font-size: 12px; }
.ksm-heading h2,
.ksm-editor-header h2 { font-size: 18px; margin: 0; }

.ksm-body { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.ksm-notice { margin: 10px 18px 0; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.ksm-notice[hidden] { display: none; }
.ksm-notice-info { background: #dbeafe; color: #1e3a8a; }
.ksm-notice-success { background: #dcfce7; color: #166534; }
.ksm-notice-warning { background: #fef3c7; color: #92400e; }
.ksm-notice-error { background: #fee2e2; color: #991b1b; }

.ksm-tabs,
.ksm-subtabs {
    align-items: center;
    background: #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 7px 14px;
}

.ksm-tab,
.ksm-subtab {
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #475569;
    cursor: pointer;
    font: inherit;
    padding: 8px 13px;
    white-space: nowrap;
}

.ksm-tab:hover,
.ksm-subtab:hover { background: #cbd5e1; color: #0f172a; }
.ksm-tab-active,
.ksm-subtab-active { background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .14); color: #0f172a; font-weight: 700; }
.ksm-content { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.ksm-section { min-height: 100%; }

.ksm-cards { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(130px, 1fr)); margin-bottom: 24px; }
.ksm-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; display: flex; flex-direction: column; gap: 4px; padding: 15px; }
.ksm-card-label { color: #64748b; font-size: 13px; }
.ksm-card-value { font-size: 23px; line-height: 1.25; overflow-wrap: anywhere; }
.ksm-info-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(180px, 1fr)); margin-bottom: 22px; }
.ksm-info-item { background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; }
.ksm-info-item strong { overflow-wrap: anywhere; }
.ksm-dashboard h3 { font-size: 16px; margin: 0 0 10px; }

.ksm-toolbar,
.ksm-action-row,
.ksm-form-footer,
.ksm-panel-heading,
.ksm-pager { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.ksm-toolbar { margin-bottom: 14px; }
.ksm-toolbar .ksm-search { flex: 1 1 260px; }
.ksm-panel-heading { justify-content: space-between; }
.ksm-panel-heading h3 { margin: 0; }
.ksm-pager { justify-content: center; padding: 14px 0 2px; }
.ksm-pager span { color: #475569; font-size: 13px; min-width: 180px; text-align: center; }

.ksm-button {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: #0f172a;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    padding: 7px 11px;
}
.ksm-button:hover { background: #cbd5e1; }
.ksm-button:disabled { cursor: not-allowed; opacity: .45; }
.ksm-button-primary { background: #155eef; border-color: #155eef; color: #fff; }
.ksm-button-primary:hover { background: #0d47c9; }
.ksm-button-secondary { background: #fff; }
.ksm-button-danger { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.ksm-button-danger:hover { background: #ffe4e6; }
.ksm-button-quiet { background: transparent; border-color: transparent; color: inherit; }
.ksm-button-small { font-size: 12px; padding: 4px 7px; }
.ksm-close-button { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 27px; line-height: 1; padding: 0 3px; }

.ksm-input,
.ksm-textarea {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    box-sizing: border-box;
    color: #0f172a;
    font: inherit;
    font-size: 13px;
    max-width: 100%;
    padding: 8px 9px;
}
.ksm-input:focus,
.ksm-textarea:focus { border-color: #155eef; box-shadow: 0 0 0 2px rgba(21, 94, 239, .14); outline: 0; }
.ksm-textarea { display: block; min-height: 210px; resize: vertical; width: 100%; }
.ksm-input-compact { min-width: 110px; padding: 5px 6px; width: 100%; }
.ksm-inline-field { align-items: center; display: inline-flex; gap: 8px; margin: 9px 0; }
.ksm-inline-field span { color: #475569; font-size: 13px; }

.ksm-table { border-collapse: collapse; font-size: 13px; table-layout: auto; width: 100%; }
.ksm-table th { background: #e2e8f0; color: #334155; font-size: 12px; font-weight: 700; padding: 8px; position: sticky; text-align: left; top: 0; white-space: nowrap; z-index: 1; }
.ksm-table td { border-bottom: 1px solid #e2e8f0; max-width: 280px; padding: 8px; vertical-align: middle; white-space: pre-line; }
.ksm-table tbody tr:hover { background: #f1f5f9; }
.ksm-table .ksm-actions { white-space: nowrap; }
.ksm-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ksm-cell-sub { display: block; margin-top: 3px; }
.ksm-media-ok { color: #166534; }
.ksm-media-missing { color: #be123c; }
.ksm-empty { color: #64748b; padding: 30px !important; text-align: center; }
.ksm-muted { color: #64748b; font-size: 12px; }
.ksm-error-box { background: #fee2e2; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b; padding: 13px; }

.ksm-denied { align-items: center; display: flex; flex-direction: column; justify-content: center; margin: auto; max-width: 580px; min-height: 400px; padding: 30px; text-align: center; }
.ksm-denied-icon { font-size: 52px; margin-bottom: 12px; }
.ksm-denied h2 { margin: 0 0 8px; }
.ksm-denied p { line-height: 1.6; margin: 5px 0; }

.ksm-editor-overlay { background: rgba(15, 23, 42, .5); z-index: 10001; }
.ksm-editor-panel { max-height: 90vh; max-width: min(900px, 94vw); min-height: 0; min-width: min(520px, 94vw); width: 820px; }
.ksm-editor-content { max-height: calc(90vh - 70px); overflow: auto; padding: 18px; }
.ksm-editor-form { display: block; }
.ksm-form-grid { display: grid; gap: 11px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ksm-field { display: flex; flex-direction: column; gap: 4px; }
.ksm-field > span { color: #475569; font-size: 12px; }
.ksm-field input,
.ksm-field select { width: 100%; }
.ksm-advanced { border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 14px; padding: 9px 11px; }
.ksm-advanced summary { color: #334155; cursor: pointer; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.ksm-form-footer { border-top: 1px solid #e2e8f0; justify-content: flex-end; margin-top: 16px; padding-top: 14px; }

.ksm-scan-panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 11px; margin-top: 24px; padding: 14px; }
.ksm-scan-summary { background: #eff6ff; border-radius: 7px; color: #1e40af; font-size: 13px; margin: 10px 0; padding: 9px; }
.ksm-scan-result { overflow-x: auto; }
.ksm-import-table td { min-width: 130px; }
.ksm-import-table td:nth-child(1) { min-width: 40px; width: 40px; }
.ksm-warning-details { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; color: #92400e; margin-top: 14px; padding: 9px 12px; }
.ksm-warning-details summary { cursor: pointer; }
.ksm-warning-details ul { max-height: 180px; overflow: auto; }

.ksm-legacy-job-status {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1e3a8a;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 12px 0;
    padding: 10px 12px;
}
.ksm-legacy-progress { font-size: 13px; font-weight: 700; }
.ksm-legacy-history { color: #475569; display: grid; gap: 5px; margin-top: 12px; }
.ksm-legacy-history-item { font-size: 12px; overflow-wrap: anywhere; }
.ksm-legacy-dashboard-status {
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    color: #1e3a8a;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 18px;
    padding: 10px 12px;
}
.ksm-legacy-dashboard-status span { flex: 1 1 260px; font-size: 12px; }
.ksm-legacy-dashboard-complete { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

.ksm-maintenance-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.ksm-maintenance-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.ksm-maintenance-card p { flex: 1; margin: 0; }
.ksm-output { background: #0f172a; border-radius: 8px; color: #dbeafe; margin-top: 16px; max-height: 220px; min-height: 70px; overflow: auto; padding: 12px; white-space: pre-wrap; }

@media (max-width: 760px) {
    .ksm-panel { border-radius: 0; height: 100%; max-height: 100%; max-width: 100%; min-height: 100%; min-width: 100%; width: 100%; }
    .ksm-content { padding: 12px; }
    .ksm-cards, .ksm-info-grid, .ksm-maintenance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ksm-form-grid { grid-template-columns: 1fr; }
    .ksm-table { min-width: 720px; }
    .ksm-list-host, .ksm-singer-list-host { overflow-x: auto; }
}

@media (max-width: 420px) {
    .ksm-cards, .ksm-info-grid, .ksm-maintenance-grid { grid-template-columns: 1fr; }
    .ksm-heading { padding: 12px; }
}
