/* 超话签到 — 系统工具
   光、玻璃与系统蓝。无衬线、细分割线、少量状态色。 */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --fill: #f2f2f7;
  --fill-strong: #e8e8ed;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #8e8e93;
  --hairline: rgba(60, 60, 67, 0.12);
  --hairline-strong: rgba(60, 60, 67, 0.22);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --green: #34c759;
  --green-text: #1f8a3b;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #ff9f0a;
  --orange-text: #a86500;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #ff3b30;
  --red-text: #d70015;
  --red-soft: rgba(255, 59, 48, 0.12);
  --segment-active: #ffffff;
  --ambient: rgba(0, 113, 227, 0.08);
  --log-bg: #0b0c0e;
  --log-text: #d1d1d6;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.045);
  --shadow-pop: 0 24px 70px rgba(0, 0, 0, 0.22);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", "JetBrains Mono",
    "Consolas", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-glass: rgba(28, 28, 30, 0.78);
    --fill: #2c2c2e;
    --fill-strong: #3a3a3c;
    --text: #f5f5f7;
    --secondary: #98989d;
    --tertiary: #7c7c80;
    --hairline: rgba(255, 255, 255, 0.1);
    --hairline-strong: rgba(255, 255, 255, 0.2);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --green: #30d158;
    --green-text: #4cd964;
    --green-soft: rgba(48, 209, 88, 0.16);
    --orange: #ff9f0a;
    --orange-text: #ffb340;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --red: #ff453a;
    --red-text: #ff6961;
    --red-soft: rgba(255, 69, 58, 0.16);
    --segment-active: #2c2c2e;
    --ambient: rgba(10, 132, 255, 0.1);
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.03),
      0 12px 32px rgba(0, 0, 0, 0.36);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(
    1100px 520px at 50% -260px,
    var(--ambient),
    transparent 70%
  );
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.hidden {
  display: none !important;
}

/* ---------- 应用框架 ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 58%, var(--bg));
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 28px 18px 20px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 2px 8px;
}

.seal {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(155deg, #5ac8fa 0%, #0a84ff 48%, #0066d6 100%);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 6px 16px rgba(0, 90, 200, 0.24);
}

.seal::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: inherit;
  pointer-events: none;
}

.seal span {
  position: relative;
  z-index: 1;
  transform: translateY(-1px);
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.024em;
}

.brand-text p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--secondary);
  font-size: 11px;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 侧栏导航 ---------- */

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 30px;
}

.side-nav .tab {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease,
    box-shadow 160ms ease;
}

.side-nav .tab svg {
  width: 19px;
  height: 19px;
  flex: none;
  opacity: 0.9;
}

@media (hover: hover) and (pointer: fine) {
  .side-nav .tab:hover:not(:disabled):not(.active) {
    background: color-mix(in srgb, var(--text) 5%, transparent);
    color: var(--text);
  }
}

.side-nav .tab.active {
  background: var(--segment-active);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07),
    0 0 0 0.5px rgba(0, 0, 0, 0.05);
}

.side-nav .tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

@media (prefers-color-scheme: dark) {
  .side-nav .tab.active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4),
      0 0 0 0.5px rgba(255, 255, 255, 0.06);
  }
}

.user-menu {
  position: relative;
  flex: none;
}

.avatar-button {
  appearance: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.avatar-button:hover {
  border-color: var(--hairline-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}

.avatar-button:active {
  transform: scale(0.96);
}

.avatar-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

.avatar {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(145deg, #5ac8fa, #0a84ff);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

.user-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 216px;
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-popover:not(.hidden) {
  animation: user-popover-in 150ms ease-out;
  transform-origin: top right;
}

@keyframes user-popover-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.user-popover-head {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 9px 12px 10px;
  line-height: 1.3;
}

.user-popover-head strong {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-popover-head span {
  color: var(--secondary);
  font-size: 11.5px;
}

.user-popover-sep {
  height: 1px;
  margin: 2px 6px 4px;
  background: var(--hairline);
}

.user-popover-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--red-text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.user-popover-item:hover {
  background: var(--red-soft);
}

.user-popover-item:focus-visible {
  outline: none;
  background: var(--red-soft);
  box-shadow: inset 0 0 0 1.5px var(--red-text);
}

.user-popover-item svg {
  flex: none;
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .user-popover:not(.hidden) {
    animation: none;
  }

  .avatar-button {
    transition: none;
  }
}

/* ---------- 主区域 ---------- */

.main {
  min-width: 0;
}

.main-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 44px clamp(28px, 4vw, 56px) 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-heading {
  min-width: 0;
}

.page-heading h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.032em;
}

.page-heading p {
  margin: 7px 0 0;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.45;
}

.topbar-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex: none;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.date-chip .weekday {
  color: var(--secondary);
  font-weight: 400;
}

.sched {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sched .lamp {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--tertiary);
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.sched.on {
  color: var(--green-text);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
  background: var(--green-soft);
}

.sched.on .lamp {
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}

/* ---------- 内容 ---------- */

.tab-panel {
  padding: 0;
  background: none;
  border: 0;
}

.panel {
  margin: 0;
  padding: 24px 26px;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.tab-panel > .panel + .panel {
  margin-top: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}

h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.022em;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- 摘要 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.stat {
  min-width: 0;
  padding: 17px 24px 18px;
  border-left: 1px solid var(--hairline);
}

.stat:first-child {
  border-left: 0;
}

.stat .label {
  color: var(--secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.stat .value {
  margin-top: 2px;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat .value-date {
  overflow: hidden;
  padding-top: 9px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  .stat .value {
    font-weight: 500;
  }
}

/* ---------- 表单控件 ---------- */

input:not([type="checkbox"]),
select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background-color: var(--fill);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: background-color 150ms ease, border-color 150ms ease,
    box-shadow 150ms ease;
}

input:not([type="checkbox"]):hover,
select:hover {
  background-color: var(--fill-strong);
}

input:not([type="checkbox"]):focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

input::placeholder {
  color: var(--tertiary);
  opacity: 1;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: inset 0 0 0 100px var(--fill);
  transition: background-color 9999s ease-out;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 8px;
  cursor: pointer;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 5px;
  background-color: var(--surface);
  cursor: pointer;
  transition: background-color 130ms ease, border-color 130ms ease,
    box-shadow 130ms ease;
}

input[type="checkbox"]:hover {
  border-color: var(--secondary);
}

input[type="checkbox"]:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.3 4.8 8.8 9.9 3.2' fill='none' stroke='%23ffffff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field > label:not(.checkline),
.entry-field > label {
  display: block;
  margin-bottom: 6px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.field .hint {
  margin-top: 7px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.5;
}

.hint {
  margin: 12px 0 0;
  color: var(--secondary);
  font-size: 12.5px;
  line-height: 1.55;
}

button {
  appearance: none;
  min-height: 36px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease,
    transform 80ms ease, opacity 150ms ease;
}

button:hover:not(:disabled) {
  background: var(--fill-strong);
}

button:active:not(:disabled) {
  transform: scale(0.985);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

button.primary {
  min-height: 40px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
}

button.small {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
}

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

button.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 20%, transparent);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}

.checkline.slim {
  min-height: 0;
  margin-top: 8px;
  color: var(--secondary);
  font-size: 12.5px;
}

/* ---------- 账户 ---------- */

.entry {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.entry-field {
  flex: 1 1 280px;
  min-width: 0;
}

.entry .primary {
  flex: none;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: middle;
}

th {
  padding-top: 0;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

th:nth-child(1) {
  width: 20%;
}

th:nth-child(2) {
  width: 13%;
}

th:nth-child(3) {
  width: 11%;
}

th:nth-child(4) {
  width: 29%;
}

th:nth-child(5) {
  width: 27%;
}

#users-table th:nth-child(1) {
  width: 24%;
}

#users-table th:nth-child(2) {
  width: 12%;
}

#users-table th:nth-child(3) {
  width: 14%;
}

#users-table th:nth-child(4) {
  width: 24%;
}

#users-table th:nth-child(5) {
  width: 26%;
}

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

td:nth-child(2) {
  font-variant-numeric: tabular-nums;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--text) 2.5%, transparent);
}

.account-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.account-meta {
  margin-top: 1px;
  color: var(--secondary);
  font-size: 12px;
}

.run-time {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.run-result {
  margin-top: 1px;
  color: var(--secondary);
  font-size: 12px;
}

.run-result.is-error {
  color: var(--red-text);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--secondary);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

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

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

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

#my-role.badge.ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.actions button {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.empty {
  margin-top: 20px;
  padding: 40px 20px;
  border-top: 1px solid var(--hairline);
  color: var(--secondary);
  font-size: 13.5px;
  text-align: center;
}

/* ---------- 签到 ---------- */

.run-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.run-mode {
  flex: 0 0 auto;
}

.run-label {
  margin-bottom: 3px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 500;
}

.max-field {
  flex: 0 0 220px;
  width: 220px;
}

.run-button {
  margin-left: auto;
}

.job-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 24px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 500;
}

.job-head #job-title {
  color: var(--text);
}

.spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid var(--fill-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

pre.log {
  max-height: 430px;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: var(--log-bg);
  color: var(--log-text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

/* ---------- 设置 ---------- */

.section-title {
  margin: 30px 0 8px;
  color: var(--secondary);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.panel-head + .section-title {
  margin-top: 22px;
}

.section-note {
  margin: 0 0 14px;
  color: var(--secondary);
  font-size: 12.5px;
  line-height: 1.55;
}

.form-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 8px 24px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
}

.form-label {
  padding-top: 10px;
  font-size: 13.5px;
  font-weight: 500;
}

.form-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 220px));
  gap: 14px 15px;
}

.form-controls.wide {
  grid-template-columns: minmax(0, 520px);
}

.password-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
}

.password-controls .field {
  flex: 1 1 160px;
  max-width: 240px;
}

.password-controls .primary {
  flex: none;
  min-height: 40px;
}

.me-line {
  margin: 0 0 4px;
  color: var(--secondary);
  font-size: 13px;
}

.me-line strong {
  margin-left: 5px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.user-entry {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) auto auto;
  gap: 0 14px;
  align-items: end;
}

.user-entry .checkline {
  min-height: 40px;
  margin-bottom: 0;
  white-space: nowrap;
}

.user-entry .primary {
  min-height: 40px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}

.switch-copy strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.switch-note {
  display: block;
  margin-top: 1px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.5;
}

.switch-row + .form-row {
  border-top: 0;
}

.switch-row input[type="checkbox"] {
  width: 51px;
  height: 31px;
  border: 0;
  border-radius: 999px;
  background-color: var(--fill-strong);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27' height='27'%3E%3Ccircle cx='13.5' cy='13.5' r='13.5' fill='%23ffffff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 27px 27px;
  background-position: left 2px center;
  transition: background-color 200ms ease, background-position 200ms ease,
    box-shadow 150ms ease;
}

.switch-row input[type="checkbox"]:hover {
  border: 0;
  background-color: var(--fill-strong);
}

.switch-row input[type="checkbox"]:checked {
  background-color: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27' height='27'%3E%3Ccircle cx='13.5' cy='13.5' r='13.5' fill='%23ffffff'/%3E%3C/svg%3E");
  background-position: right 2px center;
}

.switch-row input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- 日志 ---------- */

#log-date {
  width: auto;
  min-width: 148px;
}

/* ---------- 弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
}

.modal-card {
  position: relative;
  width: min(400px, 100%);
  padding: 26px 26px 22px;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  text-align: center;
  animation: card-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-card h2 {
  font-size: 19px;
}

.modal-sub {
  margin: 6px 0 0;
  color: var(--secondary);
  font-size: 13px;
}

.modal-card .reset-field {
  margin-top: 18px;
  text-align: left;
}

.modal-card .error {
  margin-bottom: 0;
}

.qr-box {
  display: grid;
  place-items: center;
  width: 238px;
  height: 238px;
  margin: 20px auto;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: #fff;
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-status {
  margin: 0;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.modal-actions button {
  min-width: 92px;
}

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 110;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(29, 29, 31, 0.92);
  color: #ffffff;
  font-size: 13.5px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

@media (prefers-color-scheme: dark) {
  .toast {
    background: rgba(58, 58, 60, 0.94);
  }
}

.toast.error {
  background: rgba(215, 0, 21, 0.95);
  color: #ffffff;
}

/* ---------- 登录 ---------- */

.login-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background-image: radial-gradient(
    900px 540px at 50% -12%,
    var(--ambient),
    transparent 68%
  );
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(
    circle at 1px 1px,
    color-mix(in srgb, var(--text) 9%, transparent) 1px,
    transparent 0
  );
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    #000 0%,
    transparent 72%
  );
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: 36px 32px 28px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: var(--surface-glass);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

@media (prefers-color-scheme: dark) {
  .login-card {
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  }
}

.login-brand {
  margin-bottom: 26px;
  text-align: center;
}

.login-brand .seal {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  font-size: 32px;
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.login-brand p {
  margin: 6px 0 0;
  color: var(--secondary);
  font-size: 13px;
}

.login-fields {
  display: grid;
  gap: 14px;
}

.login-field {
  margin-top: 0;
}

.w-full {
  width: 100%;
}

.login-card .primary.w-full {
  margin-top: 8px;
  min-height: 44px;
  font-size: 15px;
}

.error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--red-text);
  font-size: 12.5px;
}

.login-card .hint {
  margin-top: 14px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.footer {
  margin: 26px 0 0;
  color: var(--tertiary);
  font-size: 12px;
  line-height: 1.55;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 1024px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .sidebar-inner {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    height: auto;
    padding: 11px 70px 11px 16px;
    overflow: visible;
  }

  .brand {
    gap: 10px;
    padding: 0;
  }

  .seal {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 18px;
  }

  .brand-text h1 {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-text p {
    display: none;
  }

  .user-menu {
    position: fixed;
    top: calc(11px + env(safe-area-inset-top));
    right: 16px;
    z-index: 45;
  }

  .user-popover {
    top: calc(100% + 8px);
    width: 208px;
    max-width: calc(100vw - 32px);
  }

  .side-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    flex-direction: row;
    gap: 0;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--hairline);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
  }

  .side-nav .tab {
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: auto;
    min-height: 48px;
    padding: 5px 2px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0;
    text-align: center;
  }

  .side-nav .tab svg {
    width: 21px;
    height: 21px;
  }

  .side-nav .tab.active {
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    box-shadow: none;
  }

  .side-nav .tab:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent);
  }

  .main-inner {
    padding: 22px 16px calc(88px + env(safe-area-inset-bottom));
  }

  .topbar {
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
  }

  .page-heading h1 {
    font-size: 27px;
  }

  .page-heading p {
    margin-top: 5px;
    font-size: 13px;
  }

  .topbar-side {
    width: 100%;
    align-items: stretch;
    gap: 0;
  }

  .topbar-meta {
    width: 100%;
    justify-content: space-between;
  }

  .toast {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 820px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .form-label {
    padding-top: 0;
  }

  .form-controls {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
  }

  .stat .value-date {
    font-size: 14px;
  }

  .password-controls .field {
    flex: 1 1 100%;
    max-width: none;
  }

  .password-controls .primary {
    width: 100%;
  }

  .user-entry {
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
  }

  .user-entry .checkline {
    min-height: 36px;
  }

  .user-entry .primary {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .main-inner {
    padding: 18px 14px calc(86px + env(safe-area-inset-bottom));
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .date-chip,
  .sched {
    font-size: 11.5px;
  }

  .panel {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .stats {
    border-radius: 18px;
    margin-bottom: 16px;
  }

  .stat {
    padding: 14px 12px;
  }

  .stat .label {
    font-size: 11px;
  }

  .stat .value {
    font-size: 24px;
  }

  .stat .value-date {
    padding-top: 8px;
    font-size: 12.5px;
    line-height: 1.5;
  }

  .entry {
    align-items: stretch;
  }

  .entry .primary {
    width: 100%;
  }

  .run-row {
    gap: 14px;
  }

  .max-field {
    flex: 1 1 100%;
    width: 100%;
  }

  .run-button {
    width: 100%;
    margin-left: 0;
  }

  .table-wrap {
    margin-top: 16px;
    overflow: visible;
  }

  table {
    display: block;
    min-width: 0;
    table-layout: auto;
  }

  thead {
    display: none;
  }

  tbody {
    display: block;
  }

  tbody tr {
    display: block;
    margin-bottom: 8px;
    padding: 12px 14px;
    border: 0;
    border-radius: 14px;
    background: var(--fill);
  }

  tbody tr:last-child {
    margin-bottom: 0;
  }

  tbody tr:hover {
    background: var(--fill);
  }

  td {
    display: block;
    padding: 3px 0;
    border: 0;
  }

  td:first-child {
    padding-bottom: 8px;
  }

  td:nth-child(2)::before,
  td:nth-child(3)::before,
  td:nth-child(4)::before,
  td:nth-child(5)::before {
    display: block;
    margin-bottom: 1px;
    color: var(--secondary);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
  }

  td:nth-child(2)::before {
    content: "UID";
  }

  td:nth-child(3)::before {
    content: "登录态";
  }

  td:nth-child(4)::before {
    content: "上次签到";
  }

  td:nth-child(5) {
    padding-top: 12px;
  }

  td:nth-child(5)::before {
    content: "操作";
  }

  #users-table td:nth-child(2)::before {
    content: "角色";
  }

  #users-table td:nth-child(3)::before {
    content: "状态";
  }

  #users-table td:nth-child(4)::before {
    content: "上次登录";
  }

  #users-table td:nth-child(5)::before {
    content: "操作";
  }

  .user-entry {
    grid-template-columns: 1fr;
  }

  .actions {
    gap: 8px;
  }

  .actions button {
    flex: 1 1 auto;
    min-height: 38px;
  }

  .actions button:not(.danger) {
    background: var(--surface);
  }

  .actions button:not(.danger):hover:not(:disabled) {
    background: var(--fill-strong);
  }

  .qr-box {
    width: 200px;
    height: 200px;
  }

  .login-page {
    padding: 16px;
  }

  .login-card {
    padding: 30px 22px 24px;
    border-radius: 22px;
  }
}

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

  button:active:not(:disabled) {
    transform: none;
  }
}
