/* 四季合合 · 账号 API 工具（Web 版）— 扁平化舒适风格 */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e8ecf4;
  --text: #1f2430;
  --muted: #8a93a6;
  --primary: #4c7df0;
  --primary-2: #3b6ade;
  --primary-soft: #eef3ff;
  --ok: #2fa36b;
  --warn: #c8801f;
  --danger: #d9534f;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(31, 41, 70, 0.06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 17px; }
h2 { font-size: 15px; }
h3 { font-size: 16px; }

.muted { color: var(--muted); font-size: 12px; font-weight: 400; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 26px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #6a97ff, #4c7df0);
  color: #fff; font-size: 19px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(76, 125, 240, 0.28);
}

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

.top-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.segmented {
  display: inline-flex;
  padding: 3px;
  background: #eef1f8;
  border-radius: 12px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 16px;
  border-radius: 9px;
  font: inherit;
  cursor: pointer;
  transition: all .15s ease;
}

.segmented button.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(31, 41, 70, 0.08);
}

.field-inline { display: flex; align-items: center; gap: 8px; }
.field-inline label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.field-inline.small input { width: 68px; }

/* 布局 */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 26px 30px;
  align-items: start;
}

.accounts { grid-column: 1 / -1; }
.ops { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.logs { grid-column: 1 / -1; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .accounts, .ops, .logs { grid-column: 1; }
}

/* 平板 / 手机 */
@media (max-width: 900px) {
  .topbar { padding: 12px 16px; }
  .brand h1 { font-size: 15px; }
  .brand .logo { width: 36px; height: 36px; font-size: 17px; }
  .top-actions { width: 100%; }
  .segmented { flex: 1; }
  .segmented button { flex: 1; text-align: center; }
  .field-inline { width: 100%; }
  .field-inline input { flex: 1; }
}

/* 手机 */
@media (max-width: 640px) {
  .layout { padding: 12px 10px 24px; gap: 14px; }
  .card { padding: 12px; border-radius: 14px; }
  .card-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .row-actions { width: 100%; }
  .row-actions .btn { flex: 1 1 auto; }
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .form-grid .actions { flex-direction: row; padding-bottom: 0; }
  .form-grid .actions .btn { flex: 1; }
  .give-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .give-bar .field-inline { width: 100%; }
  .give-bar .btn { width: 100%; }
  .search { width: 100%; }
  .modal { width: 92vw; padding: 18px; }
  .table-wrap { border-radius: 10px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 8px; }
  .w-idx { width: 34px; }
  .hint { font-size: 11px; }
}

input, select, textarea { min-width: 0; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

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

/* 按钮 */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}

.btn:hover { background: #f7f9fd; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); border-color: #f3d3d2; background: #fff7f7; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 13px;
}
.icon-btn:hover { background: #fff2f1; color: var(--danger); }

/* 输入 */
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcff;
  color: var(--text);
  padding: 9px 11px;
  border-radius: 10px;
  font: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

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

textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.search { width: 180px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 12px; }
.field .inline { display: flex; gap: 8px; }
.field .inline input { flex: 1; }

.form-grid {
  display: grid;
  grid-template-columns: 1.4fr .7fr;
  gap: 14px;
  align-items: end;
}
.form-grid .actions { display: flex; gap: 8px; padding-bottom: 12px; }

/* 表格 */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); }

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

thead th {
  position: sticky;
  top: 0;
  background: #f8faff;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}

tbody td { padding: 9px 12px; border-bottom: 1px solid #f1f4fa; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background .12s ease; }
tbody tr:hover { background: #f8faff; }
tbody tr.active { background: var(--primary-soft); }
tbody tr.active td { color: #24408f; }

th.num, td.num { text-align: right; }
th.w-idx { width: 46px; }
th.w-check { width: 40px; }
th.w-id { width: 96px; }
th.w-act { width: 54px; }

.frag-wrap { max-height: 440px; }
.frag-wrap tbody tr { cursor: default; }

/* 进度 */
.progress {
  height: 8px;
  border-radius: 999px;
  background: #eef1f8;
  overflow: hidden;
  margin-top: 6px;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6a97ff, #4c7df0);
  transition: width .25s ease;
}

.status { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

/* 赠送栏 */
.give-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* 日志 */
.logs pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0f1524;
  color: #cfe0ff;
  font: 12px/1.7 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 27, 45, 0.35);
  backdrop-filter: blur(2px);
}

.modal-mask.show { display: flex; }

.modal {
  width: min(460px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(20, 27, 45, 0.25);
}

.modal.wide { width: min(640px, 100%); }
.modal h3 { margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.radio-row { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.radio-row label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 12px;
  background: #1f2430;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s ease;
  z-index: 80;
  max-width: 78vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b23a36; }
.toast.warn { background: #a9701b; }
.toast.ok { background: #237a52; }

/* 提示条 */
.hint { margin: 10px 2px 0; color: var(--muted); font-size: 12px; }
