:root {
    --ink: #111816;
    --ink-soft: #26322e;
    --paper: #f3f0e7;
    --paper-bright: #fffdf7;
    --line: #d7d1c2;
    --muted: #6d746f;
    --signal: #b8f03d;
    --signal-dark: #527500;
    --rust: #c64f2f;
    --blue: #2d61d2;
    --shadow: 0 18px 50px rgba(17, 24, 22, .08);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(rgba(17, 24, 22, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 24, 22, .025) 1px, transparent 1px),
        var(--paper);
    background-size: 24px 24px;
    font-family: "Noto Sans TC", sans-serif;
}
a { color: var(--ink); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 22px;
    color: #f8f6ef;
    background:
        radial-gradient(circle at 20% 10%, rgba(184, 240, 61, .12), transparent 13rem),
        var(--ink);
    display: flex;
    flex-direction: column;
}
.brand-mark {
    display: flex;
    gap: 12px;
    align-items: center;
    color: inherit;
    text-decoration: none;
}
.brand-mark strong { display: block; font-family: "Noto Serif TC", serif; font-size: 1.15rem; }
.brand-mark small { display: block; color: #aeb7b1; font-size: .72rem; margin-top: 2px; }
.brand-glyph {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    background: var(--signal);
    color: var(--ink);
    border-radius: 50%;
    font-weight: 900;
}
.side-nav { display: grid; gap: 5px; margin-top: 46px; }
.side-nav a {
    padding: 12px 14px;
    color: #c9d0cc;
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: .18s ease;
}
.side-nav a:hover, .side-nav a:focus {
    color: #fff;
    border-color: var(--signal);
    background: rgba(255, 255, 255, .05);
    transform: translateX(3px);
}
.sidebar-note {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #34413c;
    color: #aeb7b1;
    font-size: .78rem;
}
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 12px var(--signal);
}
.app-main { min-width: 0; }
.content-frame { max-width: 1440px; margin: 0 auto; padding: 42px 48px 80px; }
.mobile-header, .mobile-nav { display: none; }
.page-head {
    display: flex;
    gap: 24px;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 30px;
}
.page-head > :first-child { min-width: 0; max-width: 100%; }
.page-head h1, .page-kicker, .page-lead { overflow-wrap: anywhere; }
.page-kicker {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--signal-dark);
    font-weight: 800;
    font-size: .72rem;
    letter-spacing: .16em;
    text-transform: uppercase;
}
h1, h2, h3 { font-family: "Noto Serif TC", serif; letter-spacing: -.025em; }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.3rem); font-weight: 900; }
.page-lead { max-width: 720px; margin: 10px 0 0; color: var(--muted); }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border-radius: 2px; font-weight: 700; }
.btn-primary {
    --bs-btn-bg: var(--ink);
    --bs-btn-border-color: var(--ink);
    --bs-btn-hover-bg: var(--ink-soft);
    --bs-btn-hover-border-color: var(--ink-soft);
}
.btn-signal { background: var(--signal); border: 1px solid var(--ink); color: var(--ink); }
.btn-signal:hover { background: #cdf76c; }
.panel {
    padding: 24px;
    border: 1px solid var(--line);
    background: rgba(255, 253, 247, .9);
    box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 20px; }
.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.panel-title h2, .panel-title h3 { margin: 0; font-size: 1.18rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-card {
    min-height: 150px;
    padding: 20px;
    border: 1px solid var(--ink);
    background: var(--paper-bright);
    position: relative;
    overflow: hidden;
}
.metric-card::after {
    content: "";
    position: absolute;
    right: -24px;
    bottom: -36px;
    width: 100px;
    height: 100px;
    border: 18px solid var(--signal);
    border-radius: 50%;
    opacity: .4;
}
.metric-label { color: var(--muted); font-size: .82rem; }
.metric-value { margin-top: 22px; font-family: "Noto Serif TC", serif; font-size: 2.65rem; font-weight: 900; }
.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(120px, 1fr)) auto;
    gap: 10px;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.55);
}
.form-control, .form-select {
    border-color: #aaa99f;
    border-radius: 2px;
    background-color: var(--paper-bright);
}
.form-control:focus, .form-select:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 .2rem rgba(184, 240, 61, .35);
}
.form-label { font-weight: 700; font-size: .86rem; }
.form-hint { color: var(--muted); font-size: .78rem; }
.validation-summary-errors, .field-validation-error { color: #a72d18; }
.asset-table { width: 100%; border-collapse: collapse; }
.asset-table th {
    padding: 10px 12px;
    border-bottom: 2px solid var(--ink);
    color: var(--muted);
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.asset-table td { padding: 16px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.asset-table tr:hover td { background: rgba(184, 240, 61, .09); }
.asset-name { font-weight: 800; text-decoration: none; }
.asset-description { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.badge-type, .tag-chip, .tool-chip, .status-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--line);
    background: var(--paper-bright);
    font-size: .72rem;
    font-weight: 700;
}
.badge-skill { background: var(--ink); color: white; border-color: var(--ink); }
.status-active { background: var(--signal); border-color: var(--signal-dark); }
.status-archived { background: #ddd8cc; color: #666; }
.tag-list, .tool-list { display: flex; flex-wrap: wrap; gap: 5px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 20px; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.markdown-editor { min-height: 390px; font-family: "Cascadia Code", Consolas, monospace; font-size: .88rem; }
.markdown-preview {
    min-height: 390px;
    padding: 20px;
    border: 1px solid var(--line);
    background: #fff;
    overflow: auto;
}
.markdown-preview pre, .file-preview pre {
    padding: 14px;
    color: #edf6f0;
    background: var(--ink);
    overflow: auto;
}
.markdown-preview code { color: #275c4b; background: #e6f1e9; padding: 1px 4px; }
.detail-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.definition-list { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 0; }
.definition-list dt { color: var(--muted); font-size: .8rem; }
.definition-list dd { margin: 0; }
.version-list { display: grid; gap: 9px; }
.version-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}
.file-tree { margin: 0; padding: 0; list-style: none; font-family: "Cascadia Code", monospace; font-size: .86rem; }
.file-tree li { padding: 7px 9px; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.file-tree .directory { color: var(--blue); font-weight: 700; }
.notice { padding: 13px 16px; margin-bottom: 18px; border-left: 5px solid; background: white; }
.notice-success { border-color: var(--signal-dark); }
.notice-error { border-color: var(--rust); }
.warning-card { padding: 15px; border: 1px solid #db9e31; background: #fff7df; }
.danger-zone { border-color: #d18b7c; background: #fff8f5; }
.diff-line { margin: 0; padding: 2px 9px; font-family: "Cascadia Code", monospace; white-space: pre-wrap; }
.diff-added { background: #dff4df; color: #164f24; }
.diff-removed { background: #f8d9d4; color: #812413; }
.file-preview { border: 1px solid var(--line); background: white; }
.file-preview summary { cursor: pointer; padding: 12px 14px; font-weight: 700; }
.file-preview pre { margin: 0; border-radius: 0; max-height: 440px; }
.sortable-list { display: grid; gap: 8px; }
.sortable-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    background: white;
}
.drag-handle { cursor: grab; color: var(--muted); }
.empty-state { padding: 52px 20px; text-align: center; color: var(--muted); border: 1px dashed #aaa; }
@media (max-width: 1100px) {
    .filter-bar { grid-template-columns: repeat(3, 1fr); }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .editor-grid, .detail-grid, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .app-sidebar { display: none; }
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 18px;
        color: white;
        background: var(--ink);
    }
    .mobile-header .brand-glyph { width: 34px; height: 34px; }
    .nav-toggle { border: 1px solid #6d7974; color: white; background: transparent; padding: 7px 10px; }
    .mobile-nav { display: none; padding: 10px 18px; background: var(--ink-soft); }
    .mobile-nav.open { display: grid; }
    .mobile-nav a { color: white; text-decoration: none; padding: 9px 0; }
    .content-frame { padding: 26px 16px 60px; }
    .page-head { align-items: start; flex-direction: column; }
    .filter-bar { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .panel { padding: 16px; overflow-x: auto; }
    .asset-table { min-width: 720px; }
    .editor-grid { display: block; }
    .markdown-preview { margin-top: 12px; }
    .definition-list { grid-template-columns: 1fr; }
    .definition-list dd { margin-bottom: 10px; }
}
