.ikp-app {
    --ikp-teal: #0f766e;
    --ikp-teal-dark: #115e59;
    --ikp-teal-deep: #134e4a;
    --ikp-teal-soft: #dff3ef;
    --ikp-teal-fill: #8fd3cb;
    --ikp-bg: #f4f8f7;
    --ikp-card: #ffffff;
    --ikp-text: #173432;
    --ikp-muted: #657a77;
    --ikp-border: #d9e5e2;
    --ikp-grey-fill: #e2e9e7;
    --ikp-grey-line: #8fa39f;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ikp-text);
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    box-sizing: border-box;
}

.ikp-app *, .ikp-app *::before, .ikp-app *::after { box-sizing: border-box; }
.ikp-app button, .ikp-app input, .ikp-app select, .ikp-app textarea { font: inherit; }

.ikp-topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.ikp-topbar h2 { margin: 0; font-size: 30px; line-height: 1.15; }
.ikp-topbar p { margin: 5px 0 0; color: var(--ikp-muted); }
.ikp-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ikp-badges span {
    background: var(--ikp-teal-soft);
    color: var(--ikp-teal-deep);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.ikp-workspace {
    display: grid;
    grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
    min-height: 720px;
    border: 1px solid var(--ikp-border);
    border-radius: 18px;
    overflow: hidden;
    background: var(--ikp-card);
}

.ikp-settings {
    background: var(--ikp-bg);
    border-right: 1px solid var(--ikp-border);
    padding: 16px;
    overflow-y: auto;
    max-height: 82vh;
    min-height: 720px;
    scrollbar-color: var(--ikp-teal) #e8efed;
}

.ikp-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #e6eeec;
    border-radius: 11px;
    padding: 4px;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 20;
    margin-bottom: 12px;
}
.ikp-mode-tabs button {
    border: 0;
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
    color: var(--ikp-text);
    background: transparent;
    font-weight: 700;
}
.ikp-mode-tabs button.is-active { background: var(--ikp-teal); color: #fff; }

.ikp-panel {
    background: var(--ikp-card);
    border: 1px solid var(--ikp-border);
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 12px;
}
.ikp-panel h3 { margin: 0 0 11px; font-size: 15px; }
.ikp-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ikp-section-head h3 { margin-bottom: 3px; }
.ikp-section-head p { margin: 0; color: var(--ikp-muted); font-size: 12px; }

.ikp-button {
    border: 0;
    border-radius: 9px;
    min-height: 38px;
    padding: 8px 13px;
    cursor: pointer;
    font-weight: 700;
    transition: background .15s ease, opacity .15s ease;
}
.ikp-button:disabled { opacity: .45; cursor: not-allowed; }
.ikp-button-primary { background: var(--ikp-teal); color: #fff; }
.ikp-button-primary:hover { background: var(--ikp-teal-dark); }
.ikp-button-light { background: var(--ikp-teal-soft); color: var(--ikp-teal-deep); }
.ikp-button-light:hover { background: #cfe9e4; }
.ikp-save { width: 100%; margin-top: 4px; min-height: 44px; }

.ikp-dropzone {
    border: 1.5px dashed #9ab8b3;
    background: #f8fbfa;
    border-radius: 11px;
    min-height: 84px;
    padding: 15px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    color: var(--ikp-muted);
    cursor: pointer;
}
.ikp-dropzone strong { color: var(--ikp-text); }
.ikp-dropzone.is-dragover { border-color: var(--ikp-teal); background: var(--ikp-teal-soft); }

.ikp-file-list { display: grid; gap: 7px; margin-top: 10px; }
.ikp-file-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--ikp-border);
    border-radius: 9px;
    padding: 8px;
    background: #fff;
}
.ikp-file-row.is-selected { border-color: var(--ikp-teal); background: #f1faf8; }
.ikp-file-row.is-error { border-color: #c96363; background: #fff7f7; }
.ikp-file-main { min-width: 0; }
.ikp-file-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.ikp-file-main span { display: block; color: var(--ikp-muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ikp-file-type { font-size: 10px; font-weight: 800; padding: 4px 6px; border-radius: 6px; background: #e9f0ee; }
.ikp-icon-button { border: 0; background: transparent; cursor: pointer; color: var(--ikp-muted); padding: 5px; border-radius: 6px; }
.ikp-icon-button:hover { background: #edf3f1; color: var(--ikp-text); }

.ikp-field { display: grid; gap: 5px; margin-bottom: 11px; }
.ikp-field > span { font-size: 12px; font-weight: 700; }
.ikp-field input, .ikp-field select, .ikp-field textarea {
    width: 100%;
    border: 1px solid #cddbd8;
    border-radius: 8px;
    background: #fff;
    color: var(--ikp-text);
    padding: 9px 10px;
    min-height: 40px;
}
.ikp-field textarea { resize: vertical; }
.ikp-field input:focus, .ikp-field select:focus, .ikp-field textarea:focus {
    outline: 2px solid rgba(15,118,110,.22);
    border-color: var(--ikp-teal);
}

.ikp-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ikp-inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }
.ikp-inline-actions > span { color: var(--ikp-muted); font-size: 12px; margin-left: auto; }
.ikp-processing-actions { margin: 10px 0 0; }
.ikp-processing-actions .ikp-button { flex: 1; }
.ikp-small { margin: 7px 0 0; color: var(--ikp-muted); font-size: 11px; line-height: 1.45; }

.ikp-value-list {
    display: grid;
    gap: 5px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--ikp-border);
    border-radius: 9px;
    padding: 6px;
    background: #fbfdfc;
}
.ikp-value-item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 7px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
}
.ikp-value-item:hover { background: #eff5f3; }
.ikp-value-item input { accent-color: var(--ikp-teal); }

.ikp-crs-flow {
    border-radius: 8px;
    background: #eef6f4;
    color: var(--ikp-teal-deep);
    padding: 9px 10px;
    font-size: 11px;
    line-height: 1.4;
}

.ikp-status {
    position: sticky;
    bottom: 0;
    border: 1px solid #cfe2de;
    background: rgba(241,250,248,.97);
    color: var(--ikp-teal-deep);
    border-radius: 10px;
    padding: 10px 11px;
    font-size: 12px;
    font-weight: 650;
    box-shadow: 0 -4px 18px rgba(19,78,74,.05);
}
.ikp-status.is-error { background: #fff4f4; border-color: #efcaca; color: #8d2f2f; }

.ikp-map-panel { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #fff; }
.ikp-map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--ikp-border);
}
.ikp-map-toolbar strong { display: block; font-size: 14px; }
.ikp-map-toolbar span { color: var(--ikp-muted); font-size: 11px; }
.ikp-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.ikp-legend span { display: flex; align-items: center; gap: 5px; }
.ikp-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 3px; background: var(--ikp-grey-fill); border: 2px solid var(--ikp-grey-line); }
.ikp-legend i.selected { background: var(--ikp-teal-fill); border-color: var(--ikp-teal); }
.ikp-map { width: 100%; height: 100%; min-height: 660px; background: #e8efed; }
.ikp-map .leaflet-interactive { cursor: pointer; }

.ikp-dialog {
    width: min(720px, calc(100% - 30px));
    max-height: 86vh;
    border: 0;
    border-radius: 15px;
    padding: 0;
    color: var(--ikp-text);
    box-shadow: 0 18px 70px rgba(0,0,0,.24);
}
.ikp-dialog::backdrop { background: rgba(18,45,42,.45); }
.ikp-dialog form { padding: 18px; overflow-y: auto; max-height: 86vh; }
.ikp-dialog-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; margin-bottom: 12px; }
.ikp-dialog-head h3 { margin: 0; font-size: 20px; }
.ikp-dialog-head p { margin: 3px 0 0; color: var(--ikp-muted); font-size: 12px; }
.ikp-close { border: 0; background: #edf3f1; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 22px; line-height: 1; }
.ikp-detected-crs { border: 1px solid var(--ikp-border); background: #f7faf9; border-radius: 9px; padding: 10px; margin-bottom: 12px; font-size: 12px; }
.ikp-prj-details { margin-top: 7px; }
.ikp-prj-details summary { cursor: pointer; font-weight: 700; font-size: 12px; }
.ikp-prj-details pre { max-height: 160px; overflow: auto; background: #f3f6f5; border-radius: 7px; padding: 9px; white-space: pre-wrap; font-size: 10px; }
.ikp-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (max-width: 980px) {
    .ikp-topbar { flex-direction: column; }
    .ikp-badges { justify-content: flex-start; }
    .ikp-workspace { grid-template-columns: 1fr; }
    .ikp-settings { max-height: none; min-height: 0; border-right: 0; border-bottom: 1px solid var(--ikp-border); }
    .ikp-map { min-height: 520px; }
}

@media (max-width: 560px) {
    .ikp-topbar h2 { font-size: 24px; }
    .ikp-workspace { border-radius: 12px; }
    .ikp-settings { padding: 10px; }
    .ikp-two-col { grid-template-columns: 1fr; }
    .ikp-map-toolbar { align-items: flex-start; flex-direction: column; }
    .ikp-map { min-height: 430px; }
}
