/* 信桥管理后台 · 设计变量、基础排版与整体外框（侧栏 / 顶栏 / 主区）。
   CSP 为 style-src 'self'：不能使用内联 style 属性或外部字体，所有样式都写在 sms/static/sms/*.css。
   加载顺序：base.css → components.css → pages.css（响应式规则在 pages.css 末尾，必须最后加载）。 */

/* ---------- 设计变量 ---------- */
:root {
  --ink: #17262c;
  --ink-2: #47585f;
  --ink-3: #66777e;
  --line: #e5e9eb;
  --line-strong: #cdd5d9;
  --canvas: #fff;
  --subtle: #f6f8f8;
  --hover: #f1f4f5;

  --brand: #0b7a80;
  --brand-strong: #08666b;
  --brand-soft: #e7f3f2;
  --warn: #8a5a00;
  --warn-soft: #fdf3da;
  --danger: #b23a45;
  --danger-strong: #96303a;
  --danger-soft: #fbecee;
  --info: #3d639c;
  --info-soft: #eaf0f9;

  --radius: 8px;
  --radius-lg: 12px;
  --control: 36px;
  --control-sm: 30px;
  --sidebar: 228px;
  --gutter: 32px;
  --ring: 0 0 0 3px rgb(11 122 128 / 0.2);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}
h3 {
  font-size: 14px;
  font-weight: 600;
}
p {
  color: var(--ink-2);
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
code,
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--subtle);
  border: 1px solid var(--line);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}
pre {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--subtle);
  color: var(--ink);
  font: 13px/1.75 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
/* 组件自己设置了 display 时，hidden 属性仍然要生效 */
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 30;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
}
.skip-link:focus {
  top: 12px;
}
.muted {
  color: var(--ink-3);
}
.small {
  font-size: 13px;
}
.block {
  display: block;
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 12px;
}

/* ---------- 外框：侧栏 / 顶栏 / 主区 ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 20px 12px 16px;
  background: var(--subtle);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: var(--ink);
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px 9px 4px 4px;
  background: var(--brand);
  color: #fff;
  font: 19px/1 var(--serif);
}
.brand-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.08em;
}
.brand-name small {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 26px;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  padding: 0 10px 4px;
  color: var(--ink-3);
  font-size: 12px;
}
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--ink-2);
}
.nav a:hover {
  background: #e9eeef;
  color: var(--ink);
  text-decoration: none;
}
.nav a.is-active {
  background: var(--canvas);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(23 38 44 / 0.06);
}
.nav a.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.account {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.account-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
}
.account a,
.account .btn-link {
  color: var(--ink-2);
}
.account a:hover,
.account .btn-link:hover,
.account a[aria-current] {
  color: var(--ink);
}
.account a[aria-current] {
  font-weight: 600;
}

.shell {
  margin-left: var(--sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.shell.unauthenticated {
  margin-left: 0;
  background: var(--subtle);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 var(--gutter);
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.env-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--hover);
}
.env-switch a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}
.env-switch a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b6c1c6;
}
.env-switch a:hover {
  color: var(--ink);
  text-decoration: none;
}
.env-switch a.is-active {
  background: var(--canvas);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(23 38 44 / 0.12);
}
.env-switch a.is-active::before {
  background: var(--brand);
}
.env-switch a.env-production.is-active {
  color: var(--warn);
}
.env-switch a.env-production.is-active::before {
  background: #d18b00;
}
main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
main > * {
  min-width: 0;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter) 24px;
  color: var(--ink-3);
  font-size: 12px;
}

/* ---------- 页面标题 ---------- */
.back {
  align-self: flex-start;
  margin-bottom: -8px;
  color: var(--ink-3);
  font-size: 13px;
}
.back:hover {
  color: var(--ink);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.page-head p {
  max-width: 68ch;
  margin-top: 4px;
}
.page-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.page-head > .actions {
  flex: none;
}
