/* ============================================================
   拉萨二职信产学院资源库 — WorkBuddy 青绿风格 UI 系统
   参考原型：WorkBuddy 笔记（青绿主色 / 胶囊按钮 / 卡片式布局）
   · 主色 #28b894（深 #009273），背景 #f7f8f9，卡片 #fff
   · 文字：主 #191a23 / 次 #4c4f6b / 弱 #8b90a0 / 极弱 #b5b6bc
   · 分割线 #e8eaef / #f0f1f4
   · 圆角：按钮胶囊 999px，卡片 12px，输入 8px
   · 阴影：0 8px 24px rgba(0,0,0,.06)，悬停 0 8px 32px rgba(0,0,0,.12)
   ============================================================ */

:root {
    --hw-red: #28b894;
    --hw-red-dark: #009273;
    --hw-red-soft: #e6f7f2;
    --hw-ink: #191a23;
    --hw-ink-2: #4c4f6b;
    --hw-gray: #4c4f6b;
    --hw-gray-2: #8b90a0;
    --hw-gray-3: #d8dbe3;
    --hw-line: #e8eaef;
    --hw-line-2: #f0f1f4;
    --hw-bg: #f7f8f9;
    --hw-bg-gray: #f7f8f9;
    --hw-bg-gray-2: #fafbfc;
    --hw-bg-alt: #f0f1f4;
    --hw-black: #191a23;
    --hw-radius-s: 8px;
    --hw-radius-l: 12px;
    --hw-font: 'Manrope', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    --hw-shadow: 0 8px 24px rgba(0, 0, 0, .06);
    --hw-shadow-hover: 0 8px 32px rgba(0, 0, 0, .12);
    --hw-container: 1280px;
    --hw-brand-grad: linear-gradient(135deg, #28b894, #20a080);
}

body {
    background: var(--hw-bg) !important;
    color: var(--hw-ink) !important;
    font-family: var(--hw-font) !important;
    -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { font-family: var(--hw-font); }

a { transition: color .2s ease, background-color .2s ease, border-color .2s ease, opacity .2s ease, transform .2s ease, box-shadow .2s ease; }

::selection { background: rgba(40, 184, 148, .22); color: var(--hw-ink); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .12); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .2); }
::-webkit-scrollbar-track { background: transparent; }

.hw-container { max-width: var(--hw-container); }

/* ============ 顶部：WorkBuddy 单行顶栏 ============ */
.hw-topbar {
    background: #fff;
    border-bottom: 1px solid var(--hw-line-2);
    font-size: 12px;
}
.hw-topbar a { color: var(--hw-gray-2); }
.hw-topbar a:hover { color: var(--hw-red-dark); }

.hw-nav {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--hw-line);
    position: sticky;
    top: 0;
    z-index: 40;
}
.hw-logo {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--hw-ink);
    font-weight: 700;
    letter-spacing: -.01em;
    font-size: .95rem;
}
.hw-logo:hover { color: var(--hw-ink); }
.hw-logo-mark {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--hw-brand-grad);
    color: #fff;
    font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(40, 184, 148, .28);
    flex: 0 0 auto;
}
.hw-nav-link {
    display: inline-flex; align-items: center;
    height: 100%;
    padding: 0 .1rem;
    color: var(--hw-ink-2);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    position: relative;
}
.hw-nav-link:hover { color: var(--hw-red-dark); border-bottom-color: var(--hw-red); }

.hw-user-trigger {
    display: inline-flex; align-items: center; gap: .5rem;
    color: var(--hw-ink);
    font-size: 13px;
    padding: .3rem .5rem .3rem .3rem;
    border-radius: 999px;
    border: 1px solid transparent;
}
.hw-user-trigger:hover { background: var(--hw-bg); border-color: var(--hw-line); }

.hw-avatar { width: 28px; height: 28px; border-radius: 999px; object-fit: cover; }
.hw-avatar-fallback {
    width: 28px; height: 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1a202c, #4c4f6b);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.hw-dropdown {
    display: none;
    position: absolute;
    right: 0; top: calc(100% + 8px);
    min-width: 184px;
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-l);
    box-shadow: var(--hw-shadow-hover);
    padding: 6px;
    z-index: 60;
}
.hw-dropdown.active { display: block; }
.hw-dropdown a {
    display: block;
    padding: .55rem .85rem;
    color: var(--hw-ink-2);
    font-size: 13px;
    border-radius: 8px;
}
.hw-dropdown a:hover { background: var(--hw-red-soft); color: var(--hw-red-dark); }
.hw-dropdown a.danger { color: #e5484d; }
.hw-dropdown a.danger:hover { background: #fdecec; color: #cf3b40; }
.hw-dropdown .dd-sep { height: 1px; background: var(--hw-line-2); margin: 5px 8px; }

/* ============ 二级工具条 ============ */
.hw-toolbar {
    background: #fff;
    border-bottom: 1px solid var(--hw-line-2);
    position: sticky; top: 49px; z-index: 30;
}
.hw-toolbar .hw-tool {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .5rem .1rem;
    font-size: 14px;
    color: var(--hw-ink-2);
    border-bottom: 2px solid transparent;
    height: 44px;
}
.hw-toolbar .hw-tool:hover { color: var(--hw-red-dark); border-bottom-color: var(--hw-red); }

/* 搜索：胶囊形 */
.hw-search { position: relative; }
.hw-search input {
    width: 100%;
    height: 34px;
    padding: 0 2.25rem 0 .95rem;
    font-size: 13px;
    color: var(--hw-ink);
    background: var(--hw-bg);
    border: 1px solid var(--hw-line);
    border-radius: 999px;
    outline: none;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.hw-search input::placeholder { color: var(--hw-gray-2); }
.hw-search input:focus { background: #fff; border-color: var(--hw-red); box-shadow: 0 0 0 3px rgba(40, 184, 148, .12); }
.hw-search .hw-search-icon {
    position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--hw-gray-2);
    pointer-events: none;
}

/* ============ 按钮：胶囊形 ============ */
.hw-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    height: 36px;
    padding: 0 1.25rem;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--hw-brand-grad);
    border-radius: 999px;
    border: 1px solid transparent;
    box-shadow: 0 4px 12px rgba(40, 184, 148, .22);
    white-space: nowrap;
}
.hw-btn-primary:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(40, 184, 148, .32);
}

.hw-btn-outline {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    height: 36px;
    padding: 0 1.15rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--hw-ink-2);
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: 999px;
    white-space: nowrap;
}
.hw-btn-outline:hover { border-color: var(--hw-red); color: var(--hw-red-dark); background: var(--hw-red-soft); }

.hw-btn-black {
    display: inline-flex; align-items: center; justify-content: center;
    height: 36px; padding: 0 1.25rem;
    font-size: 13px; font-weight: 600;
    color: #fff; background: var(--hw-ink);
    border: 1px solid var(--hw-ink);
    border-radius: 999px;
}
.hw-btn-black:hover { background: #2b2d3a; }

.hw-btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    height: 36px; padding: 0 1.15rem;
    font-size: 13px;
    font-weight: 500;
    color: #e5484d;
    background: #fff;
    border: 1px solid #f7d5d5;
    border-radius: 999px;
}
.hw-btn-danger:hover { background: #fdecec; border-color: #e5484d; }

.hw-link { color: var(--hw-ink-2); font-size: 14px; display: inline-flex; align-items: center; gap: .3rem; }
.hw-link:hover { color: var(--hw-red-dark); }
.hw-link-red { color: var(--hw-red-dark); }
.hw-link-red:hover { color: var(--hw-red-dark); }

/* ============ 页面标题区 ============ */
.hw-page-head {
    padding: 2.2rem 0 1.4rem;
    border-bottom: 1px solid transparent;
}
.hw-page-title {
    font-size: 1.6rem;
    line-height: 1.25;
    font-weight: 700;
    color: var(--hw-ink);
    letter-spacing: -.02em;
}
.hw-page-sub {
    margin-top: .5rem;
    font-size: .9rem;
    color: var(--hw-gray-2);
    line-height: 1.6;
}
@media (min-width: 768px) {
    .hw-page-head { padding: 2.8rem 0 1.8rem; }
    .hw-page-title { font-size: 2rem; }
}

.hw-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--hw-ink);
    line-height: 1.35;
    letter-spacing: -.01em;
}
.hw-section-count { font-size: .8rem; font-weight: 400; color: var(--hw-gray-2); }

/* ============ 卡片 ============ */
.hw-card {
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-l);
    overflow: hidden;
}

.hw-note-card {
    display: block;
    position: relative;
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-l);
    padding: 1.25rem 1.25rem 1rem;
    transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
    overflow: hidden;
}
.hw-note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hw-shadow-hover);
    border-color: rgba(40, 184, 148, .35);
}
.hw-note-card .n-title {
    color: var(--hw-ink);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: -.01em;
}
.hw-note-card:hover .n-title { color: var(--hw-red-dark); }
.hw-note-card .n-excerpt {
    color: var(--hw-gray-2);
    font-size: .85rem;
    line-height: 1.65;
}
.hw-note-card .n-foot {
    border-top: 1px solid var(--hw-line-2);
    margin-top: .9rem;
    padding-top: .7rem;
    font-size: .74rem;
    color: var(--hw-gray-2);
    display: flex; align-items: center; justify-content: space-between;
}
.hw-note-card .n-bar {
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: transparent;
    border-radius: var(--hw-radius-l) 0 0 var(--hw-radius-l);
    transition: background .25s ease;
}
.hw-note-card:hover .n-bar { background: var(--hw-red); }
.hw-note-card .n-foot > span:first-child { color: var(--hw-red-dark); font-weight: 600; }

/* 状态标签 */
.hw-tag {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .1rem .55rem;
    font-size: .7rem;
    line-height: 1.6;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    font-weight: 500;
}
.hw-tag-red { color: var(--hw-red-dark); background: var(--hw-red-soft); border-color: #cdeee4; }
.hw-tag-gray { color: var(--hw-gray-2); background: var(--hw-bg); border-color: var(--hw-line); }
.hw-tag-dark { color: #fff; background: var(--hw-ink); }
.hw-tag-author { color: var(--hw-ink-2); background: var(--hw-bg-alt); max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }

/* ============ 大区块 / 空状态 ============ */
.hw-empty {
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-l);
    padding: 3.2rem 1.25rem;
    text-align: center;
    color: var(--hw-gray-2);
}
.hw-empty .emoji { font-size: 2rem; display: block; margin-bottom: .75rem; opacity: .55; }

.hw-band {
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-l);
    padding: 1.75rem 1.5rem;
}

/* ============ 表单 ============ */
.hw-input,
input.hw-input,
select.hw-input {
    width: 100%;
    height: 44px;
    padding: 0 1rem;
    font-size: 14px;
    color: var(--hw-ink);
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-s);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.hw-input::placeholder { color: #b5b6bc; }
.hw-input:focus { border-color: var(--hw-red); box-shadow: 0 0 0 3px rgba(40, 184, 148, .14); }
textarea.hw-input { height: auto; padding: .8rem 1rem; line-height: 1.7; }
input[type="file"].hw-input { height: auto; padding: .55rem .7rem; font-size: 13px; }

.hw-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--hw-ink);
    margin-bottom: .5rem;
}
.hw-hint { font-size: .75rem; color: var(--hw-gray-2); margin-top: .35rem; }

.hw-field-panel {
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-l);
    padding: 1.25rem 1.35rem;
}

/* 开关 */
.hw-switch-bg { transition: background-color .25s ease; }
#is_public:checked + .hw-switch-bg { background-color: var(--hw-red) !important; }
.hw-switch-dot { transition: transform .25s ease; }
#is_public:checked ~ .hw-switch-dot { transform: translateX(100%); }

/* 上传区 */
.hw-upload {
    border: 1px dashed var(--hw-gray-3);
    border-radius: var(--hw-radius-l);
    background: #fff;
    padding: 1.75rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}
.hw-upload:hover, .hw-upload.dragover { border-color: var(--hw-red); background: #f4fdfa; }

.hw-progress { position: relative; height: 4px; background: var(--hw-line); border-radius: 999px; overflow: hidden; }
.hw-progress-bar { height: 100%; background: var(--hw-brand-grad); transition: width .2s linear; }
.hw-progress-text { font-size: .7rem; color: var(--hw-gray-2); margin-top: .3rem; }

/* ============ 认证页 ============ */
.hw-auth {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 3rem 1rem;
    background: var(--hw-bg);
}
.hw-auth-brand { text-align: center; margin-bottom: 1.75rem; }
.hw-auth-brand .mark {
    width: 46px; height: 46px;
    margin: 0 auto .9rem;
    border-radius: 12px;
    background: var(--hw-brand-grad);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700;
    box-shadow: 0 6px 18px rgba(40, 184, 148, .28);
}
.hw-auth-brand h1 { font-size: 1.4rem; font-weight: 700; color: var(--hw-ink); letter-spacing: -.02em; }
.hw-auth-brand p { margin-top: .45rem; font-size: .85rem; color: var(--hw-gray-2); }

.hw-auth-card {
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: 16px;
    padding: 2.25rem 1.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .06);
}
@media (min-width: 640px) { .hw-auth-card { padding: 2.5rem 2.5rem; } }
.hw-auth-card h2 { font-size: 1.15rem; font-weight: 700; color: var(--hw-ink); }
.hw-auth-card .sub { font-size: .85rem; color: var(--hw-gray-2); margin-top: .4rem; }

.hw-alert { border-radius: var(--hw-radius-s); padding: .65rem .9rem; font-size: .82rem; line-height: 1.6; }
.hw-alert-error { background: #fdecec; color: #cf3b40; border: 1px solid #f7d5d5; }
.hw-alert-success { background: var(--hw-red-soft); color: var(--hw-red-dark); border: 1px solid #cdeee4; }

/* ============ 详情页 ============ */
.hw-article-head {
    border-bottom: 1px solid var(--hw-line);
    padding-bottom: 1.5rem;
    margin-bottom: 1.8rem;
}
.hw-article-title {
    font-size: 1.7rem;
    line-height: 1.32;
    font-weight: 700;
    color: var(--hw-ink);
    letter-spacing: -.025em;
}
@media (min-width: 768px) { .hw-article-title { font-size: 2.1rem; } }

.hw-meta { font-size: .8rem; color: var(--hw-gray-2); }
.hw-meta .sep { color: #d8dbe3; margin: 0 .5rem; }
.hw-meta .author-dot {
    width: 24px; height: 24px; border-radius: 999px;
    background: var(--hw-brand-grad); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
}

.hw-tag-chip {
    display: inline-flex; align-items: center;
    padding: .1rem .55rem;
    font-size: .7rem;
    border-radius: 999px;
    border-width: 1px; border-style: solid;
}

.hw-visitor {
    display: flex; align-items: center; gap: .55rem;
    padding: .4rem .85rem .4rem .4rem;
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: 999px;
}
.hw-visitor:hover { border-color: var(--hw-red); background: var(--hw-red-soft); }

.hw-attachment {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    background: #fff;
    border: 1px solid var(--hw-line);
    border-radius: var(--hw-radius-l);
    transition: background .2s ease, border-color .2s ease;
}
.hw-attachment:hover { background: var(--hw-bg); border-color: rgba(40, 184, 148, .35); }

/* ============ 表格 ============ */
.hw-table { width: 100%; border-collapse: collapse; }
.hw-table thead th {
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    color: var(--hw-gray-2);
    background: var(--hw-bg);
    padding: .85rem 1.15rem;
    border-bottom: 1px solid var(--hw-line);
    white-space: nowrap;
}
.hw-table tbody td {
    padding: .8rem 1.15rem;
    font-size: .84rem;
    color: var(--hw-ink-2);
    border-bottom: 1px solid var(--hw-line-2);
    white-space: nowrap;
}
.hw-table tbody tr:last-child td { border-bottom: none; }
.hw-table tbody tr:hover { background: #fafbfc; }

/* ============ 弹窗 ============ */
.hw-modal-mask { position: fixed; inset: 0; background: rgba(25, 26, 35, .45); backdrop-filter: blur(2px); z-index: 50; }
.hw-modal { background: #fff; border-radius: 16px; padding: 1.75rem; box-shadow: 0 24px 64px rgba(0, 0, 0, .18); }

.hw-color-dot {
    width: 28px; height: 28px;
    border-radius: 999px;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
    transition: transform .15s ease;
}
.hw-color-dot:hover { transform: scale(1.08); }

/* ============ CKEditor（保留功能，仅换肤） ============ */
.cke {
    border: 1px solid var(--hw-line) !important;
    border-radius: var(--hw-radius-l) !important;
    overflow: hidden;
    box-shadow: none !important;
}
.cke_inner { border-radius: var(--hw-radius-l); background: #fff !important; }
.cke_top {
    background: var(--hw-bg) !important;
    border-bottom: 1px solid var(--hw-line) !important;
    padding: 8px 10px !important;
}
.cke_bottom { background: var(--hw-bg) !important; border-top: 1px solid var(--hw-line) !important; }
.cke_contents { min-height: 420px !important; }
.cke_editable {
    font-size: 16px !important;
    line-height: 1.85 !important;
    padding: 26px !important;
    font-family: var(--hw-font) !important;
    color: var(--hw-ink) !important;
}
.cke_editable a { color: var(--hw-red-dark) !important; }
.cke_editable blockquote {
    border-left: 3px solid var(--hw-red) !important;
    background: var(--hw-bg) !important;
    padding: .7rem 1.1rem !important;
    border-radius: 0 8px 8px 0 !important;
    margin: 1rem 0 !important;
    color: var(--hw-ink-2) !important;
}
.cke_editable code {
    background: var(--hw-red-soft);
    color: var(--hw-red-dark);
    padding: .1rem .35rem;
    border-radius: 5px;
    font-size: .9em;
}

/* ============ 页脚 ============ */
.hw-footer {
    margin-top: 4rem;
    background: #fff;
    border-top: 1px solid var(--hw-line);
    padding: 2.25rem 0 1.5rem;
    font-size: .8rem;
    color: var(--hw-gray-2);
}
.hw-footer a { color: var(--hw-gray-2); }
.hw-footer a:hover { color: var(--hw-red-dark); }

/* ============ 工具类 ============ */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 640px) {
    .hw-note-card { padding: 1.1rem 1.05rem .9rem; }
    .hw-article-title { font-size: 1.45rem; }
    .hw-page-title { font-size: 1.4rem; }
    .hw-page-head { padding: 1.6rem 0 1.1rem; }
    .hw-footer { margin-top: 2.5rem; }
}
