/* 中碳智慧全 AI 智能商业运维操作系统 · 前端公共样式
   档案：CONST-WORKBUDDY-KYLIN-ULTI-V1.0（09 终版正式方案 第五篇 五端载体）
   视觉基线：白底 + 主色青绿 #40E0D0 + 深灰文字 + 浅青卡片底 + 顶部深底导航
*/

:root {
    --primary: #40E0D0;
    --primary-ink: #0C2E2C;
    --primary-soft: #E6FAF7;
    --card: #F2FAF9;
    --border: #D6EDE9;
    --text: #333333;
    --text-sub: #4B5563;
    --text-mute: #8A9A98;
    --white: #FFFFFF;
    --ok: #1F9D55;
    --warn: #D98A00;
    --block: #D93A3A;
    --shadow: 0 2px 10px rgba(12, 46, 44, 0.06);
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--white);
    color: var(--text);
    font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: #12867C;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------------- 顶部导航 */

.navbar {
    background: var(--primary-ink);
    color: var(--white);
    padding: 0 24px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.navbar .brand {
    font-size: 17px;
    font-weight: 700;
    padding: 14px 18px 14px 0;
    letter-spacing: 1px;
    white-space: nowrap;
}

.navbar .brand em {
    color: var(--primary);
    font-style: normal;
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.82);
    padding: 15px 14px;
    font-size: 14px;
    border-bottom: 3px solid transparent;
}

.navbar .nav-link:hover {
    color: var(--white);
    text-decoration: none;
}

.navbar .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

/* ---------------------------------------------------------------- 基址工具条 */

.basebar {
    background: var(--primary-soft);
    border-bottom: 1px solid var(--border);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-sub);
}

.basebar label {
    font-weight: 700;
    color: var(--primary-ink);
}

.basebar input[type="text"] {
    min-width: 260px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    font-family: inherit;
}

/* ---------------------------------------------------------------- 主容器 */

.wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 24px 60px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-ink);
    margin: 0 0 6px;
}

.page-desc {
    color: var(--text-sub);
    margin: 0 0 20px;
    font-size: 13px;
}

.section {
    margin-bottom: 26px;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.section-head h2 {
    font-size: 16px;
    margin: 0;
    color: var(--primary-ink);
    border-left: 4px solid var(--primary);
    padding-left: 9px;
}

.section-head .hint {
    font-size: 12px;
    color: var(--text-mute);
}

/* ---------------------------------------------------------------- 卡片 */

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.card.soft {
    background: var(--card);
}

.card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--primary-ink);
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.c2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.c3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.c4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.c5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 1080px) {
    .grid.c3,
    .grid.c4,
    .grid.c5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .grid.c2,
    .grid.c3,
    .grid.c4,
    .grid.c5 {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------------------------------------------------------------- 指标卡 */

.metric {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.metric .label {
    font-size: 12px;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 6px;
}

.metric .value {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-ink);
    margin-top: 4px;
    word-break: break-all;
}

.metric .unit {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-sub);
    margin-left: 3px;
}

.metric .sub {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 2px;
}

/* ---------------------------------------------------------------- 表格 */

table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--white);
}

table.tbl th,
table.tbl td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
    word-break: break-all;
}

table.tbl th {
    background: var(--primary-soft);
    color: var(--primary-ink);
    font-weight: 700;
    white-space: nowrap;
}

table.tbl tbody tr:nth-child(even) {
    background: #FBFEFC;
}

table.tbl td.mono {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

/* ---------------------------------------------------------------- 徽章 */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 11px;
    font-size: 12px;
    line-height: 20px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge.ok {
    background: #E8F7EE;
    color: var(--ok);
    border-color: #BEE6CD;
}

.badge.warn {
    background: #FFF6E5;
    color: var(--warn);
    border-color: #F3DFB4;
}

.badge.block {
    background: #FDECEC;
    color: var(--block);
    border-color: #F5C6C6;
}

.badge.fail {
    background: #F1F3F4;
    color: #6B7280;
    border-color: #DDE1E3;
}

.badge.info {
    background: var(--primary-soft);
    color: #12867C;
    border-color: var(--border);
}

/* ---------------------------------------------------------------- 按钮 */

.btn {
    display: inline-block;
    padding: 7px 16px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--primary-ink);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 700;
}

.btn:hover {
    filter: brightness(1.05);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn.ghost {
    background: var(--white);
    color: var(--primary-ink);
    border-color: var(--border);
}

.btn.dark {
    background: var(--primary-ink);
    border-color: var(--primary-ink);
    color: var(--primary);
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ---------------------------------------------------------------- 表单 */

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-sub);
}

.field input,
.field select,
.field textarea {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
}

.field textarea {
    resize: vertical;
    min-height: 78px;
    line-height: 1.6;
}

.form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------------------------------------------------------------- 开关 */

.switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.switch input {
    display: none;
}

.switch .track {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: #D5DDDB;
    position: relative;
    transition: background 0.18s;
    flex: none;
}

.switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    transition: left 0.18s;
}

.switch input:checked + .track {
    background: var(--primary);
}

.switch input:checked + .track::after {
    left: 20px;
}

/* ---------------------------------------------------------------- 提示条 */

.alert {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-sub);
}

.alert.warn {
    background: #FFF9EC;
    border-color: #F3DFB4;
    color: #8A5B00;
}

.alert.block {
    background: #FDECEC;
    border-color: #F5C6C6;
    color: #9B2626;
}

.alert.ok {
    background: #EAF8F0;
    border-color: #BEE6CD;
    color: #14663A;
}

/* ---------------------------------------------------------------- 对话区（私域工作台） */

.chat-log {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    padding: 12px;
    height: 320px;
    overflow-y: auto;
}

.msg {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.msg .who {
    font-size: 12px;
    color: var(--text-mute);
    margin-bottom: 3px;
}

.msg .bubble {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    max-width: 92%;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg.customer .bubble {
    background: #E9F7F5;
}

.msg.system .bubble {
    background: #FFF9EC;
    border-color: #F3DFB4;
    color: #8A5B00;
}

.msg.deny .bubble {
    background: #FDECEC;
    border-color: #F5C6C6;
    color: #9B2626;
}

/* ---------------------------------------------------------------- 底部状态条 */

.statusbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-ink);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    padding: 7px 24px;
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    z-index: 50;
}

.statusbar b {
    color: var(--primary);
    font-weight: 700;
}

.statusbar .sep {
    color: rgba(255, 255, 255, 0.35);
}

/* ---------------------------------------------------------------- 大屏（政企看板） */

body.screen {
    background: #07201E;
    color: #E6FFFB;
}

body.screen .wrap {
    max-width: 1440px;
}

body.screen .page-title {
    color: var(--primary);
}

body.screen .page-desc {
    color: rgba(230, 255, 251, 0.6);
}

body.screen .navbar {
    background: #041714;
    border-bottom: 1px solid rgba(64, 224, 208, 0.28);
}

body.screen .basebar {
    background: rgba(64, 224, 208, 0.07);
    border-bottom: 1px solid rgba(64, 224, 208, 0.2);
    color: rgba(230, 255, 251, 0.75);
}

body.screen .basebar label {
    color: var(--primary);
}

body.screen .basebar input[type="text"] {
    background: rgba(4, 23, 20, 0.85);
    border-color: rgba(64, 224, 208, 0.3);
    color: #E6FFFB;
}

body.screen .card,
body.screen .metric {
    background: rgba(64, 224, 208, 0.06);
    border: 1px solid rgba(64, 224, 208, 0.22);
    box-shadow: none;
}

body.screen .card h3,
body.screen .section-head h2,
body.screen .metric .value {
    color: var(--primary);
}

body.screen .metric .label,
body.screen .metric .sub,
body.screen .section-head .hint {
    color: rgba(230, 255, 251, 0.6);
}

body.screen table.tbl {
    background: transparent;
    color: #E6FFFB;
}

body.screen table.tbl th,
body.screen table.tbl td {
    border-color: rgba(64, 224, 208, 0.22);
}

body.screen table.tbl th {
    background: rgba(64, 224, 208, 0.12);
    color: var(--primary);
}

body.screen table.tbl tbody tr:nth-child(even) {
    background: rgba(64, 224, 208, 0.04);
}

body.screen .alert {
    background: rgba(64, 224, 208, 0.08);
    border-color: rgba(64, 224, 208, 0.25);
    color: rgba(230, 255, 251, 0.8);
}

body.screen .btn.ghost {
    background: transparent;
    border-color: rgba(64, 224, 208, 0.4);
    color: var(--primary);
}

/* ---------------------------------------------------------------- 入口卡片（首页） */

.entry-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.entry-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(12, 46, 44, 0.12);
    text-decoration: none;
}

.entry-card .name {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-ink);
}

.entry-card .desc {
    font-size: 12px;
    color: var(--text-sub);
    min-height: 38px;
}

.entry-card .go {
    font-size: 12px;
    color: #12867C;
    font-weight: 700;
}

/* ---------------------------------------------------------------- 杂项 */

.kv {
    display: flex;
    gap: 8px;
    font-size: 13px;
    padding: 3px 0;
}

.kv .k {
    color: var(--text-sub);
    min-width: 92px;
    flex: none;
}

.kv .v {
    color: var(--text);
    word-break: break-all;
}

.mono {
    font-family: Consolas, "Courier New", monospace;
}

.muted {
    color: var(--text-mute);
    font-size: 12px;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

.skeleton {
    color: var(--text-mute);
    font-size: 13px;
    padding: 10px 0;
}
