/* 计划分解表样式 */

.tl-mt-coal-plan-container {
    padding: 16px;
    margin: 0 auto;
}

.tl-mt-coal-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.tl-mt-coal-plan-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tl-mt-coal-plan-title {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.tl-mt-coal-plan-year-selector .tl-mt-coal-plan-select {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 13px;
    cursor: pointer;
}

.tl-mt-coal-plan-header-right {
    display: flex;
    gap: 8px;
}

.tl-mt-coal-plan-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.tl-mt-coal-plan-btn .material-symbols-outlined {
    font-size: 16px;
}

.tl-mt-coal-plan-btn.primary {
    background: #0ea5e9;
    color: white;
}

.tl-mt-coal-plan-btn.primary:hover {
    background: #0284c7;
}

.tl-mt-coal-plan-btn.secondary {
    background: white;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.tl-mt-coal-plan-btn.secondary:hover {
    background: #f8fafc;
}

/* 可折叠区域 */
.tl-mt-coal-plan-section {
    background: white;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.tl-mt-coal-plan-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tl-mt-coal-plan-section-header:hover {
    background: #f1f5f9;
}

.tl-mt-coal-plan-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tl-mt-coal-plan-section-title .material-symbols-outlined {
    font-size: 18px;
    color: #64748b;
    transition: transform 0.2s;
}

.tl-mt-coal-plan-section.collapsed .tl-mt-coal-plan-section-title .material-symbols-outlined.expand-icon {
    transform: rotate(-90deg);
}

.tl-mt-coal-plan-section-body {
    padding: 12px;
}

.tl-mt-coal-plan-section.collapsed .tl-mt-coal-plan-section-body {
    display: none;
}

/* 表格滚动容器 - 带左右阴影提示 */
.tl-mt-coal-plan-table-wrap {
    overflow-x: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.tl-mt-coal-plan-table-wrap::-webkit-scrollbar {
    height: 6px;
}

.tl-mt-coal-plan-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.tl-mt-coal-plan-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.tl-mt-coal-plan-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 紧凑型月度表格 */
.tl-mt-coal-plan-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

.tl-mt-coal-plan-table thead {
    background: #f8fafc;
}

.tl-mt-coal-plan-table th {
    padding: 6px 4px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    font-size: 11px;
}

/* 左侧标签列 sticky */
.tl-mt-coal-plan-table th.col-label,
.tl-mt-coal-plan-table td.col-label {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 140px;
    max-width: 140px;
    width: 140px;
}

.tl-mt-coal-plan-table th.col-label {
    background: #f8fafc;
}

.tl-mt-coal-plan-table td.col-label {
    font-weight: 500;
    color: #0f172a;
    background: white;
    font-size: 12px;
    border-right: 1px solid #e2e8f0;
}

/* 右侧合计列 sticky */
.tl-mt-coal-plan-table th.col-total,
.tl-mt-coal-plan-table td.col-total {
    position: sticky;
    right: 0;
    z-index: 2;
    min-width: 80px;
    width: 80px;
    font-weight: 600;
    border-left: 2px solid #e2e8f0;
}

.tl-mt-coal-plan-table th.col-total {
    background: #f0f9ff;
    color: #0369a1;
}

.tl-mt-coal-plan-table td.col-total {
    background: #f0f9ff;
    color: #0f172a;
}

/* 月份数据列 */
.tl-mt-coal-plan-table th.col-month,
.tl-mt-coal-plan-table td.col-month {
    min-width: 70px;
    width: 70px;
}

/* 长协表双列 (分解/实际) 更窄 */
.tl-mt-coal-plan-table th.col-half,
.tl-mt-coal-plan-table td.col-half {
    min-width: 58px;
    width: 58px;
}

.tl-mt-coal-plan-table th.right,
.tl-mt-coal-plan-table td.right {
    text-align: right;
}

.tl-mt-coal-plan-table th.center {
    text-align: center;
}

.tl-mt-coal-plan-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}

.tl-mt-coal-plan-table tbody tr:hover {
    background: #f8fafc;
}

.tl-mt-coal-plan-table tbody tr:hover td.col-label {
    background: #f8fafc;
}

.tl-mt-coal-plan-table tbody tr:hover td.col-total {
    background: #e0f2fe;
}

.tl-mt-coal-plan-table td {
    padding: 4px 4px;
    color: #475569;
}

.tl-mt-coal-plan-table td.auto {
    color: #64748b;
    font-style: italic;
    font-size: 11px;
}

/* 合计行 */
.tl-mt-coal-plan-table tr.total-row td {
    font-weight: 600;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.tl-mt-coal-plan-table tr.total-row td.col-label {
    background: #f1f5f9;
}

.tl-mt-coal-plan-table tr.total-row td.col-total {
    background: #dbeafe;
    color: #1e40af;
}

/* 紧凑输入框 */
.tl-mt-coal-plan-table input.tl-mt-coal-plan-input {
    width: 100%;
    padding: 3px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-size: 12px;
    text-align: right;
    background: white;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.tl-mt-coal-plan-table input.tl-mt-coal-plan-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
}

.tl-mt-coal-plan-table input.tl-mt-coal-plan-input:disabled,
.tl-mt-coal-plan-table input.tl-mt-coal-plan-input.readonly {
    background: #f1f5f9;
    cursor: default;
}

/* 输入框去掉上下箭头让宽度更紧凑 */
.tl-mt-coal-plan-table input[type="number"]::-webkit-inner-spin-button,
.tl-mt-coal-plan-table input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tl-mt-coal-plan-table input[type="number"] {
    -moz-appearance: textfield;
}

/* 厂商名输入 + 删除按钮 */
.tl-mt-coal-plan-table td.col-label .tl-mt-coal-plan-input {
    display: inline-block;
    width: calc(100% - 22px);
    text-align: left;
    font-size: 12px;
}

.tl-mt-coal-plan-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    background: white;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    vertical-align: middle;
}

.tl-mt-coal-plan-remove-btn:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;
}

/* 年度合同列(长协表) */
.tl-mt-coal-plan-table th.col-contract,
.tl-mt-coal-plan-table td.col-contract {
    min-width: 70px;
    width: 70px;
}

/* 占位符 */
.tl-mt-coal-plan-placeholder {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
    padding: 8px 0;
}

/* ========== 深色模式 ========== */

body.dark .tl-mt-coal-plan-title {
    color: #f1f5f9;
}

body.dark .tl-mt-coal-plan-select {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark .tl-mt-coal-plan-section {
    background: #1e293b;
}

body.dark .tl-mt-coal-plan-section-header {
    background: #0f172a;
    border-color: #334155;
}

body.dark .tl-mt-coal-plan-section-header:hover {
    background: #1e293b;
}

body.dark .tl-mt-coal-plan-section-title {
    color: #f1f5f9;
}

body.dark .tl-mt-coal-plan-table thead {
    background: #0f172a;
}

body.dark .tl-mt-coal-plan-table th {
    color: #94a3b8;
    border-color: #334155;
}

body.dark .tl-mt-coal-plan-table th.col-label {
    background: #0f172a;
}

body.dark .tl-mt-coal-plan-table th.col-total {
    background: #0c4a6e;
    color: #7dd3fc;
}

body.dark .tl-mt-coal-plan-table tbody tr {
    border-color: #334155;
}

body.dark .tl-mt-coal-plan-table tbody tr:hover {
    background: #0f172a;
}

body.dark .tl-mt-coal-plan-table td {
    color: #94a3b8;
}

body.dark .tl-mt-coal-plan-table td.col-label {
    color: #f1f5f9;
    background: #1e293b;
    border-right-color: #334155;
}

body.dark .tl-mt-coal-plan-table tbody tr:hover td.col-label {
    background: #0f172a;
}

body.dark .tl-mt-coal-plan-table td.col-total {
    background: #0c4a6e;
    color: #e0f2fe;
    border-left-color: #334155;
}

body.dark .tl-mt-coal-plan-table tbody tr:hover td.col-total {
    background: #075985;
}

body.dark .tl-mt-coal-plan-table tr.total-row td {
    background: #0f172a;
    border-color: #334155;
}

body.dark .tl-mt-coal-plan-table tr.total-row td.col-label {
    background: #0f172a;
}

body.dark .tl-mt-coal-plan-table tr.total-row td.col-total {
    background: #082f49;
    color: #7dd3fc;
}

body.dark .tl-mt-coal-plan-table input.tl-mt-coal-plan-input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark .tl-mt-coal-plan-table input.tl-mt-coal-plan-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.3);
}

body.dark .tl-mt-coal-plan-table input.tl-mt-coal-plan-input:disabled,
body.dark .tl-mt-coal-plan-table input.tl-mt-coal-plan-input.readonly {
    background: #334155;
}

body.dark .tl-mt-coal-plan-btn.secondary {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark .tl-mt-coal-plan-btn.secondary:hover {
    background: #334155;
}

body.dark .tl-mt-coal-plan-remove-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark .tl-mt-coal-plan-remove-btn:hover {
    background: #450a0a;
    color: #f87171;
    border-color: #7f1d1d;
}

body.dark .tl-mt-coal-plan-table-wrap::-webkit-scrollbar-thumb {
    background: #475569;
}

body.dark .tl-mt-coal-plan-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ========== 提示图标 & 浮层 ========== */

/* 公式规则图标 (标签旁) */
.tl-mt-tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    vertical-align: middle;
    opacity: 0.45;
    transition: opacity 0.15s;
}

.tl-mt-tip-icon:hover {
    opacity: 1;
}

.tl-mt-tip-icon.rule .material-symbols-outlined {
    font-size: 13px;
    color: #0ea5e9;
}

.tl-mt-tip-icon.detail .material-symbols-outlined {
    font-size: 12px;
    color: #8b5cf6;
    margin-left: 2px;
}

/* 浮层 tooltip - 外层定位壳（不裁剪，用于放箭头） */
.tl-mt-coal-plan-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
}

/* 点击固定模式（移动端）：启用 pointer-events 以便滚动内容 & 拦截点击 */
.tl-mt-coal-plan-tooltip.pinned {
    pointer-events: auto;
}

/* 箭头 */
.tl-mt-coal-plan-tooltip-arrow {
    position: absolute;
    top: -5px;
    width: 10px;
    height: 10px;
    background: #1e293b;
    transform: rotate(45deg);
}

.tl-mt-coal-plan-tooltip.above .tl-mt-coal-plan-tooltip-arrow {
    top: auto;
    bottom: -5px;
}

/* 内容区域（独立滚动） */
.tl-mt-coal-plan-tooltip-body {
    background: #1e293b;
    color: #f1f5f9;
    font-size: 12px;
    line-height: 1.6;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    white-space: pre-wrap;
    max-width: 460px;
    max-height: 320px;
    overflow-y: auto;
    word-break: break-all;
}

.tl-mt-coal-plan-tooltip-body .tip-title {
    font-weight: 600;
    color: #7dd3fc;
    margin-bottom: 4px;
    font-size: 12px;
}

.tl-mt-coal-plan-tooltip-body .tip-line {
    color: #cbd5e1;
}

.tl-mt-coal-plan-tooltip-body .tip-result {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #334155;
    font-weight: 600;
    color: #fbbf24;
}

.tl-mt-coal-plan-tooltip-body .tip-tag {
    color: #94a3b8;
    font-size: 11px;
}

body.dark .tl-mt-coal-plan-tooltip-body {
    background: #0f172a;
    border: 1px solid #1e293b;
}

body.dark .tl-mt-coal-plan-tooltip-arrow {
    background: #0f172a;
}

/* 移动端：增大提示图标触摸热区，提升可点击性 */
@media (hover: none) and (pointer: coarse) {
    .tl-mt-tip-icon {
        padding: 6px;
        margin: -6px;
        opacity: 0.6;
        -webkit-tap-highlight-color: transparent;
    }
    .tl-mt-coal-plan-tooltip-body {
        max-width: min(90vw, 460px);
        max-height: 50vh;
        font-size: 13px;
    }
}

/* col-total 内容包裹 */
.tl-mt-coal-plan-table td.col-total .tl-mt-tip-icon {
    display: inline-flex;
}

/* ========== 预警阈值图标 ========== */

.tl-mt-tip-icon.threshold {
    cursor: pointer;
    margin-left: 2px;
}

.tl-mt-tip-icon.threshold .material-symbols-outlined {
    font-size: 13px;
    color: #94a3b8;
    transition: color 0.15s;
}

.tl-mt-tip-icon.threshold:hover .material-symbols-outlined {
    color: #e65100;
}

.tl-mt-tip-icon.threshold.active .material-symbols-outlined {
    color: #e65100;
    opacity: 1;
}

.tl-mt-tip-icon.threshold.active {
    opacity: 1;
}

/* 阈值设置表单 */
.tl-mt-threshold-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tl-mt-threshold-toggle {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    gap: 12px;
}

.tl-mt-threshold-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tl-mt-threshold-field label {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

.tl-mt-threshold-field input,
.tl-mt-threshold-field select {
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    box-sizing: border-box;
    width: 100%;
}

.tl-mt-threshold-field input:focus,
.tl-mt-threshold-field select:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.tl-mt-threshold-field small {
    font-size: 11px;
    color: #94a3b8;
}

/* 深色模式 - 阈值 */
body.dark .tl-mt-tip-icon.threshold .material-symbols-outlined {
    color: #64748b;
}

body.dark .tl-mt-tip-icon.threshold:hover .material-symbols-outlined {
    color: #fb923c;
}

body.dark .tl-mt-tip-icon.threshold.active .material-symbols-outlined {
    color: #fb923c;
}

body.dark .tl-mt-threshold-toggle {
    color: #e2e8f0;
}

body.dark .tl-mt-threshold-field label {
    color: #cbd5e1;
}

body.dark .tl-mt-threshold-field input,
body.dark .tl-mt-threshold-field select {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark .tl-mt-threshold-field small {
    color: #64748b;
}
