:root {
  --brand: #005bac;
  --brand-dark: #073763;
  --ink: #162538;
  --muted: #667789;
  --line: #e2e9f2;
  --paper: #f3f7fb;
  --white: #fff;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(20, 42, 76, .1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
button, input, textarea { font: inherit; }
button {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
  cursor: pointer;
}
button:hover { background: #0b70c4; }
button.muted { background: #627489; }
button.danger { background: var(--danger); }
button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
small { color: var(--muted); line-height: 1.6; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(0,91,172,.08), rgba(255,255,255,0)),
    var(--paper);
}
.login-panel {
  width: min(430px, 100%);
  padding: 38px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  box-shadow: var(--shadow);
}
.login-panel img { width: 62px; height: 62px; object-fit: contain; }
.login-panel > p { margin: 16px 0 6px; color: var(--brand); font-weight: 900; letter-spacing: 0; }
.login-panel h1 { margin: 0 0 26px; font-size: 28px; }

label {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  color: #344054;
  font-weight: 800;
}
input, textarea {
  width: 100%;
  border: 1px solid #ccd6e3;
  border-radius: 4px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--white);
}
input:focus, textarea:focus {
  outline: 2px solid rgba(0,91,172,.16);
  border-color: var(--brand);
}
textarea { resize: vertical; line-height: 1.7; }

.editor-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #fff;
  background: var(--brand-dark);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255,255,255,.24);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.16);
}
.sidebar-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  padding: 3px;
  background: #fff;
  border-radius: 4px;
}
.sidebar-brand strong { display: block; font-size: 16px; }
.sidebar-brand small { color: rgba(255,255,255,.68); }
.sidebar-group-title {
  margin: 12px 4px 2px;
  color: rgba(255,255,255,.48);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}
.sidebar button, .sidebar a {
  width: 100%;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 4px;
  color: rgba(255,255,255,.84);
  background: transparent;
  text-decoration: none;
  font-weight: 800;
}
.sidebar button[data-tab="about"],
.sidebar button[data-tab="certificates"],
.sidebar button[data-tab="honors"] {
  padding-left: 24px;
}
.sidebar-subnav {
  display: grid;
  gap: 5px;
  margin: -2px 0 4px 14px;
  padding: 4px 0 8px 13px;
  border-left: 1px solid rgba(255,255,255,.2);
}
.sidebar-subnav button {
  min-height: 32px;
  padding: 0 12px;
  color: rgba(255,255,255,.72);
  font-size: 13px;
  font-weight: 800;
}
.sidebar-subnav button::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 999px;
  background: rgba(118,196,255,.9);
}
.sidebar button.active, .sidebar a:hover, .sidebar button:hover {
  color: #fff;
  background: rgba(255,255,255,.14);
}
.sidebar .muted { margin-top: 10px; background: rgba(255,255,255,.12); }

.workspace {
  min-width: 0;
  padding: 32px clamp(24px, 4vw, 60px);
}
.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: -32px calc(clamp(24px, 4vw, 60px) * -1) 20px;
  padding: 24px clamp(24px, 4vw, 60px);
  background: rgba(243,247,251,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.workspace-head p {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}
.workspace-head h1 { margin: 0 0 6px; font-size: 32px; line-height: 1.2; }
.workspace-head small { display: block; }
.form-message { min-height: 24px; margin: 0 0 14px; color: #24714a; font-weight: 800; }
.form-message.error, .error { color: var(--danger); }

.content-form {
  display: grid;
  gap: 18px;
  max-width: 1080px;
}
.preview-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border: 1px solid #cfe0f3;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(0,91,172,.08), #fff);
  box-shadow: 0 8px 22px rgba(20,42,76,.04);
}
.preview-panel strong {
  display: block;
  margin-bottom: 6px;
  color: var(--brand-dark);
  font-size: 18px;
}
.preview-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.preview-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 4px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
  text-decoration: none;
}
.preview-link:hover { background: #0b70c4; }

.news-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid #cfe0f3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20,42,76,.06);
}
.news-admin-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
  color: var(--brand-dark);
}
.news-admin-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.news-admin-list {
  display: grid;
  gap: 14px;
}
.news-admin-card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20,42,76,.05);
}
.news-admin-date {
  color: var(--brand);
  font-size: 18px;
  font-weight: 900;
}
.news-admin-main strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 20px;
}
.news-admin-main p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.7;
}
.news-admin-main small {
  color: #506174;
  font-weight: 800;
}
.news-admin-actions,
.news-editor-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}
.news-editor-top {
  justify-content: space-between;
  padding: 18px 20px;
  border: 1px solid #cfe0f3;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(0,91,172,.08), #fff);
}
.news-editor-page {
  border-left: 4px solid var(--brand);
}
.empty-state {
  padding: 34px 24px;
  border: 1px dashed #b8cce2;
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  font-weight: 800;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 8px 22px rgba(20,42,76,.04);
}
legend {
  padding: 0 8px;
  color: var(--brand-dark);
  font-size: 18px;
  font-weight: 900;
}
.array-toolbar {
  display: flex;
  justify-content: flex-end;
}
.array-item {
  border-left: 4px solid var(--brand);
}
.project-admin-intro {
  padding: 18px 22px;
  border: 1px solid #cfe0f3;
  border-radius: 8px;
  color: #41576d;
  background: linear-gradient(90deg, rgba(0,91,172,.08), #fff);
  font-weight: 800;
  line-height: 1.8;
}
.project-admin-groups {
  display: grid;
  gap: 22px;
}
.project-admin-group {
  scroll-margin-top: 28px;
  overflow: hidden;
  border: 1px solid #cfe0f3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(20, 42, 76, .06);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.project-admin-group.is-focused {
  border-color: #0066b3;
  box-shadow: 0 18px 42px rgba(0,102,179,.18);
  transform: translateY(-2px);
}
.project-admin-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-left: 5px solid var(--brand);
  background: linear-gradient(100deg, #eef7ff, #fff);
}
.project-admin-group-head strong {
  display: block;
  color: var(--brand-dark);
  font-size: 22px;
  font-weight: 900;
}
.project-admin-group-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}
.project-admin-list {
  display: grid;
  gap: 16px;
  padding: 20px;
}
.project-admin-item {
  background: #fbfdff;
  box-shadow: none;
}
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.check input { width: auto; }
.image-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: -6px 0 20px;
}
.image-row img {
  width: 160px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.image-edit-tip {
  display: block;
  margin: 10px 0 4px;
  padding: 8px 10px;
  border-left: 3px solid var(--brand);
  background: #eef6ff;
  color: #315f8d;
  font-weight: 800;
}
.upload-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 18px;
  background: #f8fbff;
  border: 1px dashed #b8cce2;
}
.image-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.image-tile {
  min-width: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.image-tile img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  margin-bottom: 10px;
  background: var(--paper);
}
.image-tile strong {
  display: block;
  overflow: hidden;
  margin-bottom: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}
.image-tile input { font-size: 12px; }

.image-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 25, 44, .56);
}
.image-editor-panel {
  width: min(920px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}
.image-editor-head,
.image-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.image-editor-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.image-editor-head p {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.image-editor-head h2 {
  margin: 0;
  font-size: 24px;
}
.image-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  padding: 22px;
}
.image-editor-preview {
  min-height: 360px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(-45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f8 75%),
    linear-gradient(-45deg, transparent 75%, #eef3f8 75%),
    #fff;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.image-editor-preview img {
  max-width: 78%;
  max-height: 320px;
  object-fit: contain;
  transition: transform .18s ease;
  box-shadow: 0 14px 34px rgba(20, 42, 76, .2);
}
.image-editor-controls {
  display: grid;
  align-content: start;
  gap: 12px;
}
.image-editor-controls label { margin-bottom: 0; }
.editor-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.editor-buttons [data-editor-reset] { grid-column: 1 / -1; }

@media (max-width: 360px) {
  .editor-view { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .sidebar-brand { grid-column: 1 / -1; }
  .sidebar .muted { margin-top: 0; }
  .workspace-head { align-items: flex-start; flex-direction: column; }
  .preview-panel { align-items: flex-start; flex-direction: column; }
  .image-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .workspace { padding: 22px 14px; }
  .workspace-head { margin: -22px -14px 18px; padding: 18px 14px; }
  .sidebar { grid-template-columns: 1fr; }
  fieldset { padding: 18px; }
}

@media (max-width: 760px) {
  .news-admin-head,
  .news-admin-card {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .project-admin-group-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .news-admin-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .news-admin-actions { justify-content: flex-start; }
  .image-editor-body { grid-template-columns: 1fr; }
  .image-editor-preview { min-height: 260px; }
  .image-editor-head,
  .image-editor-actions { align-items: flex-start; flex-direction: column; }
}
