* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --primary: #007aff;
    --primary-light: #e3f0ff;
    --success: #34c759;
    --danger: #ff3b30;
    --text: #1d1d1f;
    --text-secondary: #86868b;
    --border: #e5e5ea;
    --radius: 12px;
    --nav-height: 56px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 16px);
}

/* ============ 密码锁屏 ============ */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #1d1d1f 0%, #2c2c2e 60%, #3a3a3c 100%);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.lock-box {
    width: 100%;
    max-width: 340px;
    text-align: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 36px 28px;
    backdrop-filter: blur(8px);
}

.lock-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.lock-box h2 {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.lock-tip {
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    margin-bottom: 20px;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 20px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    transition: all 0.15s;
}

.pin-dot.filled {
    background: #007aff;
    border-color: #007aff;
}

.pin-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 26px;
    letter-spacing: 12px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
    caret-color: #007aff;
}

.pin-input:focus {
    border-color: #007aff;
}

.pin-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    letter-spacing: 1px;
}

.lock-error {
    margin-top: 14px;
    font-size: 14px;
    color: #ffd4af;
    min-height: 20px;
}

/* ============ 底部导航栏 ============ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    height: var(--nav-height);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 500;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
    padding: 6px 0;
}

.nav-item svg {
    transition: transform 0.15s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active svg {
    transform: scale(1.1);
}

/* ============ 视图容器 ============ */
.view-container {
    min-height: calc(100vh - var(--nav-height));
}

/* ============ 待办视图 ============ */
header {
    background: var(--card-bg);
    padding: 20px 16px 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.stats {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stats span {
    font-weight: 600;
    color: var(--primary);
    margin: 0 2px;
}

.add-section {
    padding: 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#todo-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#todo-input:focus {
    border-color: var(--primary);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--primary);
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.icon-btn:active {
    background: var(--primary-light);
}

.photo-preview {
    margin-top: 8px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.photo-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.small-btn {
    font-size: 13px;
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
}

#add-btn {
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

#add-btn:active {
    opacity: 0.8;
}

/* 待办 Tab 切换 */
.tabs {
    display: flex;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 73px;
    z-index: 99;
}

.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* 待办列表 */
.todo-list {
    padding: 8px 16px;
}

.todo-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: opacity 0.2s;
}

.todo-item.done {
    opacity: 0.6;
}

.todo-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: all 0.2s;
}

.todo-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.todo-checkbox.checked::after {
    content: "";
    width: 12px;
    height: 7px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(1px, -1px);
}

.todo-content {
    flex: 1;
    min-width: 0;
}

.todo-text {
    font-size: 16px;
    line-height: 1.4;
    word-break: break-word;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.todo-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.todo-photo {
    margin-top: 8px;
    width: 100%;
    max-width: 200px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.todo-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.todo-actions button {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
}

.todo-actions .delete-btn {
    color: var(--danger);
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
}

.modal-content h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.modal-todo-title {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
}

#completed-note {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    resize: none;
    outline: none;
    font-family: inherit;
}

#completed-note:focus {
    border-color: var(--primary);
}

.modal-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-photo-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-cancel, .btn-confirm {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel {
    background: var(--bg);
    color: var(--text);
}

.btn-confirm {
    background: var(--success);
    color: white;
}

.btn-cancel:active, .btn-confirm:active {
    opacity: 0.8;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* 时限选择行 */
.deadline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.deadline-row label {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.deadline-row input[type="date"] {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    background: var(--bg);
    -webkit-appearance: none;
    appearance: none;
}

.deadline-row input[type="date"]:focus {
    border-color: var(--primary);
}

.deadline-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: #fff3cd;
    color: #856404;
    margin-left: 4px;
    vertical-align: middle;
}

.deadline-tag.overdue {
    background: #fde2e1;
    color: var(--danger);
}

/* ============ 知识库视图 ============ */
.kb-search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.kb-search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.kb-search-bar input:focus {
    border-color: var(--primary);
}

.kb-sub-tabs {
    display: flex;
    margin-top: 10px;
    border-top: 1px solid var(--border);
}

.kb-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.kb-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* 面包屑 */
.kb-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.crumb {
    color: var(--primary);
    cursor: pointer;
}

.crumb:active {
    opacity: 0.7;
}

.crumb-sep {
    color: var(--text-secondary);
    margin: 0 2px;
}

/* 知识库内容区 */
.kb-content {
    padding: 8px 16px;
}

.kb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    background: var(--card-bg);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
    word-break: break-word;
}

.kb-item:active {
    background: var(--bg);
}

.kb-item svg {
    flex-shrink: 0;
    color: var(--primary);
}

.kb-folder svg {
    color: #f5a623;
}

.kb-file svg {
    color: var(--primary);
}

.kb-item span {
    font-size: 15px;
    line-height: 1.3;
}

/* 搜索结果 */
.kb-search-count {
    padding: 12px 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.kb-result {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.kb-result-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.kb-result-path {
    font-size: 12px;
    color: var(--text-secondary);
}

.kb-snippet {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 6px 8px;
    background: var(--bg);
    border-radius: 6px;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
}

.kb-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Markdown 预览 */
.kb-preview-header {
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.kb-back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 15px;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 8px;
}

.kb-preview-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.kb-preview-path {
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
}

.kb-preview-body {
    font-size: 15px;
    line-height: 1.7;
    word-break: break-word;
    padding-bottom: 40px;
}

.kb-preview-body h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    position: static;
    background: none;
    top: auto;
    z-index: auto;
}

.kb-preview-body h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 18px 0 10px;
    position: static;
    background: none;
    top: auto;
    z-index: auto;
}

.kb-preview-body h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 16px 0 8px;
}

.kb-preview-body h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 14px 0 8px;
}

.kb-preview-body p {
    margin: 8px 0;
}

.kb-preview-body ul {
    padding-left: 20px;
    margin: 8px 0;
}

.kb-preview-body li {
    margin: 4px 0;
}

.kb-preview-body strong {
    font-weight: 700;
}

.kb-preview-body em {
    font-style: italic;
}

.md-inline-code {
    background: #f0f0f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 13px;
}

.md-code-block {
    background: #1d1d1f;
    color: #e5e5ea;
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.5;
}

.md-code-block code {
    font-family: "SF Mono", "Fira Code", monospace;
}

.kb-preview-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}

.kb-preview-body td {
    border: 1px solid var(--border);
    padding: 8px 10px;
}

.kb-preview-body tr:nth-child(odd) {
    background: var(--bg);
}

/* ============ 家庭网络标签（浅色主题） ============ */
.net-conn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.net-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c7c7cc;
}

.net-dot.ok {
    background: var(--success);
}

.net-dot.err {
    background: var(--danger);
}

.net-conn .icon-btn {
    margin-left: auto;
}

/* 模式开关卡片 */
.net-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
}

.switch-title {
    font-size: 17px;
    font-weight: 600;
}

.switch-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.power-switch {
    width: 54px;
    height: 32px;
    border-radius: 16px;
    background: #c7c7cc;
    position: relative;
    transition: background 0.25s;
    cursor: pointer;
    flex-shrink: 0;
}

.power-switch .knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: left 0.25s;
}

.power-switch.open {
    background: var(--success);
}

.power-switch.open .knob {
    left: 24px;
}

.power-switch.closed {
    background: var(--danger);
}

.power-switch.closed .knob {
    left: 2px;
}

.power-switch.busy {
    opacity: 0.6;
    pointer-events: none;
}

.net-card.closed .switch-title {
    color: var(--danger);
}

/* 统计 */
.net-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.net-stat {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 4px;
    text-align: center;
}

.net-stat .num {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.net-stat .lbl {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 区块 */
.net-section {
    margin: 16px 0;
}

.net-sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.net-sec-head h2 {
    font-size: 16px;
}

.badge {
    font-size: 12px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 600;
}

.badge.danger {
    background: #ffe5e3;
    color: var(--danger);
}

/* 列表 */
.net-list {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.net-list .item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

.net-list .item:last-child {
    border-bottom: none;
}

.net-list .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c7c7cc;
    flex-shrink: 0;
}

.net-list .dot.on {
    background: var(--success);
}

.net-list .dot.off {
    background: #c7c7cc;
}

.net-list .dot.err {
    background: var(--danger);
}

.net-list .info {
    flex: 1;
    min-width: 0;
}

.net-list .name {
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.net-list .meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.net-list .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.net-list .empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* 小按钮 */
.mini-btn {
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.mini-btn.accent {
    background: var(--primary);
    color: white;
}

.mini-btn.danger {
    background: #ffe0e3;
    color: var(--danger);
}

.mini-btn:active {
    opacity: 0.75;
}

/* 日志 */
.log-item {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
}

.log-item:last-child {
    border-bottom: none;
}

.log-item .lt {
    color: var(--text-secondary);
    margin-right: 8px;
    font-family: "SF Mono", monospace;
    font-size: 12px;
}

.log-item.error {
    color: var(--danger);
}

/* 弹窗字段 */
.field-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 12px 0 6px;
}

#net-m-name, #net-m-mac {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    outline: none;
}

#net-m-name:focus, #net-m-mac:focus {
    border-color: var(--primary);
}

#net-m-mac:disabled {
    background: var(--bg);
    color: var(--text-secondary);
}

.modal-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
    min-height: 18px;
}

/* 定时时间段 */
.range-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}

.range-row input[type="time"] {
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    flex: 1;
    min-width: 0;
}

.range-row select {
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: white;
}

.range-row .del {
    border: none;
    background: #ffe0e3;
    color: var(--danger);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-cancel.full {
    width: 100%;
    margin-top: 10px;
    background: var(--primary-light);
    color: var(--primary);
}

/* ============ 用户管理视图 ============ */
.users-stats {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.users-stats span {
    font-weight: 600;
    color: var(--primary);
    margin: 0 2px;
}

.users-cfg-badge {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 10px;
    flex-shrink: 0;
}

.users-cfg-badge.on {
    background: #e8f5e9;
    color: var(--success);
}

.users-cfg-badge.off {
    background: var(--bg);
    color: var(--text-secondary);
}

/* ============ 安全日志视图 ============ */
.logs-stats {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.logs-filter {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
}

.logs-filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.logs-select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
}

.logs-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.logs-pagination span {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 48px;
    text-align: center;
}

.log-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.badge.warn {
    background: #fff3cd;
    color: #856404;
}

/* ============ AI 助手标签 ============ */
.ai-conn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.ai-conn .icon-btn {
    margin-left: auto;
    background: var(--primary);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
}
.ai-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}
.ai-cwd {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}
.ai-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
    min-height: 40vh;
    max-height: 55vh;
    overflow-y: auto;
}
.ai-msg {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.55;
    word-break: break-word;
}
.ai-msg.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}
.ai-msg.bot {
    align-self: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.ai-msg.loading {
    color: var(--text-secondary);
    font-style: italic;
}
.ai-msg pre {
    background: #1d1d1f;
    color: #e5e5ea;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    margin: 8px 0;
}
.ai-msg code {
    font-family: "SF Mono", monospace;
}
.ai-attach {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-light);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 8px;
}
.ai-attach span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-input-bar {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding: 8px 0;
}
.ai-input-bar input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 20px;
    font-size: 16px;
    outline: none;
    background: var(--card-bg);
}
.ai-input-bar input:focus {
    border-color: var(--primary);
}
.ai-input-bar input:disabled {
    background: var(--bg);
    color: var(--text-secondary);
}
.ai-input-bar .mini-btn {
    padding: 10px 18px;
    border-radius: 20px;
}
