


.theme-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--c-border);
}
.theme-row:last-of-type { border-bottom: 0; }
.theme-label { flex: 1; min-width: 0; }
.theme-label .tl-name {
  display: block;
  font-size: 14px; font-weight: 500;
  color: var(--c-text);
  font-family: var(--font-serif);
  letter-spacing: 0.5px;
}
.theme-label .tl-desc {
  display: block; font-size: 11px; color: var(--c-text-3);
  margin-top: 2px;
}
.theme-input {
  display: flex; align-items: center; gap: 8px;
}
.theme-input input[type="color"] {
  width: 48px; height: 36px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: #fff;
}
.theme-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.theme-input input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.theme-input code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px; color: var(--c-text-2);
  background: var(--c-bg-soft);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  letter-spacing: 0.5px;
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 860px) { .preset-grid { grid-template-columns: repeat(2, 1fr); } }
.preset-tile {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.preset-tile:hover {
  border-color: var(--c-gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.preset-tile .pt-preview {
  position: relative;
  height: 48px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid var(--c-border);
}
.preset-tile .pt-bg {
  position: absolute; inset: 0;
}
.preset-tile .pt-bar {
  position: absolute; left: 6px; right: 6px; top: 22px;
  height: 8px; border-radius: 4px;
}
.preset-tile .pt-dot {
  position: absolute; top: 6px;
  width: 8px; height: 8px; border-radius: 50%;
}
.preset-tile .pt-dot:nth-of-type(2) { right: 6px; }
.preset-tile .pt-dot:nth-of-type(3) { right: 18px; }
.preset-tile .pt-name {
  font-size: 12px; color: var(--c-text-2);
  font-family: var(--font-serif);
  letter-spacing: 0.5px;
}

.theme-preview {
  display: flex; gap: 16px;
  flex-wrap: wrap;
}
.tp-card {
  flex: 1; min-width: 280px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.tp-title {
  font-family: var(--font-serif);
  font-size: 16px; font-weight: 500;
  color: var(--c-text);
}
.tp-meta {
  font-size: 12px; color: var(--c-text-3);
  margin-top: 4px;
}
.tp-btn { font-size: 12px; padding: 5px 12px; }
.tp-divider {
  height: 1px; background: var(--c-border);
  margin: 12px 0;
}

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--c-text-2); margin-bottom: 4px; }
.form-row .req::after { content: ' *'; color: var(--c-gold); font-weight: 600; }
.txt, select.txt, textarea.txt {
  width: 100%; padding: 10px 14px; border: 1px solid var(--c-border);
  border-radius: 10px; font-size: 13px;
  font-family: inherit; outline: none; background: #FFFFFF;
  transition: all .2s; color: var(--c-text);
  box-shadow: 0 1px 2px rgba(139, 115, 85, 0.03);
}
.txt:focus { border-color: var(--c-gold); box-shadow: 0 0 0 3px rgba(200, 169, 119, 0.12); }


.dpick-wrap { position: relative; display: inline-block; }
.dpick {
  cursor: pointer; padding-right: 34px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.dpick::after {
  content: "";
  position: absolute; right: 12px; top: 50%;
  width: 14px; height: 14px; margin-top: -8px; opacity: .45;
  background: currentColor;
  -webkit-mask: no-repeat center/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='1'/%3E%3Cpath d='M8 3v4M16 3v4M3 11h18'/%3E%3C/svg%3E");
  mask: no-repeat center/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='1'/%3E%3Cpath d='M8 3v4M16 3v4M3 11h18'/%3E%3C/svg%3E");
  pointer-events: none;
}
.dpick:focus { border-color: var(--c-gold); box-shadow: 0 0 0 3px rgba(200, 169, 119, 0.12); }
.dpick.dpick-empty { color: var(--c-text-3); }

.dpick-pop {
  
  position: fixed; z-index: 9000; top: 0; left: 0;
  width: 268px; padding: 14px;
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.14);
  font-size: 13px; color: var(--c-text);
  display: none; user-select: none;
}
.dpick-pop.open { display: block; }

.dpick-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.dpick-hd button {
  width: 26px; height: 26px; border: 0; background: transparent;
  color: var(--c-text-2); cursor: pointer; border-radius: 6px; font-size: 15px;
}
.dpick-hd button:hover { background: var(--c-bg-soft); color: var(--c-text); }
.dpick-hd .dpick-title { font-size: 14px; font-weight: 500; }

.dpick-wk, .dpick-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dpick-wk { margin-bottom: 4px; }
.dpick-wk span {
  text-align: center; font-size: 11px; color: var(--c-text-3); padding: 3px 0;
}
.dpick-grid b {
  display: flex; align-items: center; justify-content: center;
  height: 30px; font-size: 12px; font-weight: 400; border-radius: 6px;
  cursor: pointer; color: var(--c-text);
  user-select: none; -webkit-user-select: none;   
}
.dpick-grid b:hover { background: var(--c-bg-soft); }
.dpick-grid b.other { color: var(--c-text-3); opacity: .45; }
.dpick-grid b.today { box-shadow: inset 0 0 0 1px var(--c-gold); }
.dpick-grid b.sel { background: var(--c-primary); color: var(--c-card); }
.dpick-grid b.sel.today { box-shadow: none; }
.dpick-ft { display: flex; justify-content: space-between; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--c-border); }
.dpick-ft button {
  border: 0; background: transparent; color: var(--c-text-2);
  font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.dpick-ft button:hover { color: var(--c-gold); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--c-border); font-size: 13px; }
.tbl th { background: var(--c-bg-soft); font-weight: 600; color: var(--c-text-2); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.tbl tbody tr:hover { background: var(--c-gold-soft); }

.badge {
  display: inline-block; padding: 2px 10px; font-size: 11px;
  border-radius: 10px; background: var(--c-bg-soft); color: var(--c-text-2);
  font-weight: 500;
}
.badge-success { background: rgba(107, 142, 90, 0.12); color: #4A6741; }
.badge-warn { background: rgba(182, 139, 62, 0.15); color: #8A6B2E; }
.badge-danger { background: rgba(160, 59, 59, 0.12); color: #802E2E; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; border: 1px solid; }
.alert-info { background: rgba(43, 127, 255, 0.06); color: #1E40AF; border-color: rgba(43, 127, 255, 0.2); }
.alert-warn { background: rgba(182, 139, 62, 0.08); color: #8A6B2E; border-color: rgba(182, 139, 62, 0.25); }


.modal-mask {
  position: fixed; inset: 0; background: rgba(42, 42, 42, 0.35);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: #FFFFFF; border-radius: 18px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(42, 42, 42, 0.18), 0 4px 12px rgba(42, 42, 42, 0.08);
  border: 1px solid rgba(200, 169, 119, 0.15);
}
.modal.lg { max-width: 800px; }
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 16px; font-family: var(--font-serif);
  background: linear-gradient(180deg, #FAF8F5 0%, #FFFFFF 100%);
  border-radius: 18px 18px 0 0;
}
.modal-close { background: none; border: none; cursor: pointer; color: var(--c-text-3); font-size: 20px; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--c-bg-soft); color: var(--c-primary); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--c-border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--c-bg-soft);
  border-radius: 0 0 18px 18px;
}


.class-card { display: flex; align-items: center; gap: 16px; }
.class-card .avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--c-primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; flex-shrink: 0;
}
.class-card .info { flex: 1; min-width: 0; }
.class-card .name { font-size: 16px; font-weight: 600; }
.class-card .meta { color: var(--c-text-3); font-size: 12px; margin-top: 2px; }
.class-card .actions { display: flex; gap: 6px; flex-shrink: 0; }

.empty {
  text-align: center; padding: 40px 20px; color: var(--c-text-3);
  background: var(--c-card); border: 1px dashed var(--c-border); border-radius: var(--radius);
}


.spin-loader {
  display: inline-block;
  width: 36px; height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


#toast-root {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  padding: 10px 16px; background: var(--c-text); color: white;
  border-radius: var(--radius-sm); font-size: 13px;
  animation: toastIn .2s; box-shadow: var(--shadow-lg);
  max-width: 320px;
}
.toast.success { background: var(--c-success); }
.toast.warn { background: var(--c-warn); }
.toast.danger { background: var(--c-danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }


@media (max-width: 860px) {
  
  .hb-burger { display: flex !important; }
  .sb-toggle { display: none !important; }

  
  .mod-header { flex-wrap: wrap; gap: 8px; }
  .mod-header h2 { font-size: 18px; }
  .mod-tools { flex-wrap: wrap; width: 100%; gap: 6px; }
  .mod-tools select.txt, .mod-tools .btn { font-size: 12px; padding: 6px 10px; }

  
  .grid-2, .grid-4 { grid-template-columns: 1fr; }

  
  .tbl th, .tbl td { font-size: 12px; padding: 6px 8px; }

  
  .form-grid { grid-template-columns: 1fr; }

  
  .modal { max-width: 100%; max-height: 100vh; border-radius: 0; }
  .modal.lg { max-width: 100%; }
  .modal-mask { padding: 0; }

  
  .class-card { flex-direction: column; align-items: flex-start; }
  .class-card .avatar { width: 48px; height: 48px; font-size: 20px; }
  .class-card .info { width: 100%; }
  .class-card .actions { width: 100%; flex-wrap: wrap; }
  .class-card .ci-banner { flex-wrap: wrap; }
  .class-card .name { font-size: 16px; word-break: break-all; }
  .class-card .meta { font-size: 12px; }

  
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { margin-bottom: 12px; border: 1px solid var(--c-border); border-radius: 6px; padding: 8px; }
  .tbl td { border: none; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .tbl td[data-label]::before { content: attr(data-label); font-weight: 500; color: var(--c-text-3); font-size: 11px; min-width: 60px; }
  .tbl td .btn-mini { font-size: 12px; padding: 4px 8px; }

  
  .sch-cell { height: 56px; padding: 2px; }
  .sch-subj { font-size: 11px; }
  .sch-tea { font-size: 9px; }
  .sch-day { font-size: 12px; padding: 6px 2px; }
  .sch-period { font-size: 10px; }
  .sch-grid-wrap { padding: 8px; }
  .sch-legend { padding: 8px; font-size: 11px; gap: 10px; }

  
  .modal-body { padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }

  
  body { font-size: 14px; }
  .btn { font-size: 12px; padding: 6px 10px; }

  
  #mobile-tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(200, 169, 119, 0.2);
    box-shadow: 0 -2px 16px rgba(139, 115, 85, 0.08);
    z-index: 30;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  #mobile-tabbar .mt-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 8px 4px 6px; cursor: pointer;
    color: var(--c-text-3);
    font-size: 10px; letter-spacing: 0.5px;
    transition: color .2s;
    border: none; background: none;
    font-family: inherit;
  }
  #mobile-tabbar .mt-item .icon { font-size: 20px; width: 20px; height: 20px; }
  #mobile-tabbar .mt-item.on { color: var(--c-primary); }
  #mobile-tabbar .mt-item.on .icon { color: var(--c-primary); }
  
  #main { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
}

@media (min-width: 861px) {
  #mobile-tabbar { display: none; }
}
.hb-burger { display: none; flex-direction: column; gap: 3px; background: none; border: none; cursor: pointer; padding: 4px; }
.hb-burger span { display: block; width: 18px; height: 2px; background: var(--c-text); }
#mask-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40; }
#mask-bg.show { display: block; }




.stage-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 2px;
  vertical-align: middle;
  line-height: 1.4;
}
.stage-小学 { background: #dcfce7; color: #166534; }
.stage-初中 { background: #dbeafe; color: #1e40af; }
.stage-高中 { background: #ede9fe; color: #5b21b6; }

.sch-card-wrap { padding: 0; overflow: auto; }
.sch-legend { display: flex; gap: 16px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--c-border); background: var(--c-bg-1, #fafbfc); font-size: 12px; flex-wrap: wrap; }
.sch-legend-item { display: inline-flex; align-items: center; gap: 4px; color: var(--c-text-2, #4b5563); }
.sch-grid-wrap { padding: 12px; }

.sch-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: var(--c-bg-card, #fff);
}
.sch-grid th, .sch-grid td {
  border: 1px solid var(--c-border, #e5e7eb);
  text-align: center;
  vertical-align: middle;
  padding: 0;
}
.sch-grid thead th {
  background: var(--c-bg-2, #f3f4f6);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 6px;
  color: var(--c-text-1, #111827);
  position: sticky;
  top: 0;
  z-index: 2;
}
.sch-corner {
  width: 60px;
  font-size: 11px;
  color: var(--c-text-3, #6b7280);
}
.sch-day { min-width: 90px; }
.sch-period {
  background: var(--c-bg-1, #f9fafb);
  font-size: 11px;
  color: var(--c-text-2, #4b5563);
  width: 60px;
  padding: 8px 4px;
  position: sticky;
  left: 0;
  z-index: 1;
}
.sch-cell {
  height: 70px;
  padding: 4px;
  position: relative;
  background: var(--c-bg-card, #fff);
  transition: background 0.1s;
}
.sch-cell:hover {
  background: var(--c-bg-1, #f9fafb);
  cursor: pointer;
}
.sch-cell.sch-dim {
  background: var(--c-bg-1, #f3f4f6);
  opacity: 0.5;
}
.sch-empty {
  color: var(--c-text-3, #9ca3af);
  font-size: 18px;
  line-height: 60px;
  opacity: 0;
  transition: opacity 0.15s;
}
.sch-cell:hover .sch-empty { opacity: 0.6; }

.sch-card {
  display: block;
  width: 100%;
  height: 100%;
  padding: 4px 6px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(0,0,0,0.05);
  transition: transform 0.1s, box-shadow 0.1s;
  overflow: hidden;
}
.sch-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  z-index: 1;
}
.sch-card.sch-faded { opacity: 0.35; }
.sch-card.sch-dim-card { opacity: 0.5; }
.sch-subj { font-weight: 600; font-size: 12px; color: #1f2937; line-height: 1.3; }
.sch-tea { font-size: 10px; color: #6b7280; line-height: 1.3; margin-top: 1px; }
.sch-wt {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.2;
}
.sch-wt-all { background: #e0e7ff; color: #3730a3; }
.sch-wt-odd { background: #fef3c7; color: #92400e; }
.sch-wt-even { background: #dcfce7; color: #166534; }

.sch-add-mini {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  background: var(--c-primary, #4f46e5);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.sch-cell:hover .sch-add-mini { opacity: 1; }