/* ============================================================
 * Timeline CSS v202606221430
 * Layout: FULL-WIDTH ruler on top, continuous dynasty color bar
 * Style: clean warm background (no grid)
 * English comments only for FTP GBK safety!
 * ============================================================ */

/* Hide builder edit button on timeline page */
body.tl-no-footer #builder-fab { display: none !important; }

/* Timeline page needs NO main-content padding */
body.tl-no-footer .main-content,
body.tl-no-footer > .main-content,
body.tl-no-footer main.main-content {
    padding: 0;
}

/* ---- Reset ---- */
.tl-wrapper * { box-sizing: border-box; margin: 0; padding: 0; }
.tl-wrapper {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 60px);
    overflow: hidden;
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f8f5f0;
}

/* Hide footer on timeline page */
body.tl-no-footer > footer,
body.tl-no-footer .site-footer,
body.tl-no-footer footer#footer {
    display: none !important;
}

/* ===== TOP RULER (full width, transparent over grid) ===== */
.tl-ruler {
    flex-shrink: 0;
    position: relative;
    /* Semi-transparent warm overlay — lets grid show through */
    background: rgba(250, 247, 242, 0.88);
    border-bottom: 1px solid #ddd5c8;
    z-index: 20;
    cursor: grab;
}
.tl-ruler:active {
    cursor: grabbing;
}
/* Ruler zoom/pan controls bar */
.tl-ruler-controls {
    position: absolute;
    top: 4px;
    right: 8px;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 3px;
}
.tl-ruler-controls button {
    background: #fff;
    border: 1px solid #ddd5c8;
    border-radius: 3px;
    padding: 1px 9px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    min-width: 26px;
    text-align: center;
}
.tl-ruler-controls button:hover {
    background: #f8f5ef;
    border-color: #c4a882;
    color: #333;
}
.tl-ruler-controls span {
    font-size: 10px;
    color: #999;
    min-width: 32px;
    text-align: center;
}
.tl-r-row {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Row 1: Western years */
.tl-r-west {
    height: 26px;
    border-bottom: 1px dashed #ddd5c8;
    padding: 0 16px;
    line-height: 26px;
}

/* Row 2: Colored era bar — continuous dynasty timeline */
.tl-r-era {
    height: 28px;
    margin: 4px 0 2px;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    position: relative;
}

/* Era segment — part of a continuous colored line */
.tl-era-seg {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 0;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.92);
    letter-spacing: 2px;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.15s;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.tl-era-seg:hover {
    opacity: 0.85 !important;
    z-index: 5;
}

/* Event dot ON the era bar */
.tl-era-dot {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 15;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 1px 4px rgba(0,0,0,0.2);
}
.tl-era-dot:hover {
    transform: translateY(-50%) scale(1.7);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 0 0 3px currentColor, 0 3px 10px rgba(0,0,0,0.2);
    z-index: 20;
}
.tl-era-dot.active {
    transform: translateY(-50%) scale(1.6);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor, 0 2px 8px rgba(0,0,0,0.25);
    z-index: 22;
}
/* Pinned time-axis segment */
.tl-ta-pinned {
    opacity: 1 !important;
    height: 18px !important;
    top: -2px;
    box-shadow: 0 0 8px 2px rgba(145, 51, 0, 0.3);
    z-index: 12 !important;
}

/* Row 3: Chinese dynasty labels — under the continuous color line */
.tl-r-cn {
    height: 20px;
    padding: 0 4px;
    line-height: 20px;
}

/* ===== RIGHT AREA (ruler + content, flex column) ===== */
.tl-right-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

/* ===== BELOW-RULER AREA (legacy alias) ===== */

/* ===== LEFT SIDEBAR (kg-style 240px, full height) ===== */
.tl-sidebar {
    width: 240px !important;
    height: 100%;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e8ecf4;
    display: flex;
    flex-direction: column;
    z-index: 90;
    overflow-y: auto;
}

.tl-sidebar::-webkit-scrollbar { width: 4px; }
.tl-sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Sidebar header */
.tl-sb-header { padding: 18px 16px 12px; }
.tl-sb-title { margin: 0; font-size: 17px; color: #1a1a2e; font-weight: 700; }

/* Section block */
.tl-sb-section { padding: 0 14px 10px; }
.tl-sb-label { font-size: 11px; color: #bbb; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }

/* Filter tabs (pill buttons, like kg.php) */
.tl-sb-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.tl-sb-tab {
    display: inline-flex; align-items: center; padding: 3px 11px;
    border: 1px solid #ddd; border-radius: 14px; background: #fff;
    cursor: pointer; font-size: 12px; color: #666;
    text-decoration: none; transition: all 0.15s; white-space: nowrap;
}
.tl-sb-tab::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: var(--dot-color, transparent); flex-shrink: 0; margin-right: 5px;
}
.tl-sb-tab:hover { border-color: var(--dot-color, #1677ff); color: #333; }
.tl-sb-tab.active { background: var(--dot-color, #1677ff); color: #fff; border-color: var(--dot-color, #1677ff); }
.tl-sb-tab.active::before { background: rgba(255,255,255,0.8); }

/* Search input */
.tl-sb-search {
    width: 100%; padding: 7px 10px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 13px; color: #333; transition: border-color 0.2s; box-sizing: border-box;
}
.tl-sb-search:focus { outline: none; border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22,119,255,0.08); }
.tl-sb-search::placeholder { color: #bbb; }

/* Legend */
.tl-sb-legend-wrap { border-top: 1px solid #f0f0f0; padding-top: 10px; }
.tl-sb-legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: #888; }
.tl-sb-legend span { display: inline-flex; align-items: center; gap: 3px; }
.tl-sb-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }

/* Period/Dynasty list (shown under active region) */
.tl-sb-periods { background: #fafbfc; border-radius: 8px; padding: 10px 12px !important; margin: 4px 14px 6px; }
.tl-sb-period-list { display: flex; flex-direction: column; gap: 3px; max-height: 200px; overflow-y: auto; }
.tl-sb-period-list::-webkit-scrollbar { width: 3px; }
.tl-sb-period-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.tl-sb-period {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 8px; border-radius: 5px;
    font-size: 12px; color: #555; cursor: pointer;
    transition: background 0.12s;
}
.tl-sb-period:hover { background: #eef2ff; color: #333; }
.tl-sb-period i {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0; vertical-align: middle;
}

/* Legacy item class - kept for backward compat */
.tl-sb-item {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 2px;
}
.tl-sb-item:hover { background: rgba(240, 235, 227, 0.9); color: #555; }
.tl-sb-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #913300;
    font-weight: 600;
    box-shadow: 1px 0 0 #ddd5c8;
}

/* Dynasty list items */
.tl-sb-dynasty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    transition: background 0.12s;
}
.tl-sb-dynasty:hover { background: #f5f0e8; }
.tl-sb-dynasty i {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
}

/* Event list items in sidebar */
.tl-sb-event-list { display: flex; flex-direction: column; gap: 2px; }
.tl-sb-event {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: background 0.12s;
    text-decoration: none;
    line-height: 1.4;
}
.tl-sb-event:hover { background: #f8f4ec; color: #333; }
.tl-sb-dot {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.tl-sb-text {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; min-width: 0;
}

/* Empty state */
.tl-sb-empty {
    padding: 14px 10px;
    font-size: 12px;
    color: #bbb;
    text-align: center;
    line-height: 1.6;
}

/* Label hint (count badge) */
.tl-sb-label-hint {
    font-size: 10px;
    color: #ccc;
    margin-left: auto;
}
.tl-dyn-detail {
    display: none;
    position: relative;
    min-height: 380px;
    /* Height is set dynamically by JS based on content (event cards + legend) */
    margin: 6px 0 0 0;
    border-radius: 8px;
    /* Inherit grid background from parent .tl-canvas-area — no duplicate grid */
    background-color: transparent;
    border: none;
    overflow: visible;
    box-shadow: none;
    cursor: default;
    /* Leave room for bottom dimension legend bar */
    padding-bottom: 40px;
}
/* Visual separator between main ruler and sub-timeline */
.tl-dyn-detail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #c4956a, #913300, #c4956a);
    border-radius: 8px 8px 0 0;
}

/* ===== Bottom Dimension Legend Bar ===== */
.tl-dim-legend-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 36px;
    height: auto;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-top: 1px solid #e8e2d8;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    padding: 6px 16px;
    gap: 12px;
    z-index: 12;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    box-sizing: border-box;
}
.tl-dim-legend-bar::-webkit-scrollbar { height: 3px; }
.tl-dim-legend-bar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.tl-dim-tag {
    display: inline-flex !important;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    cursor: pointer;
    padding: 4px 11px;
    border-radius: 14px;
    transition: all 0.15s;
    background: rgba(245,243,238,0.8);
    border: 0.5px solid #eee5d9;
    flex-shrink: 0;
}
.tl-dim-tag:hover {
    background: rgba(145,51,0,0.06);
    color: #913300;
}
.tl-dim-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Also show dimension bar in global view (below era bar) */
.tl-global-dim-bar {
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    min-height: 32px;
    height: auto;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-top: 1px solid #eee5d9;
    border-radius: 0 0 6px 6px;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    padding: 6px 14px;
    gap: 14px;
    z-index: 8;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
}

/* ===== RIGHT CONTENT / GRID AREA ===== */
.tl-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* Coordinate-paper grid background — warm tone */
    background-color: #faf6ee;
    background-image:
        linear-gradient(rgba(180,165,140,0.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(180,165,140,0.35) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(245,238,225,0.3) 100%);
    background-size: 40px 40px, 40px 40px, 100% 100%;
    background-position: -1px -1px, -1px -1px, 0 0;
    /* Room for bottom dimension legend bar */
    padding-bottom: 36px;
}

/* Canvas area — relative positioning for detail panel */
.tl-canvas-area {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Grid background is on .tl-content (parent) — transparent here */
    background: transparent;
}

/* ===== TOP BAR (breadcrumb + view buttons + toolbar) ===== */
.tl-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0px 14px;
    background: #fff;
    border-bottom: 1px solid #e8e2d8;
    flex-shrink: 0;
    z-index: 15;
    min-height: 44px;
}
.tl-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}
.tl-breadcrumb a {
    color: #913300;
    text-decoration: none;
    font-weight: 500;
}
.tl-breadcrumb a:hover { text-decoration: underline; }
.tl-bc-sep {
    color: #bbb;
    font-size: 12px;
    margin: 0 2px;
}

/* View toggle buttons */
.tl-view-btns {
    display: flex;
    gap: 2px;
    margin-left: auto;
}
.tl-vb {
    padding: 4px 12px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}
.tl-vb:hover {
    border-color: #913300;
    color: #913300;
}
.tl-vb.active {
    background: #913300;
    color: #fff;
    border-color: #913300;
}

/* ===== 详情面板（右侧浮动滑入） ===== */
.tl-detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 340px;
    height: 100%;
    background: #fff;
    border-left: 2px solid #c4956a;
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
}
.tl-detail-panel.open {
    transform: translateX(0);
}

/* ===== Detail Panel Header — 标题独占一行，年份+按钮第二行 ===== */
.tl-dp-header {
    display: flex;
    flex-direction: column;
    padding: 10px 14px 8px;
    border-bottom: 1px solid #f0ebe4;
    flex-shrink: 0;
    gap: 6px;
}
/* 第一行：标题（独立一行） */
.tl-dp-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin: 0;
}
/* 第二行：年份 + 按钮 */
.tl-dp-header-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

/* ===== Description Area (截图2红圈文字) ===== */
.tl-dp-desc-area {
    padding: 10px 14px;
    font-size: 13px;
    color: #666;
    line-height: 1.8;
    border-bottom: 1px solid #f5f2ed;
    flex-shrink: 0;
    max-height: 120px;
    overflow-y: auto;
    background: linear-gradient(180deg,#fffcf7,#fff);
}
.tl-dp-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.tl-dp-tabs {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0 10px;
    border-bottom: 1px solid #e8e0d0;
    overflow-x: auto;
    flex-shrink: 0;
}
.tl-dp-tab {
    padding: 8px 14px;
    font-size: 12px;
    color: #888;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.tl-dp-tab:hover {
    color: #555;
}
.tl-dp-tab.active {
    color: #913300;
    border-bottom-color: #913300;
    font-weight: 600;
}
/* Tab content panels */
.tl-dp-tab-content {
    display: none;
    padding: 12px 14px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.tl-dp-tab-content.active {
    display: block;
}

/* Detail panel body — pure wrapper, NO padding (tab-content handles it) */
.tl-dp-body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Time axis inside content area */
.tl-time-axis {
    position: absolute;
    top: 14px;
    left: 12px;
    right: 12px;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    z-index: 8;
}
.tl-ta-seg {
    position: absolute;
    top: 0;
    height: 100%;
    cursor: pointer;
    transition: opacity 0.15s;
    border-radius: 7px;
}
.tl-ta-seg:hover { opacity: 0.95 !important; }

/* Event dots layer (detail view when zoomed in) */
.tl-dots-layer {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    height: 50px;
    z-index: 10;
}
.tl-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 0 2px #fcfbfa, 0 0 0 3px rgba(0,0,0,0.05);
    top: 0;
}
.tl-dot:hover {
    transform: scale(1.6);
    box-shadow: 0 0 0 2px #fcfbfa, 0 0 0 5px currentColor, 0 3px 10px rgba(0,0,0,0.15);
    z-index: 20;
}
.tl-dot.active {
    transform: scale(1.5);
    box-shadow: 0 0 0 2px #fcfbfa, 0 0 0 5px currentColor, 0 3px 14px rgba(0,0,0,0.18);
    z-index: 25;
}

/* ===== TOOLBAR (right-side vertical) ===== */
.tl-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.tl-tb-btn {
    font-size: 14px;
    font-weight: 400;
    min-width: 28px;
    min-height: 28px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 0.5px solid #d8d4c8;
    background: #fff;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.tl-tb-btn:hover { background: #f8f5ef; border-color: #c4a882; color: #333; }
.tl-tb-btn.active { background: #913300; color: #fff; border-color: #913300; }
.tl-tb-zoom { font-size: 11px; color: #888; min-width: 36px; text-align: center; font-weight: 500; padding: 2px 0; }
.tl-tb-sep {
    width: 1px;
    height: 18px;
    background: #e8e2d8;
    margin: 0 3px;
}


/* ===== EVENT CARDS LAYER (period selected) ===== */
.tl-event-cards-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* let clicks pass through to canvas */
    z-index: 15;
    overflow: visible;
}

.tl-ev-card {
    position: absolute;
    width: 200px;
    background: #fff;
    border: 1px solid #e8e0d4;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s, box-shadow 0.2s;
}
.tl-ev-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border-color: #c9b896;
}
.tl-ev-card.active {
    border-color: #913300;
    box-shadow: 0 4px 16px rgba(145,51,0,0.15);
}

.tl-ev-card-dot {
    position: absolute;
    top: -6px;
    left: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.tl-ev-card-year {
    font-size: 11px;
    color: #913300;
    font-weight: 600;
    margin-bottom: 4px;
    padding-left: 18px;
}

.tl-ev-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tl-ev-card-desc {
    font-size: 11.5px;
    color: #888;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Vertical time line at each event node position */
.tl-ev-vline {
    position: absolute;
    top: 76px;  /* below ruler rows (24+32+20) — for period sub-timeline */
    bottom: 40px; /* above dim legend bar */
    width: 1px;
    opacity: 0.35;
    z-index: 2;
    pointer-events: none;
}
/* Global view: vlines span full layer height (no internal rulers) */
.tl-event-cards-layer .tl-ev-vline {
    top: 0;
    bottom: 0;
}

/* ===== DETAIL PANEL: Events Tab Items ===== */
.tl-dp-ev-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    border-bottom: 0.5px solid #f5f0ea;
    cursor: pointer;
    transition: background 0.15s;
    gap: 8px;
}
.tl-dp-ev-item:hover {
    background: #faf8f3;
}
.tl-dp-ev-item:last-child {
    border-bottom: none;
}

.tl-dp-ev-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
}

.tl-dp-ev-year {
    flex-shrink: 0;
    font-size: 11px;
    color: #913300;
    font-weight: 600;
    min-width: 48px;
    margin-top: 1px;
}

/* Simple event list item — inside .tl-dp-ev-item */
.tl-dp-ev-item .tl-dp-ev-title {
    flex: 1;
    font-size: 13px;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
}
.tl-dp-ev-item .tl-dp-ev-desc {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
    line-height: 1.4;
}

/* Sidebar active states for period/dynasty/event */
.tl-sb-dynasty.active {
    background: rgba(145, 51, 0, 0.08);
    color: #913300;
    font-weight: 700;
    border-left: 3px solid #913300;
    padding-left: 9px;
}
.tl-sb-period.active {
    background: rgba(145, 51, 0, 0.06);
    color: #913300;
    font-weight: 600;
    border-left: 3px solid #c47a3d;
}
.tl-sb-event.active {
    background: rgba(145, 51, 0, 0.05);
    color: #913300;
    font-weight: 600;
    border-left: 3px solid #913300;
}

/* ===== Detail Panel Action Buttons ===== */
.tl-dp-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.tl-dp-btn-fav {
    padding: 5px 12px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
    white-space: nowrap;
}
.tl-dp-btn-fav:hover {
    background: #fff7e6;
    border-color: #ffc069;
    color: #ad6800;
}
.tl-dp-btn-link:hover {
    background: #e6f7ff;
    border-color: #91d5ff;
    color: #096dd9;
}

/* ===== Add Event Inline Form ===== */
.tl-add-event-form {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 18px;
}
.tl-ae-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}
.tl-ae-row label {
    width: 80px;
    font-size: 13px;
    color:#555;
    text-align:right;
    flex-shrink:0;
}
.tl-ae-row input,.tl-ae-row select,.tl-ae-row textarea {
    flex:1;
    padding:7px 10px;
    border:1px solid #d9d9d9;
    border-radius:6px;
    font-size:13px;
}
.tl-ae-row textarea{resize:vertical;min-height:50px}
.tl-ae-row input:focus,.tl-ae-row select:focus,.tl-ae-row textarea:focus{
    outline:none;border-color:#913300;box-shadow:0 0 0 2px rgba(145,51,0,0.1)
}
.tl-ae-actions{
    margin-top:12px;padding-top:12px;border-top:1px dashed #e0e0e0;
    display:flex;gap:8px;justify-content:flex-end
}
.tl-ae-btn-save{
    padding:7px 20px;background:#913300;color:#fff;border:none;border-radius:6px;
    cursor:pointer;font-size:13px;font-weight:600
}
.tl-ae-btn-save:hover{background:#7a2900}
.tl-ae-btn-cancel{
    padding:7px 16px;background:#fff;color:#666;border:1px solid #d9d9d9;border-radius:6px;
    cursor:pointer;font-size:13px
}
.tl-ae-btn-cancel:hover{border-color:#999;color:#333}
.tl-ae-msg{margin-top:10px;font-size:13px;text-align:center;min-height:20px}

/* ===== Detail Panel Buttons & Meta ===== */
.tl-dp-hbtn {
    padding: 3px 9px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #666;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tl-dp-hbtn:hover {
    border-color: #913300;
    color: #913300;
}
/* Add Event button */
.tl-dp-btn-add { background: #913300; color: #fff; border-color: #913300; }
.tl-dp-btn-add:hover { background: #7a2a00; border-color: #7a2a00; }
/* Associate button */
.tl-dp-btn-assoc { color: #913300; border: 1px solid #913300; }
.tl-dp-btn-assoc:hover { background: #913300; color: #fff; }
/* Close button */
.tl-dp-close {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    padding: 2px 7px;
    line-height: 1.3;
}
.tl-dp-close:hover { color: #c33; border-color: #c99; }

/* Meta: year range like "1368 ~ 1397 · 明" */
.tl-dp-meta {
    font-size: 12px;
    color: #913300;
    font-weight: 600;
    white-space: nowrap;
}
.tl-dp-meta b { color:#913300; }
.tl-dp-type-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    background: #f0ebe4;
    color: #913300;
    border-radius: 8px;
    margin-left: 4px;
}

/* ===== Event Card List (事件 Tab - 匹配截图2) ===== */
.tl-dp-event-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.15s;
}
.tl-dp-event-card:hover {
    background: #fafafa;
    margin: 0 -18px;
    padding: 12px 18px;
}
.tl-dp-event-card:last-child {
    border-bottom: none;
}
.tl-dp-ev-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tl-dp-ev-icon {
    font-size: 22px;
    line-height: 1;
}
.tl-dp-ev-info {
    flex: 1;
    min-width: 0;
}
/* Card-style event items — inside .tl-dp-event-card */
.tl-dp-event-card .tl-dp-ev-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tl-dp-event-card .tl-dp-ev-desc {
    font-size: 12px;
    color: #999;
    line-height: 1.5;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tl-dp-ev-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.tl-dp-ev-tag {
    display: inline-block;
    font-size: 11px;
    color: #888;
    background: #f5f5f5;
    padding: 1px 8px;
    border-radius: 10px;
    line-height: 1.6;
}
.tl-dp-ev-tag.year {
    color: #913300;
    background: #fff8f0;
}
