/* ================================================================
   睿桨数智 — 统一浅色主题 (Shared Light Theme)
   所有面向用户的页面共享此 CSS 变量和基础样式
   ================================================================ */

:root {
  /* ── 背景层级 ── */
  --bg:            #f5f7fa;
  --bg-alt:        #f0f2f5;
  --card:          #ffffff;
  --card-hover:    #fafbfc;

  /* ── 品牌色 ── */
  --brand:         #1a3a6e;    /* 深海蓝 — Header梯度、侧边栏、主按钮 */
  --brand-light:   #2563eb;    /* 蓝 — 链接、焦点 */
  --brand-gradient: linear-gradient(135deg, #1a3a6e, #2563eb);
  --accent:        #0ea5e9;    /* 水面天蓝 — 高亮、选中、次要强调 */

  /* ── 文字 ── */
  --text:          #1e293b;
  --text-strong:   #0f172a;
  --text-secondary: #475569;
  --muted:         #64748b;
  --placeholder:   #94a3b8;

  /* ── 边框 ── */
  --border:        #e2e8f0;
  --border-light:  #f1f5f9;

  /* ── 状态色 ── */
  --success:       #10b981;
  --success-bg:    #ecfdf5;
  --success-border:#a7f3d0;
  --warning:       #f59e0b;
  --warning-bg:    #fffbeb;
  --warning-border:#fde68a;
  --danger:        #ef4444;
  --danger-bg:     #fef2f2;
  --danger-border: #fecaca;
  --info-bg:       #eff6ff;
  --info-border:   #bfdbfe;
  --info-text:     #1e40af;

  /* ── 圆角 ── */
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     12px;
  --radius-xl:     16px;
  --radius-full:   9999px;

  /* ── 阴影 ── */
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.04);
  --shadow:        0 1px 6px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.10);

  /* ── 间距 ── */
  --space-xs:      4px;
  --space-sm:      8px;
  --space-md:      12px;
  --space-lg:      16px;
  --space-xl:      24px;
  --space-2xl:     32px;

  /* ── 字体 ── */
  --font: -apple-system, BlinkMacSystemFont, "Noto Sans SC", "PingFang SC",
          "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Cascadia Code", "Fira Code",
               "Consolas", monospace;

  /* ── 过渡 ── */
  --transition: 0.2s ease;
}

/* ================================================================
   Reset & Base
   ================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--brand-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent); }

/* ================================================================
   Typography
   ================================================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-strong);
}

p { color: var(--text); }

.text-muted { color: var(--muted); font-size: 0.875rem; }
.text-sm   { font-size: 0.8125rem; }
.text-xs   { font-size: 0.75rem; }

/* ================================================================
   Cards (共享卡片样式)
   ================================================================ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: var(--space-lg);
  transition: box-shadow var(--transition);
}
.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.card-header h2, .card-header h3 {
  font-size: 1rem;
  margin: 0;
  border: none;
  padding: 0;
}

/* ================================================================
   Form elements
   ================================================================ */

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

label .req { color: var(--danger); }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--text);
  background: #fafbfc;
  outline: none;
  transition: border-color var(--transition), background var(--transition),
              box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand-light);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--bg-alt);
  color: var(--placeholder);
  cursor: not-allowed;
}

input::placeholder { color: var(--placeholder); }

.hint {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: var(--space-xs);
  line-height: 1.4;
}

/* ================================================================
   Buttons
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-light);
  border-color: var(--brand-light);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  color: var(--brand-light);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--brand-light);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-alt);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-sm  { padding: 5px 12px; font-size: 0.75rem; }
.btn-lg  { padding: 12px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

/* ================================================================
   Messages / Alerts
   ================================================================ */

.msg {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.msg-error {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid var(--danger-border);
}

.msg-success {
  background: var(--success-bg);
  color: #166534;
  border: 1px solid var(--success-border);
}

.msg-info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.msg-warning {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid var(--warning-border);
}

/* ================================================================
   Badges / Pills
   ================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
}

.badge-success { background: var(--success-bg); color: #166534; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-info    { background: var(--info-bg);    color: #1e40af; }

/* ================================================================
   Utility classes
   ================================================================ */

.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm     { gap: var(--space-sm); }
.gap-md     { gap: var(--space-md); }
.gap-lg     { gap: var(--space-lg); }

.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }

.text-center { text-align: center; }

.w-full  { width: 100%; }

/* ================================================================
   Scrollbar
   ================================================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--placeholder); }

/* ================================================================
   Selection
   ================================================================ */

::selection {
  background: rgba(14, 165, 233, 0.15);
  color: var(--text);
}
