/* ============================================================
   海岸学堂 管理后台样式（统一侧边导航 · 简洁管理风）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #333;
  background: #F2F6FA;
}
.hidden { display: none !important; }
a { text-decoration: none; color: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #EAF6FF 0%, #CDEBFA 60%, #A8D8F0 100%);
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 44px 40px 36px;
  box-shadow: 0 18px 50px rgba(46, 90, 136, .25);
  text-align: center;
}
.login-logo { font-size: 56px; }
.login-card h1 { font-size: 24px; margin-top: 8px; }
.login-sub { color: #8aa; margin: 6px 0 24px; font-size: 13px; }
.login-card label { display: block; text-align: left; margin: 14px 0 6px; font-weight: 600; }
.login-card input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #DCE6EE;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.login-card input:focus { border-color: #56A7E8; }
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 11px 26px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-main {
  width: 100%;
  margin-top: 26px;
  background: linear-gradient(90deg, #56A7E8, #2E7DB8);
  color: #fff;
}
.btn-main.btn-fit { width: auto; margin-top: 0; }
.btn-main:hover { opacity: .92; }
.btn-plain { background: #EAF2F9; color: #2E5A88; }
.btn-danger { background: #F56B4E; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.login-msg { margin-top: 14px; color: #E0483E; font-size: 13px; min-height: 18px; }

/* ---------- 整体布局 ---------- */
.main { display: flex; min-height: 100vh; }

/* ---------- 侧边导航（统一） ---------- */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #2E5A88, #1F3F63);
  color: #DCE9F5;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}
.brand { padding: 22px 20px 18px; font-size: 17px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand b { color: #fff; }
.brand small { display: block; margin-top: 4px; font-size: 12px; color: #9FBBD6; }
.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-item {
  display: block;
  padding: 12px 16px;
  margin-bottom: 4px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: #56A7E8; color: #fff; font-weight: 700; }
.sidebar-foot {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar-ai-link{margin-left:auto;padding:8px 14px;border-radius:9px;background:#eef5fb;color:#2e5a88;font-size:13px;font-weight:700}.topbar-ai-link.active{background:#56a7e8;color:#fff}.field small{display:block;margin-top:6px;color:#80909d;font-size:12px;line-height:1.5}
.sidebar-foot a { color: #FFC7B8; }

/* ---------- 内容区 ---------- */
.content {
  flex: 1;
  margin-left: 220px;
  padding: 24px 30px 60px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.topbar h1 { font-size: 22px; color: #1F3F63; }
.page-hint { color: #748895; margin: -5px 0 18px; line-height: 1.7; }

/* 卡片 */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 2px 10px rgba(31, 63, 99, .06);
  margin-bottom: 20px;
}
.card h3 { font-size: 16px; margin-bottom: 16px; color: #1F3F63; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(31, 63, 99, .06);
  border-left: 5px solid #56A7E8;
}
.stat-card .num { font-size: 30px; font-weight: 800; color: #1F3F63; }
.stat-card .label { margin-top: 6px; color: #8aa; font-size: 13px; }
.stat-card.c2 { border-left-color: #FF8B6B; }
.stat-card.c3 { border-left-color: #7CC7A8; }
.stat-card.c4 { border-left-color: #FFD166; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: #9aa; margin-top: 5px; line-height: 1.6; }
.field input, .field input[type=text], .field input[type=password], .field input[type=number], .field select, .field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 2px solid #DCE6EE;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.field input:focus, .field select:focus { border-color: #56A7E8; }
.field-wide { grid-column: 1 / -1; }
.settings-image-preview{display:flex;align-items:center;gap:14px;min-height:74px;margin-top:12px;padding:10px;border:1px dashed #cdd9e2;border-radius:8px;background:#f8fafb;color:#81919d;font-size:12px}.settings-image-preview img{width:96px;height:96px;object-fit:contain;border-radius:6px;background:#fff}.settings-image-preview.share-preview img{width:150px;height:120px}
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.switch input { display: none; }
.slider {
  position: absolute; inset: 0;
  background: #CBD8E4;
  border-radius: 26px;
  transition: .2s;
}
.slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: #56A7E8; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.form-actions { margin-top: 22px; }
.msg { margin-top: 12px; font-size: 13px; }
.msg.ok { color: #2E9E63; }
.msg.err { color: #E0483E; }

/* 试听 */
.voice-test { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.voice-test input { flex: 1; min-width: 260px; padding: 10px 13px; border: 2px solid #DCE6EE; border-radius: 10px; }
.voice-test audio { height: 40px; margin-top: 10px; width: 100%; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #EEF2F6; }
.tbl th { background: #F7FAFD; color: #5b7894; font-weight: 700; white-space: nowrap; }
.tbl tr:hover td { background: #FBFDFF; }
.tbl .mono { font-family: Consolas, monospace; font-size: 12px; color: #5b7894; }
.table-input { min-width: 190px; padding: 8px 10px; border: 1px solid #dce6ee; border-radius: 8px; outline: none; }
.table-input:focus { border-color: #56a7e8; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: #EAF2F9; color: #2E5A88;
}
.badge.ok { background: #E3F4EC; color: #1F6B3E; }
.badge.warn { background: #FFF3D6; color: #8a6d1a; }
.badge.bad { background: #FFE9E0; color: #B33A22; }

/* 分页 */
.pager { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.pager button { padding: 5px 14px; border: 1px solid #DCE6EE; background: #fff; border-radius: 8px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .info { color: #8aa; font-size: 13px; }

/* 标签页 */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab {
  padding: 8px 20px;
  border-radius: 20px;
  background: #EAF2F9;
  color: #2E5A88;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}
.tab.active { background: #56A7E8; color: #fff; }

/* 空态 / 加载 */
.empty { text-align: center; color: #9aa; padding: 40px 0; }
.loading { text-align: center; color: #9aa; padding: 30px 0; }

/* 练字字库管理 */
.library-toolbar { display: flex; align-items: end; gap: 26px; flex-wrap: wrap; }
.image-vocab-toolbar{gap:14px 18px}.image-vocab-toolbar .compact-field{width:190px}.image-vocab-toolbar .count-field{width:120px}.image-vocab-toolbar .compact-field label{color:#526979;font-size:13px}.image-vocab-toolbar .compact-field select,.image-vocab-toolbar .compact-field input{height:42px}.image-vocab-toolbar>.btn{height:42px}.image-vocab-toolbar>.msg{flex:1;min-width:220px;margin:0 0 10px}
.library-select label { display: block; margin-bottom: 7px; font-weight: 700; }
.library-select select, .library-select input, .grade-edit input {
  height: 40px; padding: 0 12px; border: 2px solid #dce6ee; border-radius: 9px; background: #fff; outline: none;
}
.library-select select { min-width: 150px; }
.library-select .batch-count-input { width: 110px; }
.library-select input:focus { border-color: #56A7E8; }
.grade-edit { display: flex; align-items: center; gap: 9px; }
.grade-edit input:first-child { width: 130px; }
.grade-edit input[type=number] { width: 80px; }
.editor-head, .table-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.editor-head span, .table-title span { color: #8294a0; font-size: 12px; }
.char-form { display: grid; grid-template-columns: 110px 1fr 1fr 110px; gap: 14px 18px; }
.char-form .field-wide { grid-column: span 2; }
.editor-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.editor-actions .btn-main { width: auto; margin-top: 0; }
.table-wrap { overflow-x: auto; }
.table-title h3 { margin-bottom: 12px; }
.char-cell { font-family: "KaiTi", "STKaiti", serif; font-size: 24px; font-weight: 700; }
.order-cell { min-width: 180px; max-width: 320px; color: #607887; }
.actions { white-space: nowrap; }
.actions .btn + .btn { margin-left: 6px; }
.row-disabled { opacity: .55; }
.cutaway-thumb{width:82px;height:58px;object-fit:cover;border-radius:8px;background:#edf1f4}.cutaway-wide{width:min(980px,100%);max-height:90vh;overflow:auto}.cutaway-image-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:18px}.cutaway-image-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.cutaway-image-card{display:grid;grid-template-columns:128px 1fr;gap:14px;padding:13px;border:1px solid #dfe8ee;border-radius:12px}.cutaway-image-card img{width:128px;height:112px;object-fit:cover;border-radius:9px;background:#edf1f4}.cutaway-image-card h4{margin:4px 0 6px}.cutaway-image-card p{color:#718493;font-size:12px;line-height:1.5}.cutaway-image-card .actions{margin-top:10px}.cutaway-placeholder{width:128px;height:112px;display:flex;align-items:center;justify-content:center;border-radius:9px;background:#edf1f4;color:#8fa0aa;font-size:12px}@media(max-width:900px){.cutaway-image-list{grid-template-columns:1fr}}
.vocab-word-list .cutaway-image-card{display:block}.vocab-word-list .empty{grid-column:1/-1}.vocab-word-list h4 small{font-weight:400;color:#718493}.vocab-word-list p{margin:5px 0;overflow-wrap:anywhere}
.toolbar-main { margin-left: auto; }
.record-toolbar { display: flex; align-items: center; justify-content: space-between; }
.record-toolbar select { min-width: 180px; padding: 10px 12px; border: 2px solid #dce6ee; border-radius: 9px; background: #fff; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(20, 38, 54, .48);
}
.modal-dialog { border-radius: 12px; background: #fff; padding: 24px; box-shadow: 0 24px 70px rgba(18, 38, 57, .28); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { color: #1f3f63; font-size: 18px; }
.icon-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #edf2f5; color: #547083; font-size: 24px; line-height: 30px; cursor: pointer; }
.modal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.modal-form .field-wide { grid-column: 1 / -1; }
.image-vocab-editor { width: min(1120px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; }
.image-vocab-editor .modal-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.image-vocab-editor .modal-form .field-wide { grid-column: span 2; }
.image-vocab-editor .modal-form .field-full { grid-column: 1 / -1; }
.modal-note { margin-top: 16px; padding: 10px 12px; border-left: 3px solid #65a5b3; background: #edf6f7; color: #657b86; font-size: 12px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions .msg { margin: 0 auto 0 0; }
@media (max-width: 900px) {
  .library-toolbar, .grade-edit { align-items: stretch; flex-direction: column; }
  .image-vocab-toolbar .compact-field,.image-vocab-toolbar .count-field{width:100%}.image-vocab-toolbar>.msg{min-width:0;margin:0}
  .image-vocab-editor .modal-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .image-vocab-editor .modal-form .field-full { grid-column: 1 / -1; }
  .toolbar-main { margin-left: 0; }
  .content { padding: 20px; }
}
@media (max-width: 680px) {
  .sidebar { width: 178px; }
  .content { margin-left: 178px; padding: 16px; }
  .modal-form { grid-template-columns: 1fr; }
  .modal-form .field-wide { grid-column: auto; }
  .image-vocab-editor .modal-form { grid-template-columns: 1fr; }
  .image-vocab-editor .modal-form .field-wide, .image-vocab-editor .modal-form .field-full { grid-column: auto; }
  .stat-grid { grid-template-columns: 1fr; }
}
