/*
 * OneHealth 공통 UI/UX 통합 레이어
 * - 개별 Razor CSS가 페이지마다 따로 잡던 화면 높이/스크롤/카드/표 규칙을 마지막 CSS에서 통일한다.
 * - 1920x1080 / 100% 배율 기준으로 브라우저 전체 스크롤을 줄이고, 카드/탭 내부에서만 스크롤되도록 한다.
 */
:root {
    --oh-header-height: 64px;
    --oh-page-gap: .72rem;
    --oh-radius-lg: 18px;
    --oh-radius-md: 14px;
    --oh-border: #cfe1f6;
    --oh-border-strong: #9dc8ff;
    --oh-bg: #eef5ff;
    --oh-panel: #fff;
    --oh-text: #08224a;
    --oh-muted: #496584;
    --oh-blue: #0b377d;
    --oh-blue-2: #174f9e;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--oh-bg);
    color: var(--oh-text);
    font-size: 16px;
}

body { margin: 0; }

.ke-shell,
.ke-shell-topnav {
    height: 100vh;
    min-height: 0;
    overflow: hidden !important;
}

.ke-global-header { flex: 0 0 auto; }

.ke-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.ke-content {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--oh-page-gap);
    padding: .82rem .92rem .92rem !important;
}

.oh-page-header,
.bat-hero,
.alpha-hero,
.pathogen-hero {
    flex: 0 0 auto;
    margin: 0 !important;
    border: 1px solid var(--oh-border) !important;
    border-radius: var(--oh-radius-lg) !important;
    background: linear-gradient(180deg, #f8fbff 0%, #eff7ff 100%) !important;
    box-shadow: 0 12px 28px rgba(15, 48, 96, .08) !important;
    padding: .88rem 1rem !important;
}

.oh-page-header h1,
.bat-hero h1,
.alpha-hero h1,
.pathogen-hero h1 {
    font-size: clamp(1.32rem, 1.38vw, 1.72rem) !important;
    line-height: 1.12;
    margin: 0 0 .28rem !important;
    color: #06235a !important;
    font-weight: 950 !important;
}

.oh-subtitle,
.bat-hero p,
.alpha-hero p,
.pathogen-hero p {
    margin: 0 !important;
    color: var(--oh-muted) !important;
    font-size: .93rem !important;
    font-weight: 750;
}

.oh-unified-page,
.oh-workspace-root,
.bat-workspace,
.alpha-workspace,
.pathogen-workspace {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--oh-page-gap);
}

.oh-grid,
.bat-main-layout,
.alpha-main-layout,
.pathogen-main-layout,
.oh-map-layout {
    min-height: 0;
}

.ke-content > .oh-grid:last-child,
.ke-content > .oh-card:last-child,
.oh-unified-page > .oh-grid:last-child,
.oh-unified-page > .oh-card:last-child,
.oh-workspace-root > .bat-main-layout,
.oh-workspace-root > .alpha-main-layout,
.oh-workspace-root > .pathogen-main-layout {
    flex: 1 1 auto;
    overflow: hidden;
}

.oh-card,
.oh-stat-card,
.bat-kpi-strip > article,
.alpha-kpi-strip > article,
.pathogen-kpi-strip > article {
    border: 1px solid var(--oh-border) !important;
    border-radius: var(--oh-radius-lg) !important;
    background: var(--oh-panel) !important;
    box-shadow: 0 12px 28px rgba(15, 48, 96, .06) !important;
}

.oh-card {
    min-height: 0;
    overflow: hidden;
    padding: .85rem !important;
}

.oh-card h2,
.oh-card h3,
.oh-card h4 {
    color: #08275d;
    font-weight: 900;
}

.oh-grid {
    gap: var(--oh-page-gap) !important;
}

.oh-card:has(.oh-table-wrap),
.oh-card:has(.oh-list-scroll),
.oh-card:has(.bat-list-scroll),
.oh-card:has(.alpha-list-scroll),
.oh-card:has(.pathogen-list-scroll) {
    display: flex;
    flex-direction: column;
}

.oh-table-wrap,
.oh-list-scroll,
.bat-list-scroll,
.alpha-list-scroll,
.pathogen-list-scroll,
.bat-tree-scroll,
.alpha-detail-scroll,
.pathogen-detail-scroll,
.oh-scroll-area,
.oh-map-side-scroll {
    min-height: 0;
    overflow: auto !important;
    scrollbar-gutter: stable;
}

.oh-table-wrap {
    flex: 1 1 auto;
    max-height: min(56vh, 620px);
}

.ke-content > .oh-grid:last-child .oh-table-wrap,
.oh-unified-page > .oh-grid:last-child .oh-table-wrap {
    max-height: none;
}

.oh-table th,
.oh-table td {
    padding: .52rem .55rem !important;
    font-size: .88rem;
}

.oh-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #eaf3ff !important;
    color: #06235a !important;
}

input,
select,
textarea,
.btn,
.oh-btn,
button {
    font-size: .92rem !important;
}

.oh-field label {
    color: #12315f !important;
    font-size: .84rem !important;
    font-weight: 900 !important;
}

.oh-badge {
    color: #083c7c !important;
    font-weight: 900 !important;
}

.bat-kpi-strip,
.alpha-kpi-strip,
.pathogen-kpi-strip {
    flex: 0 0 auto;
    gap: var(--oh-page-gap) !important;
}

.bat-filter-card,
.alpha-filter-card,
.pathogen-filter-card {
    flex: 0 0 auto;
    margin: 0 !important;
}

.bat-main-layout,
.alpha-main-layout,
.pathogen-main-layout {
    flex: 1 1 auto;
    overflow: hidden;
}

.bat-tree-panel,
.bat-list-panel,
.bat-detail-panel,
.alpha-list-panel,
.alpha-detail-panel,
.pathogen-tree-panel,
.pathogen-list-panel,
.pathogen-detail-panel {
    min-height: 0 !important;
    overflow: hidden !important;
}

.oh-map-page > .oh-grid.oh-mb,
.oh-map-page > .oh-card.oh-mb {
    flex: 0 0 auto;
    margin-bottom: 0 !important;
}

.oh-map-page .oh-map-layout {
    flex: 1 1 auto;
    overflow: hidden;
    margin-bottom: 0 !important;
}

.oh-map-card,
.oh-map-layout > .oh-card {
    min-height: 0;
    overflow: hidden;
}

.oh-map-container {
    min-height: 360px !important;
    height: clamp(360px, 46vh, 520px) !important;
}

.oh-map-layout > .oh-card:last-child {
    display: flex;
    flex-direction: column;
}

.oh-map-layout > .oh-card:last-child .oh-table-wrap {
    max-height: none;
}

.oh-actions,
.oh-page-header,
.oh-form-grid {
    min-width: 0;
}

.oh-actions { gap: .45rem !important; }

.oh-page-header .oh-actions,
.oh-page-header > .oh-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.oh-card p:last-child { margin-bottom: 0; }

.oh-muted { color: var(--oh-muted) !important; }

@media (min-width: 1500px) {
    .oh-field { grid-column: span 3; }
    .oh-field-wide { grid-column: span 6; }
    .oh-field-full { grid-column: span 12; }

    .ke-content { padding: .95rem 1rem 1rem !important; }
}

@media (max-width: 1180px) {
    html, body { overflow: auto; }
    .ke-shell, .ke-shell-topnav, .ke-main, .ke-content { height: auto; overflow: visible !important; }
    .ke-content { display: block; }
    .oh-unified-page, .oh-workspace-root, .bat-workspace, .alpha-workspace, .pathogen-workspace { height: auto; overflow: visible; }
    .oh-table-wrap { max-height: 60vh; }
}

/* hotfix 020: 생태환경 기준 상단/지표 압축 및 분류체계 관리 버튼 2줄화 */
.oh-page-header,
.bat-hero,
.alpha-hero,
.pathogen-hero {
    padding: .58rem .92rem !important;
    min-height: auto !important;
}

.oh-page-header h1,
.bat-hero h1,
.alpha-hero h1,
.pathogen-hero h1 {
    font-size: clamp(1.18rem, 1.16vw, 1.46rem) !important;
    line-height: 1.08 !important;
    margin-bottom: .2rem !important;
}

.oh-subtitle,
.bat-hero p,
.alpha-hero p,
.pathogen-hero p {
    font-size: .84rem !important;
    line-height: 1.25 !important;
}

.bat-kpi-strip > article,
.alpha-kpi-strip > article,
.pathogen-kpi-strip > article {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "label value"
        "note note";
    align-items: center;
    column-gap: .55rem;
    row-gap: .16rem;
    min-height: 3.15rem;
    padding: .52rem .72rem !important;
}

.bat-kpi-strip > article > span,
.alpha-kpi-strip > article > span,
.pathogen-kpi-strip > article > span {
    grid-area: label;
    min-width: 0;
    font-size: .78rem !important;
    line-height: 1.1 !important;
}

.bat-kpi-strip > article > strong,
.alpha-kpi-strip > article > strong,
.pathogen-kpi-strip > article > strong {
    grid-area: value;
    margin: 0 !important;
    font-size: 1.18rem !important;
    line-height: 1 !important;
    text-align: right;
}

.bat-kpi-strip > article > small,
.alpha-kpi-strip > article > small,
.pathogen-kpi-strip > article > small {
    grid-area: note;
    font-size: .76rem !important;
    line-height: 1.1 !important;
}

.bat-taxonomy-admin-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px !important;
    margin: 6px 0 8px !important;
}

.bat-taxonomy-admin-tools button,
.bat-taxonomy-admin-tools .bat-mini-btn,
.bat-taxonomy-admin-tools .oh-admin-action {
    min-width: 0 !important;
    height: 32px !important;
    padding: 0 .42rem !important;
    border-radius: 9px !important;
    font-size: .8rem !important;
    line-height: 1.05 !important;
}

.bat-taxonomy-admin-tools .oh-admin-action-delete {
    grid-column: span 1;
}

.bat-center-search-panel {
    padding: .52rem .62rem !important;
}

@media (max-width: 900px) {
    .bat-taxonomy-admin-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* hotfix 039: 병원체/초음파/지도 화면 1920x1080 기준 작업영역 재정렬 */
.pathogen-hero {
    justify-content: flex-start !important;
}

.pathogen-detail-panel {
    display: block !important;
    min-height: 0 !important;
    overflow: auto !important;
    scrollbar-gutter: stable !important;
    padding-right: .65rem !important;
}

.pathogen-detail-panel .pathogen-detail-title,
.pathogen-detail-panel .pathogen-detail-section {
    flex: 0 0 auto;
}

.oh-acoustic-page {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.oh-acoustic-split {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(420px, .78fr) minmax(620px, 1.22fr);
    gap: var(--oh-page-gap);
}

.oh-acoustic-pane {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.oh-acoustic-upload-form {
    flex: 0 0 auto;
}

.oh-acoustic-subpanel,
.oh-acoustic-result-card {
    min-height: 0;
    border: 1px solid #d9e7f8;
    border-radius: 14px;
    background: #f8fbff;
    padding: .65rem;
}

.oh-acoustic-subpanel {
    display: flex;
    flex-direction: column;
}

.oh-acoustic-subpanel:first-of-type {
    flex: 1 1 auto;
}

.oh-acoustic-model-panel {
    flex: .65 1 auto;
}

.oh-acoustic-subpanel h4,
.oh-acoustic-result-card h4 {
    margin: 0 0 .45rem;
    color: #08275d;
    font-size: .98rem;
    font-weight: 950;
}

.oh-acoustic-result-grid {
    flex: 0 0 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .8fr);
    gap: .65rem;
}

.oh-acoustic-result-card {
    overflow: hidden;
}

.oh-acoustic-prediction-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.oh-acoustic-spectrogram-panel {
    flex: 0 0 min(30vh, 260px);
    display: flex;
    flex-direction: column;
}

.oh-acoustic-spectrogram-panel img {
    min-height: 0;
    flex: 1 1 auto;
    width: 100%;
    object-fit: contain;
    border: 1px solid var(--oh-border);
    border-radius: 12px;
    background: #fff;
}

.oh-pane-scroll {
    min-height: 0;
    overflow: auto !important;
    scrollbar-gutter: stable;
}

.oh-map-three-pane {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(300px, 22%) minmax(620px, 1fr) minmax(320px, 24%);
    gap: var(--oh-page-gap);
}

.oh-map-three-pane > .oh-card {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.oh-map-list-pane .oh-table-wrap,
.oh-map-info-pane .oh-table-wrap {
    flex: 1 1 auto;
    max-height: none !important;
}

.oh-map-list-pane .oh-table td strong,
.oh-map-list-pane .oh-table td small {
    display: block;
    min-width: 0;
}

.oh-map-list-pane .oh-table td small {
    color: var(--oh-muted);
    font-size: .75rem;
    font-weight: 750;
}

.oh-map-center-pane .oh-map-container {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
}

.oh-map-center-pane .oh-map-summary-line {
    flex: 0 0 auto;
}

.oh-map-info-pane {
    overflow: auto !important;
    scrollbar-gutter: stable;
}

.oh-map-info-pane .oh-map-side-summary {
    flex: 0 0 auto;
}

@media (max-width: 1180px) {
    .oh-acoustic-page,
    .oh-acoustic-split,
    .oh-map-three-pane {
        height: auto;
        overflow: visible;
    }

    .oh-acoustic-split,
    .oh-map-three-pane,
    .oh-acoustic-result-grid {
        grid-template-columns: 1fr;
    }

    .oh-acoustic-pane,
    .oh-map-three-pane > .oh-card {
        overflow: visible;
    }
}
