:root {
  --ink: #17283b;
  --muted: #667384;
  --blue: #2f56d8;
  --coral: #ff624d;
  --yellow: #f4c84a;
  --paper: #f7f5ee;
  --white: #fffefb;
  --line: rgba(23, 40, 59, 0.17);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.admin-header {
  height: 74px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(247, 245, 238, 0.94);
  border-bottom: 1px solid var(--line);
}

.admin-brand { display: flex; align-items: center; gap: 10px; }
.admin-brand span { color: var(--coral); font-size: 28px; transform: rotate(-8deg); }
.admin-brand strong { letter-spacing: 0.06em; }
.back-link { font-size: 13px; font-weight: 800; }
.admin-header-actions { display: flex; align-items: center; gap: 16px; }
.admin-header-actions > span { color: var(--blue); font-size: 12px; font-weight: 800; }
.logout-button { padding: 0; color: var(--muted); background: transparent; border: 0; cursor: pointer; }

.admin-main { width: min(1240px, calc(100vw - 48px)); margin: 0 auto; padding: 44px 0 96px; }
.admin-hero {
  min-height: min(680px, calc(100vh - 150px));
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(390px, 0.86fr);
  overflow: hidden;
  background: var(--white);
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  box-shadow: 9px 10px 0 var(--ink);
}
.admin-login-visual { position: relative; min-width: 0; margin: 0; overflow: hidden; background: #e8dfc9; border-right: 1.5px solid var(--ink); }
.admin-login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 58%, rgba(14, 34, 56, 0.15));
}
.admin-login-visual img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 52% center; }
.admin-login-visual figcaption { position: absolute; z-index: 1; right: 22px; bottom: 22px; display: flex; gap: 7px; }
.admin-login-visual figcaption span { padding: 7px 11px; color: var(--ink); background: rgba(255, 254, 251, 0.92); border: 1px solid var(--ink); border-radius: 99px; font-size: 11px; font-weight: 900; }

.admin-login-panel { position: relative; padding: 72px 62px 58px; display: flex; flex-direction: column; justify-content: center; }
.admin-login-panel::before {
  content: "";
  position: absolute;
  top: 24px;
  right: 24px;
  width: 70px;
  height: 34px;
  opacity: 0.35;
  background-image: radial-gradient(circle, var(--blue) 1.5px, transparent 1.8px);
  background-size: 11px 11px;
}
.admin-heading > p { margin: 0 0 10px; color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: 0.2em; }
.admin-hero h1 { margin: 0; font-family: "STKaiti", "KaiTi", sans-serif; font-size: clamp(54px, 5vw, 72px); line-height: 1; }
.admin-scope { margin: 27px 0 52px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
.admin-scope i { width: 18px; height: 1px; background: var(--line); }
.token-form { width: 100%; }
.token-form > label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 800; }
.token-form > div { display: grid; gap: 11px; }
.token-form input { min-width: 0; height: 48px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--white); }
.token-form button { min-height: 48px; margin-top: 3px; padding: 0 20px; color: white; background: var(--ink); border: 1.5px solid var(--ink); border-radius: 4px; box-shadow: 3px 3px 0 var(--coral); cursor: pointer; font-weight: 800; }
.token-form button:hover { background: var(--blue); }
.token-form output { min-height: 20px; display: block; padding-top: 7px; color: var(--muted); font-size: 11px; }
.token-form output.is-ok { color: #28794c; }
.token-form output.is-error { color: #b33026; }
body.is-authenticated .token-form > label,
body.is-authenticated .token-form > div { display: none; }
body:not(.is-authenticated) .admin-tabs,
body:not(.is-authenticated) .admin-panel { display: none; }
body.is-authenticated .admin-main { padding-top: 64px; }
body.is-authenticated .admin-hero {
  min-height: 0;
  display: flex;
  align-items: end;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.is-authenticated .admin-login-visual,
body.is-authenticated .admin-scope,
body.is-authenticated .admin-login-panel::before { display: none; }
body.is-authenticated .admin-login-panel { width: 100%; padding: 0; flex-direction: row; align-items: end; justify-content: space-between; }
body.is-authenticated .admin-hero h1 { font-size: 62px; }
body.is-authenticated .token-form { width: auto; }

.admin-tabs { margin: 58px 0 0; display: flex; gap: 10px; border-bottom: 2px solid var(--ink); }
.admin-tabs button { padding: 13px 21px; color: var(--muted); background: transparent; border: 0; border-radius: 5px 5px 0 0; cursor: pointer; font-weight: 800; }
.admin-tabs button.is-active { color: white; background: var(--blue); }

.admin-panel { display: none; padding-top: 46px; }
.admin-panel.is-active { display: block; }
.panel-heading { margin-bottom: 28px; display: flex; align-items: end; justify-content: space-between; }
.panel-heading > div { display: flex; align-items: baseline; gap: 14px; }
.panel-heading span { color: var(--coral); font-size: 11px; font-weight: 900; }
.panel-heading h2 { margin: 0; font-family: "STKaiti", "KaiTi", sans-serif; font-size: 38px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.admin-grid { display: grid; grid-template-columns: minmax(330px, 0.7fr) minmax(0, 1.3fr); gap: 28px; align-items: start; }
.editor-form { padding: 28px; display: grid; gap: 17px; background: var(--white); border: 1.5px solid var(--ink); border-radius: 5px; box-shadow: 6px 7px 0 var(--ink); }
.form-title { display: flex; align-items: center; justify-content: space-between; }
.form-title h3 { margin: 0 0 5px; font-size: 20px; }
.form-title button { padding: 0; color: var(--blue); background: transparent; border: 0; cursor: pointer; font-size: 12px; font-weight: 800; }
.editor-form > label,
.field-row label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
input, select, textarea { width: 100%; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; outline: none; }
input, select { height: 42px; padding: 0 11px; }
textarea { padding: 11px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 86, 216, 0.12); }
input[type="file"] { height: auto; padding: 9px; }
.check-field { display: flex !important; grid-template-columns: auto 1fr; align-items: center; justify-content: start; }
.check-field input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.submit-button { min-height: 46px; color: white; background: var(--coral); border: 1.5px solid var(--ink); border-radius: 4px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer; font-weight: 900; }
.submit-button:disabled { opacity: 0.55; cursor: wait; }
.form-message { min-height: 18px; color: var(--muted); font-size: 11px; }
.form-message.is-error { color: #b33026; }
.form-message.is-ok { color: #28794c; }

.record-list { display: grid; gap: 12px; }
.empty-record { min-height: 180px; display: grid; place-items: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 5px; }
.record-card { padding: 21px 22px; display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: center; background: rgba(255, 254, 251, 0.75); border: 1px solid var(--line); border-radius: 5px; }
.record-card h3 { margin: 0 0 7px; font-size: 17px; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.record-meta span { padding: 5px 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 99px; }
.record-actions { display: flex; gap: 7px; }
.record-actions button { min-height: 34px; padding: 0 10px; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: 800; }
.record-actions button:hover { border-color: var(--blue); color: var(--blue); }

.work-record { grid-template-columns: 74px minmax(0, 1fr) auto; }
.work-thumb { width: 74px; height: 62px; object-fit: cover; border-radius: 3px; background: #ddd; }
.work-records .record-card[data-status="archived"] { opacity: 0.58; }

@media (max-width: 900px) {
  .admin-main { width: min(760px, calc(100vw - 48px)); }
  .admin-hero { min-height: 0; grid-template-columns: 1fr; }
  .admin-login-visual { height: 310px; border-right: 0; border-bottom: 1.5px solid var(--ink); }
  .admin-login-visual img { object-position: center 62%; }
  .admin-login-panel { padding: 48px 54px 44px; }
  .admin-scope { margin-bottom: 36px; }
  body.is-authenticated .admin-main { width: min(1240px, calc(100vw - 48px)); }
  .admin-grid { grid-template-columns: 1fr; }
  .editor-form { box-shadow: 4px 5px 0 var(--ink); }
}

@media (max-width: 600px) {
  .admin-header { height: 66px; padding-inline: 16px; }
  .admin-brand strong { font-size: 14px; }
  .admin-main,
  body.is-authenticated .admin-main { width: calc(100vw - 28px); padding-top: 22px; }
  .admin-hero { box-shadow: 5px 6px 0 var(--ink); }
  .admin-login-visual { height: 205px; }
  .admin-login-visual figcaption { right: 14px; bottom: 14px; }
  .admin-login-panel { padding: 30px 24px 27px; }
  .admin-login-panel::before { top: 16px; right: 14px; }
  .admin-hero h1,
  body.is-authenticated .admin-hero h1 { font-size: 48px; }
  .admin-scope { margin: 20px 0 28px; }
  body.is-authenticated .admin-login-panel { flex-direction: column; align-items: stretch; }
  .admin-tabs button { flex: 1; padding-inline: 10px; }
  .panel-heading p { display: none; }
  .editor-form { padding: 21px 18px; }
  .field-row { grid-template-columns: 1fr; }
  .record-card { grid-template-columns: 1fr; }
  .work-record { grid-template-columns: 66px 1fr; }
  .work-record .record-actions { grid-column: 1 / -1; }
  .token-form > div { gap: 8px; }
  .token-form button { min-height: 46px; }
  .admin-header-actions > span { display: none; }
}
