/* 班级看板 · 运营者后台（admin.hhhlll.xyz）自包含样式
 * 配色沿用 src/web/css/app.css 的 M3 深绿 + 青柠主色；本文件不依赖任何外部资源。
 * 该文件与 index.html / js/admin.js 一起由 deploy.sh 复制到 /var/www/classboard/admin-page/。
 */

:root {
  --bg1: #1F3B2C;
  --bg2: #24422F;
  --card: #2E4A38;
  --card2: #33523F;
  --ink: #FFFFFF;
  --sub: #C9D8CC;
  --hi: #C6E86B;
  --line: rgba(255, 255, 255, .12);
  --danger: #E8837A;
  --warn: #F0C36D;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "微软雅黑", "Source Han Sans SC", sans-serif;
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
.hidden, [hidden] { display: none !important; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 22px;
  background: rgba(31, 59, 44, .95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { font-size: 18px; font-weight: 800; letter-spacing: .6px; white-space: nowrap; }
.brand-mark { color: var(--hi); margin-right: 6px; }
.topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.operator-name { font-size: 13px; color: var(--hi); white-space: nowrap; }
.expires-at { font-size: 12px; color: var(--sub); white-space: nowrap; }

/* ---------------- 通用容器 ---------------- */
.workspace { max-width: 1160px; margin: 0 auto; padding: 20px 18px 64px; }
.view { display: block; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card-title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 1em;
  border-radius: 3px;
  background: var(--hi);
}
.sub-title { font-size: 15px; font-weight: 700; margin: 22px 0 8px; color: var(--hi); }
.hint { font-size: 12px; color: var(--sub); margin: 0 0 12px; }
em { color: var(--danger); font-style: normal; }

/* ---------------- 表单 ---------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin-bottom: 14px;
}
.form-grid .field-wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 13px; color: var(--sub); }
.field-tip { font-size: 11px; color: var(--sub); opacity: .85; }
input, textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--hi); }
input::placeholder { color: rgba(201, 216, 204, .55); }
input[type="number"] { color-scheme: dark; }
select { cursor: pointer; }

.subject-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px 6px;
  margin: 0 0 14px;
}
.subject-fieldset legend { font-size: 13px; color: var(--sub); padding: 0 6px; }
.subject-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card2);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.check-chip:hover { border-color: var(--hi); }
.check-chip input { width: auto; margin: 0; accent-color: var(--hi); cursor: pointer; }

.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.btn {
  font-family: inherit;
  font-size: 14px;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: opacity .16s, transform .16s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--hi);
  color: #1F3B2C;
  font-weight: 700;
  border-color: var(--hi);
}
.btn-secondary { background: var(--card2); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--sub); border-color: var(--line); }
.btn-link {
  background: transparent;
  color: var(--hi);
  border: none;
  padding: 4px 6px;
  font-size: 13px;
  text-decoration: underline;
}
.btn-block { width: 100%; margin-top: 6px; }
.btn.is-busy { opacity: .65; }

.notice {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin: 10px 0;
  background: rgba(198, 232, 107, .10);
  border: 1px solid var(--hi);
  color: var(--hi);
  line-height: 1.55;
}
.notice.error {
  background: rgba(232, 131, 122, .12);
  border-color: var(--danger);
  color: var(--danger);
}
.danger-banner {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  background: rgba(232, 131, 122, .14);
  border: 1px solid var(--danger);
  color: var(--danger);
  line-height: 1.6;
}
.danger-banner strong { color: #FFD9D3; }

/* ---------------- 登录 ---------------- */
.view-login { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 60px); padding: 24px; }
.login-wrap { width: 100%; max-width: 430px; }
.login-header { margin-bottom: 18px; }
.login-title { font-size: 25px; font-weight: 800; letter-spacing: 1px; }
.login-sub { margin-top: 8px; color: var(--sub); font-size: 12px; line-height: 1.7; }
.login-card { display: flex; flex-direction: column; gap: 4px; padding: 22px; }
.login-card .field { margin-bottom: 12px; }
.login-foot { text-align: center; color: var(--sub); font-size: 11px; margin: 14px 0 0; }

/* ---------------- 分区标签 ---------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(46, 74, 56, .7);
  color: var(--sub);
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active { border-color: var(--hi); color: var(--hi); background: rgba(198, 232, 107, .10); font-weight: 700; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: top;
}
.data-table th { background: rgba(0, 0, 0, .18); color: var(--sub); font-weight: 700; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, .04); }
.data-table td.mono, .mono { font-family: Consolas, "Courier New", monospace; letter-spacing: .3px; }
.data-table .secret { color: var(--hi); font-weight: 700; }
.data-table .row-owner { background: rgba(198, 232, 107, .07); }
.empty { text-align: center; color: var(--sub); font-size: 13px; padding: 18px 0; }
.data-table .empty-cell { text-align: center; color: var(--sub); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.pager-info { font-size: 13px; color: var(--sub); }

/* ---------------- 列表工具栏 ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"] { flex: 1 1 260px; }
.toolbar select { flex: 0 0 140px; }

/* ---------------- 开通单 / 打印 ---------------- */
.kv-line { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 12px; color: var(--sub); margin-bottom: 14px; }
.kv-line b { color: var(--ink); font-weight: 700; }
.sheet-printable { background: rgba(0, 0, 0, .12); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.sheet-heading { font-size: 17px; font-weight: 800; margin: 0 0 8px; }
.sheet-warning { font-size: 12px; color: var(--warn); margin: 0 0 12px; line-height: 1.6; }
.sheet-foot { font-size: 12px; color: var(--sub); margin: 12px 0 0; }
.sheet-table { min-width: 900px; }
.sheet-table th, .sheet-table td { white-space: nowrap; }

/* ---------------- 详情 ---------------- */
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-head .card-title { margin-bottom: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.summary-item {
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card2);
  min-width: 0;
  font-size: 13px;
}
.summary-item .k { flex: 0 0 108px; color: var(--sub); }
.summary-item .v { flex: 1; word-break: break-all; white-space: normal; }
.secret-panel { margin-top: 14px; padding: 14px; border: 1px dashed var(--danger); border-radius: 10px; }
.secret-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 8px 0; }
.secret-label { font-size: 12px; color: var(--sub); flex: 0 0 110px; }
.secret-value {
  font-family: Consolas, "Courier New", monospace;
  font-size: 17px;
  font-weight: 700;
  color: #1F3B2C;
  background: var(--hi);
  padding: 5px 12px;
  border-radius: 8px;
  user-select: all;
  word-break: break-all;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 14px);
  z-index: 50;
  max-width: 86vw;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(20, 36, 26, .97);
  color: #fff;
  border: 1px solid var(--line);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { border-color: var(--hi); color: var(--hi); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 760px) {
  .topbar { padding: 11px 14px; flex-wrap: wrap; }
  .brand { font-size: 16px; }
  .expires-at { display: none; }
  .workspace { padding: 14px 12px 48px; }
  .card { padding: 15px; }
  .form-grid, .summary-grid { grid-template-columns: 1fr; }
  .toolbar input[type="search"] { flex: 1 1 100%; }
  .view-login { min-height: calc(100vh - 56px); padding: 16px; }
}

/* ---------------- 打印：只输出开通单 ---------------- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  body * { visibility: hidden !important; }
  #sheet-print, #sheet-print * { visibility: visible !important; }
  #sheet-print {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0;
    border: none;
    background: #fff !important;
    color: #000 !important;
  }
  .topbar, .tabs, .no-print, .toast, #view-login, #view-tenants, #view-detail { display: none !important; }
  .sheet-heading, .sheet-warning, .sheet-foot, .data-table th, .data-table td { color: #000 !important; }
  .sheet-warning { font-weight: 700; }
  .data-table { min-width: 0; }
  .data-table th, .data-table td {
    border: 1px solid #333 !important;
    background: #fff !important;
    color: #000 !important;
    white-space: normal;
    word-break: break-all;
  }
  .data-table .secret, .data-table .row-owner { color: #000 !important; background: #fff !important; }
  .table-wrap { overflow: visible; border: none; }
}
