:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --card-border: #e8ecf1;
  --text: #1e2a3a;
  --text-secondary: #6b7a8f;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --tab-bg: #ffffff;
  --tab-active: #3b82f6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
#app { width: min(1480px, 100%); margin: 0 auto; padding: 0 16px 80px; display: grid; grid-template-columns: 210px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 16px; }
#topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 16px 0 0; }
#topbar h1 { font-size: 20px; font-weight: 700; }
.topbar-subtitle { margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-actions a { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.topbar-actions a:hover { color: var(--accent); }
.badge { font-size: 11px; padding: 4px 10px; border-radius: 20px; font-weight: 600; }
.badge-on { background: #dcfce7; color: #166534; }
.badge-off { background: #fee2e2; color: #991b1b; }
.badge-warn { background: #fef3c7; color: #92400e; }
#tabbar { position: sticky; top: 12px; align-self: start; display: flex; flex-direction: column; gap: 4px; background: var(--tab-bg); border-radius: var(--radius); padding: 8px; overflow: visible; box-shadow: var(--shadow); max-height: calc(100vh - 96px); }
.tab { width: 100%; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 10px; border: none; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--text-secondary); transition: all .15s; text-align: left; }
.tab span { width: 20px; text-align: center; }
.tab:hover { background: #f0f2f5; }
.tab.active { background: var(--accent); color: #fff; }
main#content { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h3 { font-size: 15px; margin-bottom: 10px; }
.slot { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f2f5; }
.slot-time { font-weight: 700; font-size: 15px; min-width: 50px; }
.slot-subj { flex: 1; font-size: 13px; }
.slot-status { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.status-sent { background: #dcfce7; color: #166534; }
.status-pending { background: #f0f2f5; color: #6b7a8f; }
.status-sending { background: #fef9c3; color: #854d0e; }
.status-missed { background: #fee2e2; color: #991b1b; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #f0f2f5; }
th { font-weight: 600; color: var(--text-secondary); font-size: 11px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; font-family: var(--font); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
textarea { resize: vertical; min-height: 60px; }
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: var(--text); }
.btn-outline:hover { background: #f0f2f5; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
#modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
#modal-box { background: #fff; border-radius: var(--radius); max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; padding: 24px; position: relative; }
#modal-close { position: absolute; top: 12px; right: 16px; font-size: 24px; cursor: pointer; color: var(--text-secondary); }
.hidden { display: none !important; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width:860px) {
  #app { display: block; padding: 0 12px 80px; }
  #topbar { align-items: flex-start; gap: 10px; }
  .topbar-actions { justify-content: flex-start; }
  #tabbar { position: static; flex-direction: row; overflow-x: auto; margin: 12px 0 16px; max-height: none; }
  .tab { width: auto; min-width: 92px; justify-content: center; padding: 8px 10px; font-size: 12px; }
}
@media (max-width:600px) { .row { grid-template-columns: 1fr; } #topbar { flex-direction: column; } }
.log-box { background: #1e2a3a; color: #e2e8f0; font-family: "Cascadia Code", "Fira Code", monospace; font-size: 12px; padding: 12px; border-radius: 6px; height: 300px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.text-sm { font-size: 12px; color: var(--text-secondary); }
.text-success { color: var(--success); font-weight: 600; }
.text-danger { color: var(--danger); font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.copy-cat { margin-bottom: 16px; }
.copy-cat-title { font-weight: 600; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #f0f2f5; margin-bottom: 6px; }
.copy-item { padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 6px; align-items: flex-start; }
.copy-item:hover { background: #f8f9fb; }
.copy-item .key { font-family: monospace; font-size: 11px; color: var(--accent); min-width: 55px; }
.copy-item .val { font-size: 12px; word-break: break-all; }

/* Pack list styles */
.pack-list { font-size: 13px; }
.pack-item:hover { background: #f0f2f5; }
.pack-item input[type="checkbox"] { cursor: pointer; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-ghost { background: transparent; border: 1px solid #ddd; color: #999; }
.recall-step-tabs { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 8px; margin: 12px 0 14px; }
.recall-step-tab { border: 1px solid var(--card-border); background: #fff; color: var(--text-secondary); border-radius: 8px; min-height: 42px; padding: 8px 10px; font-weight: 700; cursor: pointer; text-align: center; }
.recall-step-tab:hover { border-color: var(--accent); color: var(--accent); background: #f8fbff; }
.recall-step-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 14px rgba(45, 121, 255, 0.18); }
.recall-section { display: none; }
.recall-section.active { display: block; }
.recall-panel { max-width: 980px; }
.recall-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.recall-builder { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr; gap: 8px; align-items: end; }
.recall-builder .form-group { margin-bottom: 8px; }
.command-list { display: grid; grid-template-columns: 1fr; gap: 6px; }
.command-list code { display: block; padding: 7px 9px; border: 1px solid var(--card-border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 12px; white-space: normal; word-break: break-word; }
.backend-op-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.backend-op-section { margin-top: 4px; }
.ops-subsection { border: 1px solid #e8ecf1; border-radius: 8px; padding: 12px; margin: 12px 0; background: #fbfcfe; }
.ops-subtitle { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.permission-list { border: 1px solid var(--card-border); border-radius: 6px; padding: 8px; background: #fff; }
.permission-dual { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.permission-panel { min-width: 0; border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; background: #fff; }
.permission-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-weight: 700; font-size: 13px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.permission-panel-head span { color: var(--text-muted); font-weight: 500; }
.permission-box { height: 340px; overflow: auto; padding: 6px 10px; }
.permission-row { display: flex; align-items: center; gap: 8px; min-height: 30px; border-bottom: 1px solid #eef2f7; font-size: 13px; cursor: pointer; }
.permission-row:last-child { border-bottom: 0; }
.permission-row input { width: auto; }
.permission-row span { display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.permission-row em { font-style: normal; color: var(--text-muted); font-size: 12px; font-weight: 400; }
.permission-row small { color: var(--text-muted); margin-left: auto; font-size: 12px; }
@media (max-width: 820px) { .permission-dual { grid-template-columns: 1fr; } }
@media (max-width:1100px) { .recall-step-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width:1100px) { .recall-builder { grid-template-columns: 1fr 1fr; } }
@media (max-width:600px) { .recall-step-tabs { grid-template-columns: 1fr; } }
@media (max-width:600px) { .recall-builder { grid-template-columns: 1fr; } }
.shortlink-replay-toolbar { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; }
.shortlink-replay-controls { display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; }
.shortlink-replay-controls label { display:flex; gap:6px; align-items:center; font-size:12px; color:var(--text-secondary); }
.shortlink-replay-controls select { width:110px; }
#slr-creator { width:170px; }
.shortlink-replay-controls input { width:72px; }
.shortlink-replay-table { min-width:1050px; }
.shortlink-replay-table td { vertical-align:top; }
.shortlink-replay-link { display:grid; grid-template-columns:minmax(220px,1fr) 64px 20px; gap:8px; align-items:center; margin-bottom:4px; }
.shortlink-replay-link a { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.shortlink-replay-link b { color:#16a34a; text-align:right; }
.shortlink-status-pass,.shortlink-status-wait { display:inline-block; padding:3px 8px; border-radius:999px; font-size:11px; font-weight:700; }
.shortlink-status-pass { background:#dcfce7; color:#166534; }
.shortlink-status-wait { background:#fff7ed; color:#9a3412; }
