/* opagent common.css — iOS 系统风格 */
/* 版本：每次改动版本号 +1（缓存击破） */
:root {
  --bg: #f2f2f7;
  --bg-2: #ffffff;
  --bg-3: #fafafc;
  --card: #ffffff;
  --text: #000000;
  --text-2: #3c3c43;
  --text-3: #8e8e93;
  --text-4: #c7c7cc;
  --blue: #007aff;
  --blue-2: #0a84ff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --pink: #ff2d55;
  --indigo: #5856d6;
  --sep: #e5e5ea;
  --sep-2: #d1d1d6;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 6px 20px rgba(0,0,0,0.06);
  --navbar-h: 44px;
  --tabbar-h: 50px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ====== 导航栏 ====== */
.navbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--navbar-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600;
  color: #000;
}
.navbar .nav-left, .navbar .nav-right {
  position: absolute; top: 0; height: 100%;
  display: flex; align-items: center; padding: 0 16px;
}
.navbar .nav-left { left: 0; }
.navbar .nav-right { right: 0; }
.navbar button.nav-btn {
  background: transparent; border: none;
  color: #000 !important;
  font-size: 15px; padding: 4px 8px;
}

/* ====== 主内容 ====== */
.page {
  max-width: 920px; margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(var(--safe-bottom) + 24px);
  min-height: calc(100vh - var(--navbar-h));
}
.page-title { font-size: 28px; font-weight: 700; margin: 8px 4px 16px; }
.page-sub { font-size: 13px; color: var(--text-3); margin: -8px 4px 16px; }

/* ====== 卡片 ====== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 13px; color: var(--text-3); margin-bottom: 8px; }
.card-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 0.5px solid var(--sep); }
.card-row:first-of-type { border-top: none; }

/* ====== 按钮 ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--blue); color: #fff !important;
  border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 15px; font-weight: 500;
  transition: opacity .15s, transform .05s;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn-secondary { background: var(--bg); color: var(--blue) !important; border: 0.5px solid var(--sep-2); }
.btn-danger { background: var(--red); }
.btn-success { background: var(--green); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }

/* ====== 输入 ====== */
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-3);
  border: 0.5px solid var(--sep);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px; color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--blue); }
.textarea { min-height: 90px; resize: vertical; }
.field-label { font-size: 13px; color: var(--text-2); margin-bottom: 6px; display: block; font-weight: 500; }
.field { margin-bottom: 14px; }

/* ====== 列表组（iOS Inset Grouped） ====== */
.list-group {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.list-section-header {
  font-size: 13px; color: var(--text-3);
  padding: 16px 4px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.list-item {
  display: flex; align-items: center;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--sep);
  min-height: 44px;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 15px; font-weight: 500; }
.list-item .li-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.list-item .li-right { color: var(--text-3); font-size: 13px; }

/* ====== 徽章 ====== */
.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--bg); color: var(--text-2);
}
.badge-blue   { background: rgba(0,122,255,0.12);  color: var(--blue); }
.badge-green  { background: rgba(52,199,89,0.14);  color: var(--green); }
.badge-orange { background: rgba(255,149,0,0.16);  color: var(--orange); }
.badge-red    { background: rgba(255,59,48,0.14);  color: var(--red); }
.badge-purple { background: rgba(175,82,222,0.14); color: var(--purple); }
.badge-gray   { background: var(--bg); color: var(--text-3); }

/* ====== 切换开关 ====== */
.switch { position: relative; width: 51px; height: 31px; }
.switch input { display: none; }
.switch .slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--sep-2); border-radius: 999px;
  transition: 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 27px; width: 27px;
  left: 2px; top: 2px; background: #fff; border-radius: 50%;
  transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ====== Modal ====== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  padding: 14px 16px; border-bottom: 0.5px solid var(--sep);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600;
}
.modal-body { padding: 16px; }
.modal-footer {
  padding: 12px 16px; border-top: 0.5px solid var(--sep);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ====== Toast ====== */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(0,0,0,0.78); color: #fff;
  padding: 10px 16px; border-radius: 10px;
  font-size: 14px; z-index: 200;
  animation: fadein .2s;
  max-width: 80vw;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ====== 表格 ====== */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); font-size: 13px;
}
.table th, .table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 0.5px solid var(--sep);
  white-space: nowrap;
}
.table th { background: var(--bg); font-weight: 600; color: var(--text-2); }
.table tr:hover td { background: var(--bg-3); }
.table td .truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* ====== 工具 ====== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-3 { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.fw-6 { font-weight: 600; }
.fw-7 { font-weight: 700; }
.divider { height: 0.5px; background: var(--sep); margin: 12px 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.loading { padding: 40px 16px; text-align: center; color: var(--text-3); }

/* ====== 危险标记 ====== */
.sensitive-tag {
  display: inline-block;
  background: var(--red); color: #fff;
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
  margin: 2px 4px 2px 0;
}
.sensitive-tag.s2 { background: var(--orange); }
.sensitive-tag.s1 { background: #ffd60a; color: #000; }

/* ====== 响应式 ====== */
@media (max-width: 600px) {
  .page { padding: 12px; }
  .page-title { font-size: 22px; }
  .table th, .table td { padding: 8px; font-size: 12px; }
}
