/* 面板自定义样式：在 Pico.css(classless) 之上补充布局/品牌/徽章等少量定制。 */

/* ---------- 布局：左侧纵向侧边栏 ---------- */
body { --pico-font-size: 100%; }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex: 0 0 218px; background: #0f172a; color: #e2e8f0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  font-weight: 700; font-size: 15px; color: #fff;
  display: flex; align-items: center; gap: 9px;
  padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand .logo {
  width: 26px; height: 26px; border-radius: 7px; font-size: 14px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
/* 左侧纵向菜单 */
.vmenu { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; }
.vmenu .m {
  background: transparent; border: 0; color: #94a3b8; cursor: pointer;
  text-align: left; padding: 9px 13px; border-radius: 8px;
  font-weight: 600; font-size: 14px; width: 100%;
}
.vmenu .m:hover { color: #e2e8f0; background: rgba(255,255,255,.06); }
.vmenu .m.active { color: #fff; background: linear-gradient(90deg, #2563eb, #1d4ed8); box-shadow: 0 2px 6px rgba(37,99,235,.35); }
.sidebar .userfoot {
  margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar .userfoot .uname {
  color: #cbd5e1; font-size: 13px; display: block; margin-bottom: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .logout {
  width: 100%; --pico-background-color: rgba(255,255,255,.05);
  --pico-border-color: #334155; --pico-color: #cbd5e1; font-size: 13px;
}
.sidebar .logout:hover { --pico-background-color: #334155; }
.content { flex: 1; min-width: 0; padding: 20px 26px 80px; background: var(--pico-background-color, #f6f8fb); }

/* ---------- 工具条/标题 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 19px; }
.grow { flex: 1; }
/* 让工具栏里的输入框与按钮垂直居中对齐、视觉等高 */
.toolbar input, .toolbar button { height: 36px; box-sizing: border-box; margin: 0; }
.toolbar input { min-width: 120px; }
.toolbar button { display: inline-flex; align-items: center; justify-content: center; }

/* ---------- 卡片面板 ---------- */
.panel { margin-bottom: 16px; overflow-x: auto; }
.panel .head {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--pico-muted-border-color, #e5e7eb);
  padding-bottom: 10px; margin-bottom: 12px;
}
.panel .head h3 { margin: 0; font-size: 15px; }

/* ---------- 表格紧凑与状态徽章 ---------- */
table { margin-bottom: 0; }
th, td { padding: .5rem .7rem; white-space: nowrap; }
td.mono, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; }
.row-actions { text-align: right; }
.row-actions button { margin-left: 4px; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge.green { background: #e8f7ee; color: #16a34a; }
.badge.blue { background: #eaf1ff; color: #2563eb; }
.badge.gray { background: #eef1f5; color: #6b7280; }
.badge.amber { background: #fef3e2; color: #b45309; }
.badge.red { background: #fdecec; color: #dc2626; }
.tag-chip {
  background: #eaf1ff; color: #2563eb; border-radius: 6px; padding: 1px 8px;
  font-size: 12px; font-weight: 600; font-family: ui-monospace, Consolas, monospace;
}
td.center, th.center { text-align: center; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(10,15,30,.42); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 7vh 14px 14px;
}
.modal { width: 640px; max-width: 100%; max-height: 86vh; overflow: auto; }
.modal .mhead {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--pico-muted-border-color, #e5e7eb); padding-bottom: 10px; margin-bottom: 14px;
}
.modal .mhead h3 { margin: 0; font-size: 16px; flex: 1; }
.modal .mfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; }
.grid2 .full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 4px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; }
.field textarea { resize: vertical; }
.row-check { display: flex; align-items: center; gap: 10px; margin: 2px 0; }
.help { color: var(--pico-muted-color, #6b7280); font-size: 12px; }

/* ---------- 账号页(注册/登录) ---------- */
.authwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0f172a, #1e3a8a); padding: 16px; }
.authcard { width: 400px; max-width: 100%; padding: 26px 28px; }
.authcard h1 { font-size: 20px; margin: 0 0 4px; }
.authcard .sub { color: var(--pico-muted-color, #6b7280); margin-bottom: 16px; }
.authcard label { font-weight: 600; }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #111827; color: #fff; padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 420px; font-size: 13px;
}
.toast.ok { border-left: 4px solid #22c55e; }
.toast.err { border-left: 4px solid #ef4444; }
.toast.warn { border-left: 4px solid #f59e0b; }

@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- 响应式：窄屏时侧边栏折叠为顶部横条 ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 12px; flex-wrap: wrap;
  }
  .sidebar .brand { padding: 0 4px; border: 0; font-size: 14px; }
  .vmenu { flex-direction: row; padding: 0; flex: 1; min-width: 0; gap: 2px; flex-wrap: wrap; }
  .vmenu .m { width: auto; padding: 8px 12px; }
  .sidebar .userfoot { margin-top: 0; padding: 0; border: 0; display: flex; align-items: center; gap: 8px; }
  .sidebar .userfoot .uname { display: none; }
  .sidebar .logout { width: auto; padding: 6px 12px; }
  .content { padding: 14px 12px 60px; }
}
/* 表单里的操作行(弹窗底部/保存行)统一右对齐、元素间留空隙 */
.mfoot, [style*="text-align:right"] { gap: 8px; }
