/* JUTA 管理后台样式：浅色专业后台 + 深色模式，与桌面端品牌 token 对齐 */
:root {
  --brand: #1677ff;
  --brand-strong: #0958d9;
  --brand-soft: rgba(22, 119, 255, 0.1);
  --brand-line: rgba(22, 119, 255, 0.26);
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --surface-hover: #f5f8fd;
  --line: #e7e9ee;
  --line-strong: #d6dae1;
  --text: #17181a;
  --text-2: #4b5563;
  --muted: #7b8794;
  --sidebar: #0e141d;
  --sidebar-text: #98a6ba;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(22, 119, 255, 0.16);
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --success: #12a150;
  --success-soft: #e7f7ee;
  --warning: #d97706;
  --warning-soft: #fff4e5;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 28px 70px rgba(6, 14, 28, 0.3);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme='dark'] {
  --brand: #4d9bff;
  --brand-strong: #7ab6ff;
  --brand-soft: rgba(77, 155, 255, 0.14);
  --brand-line: rgba(77, 155, 255, 0.32);
  --bg: #0b0f16;
  --surface: #131a24;
  --surface-muted: #0e141d;
  --surface-hover: #182230;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e6ebf2;
  --text-2: #b9c4d4;
  --muted: #8a98ab;
  --sidebar: #080c12;
  --sidebar-text: #8b9ab0;
  --sidebar-active: rgba(77, 155, 255, 0.16);
  --danger: #ff6b6e;
  --danger-soft: rgba(229, 72, 77, 0.16);
  --success: #3ddc84;
  --success-soft: rgba(18, 161, 80, 0.16);
  --warning: #f0a44a;
  --warning-soft: rgba(217, 119, 6, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

a {
  color: var(--brand);
  text-decoration: none;
}

button {
  font: inherit;
}

::selection {
  background: var(--brand-soft);
}

/* ---------- 登录 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(760px 420px at 12% 8%, rgba(22, 119, 255, 0.16), transparent 62%),
    radial-gradient(620px 380px at 88% 92%, rgba(18, 161, 80, 0.1), transparent 62%),
    var(--sidebar);
}

html[data-theme='dark'] .login-page {
  background:
    radial-gradient(760px 420px at 12% 8%, rgba(77, 155, 255, 0.14), transparent 62%),
    radial-gradient(620px 380px at 88% 92%, rgba(61, 220, 132, 0.08), transparent 62%),
    #070a10;
}

.login-card {
  width: 400px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 32px 28px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #4aa3ff);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.6px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.login-brand h1 {
  font-size: 18px;
  margin: 0;
}

.login-brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.login-card label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin: 16px 0 6px;
}

.login-tip {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.login-theme {
  position: fixed;
  top: 18px;
  right: 18px;
}

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 18px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-size: 14px;
}

.sidebar .brand .login-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 11px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group {
  margin-top: 14px;
}

.nav-group:first-child {
  margin-top: 0;
}

.nav-group-title {
  padding: 0 10px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.72);
  text-transform: uppercase;
}

.nav a {
  position: relative;
  color: var(--sidebar-text);
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 500;
}

.nav a.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.nav .icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  flex: 0 0 auto;
}

.nav .icon svg {
  width: 15px;
  height: 15px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.sidebar-footer .who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 10px;
  color: #dce6f7;
  font-size: 13px;
}

.sidebar-footer .who small {
  display: block;
  color: var(--sidebar-text);
  margin-top: 2px;
  font-size: 11.5px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sidebar-active);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
}

.nav-logout {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  color: #dce6f7;
  padding: 9px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.nav-logout:hover {
  background: rgba(229, 72, 77, 0.85);
  color: #fff;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  height: 64px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  min-width: 0;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-search {
  margin-left: auto;
  position: relative;
  width: 260px;
}

.topbar-search input {
  padding-left: 34px;
  height: 36px;
  background: var(--surface-muted);
}

.topbar-search .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.topbar-search kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  line-height: 18px;
  background: var(--surface);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
  flex: 0 0 auto;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.topbar-badge {
  position: relative;
}

.topbar-badge .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 15px;
  text-align: center;
  font-weight: 600;
}

/* 分钟级时钟从视觉上移到底部提示，不再占用顶栏 */
.topbar-clock {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- 页面容器 ---------- */
.page {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px 28px 48px;
  animation: page-in 0.18s var(--ease);
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h2 {
  margin: 0;
  font-size: 18px;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0 0 10px;
}

/* ---------- 通用组件 ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px var(--brand-soft);
}

.btn.primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn.danger {
  color: var(--danger);
  border-color: var(--danger-soft);
}

.btn.danger:hover {
  background: var(--danger-soft);
}

.btn.danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn.danger-solid:hover {
  filter: brightness(0.94);
}

.btn.success {
  color: var(--success);
  border-color: var(--success-soft);
}

.btn.success:hover {
  background: var(--success-soft);
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 7px;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn.danger-text {
  color: var(--danger);
}

.btn.danger-text:hover {
  background: var(--danger-soft);
  border-color: transparent;
}

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

.btn.loading {
  position: relative;
  color: transparent !important;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  left: 50%;
  top: 50%;
  margin: -7px 0 0 -7px;
  color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.card.pad {
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}

.card-head h3 {
  margin: 0;
  font-size: 14.5px;
}

.card-head .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar .search {
  width: 240px;
}

.toolbar .spacer {
  flex: 1;
}

.toolbar .muted {
  font-size: 12.5px;
}

/* ---------- 概览 ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}

.kpi:hover {
  border-color: var(--brand-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kpi-top {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.kpi-icon.green {
  background: var(--success-soft);
  color: var(--success);
}

.kpi-icon.orange {
  background: var(--warning-soft);
  color: var(--warning);
}

.kpi-icon.red {
  background: var(--danger-soft);
  color: var(--danger);
}

.kpi .value {
  font-size: 28px;
  font-weight: 650;
  margin-top: 10px;
  letter-spacing: 0.2px;
  line-height: 1.1;
}

.kpi .hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
  line-height: 1.6;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* 待办 */
.todo-list {
  display: flex;
  flex-direction: column;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.todo-item:first-child {
  border-top: 0;
}

.todo-item:hover {
  background: var(--surface-hover);
}

.todo-item .todo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex: 0 0 auto;
}

.todo-item.warn .todo-dot {
  background: var(--warning);
}

.todo-item.danger .todo-dot {
  background: var(--danger);
}

.todo-item .todo-main {
  min-width: 0;
  flex: 1;
}

.todo-item .todo-title {
  font-size: 13.5px;
  color: var(--text);
}

.todo-item .todo-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.todo-item .todo-count {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.todo-item .todo-arrow {
  color: var(--muted);
  opacity: 0.7;
}

/* 趋势图 */
.trend-wrap {
  padding: 6px 18px 14px;
}

.trend-svg {
  width: 100%;
  height: auto;
  max-height: 240px;
  display: block;
  overflow: visible;
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 12px;
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-key i {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

/* 最近操作 */
.audit-feed {
  display: flex;
  flex-direction: column;
}

.feed-item {
  display: flex;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}

.feed-item:first-child {
  border-top: 0;
}

.feed-item .feed-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  flex: 0 0 auto;
  padding-top: 1px;
}

.feed-item .feed-main {
  min-width: 0;
}

.feed-item .feed-actor {
  color: var(--text-2);
}

.feed-item .feed-action {
  font-family: var(--mono);
  color: var(--brand-strong);
  font-size: 11.5px;
}

.feed-item .feed-target {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--surface-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr {
  transition: background 0.14s var(--ease);
}

.table tbody tr.clickable {
  cursor: pointer;
}

.table tbody tr:hover {
  background: var(--surface-hover);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .actions {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.table .actions .btn {
  padding: 4px 8px;
  font-size: 12px;
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.table .actions .btn:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.table .actions .btn.danger-text {
  color: var(--danger);
}

.table .actions .btn.danger-text:hover {
  background: var(--danger-soft);
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cell-user .avatar {
  width: 28px;
  height: 28px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 11px;
}

html[data-theme='dark'] .cell-user .avatar {
  color: var(--brand);
}

.cell-user .u-name {
  font-weight: 550;
  color: var(--text);
}

.cell-user .u-id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.cell-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

/* 行内更多菜单 */
.row-menu {
  position: fixed;
  z-index: 70;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 5px;
  animation: pop 0.12s var(--ease);
}

.row-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}

.row-menu button:hover {
  background: var(--surface-hover);
}

.row-menu button.danger {
  color: var(--danger);
}

.row-menu button.danger:hover {
  background: var(--danger-soft);
}

/* ---------- 徽标 / chip ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  line-height: 18px;
  white-space: nowrap;
  background: var(--surface-muted);
  color: var(--muted);
}

.badge.green {
  background: var(--success-soft);
  color: var(--success);
}

.badge.red {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.gray {
  background: var(--surface-muted);
  color: var(--muted);
}

.badge.blue {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.badge.orange {
  background: var(--warning-soft);
  color: var(--warning);
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.muted {
  color: var(--muted);
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .empty-title {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 6px;
}

.empty .empty-sub {
  font-size: 12.5px;
  margin-bottom: 14px;
}

.error-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.error-state .error-title {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 6px;
}

/* ---------- 骨架屏 ---------- */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface-hover) 37%, var(--surface-muted) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.skeleton-table {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.skeleton-row .skeleton {
  height: 12px;
}

.skeleton-row .w-1 {
  width: 18%;
}
.skeleton-row .w-2 {
  width: 26%;
}
.skeleton-row .w-3 {
  width: 16%;
}
.skeleton-row .w-4 {
  width: 22%;
}
.skeleton-row .w-5 {
  width: 10%;
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}

.pager .pager-total {
  margin-right: auto;
}

.pager button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 12.5px;
  transition: 0.14s var(--ease);
}

.pager button:hover:not(:disabled) {
  border-color: var(--brand-line);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.pager button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager .ellipsis {
  padding: 0 2px;
}

/* ---------- chip ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-2);
  transition: 0.14s var(--ease);
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip.active {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: var(--brand-strong);
  font-weight: 500;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 38, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 20px 20px;
  z-index: 58;
  overflow: auto;
}

.modal {
  width: 560px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.16s var(--ease);
}

.modal.wide {
  width: 860px;
}

@keyframes pop {
  from {
    transform: translateY(6px) scale(0.99);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 7px;
  width: 28px;
  height: 28px;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-body {
  padding: 18px 22px;
  max-height: 66vh;
  overflow: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.6;
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.field .error-text {
  display: none;
  color: var(--danger);
  font-size: 11.5px;
  margin-top: 5px;
}

.field.invalid .error-text {
  display: block;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text-2);
}

.section-title:first-child {
  margin-top: 0;
}

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  font-size: 13px;
}

.kv .k {
  color: var(--muted);
}

.code-list {
  background: var(--sidebar);
  color: #d7e5ff;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow: auto;
}

/* ---------- 右侧抽屉 ---------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 38, 0.38);
  backdrop-filter: blur(1px);
  z-index: 55;
  animation: fade-in 0.16s var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 56;
  display: flex;
  flex-direction: column;
  animation: slide-in 0.2s var(--ease);
}

@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.drawer-head {
  padding: 18px 22px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-head-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.drawer-head-top .drawer-title {
  flex: 1;
  min-width: 0;
}

.drawer-head-top h3 {
  margin: 0;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer .avatar {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

html[data-theme='dark'] .drawer .avatar {
  color: var(--brand);
}

.drawer-head-top .drawer-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 4px;
}

.drawer-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.drawer-tabs {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.drawer-tab {
  border: 0;
  background: transparent;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.drawer-tab:hover {
  color: var(--text);
}

.drawer-tab.active {
  color: var(--brand-strong);
  border-bottom-color: var(--brand);
  font-weight: 500;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 18px 22px 32px;
}

.drawer-body .table th,
.drawer-body .table td {
  padding: 10px 12px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat-strip .mini {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface-muted);
}

.stat-strip .mini .k {
  color: var(--muted);
  font-size: 11.5px;
}

.stat-strip .mini .v {
  font-size: 16px;
  font-weight: 600;
  margin-top: 4px;
}

/* ---------- 设置 ---------- */
.svc-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-card {
  padding: 20px 22px 18px;
}

.settings-card .form-grid {
  margin-top: 16px;
}

.save-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}

.save-bar .save-state {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  background: #13203a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(8, 20, 44, 0.35);
  animation: pop 0.18s var(--ease);
}

html[data-theme='dark'] .toast {
  background: #1c2737;
  border: 1px solid var(--line);
}

.toast.error {
  background: #b52a2e;
}

.toast.success {
  background: #0d7a3d;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    overflow: hidden;
  }
  .sidebar .brand {
    padding: 0;
  }
  .sidebar .brand span:last-child {
    display: none;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    flex: 1;
    gap: 4px;
  }
  .nav-group {
    display: contents;
  }
  .nav-group-title {
    display: none;
  }
  .nav a {
    padding: 7px 10px;
    white-space: nowrap;
  }
  .nav a.active::before {
    display: none;
  }
  .nav .icon {
    display: none;
  }
  .sidebar-footer {
    margin: 0;
    border: 0;
    padding: 0;
  }
  .sidebar-footer .who {
    display: none;
  }
  .nav-logout {
    width: auto;
    padding: 7px 10px;
  }
  .topbar {
    padding: 0 16px;
    height: 56px;
  }
  .topbar-search {
    display: none;
  }
  .topbar-clock {
    display: none;
  }
  .page {
    padding: 16px 16px 40px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .drawer {
    width: 100%;
  }
  .stat-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
