/**
 * 肯德基APP CMS · 三码合一二维码工具 · 布局骨架与公共组件
 * 覆盖：顶栏 / 侧栏导航 / 内容区 / 卡片 / 表单控件 / 按钮 / toast / modal / 页脚 / iframe
 * 框架与所有子页面共享
 */
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--qt-text-primary); background: var(--qt-bg-page);
  font-family: var(--qt-font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ===== Topbar（框架） ===== */
.qt-topbar { height: 48px; padding: 0 24px 0 14px; display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid #ececec; position: sticky; top: 0; z-index: 40; }
.qt-brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: #252525; }
.qt-brand-mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #b93636; color: #fff; font-size: 10px; font-weight: 600; }
.qt-topbar-right { display: flex; align-items: center; gap: 16px; }
.qt-admin { color: #999; font-size: 14px; }

/* ===== Shell / Sidebar（框架；v11 对齐 cardStyleContent 目录导航） ===== */
.qt-shell { display: flex; align-items: stretch; min-height: calc(100vh - 48px); }
.qt-sidebar { width: 220px; flex: 0 0 220px; background: #fff; border-right: 1px solid #e8e8e8; padding: 12px 10px 24px; position: sticky; top: 48px; align-self: flex-start; height: calc(100vh - 48px); overflow-y: auto; }
.qt-sidebar::-webkit-scrollbar { width: 6px; }
.qt-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.qt-sidebar::-webkit-scrollbar-track { background: transparent; }

/* 域节点（L1）：黑色大字，点击仅折叠/展开（cardStyleContent .domain-toggle） */
.nav-group { margin-bottom: 10px; border-radius: 8px; }
.nav-group-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 4px; border-radius: 6px; color: #000; cursor: pointer; user-select: none; transition: background .2s; }
.nav-group-head:hover { background: #f5f5f5; }
.nav-group-head .nav-group-title { font-size: 18px; font-weight: 600; line-height: 1.4; color: #000; }
.nav-group-head .caret { font-size: 12px; color: #000; flex-shrink: 0; transition: transform .2s; }
.nav-group.open .nav-group-head .caret { transform: rotate(90deg); }
.nav-sub { display: none; flex-direction: column; gap: 2px; }
.nav-group.open > .nav-sub { display: flex; }

/* 分组项（L2 可点叶子）（cardStyleContent .group-item） */
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 20px; border-radius: 6px; color: #595959; font-size: 16px; line-height: 1.35; cursor: pointer; user-select: none; transition: background .2s, color .2s; }
.nav-item:hover { background: #f5f5f5; }
.nav-item.active { background: #fcf0f1; color: #DA2634; font-weight: 600; }
.nav-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Main / 面包屑（框架 + 子页面） ===== */
.qt-main { flex: 1; padding: 26px 38px 40px; min-width: 0; overflow-x: hidden; }
@media (max-width: 1280px) {
  .qt-main { padding: 26px 20px 40px; }
}
.breadcrumb { margin-bottom: 22px; color: #7d7d7d; font-size: 14px; display: flex; align-items: center; } /* v21 统一「>」分隔 */
.breadcrumb-sep { margin: 0 8px; color: #bfbfbf; }
.breadcrumb-link { color: #7d7d7d; text-decoration: none; cursor: pointer; transition: color .2s; }
.breadcrumb-link:hover { color: #da2634; }
.breadcrumb strong { color: #333; font-weight: 500; }
.add-page-head .breadcrumb { margin-bottom: 0; } /* 页面头内：返回按钮 + 面包屑同行 */

/* ===== 卡片 ===== */
.qt-card { position: relative; background: #fff; border-radius: 6px; overflow: hidden; }

/* ===== 卡片水印（对齐 simulation .ad-watermark：admin 平铺） ===== */
.qt-watermark { position: absolute; inset: 64px 0 0; pointer-events: none; overflow: hidden; opacity: .17; }
.qt-watermark span { position: absolute; color: #777; transform: rotate(-24deg); font-size: 15px; }

/* ===== 表单控件（公共） ===== */
.qt-input { width: 100%; max-width: 500px; height: 32px; border: 1px solid var(--qt-border-subtle); border-radius: var(--qt-radius); padding: 6px 10px; color: #333; background: #fff; outline: none; transition: border-color .18s, box-shadow .18s; }
.qt-input::placeholder { color: #aaa; }
.qt-input:hover { border-color: var(--qt-color-primary-border); }
.qt-input:focus { border-color: var(--qt-color-primary); box-shadow: 0 0 0 3px rgba(200, 60, 60, .12); }
.qt-input-error { border-color: var(--qt-color-primary) !important; box-shadow: 0 0 0 3px rgba(200, 60, 60, .12); }

.qt-select { width: 100%; max-width: 500px; position: relative; }
.qt-select-trigger { height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 1px solid var(--qt-border-subtle); border-radius: var(--qt-radius); background: #fff; cursor: pointer; transition: border-color .18s, box-shadow .18s; }
.qt-select-trigger:hover { border-color: var(--qt-color-primary-border); }
.qt-select-trigger.focused { border-color: var(--qt-color-primary); box-shadow: 0 0 0 3px rgba(200, 60, 60, .12); }
.qt-select-value { font-size: 14px; color: #333; flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-select-placeholder { font-size: 14px; color: #aaa; flex: 1; min-width: 0; text-align: left; }
.qt-select-caret { color: #98a2b3; font-size: 12px; flex-shrink: 0; }
.qt-select-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--qt-border-subtle); border-radius: var(--qt-radius); box-shadow: 0 18px 40px rgba(15, 23, 42, .16); max-height: 256px; overflow-y: auto; z-index: 50; display: none; padding: 4px; }
.qt-select.open .qt-select-dropdown { display: block; }
.qt-select-option { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; border-radius: 4px; font-size: 13px; color: #344054; cursor: pointer; transition: background .15s; }
.qt-select-option:hover { background: var(--qt-bg-subtle); }
.qt-select-option.selected { background: var(--qt-color-primary-light); color: var(--qt-color-primary); font-weight: 600; }
.qt-select-option-name { flex-shrink: 0; }

/* ===== 按钮 ===== */
.qt-btn { min-width: 88px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border: 1px solid var(--qt-border-subtle); border-radius: var(--qt-radius); background: #fff; color: #374151; font-size: 14px; white-space: nowrap; transition: all .2s; }
.qt-btn:hover { border-color: var(--qt-color-primary-border); color: var(--qt-color-primary); background: var(--qt-color-primary-light); }
.qt-btn-primary { border-color: var(--qt-color-primary); background: var(--qt-color-primary); color: #fff; box-shadow: 0 6px 14px rgba(200, 60, 60, .22); }
.qt-btn-primary:hover { border-color: var(--qt-color-primary-hover); background: var(--qt-color-primary-hover); color: #fff; }
.qt-btn-link { min-width: 0; border: 0; background: transparent; color: var(--qt-color-primary); padding: 0 4px; box-shadow: none; }
.qt-btn-link:hover { background: transparent; color: var(--qt-color-primary-hover); text-decoration: underline; }
.qt-btn-dashed { border-style: dashed; color: #666; background: #fff; }
.qt-btn-sm { min-width: 0; min-height: 30px; padding: 0 10px; font-size: 12px; }

/* ===== 按钮 loading 态（v2） ===== */
.qt-btn { position: relative; }
.qt-btn.is-loading { pointer-events: none; opacity: .88; }
.qt-btn.is-loading .btn-spinner { width: 13px; height: 13px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: qt-spin .7s linear infinite; flex-shrink: 0; display: inline-block; }
.qt-btn.is-loading:not(.qt-btn-primary) .btn-spinner { border-color: rgba(200, 60, 60, .25); border-top-color: var(--qt-color-primary); }
@keyframes qt-spin { to { transform: rotate(360deg); } }

/* ===== Toast（框架） ===== */
.qt-toast { position: fixed; z-index: 90; top: 22px; left: 50%; transform: translate(-50%, -12px); display: none; min-width: 240px; padding: 10px 14px; border-radius: var(--qt-radius); background: #111827; color: #fff; box-shadow: 0 12px 30px rgba(15, 23, 42, .24); text-align: center; opacity: 0; transition: opacity .18s, transform .18s; font-size: 14px; }
.qt-toast.show { display: block; opacity: 1; transform: translate(-50%, 0); }

/* ===== Modal（框架 + 子页面共享） ===== */
.qt-modal-mask { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; animation: qt-fade-in .18s ease; }
.qt-modal { width: 460px; max-width: calc(100vw - 48px); max-height: 80vh; display: flex; flex-direction: column; background: #fff; border-radius: 6px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); overflow: hidden; }
.qt-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; font-size: 15px; font-weight: 600; color: #1f2937; }
.qt-modal-close { border: 0; background: transparent; color: #98a2b3; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.qt-modal-close:hover { color: #475569; background: #f1f5f9; }
.qt-modal-body { padding: 4px 20px 18px; color: #374151; overflow-y: auto; }
.qt-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid #f1f5f9; }
@keyframes qt-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ===== 页脚（框架） ===== */
.update-record { height: 120px; display: flex; align-items: center; justify-content: center; color: #98a2b3; font-size: 14px; }

/* ===== 子页面 iframe（file:// 模式） ===== */
.qt-page-frame { width: 100%; height: calc(100vh - 48px - 26px); border: 0; display: block; background: transparent; position: relative; z-index: 75; }

/* ===== 外壳层全窗口遮罩（v7：file:// 模式弹窗打开时变暗顶栏/侧栏） ===== */
.qt-shell-mask { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, .45); pointer-events: none; animation: qt-fade-in .18s ease; }
