:root {
  --bg: #f5f5f5;
  --panel: #ffffff;
  --text: #000000;
  --muted: #666666;
  --primary: #22c55e;
  --danger: #ef4444;
  --link: #0066cc;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

.app-header, .app-footer {
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid #eeeeee;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-footer { border-top: 1px solid #eeeeee; border-bottom: none; }
.app-header h1 { margin: 0 0 8px; font-size: 20px; }
.app-header #admin-login-status { margin: 0; font-size: 12px; }
.app-header #admin-login-status a { color: var(--link); text-decoration: none; margin-left: 8px; }
.user-info { margin-top: 6px; text-align: right; }
.user-info a { color: var(--link); text-decoration: none; margin-left: 8px; }

.nav a {
  color: var(--link);
  text-decoration: none;
  margin-right: 12px;
}
.nav a.active { font-weight: 600; text-decoration: underline; }

.container { max-width: 920px; margin: 18px auto; padding: 0 12px; }

.panel { background: var(--panel); border: 1px solid #dddddd; border-radius: 8px; padding: 16px; }
.panel.active-panel { background: #f0f0f0; }
.panel + .panel { margin-top: 12px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input, select, button, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #cccccc;
  background: #ffffff;
  color: var(--text);
}
input[type="checkbox"] {
  width: auto;
  height: 16px;
  padding: 0;
}
button { cursor: pointer; }
button.primary { background: #1d4ed8; border-color: #2563eb; color: #ffffff; }
button.danger { background: #cc3333; border-color: #dd4444; color: #ffffff; }

.list { width: 100%; border-collapse: collapse; }
.list { /* restore original */ }
.list th, .list td { border-bottom: 1px solid #eeeeee; padding: 10px; text-align: left; }
.list th { color: var(--muted); font-weight: 600; }
/* 列名居中显示（仅表头） */
.list thead th { text-align: center; }
/* 数据单元格居中显示 */
.list tbody td { text-align: center; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.tag.income { background: rgba(34,197,94,0.15); color: var(--primary); }
.tag.expense { background: rgba(239,68,68,0.15); color: var(--danger); }

.flex { display: flex; align-items: center; gap: 8px; }
.space-between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.right { text-align: right; }

.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.totals .card { background: #ffffff; border: 1px solid #dddddd; border-radius: 8px; padding: 12px; }
.totals .value { font-size: 20px; font-weight: 700; }
/* 管理页标题居中与小图标按钮 */
.panel-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.panel-title {
  grid-column: 2;
  justify-self: center;
  margin: 0;
}
.panel-header #open-entry {
  grid-column: 3;
  justify-self: end;
}
.panel-header #ann-create {
  grid-column: 3;
  justify-self: end;
}
.small-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 18px;
  border-radius: 6px;
}
.admin-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 1 1 auto;
}
/* 右侧按钮组与左侧筛选同样的对齐与间距 */
.toolbar-buttons { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

/* 紧凑字段最小宽度，防止被挤压不可见 */
.field-compact { min-width: 140px; }
/* 两行紧凑字段：标签在上，输入在下，整体更矮更紧凑 */
.field-compact { display: flex; flex-direction: column; gap: 2px; }
.field-compact label { margin: 0; font-size: 12px; }
.compact-small { height: 28px; padding: 3px 8px; font-size: 12px; }

/* 工具栏紧凑按钮，和紧凑输入等高、宽度自动 */
.compact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 4px 10px;
  font-size: 13px;
  width: auto;
}

/* 提现列表：开始/结束时间标签更紧凑，降低占用高度 */
label[for="wd-start-input"],
label[for="wd-end-input"] {
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 1;
}
#admin-user-info {
  font-size: 12px;
}
.compact-input {
  height: 32px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

/* 表格操作按钮区域 */
.table-actions { display: flex; align-items: center; gap: 8px; }
.table-actions button { width: auto; padding: 6px 10px; font-size: 12px; }
/* 操作列居中显示按钮 */
.table-actions { justify-content: center; }

/* 底部分页按钮更紧凑，避免过长 */
.pager button { width: auto; padding: 6px 10px; font-size: 12px; }

/* 管理页用户表头居中 */
.table thead th { text-align: center; }
/* 管理页用户表体居中 */
.table tbody td { text-align: center; }

/* 用户表列宽与对齐优化 */
.user-table { table-layout: fixed; }
.user-table th,
.user-table td { vertical-align: middle; }
.user-table .col-username {
  text-align: center;
  width: 24%;
  max-width: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-table .col-role,
.user-table .col-created,
.user-table .col-actions { text-align: center; }
.user-table .col-role { width: 16%; }
.user-table .col-created { white-space: nowrap; width: 29%; }
.user-table .col-actions { width: 31%; }
/* 默认账户高亮（深色主题友好）：淡绿色背景 + 左侧强调线 */
.default-row {
  background-color: rgba(34,197,94,0.10);
  border-left: 3px solid var(--primary);
}
.default-row td {
  font-weight: 500;
  color: var(--text);
}
.published-row {
  background-color: rgba(34,197,94,0.15);
  border-left: 3px solid var(--primary);
}
.badge-published {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: rgba(34,197,94,0.12);
}

/* 账户列文本截断，避免过长影响其它列 */
.truncate-account {
  display: inline-block;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ann-wrap { overflow-x: hidden; }
.truncate-content {
  display: inline-block;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.table { width: 100%; }
.tab-active { background: #f0f0f0; border-radius: 8px; }

/* Mobile specific components */
.m-section { padding-bottom: 64px; }
.m-tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: space-around; padding: 8px; background: #ffffff; border-top: 1px solid #eeeeee; }
.m-tabs a { flex: 1; text-align: center; padding: 8px 10px; }
.m-card { background: #ffffff; border: 1px solid #dddddd; border-radius: 12px; padding: 14px; line-height: 1.5; }
.m-card-title { font-size: 20px; }
.m-card-row { margin-top: 6px; }
.badge-status { display: inline-block; padding: 2px 6px; font-size: 12px; border-radius: 6px; border: 1px solid #cccccc; color: #666666; background: #f5f5f5; }
.badge-status.pending { color: #b45309; border-color: #f59e0b; background: rgba(245,158,11,0.12); }
.badge-status.completed { color: var(--primary); border-color: var(--primary); background: rgba(34,197,94,0.12); }
.badge-status.rejected { color: var(--danger); border-color: var(--danger); background: rgba(239,68,68,0.12); }

.combo-option { padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.combo-option:hover { background: #e6f0ff; }
