/* ooko 控制台设计系统：语义化类 + CSS 变量，浅色/深色共用一套骨架 */
/* Tailwind preflight 已关闭，这里补最小化的元素重置，避免按钮继承 UA 灰底 */
button, input, select, textarea { font: inherit; color: inherit; }
button { background: transparent; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:root {
  --bg: #f4f4f5;
  --bg-side: #fafafa;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --surface-3: #efeff1;
  --border: #e9e9ec;
  --border-strong: #d9d9de;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #8f8f98;
  --primary: #111113;
  --primary-soft: #f0f0f2;
  --primary-fg: #ffffff;
  --primary-hover: #27272a;
  --ring: rgba(17, 17, 19, 0.08);
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --danger-border: #f6c6c6;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --warn-border: #f3ddb4;
  --ok: #15803d;
  --ok-soft: #e9f7ee;
  --ok-border: #bfe6cc;
  --info: #1d4ed8;
  --info-soft: #e9eefd;
  --shadow-sm: 0 1px 2px rgba(16, 16, 20, 0.05);
  --shadow-md: 0 10px 30px rgba(16, 16, 20, 0.09);
  --shadow-lg: 0 24px 70px rgba(16, 16, 20, 0.16);
  --radius: 16px;
  --seg-active: var(--surface);
}
html.dark {
  --bg: #0a0a0c;
  --bg-side: #0e0e11;
  --surface: #141418;
  --surface-2: #1b1b20;
  --surface-3: #232329;
  --border: #26262c;
  --border-strong: #34343c;
  --seg-active: var(--surface-3);
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --primary: #fafafa;
  --primary-soft: #232329;
  --primary-fg: #131316;
  --primary-hover: #e4e4e7;
  --ring: rgba(250, 250, 250, 0.12);
  --danger: #f87171;
  --danger-soft: #2a1416;
  --danger-border: #4a2225;
  --warn: #fbbf24;
  --warn-soft: #2a2113;
  --warn-border: #453719;
  --ok: #4ade80;
  --ok-soft: #12251a;
  --ok-border: #1f3f2b;
  --info: #93b4ff;
  --info-soft: #151c30;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
}
* { box-sizing: border-box; }
[v-cloak] { display: none; }
html, body { margin: 0; padding: 0; height: 100%; }
/* 根节点必须有确定高度，.shell 的 height:100% 才能撑满视口，
   否则内容短时侧栏会「缩水」，底部账号区跟着往上跑 */
#app { height: 100%; }
.app-root { height: 100%; display: flex; flex-direction: column; }
.app-root > .shell { flex: 1 1 auto; min-height: 0; height: auto; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--ring); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }

/* ---------- 基础控件 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-quiet { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.panel { background: var(--surface-2); border-radius: 12px; }
.divider { height: 1px; background: var(--border); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s, opacity .15s, transform .06s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: transparent; border: 0; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.input, .select, .textarea {
  width: 100%; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px;
  padding: 8px 11px; font-size: 13px; outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--border-strong); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }
.input-lg { height: 40px; font-size: 14px; }
.textarea { min-height: 96px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; }
.select-compact {
  appearance: none; cursor: pointer; height: 28px; line-height: 26px;
  font-size: 12px; padding: 0 20px 0 6px; border: 0; border-radius: 8px;
  background-color: transparent; color: var(--text-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f8f98' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.select-compact:hover { background-color: var(--surface-2); }
.select { appearance: none; cursor: pointer; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f8f98' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--text-3); }
.checkbox { width: 15px; height: 15px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface); appearance: none; cursor: pointer; position: relative; flex: none; }
.checkbox:checked { background: var(--primary); border-color: var(--primary); }
.checkbox:checked::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid var(--primary-fg); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }
.switch { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .18s; flex: none; border: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s; }
.switch.on { background: #16a34a; }
.switch.on::after { transform: translateX(14px); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-sm { height: 20px; padding: 0 7px; font-size: 11.5px; }
.pill-btn { cursor: pointer; border: 1px solid transparent; }
.pill-btn:hover { background: var(--surface-3); }
.pill-active { background: var(--primary); color: var(--primary-fg); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-info { background: var(--info-soft); color: var(--info); }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; }
.pill-active .count-badge { background: rgba(255,255,255,.2); color: inherit; }

.dot { width: 6px; height: 6px; border-radius: 999px; flex: none; }
.dot-ok { background: #22c55e; }
.dot-warn { background: #f59e0b; }
.dot-danger { background: #ef4444; }
.dot-muted { background: var(--text-3); }

/* ---------- 表格 ---------- */
.table { width: 100%; font-size: 13px; }
/* 列多或窄屏时表格横向滚动，避免内容被挤成一条竖排 */
.table-scroll { overflow-x: auto; }
.table-scroll .table { min-width: 900px; }
.table-scroll .table th, .table-scroll .table td { white-space: nowrap; }
.table thead th {
  text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: transparent;
}
.table tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table-compact tbody td { padding: 9px 12px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 弹层 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(9, 9, 11, 0.42); backdrop-filter: blur(2px); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; }
.overlay-center { align-items: center; padding: 24px 16px; }
.modal { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; border: 1px solid var(--border); animation: pop .16s ease-out; }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 900px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.fade-enter-active, .fade-leave-active { transition: opacity .15s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

.menu { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 4px; min-width: 168px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border-radius: 8px; font-size: 13px; color: var(--text); background: transparent; border: 0; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-2); }
.menu-item-danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* ---------- 布局 ---------- */
.shell { display: flex; height: 100%; overflow: hidden; }
.sidebar { width: 252px; flex: none; background: var(--bg-side); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: width .18s ease; }
.shell.collapsed .sidebar { width: 84px; }
.shell.collapsed .sidebar > div:first-child { justify-content: center; padding-left: 0; padding-right: 0; }
.shell.collapsed .nav-item { justify-content: center; padding: 0; width: 46px; height: 38px; margin: 1px auto; }
.shell.collapsed .nav-group-title { padding-left: 0; padding-right: 0; }
.shell.collapsed .ws-item { justify-content: center; padding-left: 0; padding-right: 0; width: 46px; margin: 0 auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid transparent; }
.content { flex: 1; overflow-y: auto; padding: 4px 20px 40px; }
.nav-item { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 9px; border-radius: 9px; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid transparent; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.nav-group-title { font-size: 11.5px; color: var(--text-3); font-weight: 600; padding: 12px 10px 5px; letter-spacing: .02em; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.nav-badge { margin-left: auto; font-size: 11px; color: var(--text-3); }
.ws-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.ws-item:hover { background: var(--surface-2); }

.cmdk-trigger { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 10px; border-radius: 9px; background: var(--surface-2); color: var(--text-3); font-size: 12.5px; border: 1px solid var(--border); cursor: pointer; }
.cmdk-trigger:hover { background: var(--surface-3); }

/* ---------- 其它 ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.toast-wrap { position: fixed; z-index: 90; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); border-radius: 12px; padding: 10px 14px; font-size: 13px; display: flex; align-items: center; gap: 8px; min-width: 220px; animation: pop .16s; }
.toast-ok { color: var(--ok); }
.toast-err { color: var(--danger); }
.tooltip { position: absolute; z-index: 80; background: #18181b; color: #fafafa; font-size: 11.5px; padding: 5px 8px; border-radius: 7px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-md); }
.pop { position: absolute; z-index: 40; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; }
.link { color: var(--info); cursor: pointer; }
.link:hover { text-decoration: underline; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 56px 16px; color: var(--text-2); }
.hl { outline: 2px solid #111; outline-offset: 2px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 50; height: 100%; box-shadow: var(--shadow-lg); }
  .content { padding: 4px 14px 40px; }
}
