/* NRG+ 内容工作台 · editorial monochrome */
:root {
  color-scheme: light;
  /* Palette, typography and spacing are inherited from the shared tokens.css. */
  --ink: var(--text);
  --surface: var(--white);
  --canvas: var(--paper);
  --soft: var(--paper-2);
  --quiet: #646464;
  --sidebar-width: 264px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--surface); }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.side :focus-visible, .login__masthead :focus-visible { outline-color: var(--surface); }

/* Identity */
.wordmark {
  display: inline-block;
  font: 700 37px/1 var(--sans);
  letter-spacing: -.095em;
  white-space: nowrap;
}
.wordmark__plus { display: inline-block; padding-left: 3px; font-weight: 400; }
.mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  background: var(--ink);
  color: var(--surface);
}
.mark::after { content: "+"; font: 600 19px/1 var(--sans); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  transition: background-color .18s var(--ease), color .18s var(--ease),
    border-color .18s var(--ease), transform .18s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--soft); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn--solid { background: var(--ink); color: var(--surface); }
.btn--solid:hover:not(:disabled) { background: var(--line-dark); color: var(--surface); }
.btn--plain { border-color: var(--line); background: var(--surface); }
.btn--plain:hover:not(:disabled) { border-color: var(--ink); background: var(--surface); }
.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Login · two editorial columns */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(440px, 46%); min-height: 100svh; }
.login__masthead {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: clamp(32px, 5vw, 72px);
  background: var(--black);
  color: var(--surface);
}
.login__masthead-top, .login__masthead-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.login__masthead-top > span:last-child, .login__masthead-bottom > span:last-child,
.login__eyebrow, .login__brand-text, .side__brand-text, .side__section,
.main__topline, .main__eyebrow, .drawer__eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: .06em;
}
.login__masthead-top .wordmark { font-size: 56px; }
.login__masthead-top > span:last-child { padding-top: 10px; color: #bfbfbf; }
.login__masthead-bottom { align-items: flex-end; }
.login__masthead-bottom > span:first-child { font-size: clamp(32px, 4.6vw, 72px); font-weight: 500; line-height: 1.25; letter-spacing: -.065em; }
.login__masthead-bottom > span:last-child { flex: none; color: #bfbfbf; text-align: right; }
.login__entry { display: grid; place-items: center; padding: var(--space-5) clamp(24px, 6vw, 96px); background: var(--surface); }
.login__panel { width: min(100%, 440px); display: flex; flex-direction: column; align-items: stretch; }
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(64px, 13vh, 144px); }
.login__brand-text { color: var(--muted); }
.login__head { margin-bottom: var(--space-5); }
.login__eyebrow { margin: 0 0 var(--space-2); color: var(--quiet); }
.login__title { margin: 0; font-size: clamp(38px, 4.2vw, 64px); font-weight: 600; line-height: 1.15; letter-spacing: -.065em; }
.login__desc { margin: var(--space-2) 0 0; font-size: 15px; color: var(--muted); }
.login__form { display: grid; gap: var(--space-3); }
.login__form .field { gap: 10px; }
.login__form .input { min-height: 56px; }
.login__form .btn { min-height: 54px; }
.login__foot { margin: var(--space-6) 0 0; color: var(--muted); font-size: 14px; }
.login__foot a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.login__foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.login .notice { margin-top: var(--space-3); }

/* Fixed left navigation */
.layout { min-height: 100svh; }
.side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 40px 24px 28px;
  background: var(--black);
  color: var(--surface);
}
.side__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 0 10px; }
.side__brand-text { color: #bfbfbf; }
.side__nav-area { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: var(--space-6); }
.side__section { display: flex; justify-content: space-between; margin: 0 10px 12px; color: #bfbfbf; }
.side__section span { color: #a8a8a8; }
.side__nav { display: grid; align-content: start; gap: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-dark) transparent; }
.nav__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #bfbfbf;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.nav__item:hover { background: #242424; color: var(--surface); }
.nav__item.is-active { background: var(--surface); color: var(--ink); font-weight: 600; }
.nav__num { min-width: 22px; font: 400 12px/1 var(--mono); color: #a8a8a8; }
.nav__item.is-active .nav__num { color: var(--muted); }
.side__foot { display: grid; gap: 4px; padding-top: var(--space-3); border-top: 1px solid var(--line-dark); }
.side__link, .side__logout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: #bfbfbf;
  font-size: 13px;
  text-decoration: none;
  text-align: left;
  transition: color .18s var(--ease);
}
.side__link:hover, .side__logout:hover { color: var(--surface); }

/* Workspace */
.main { min-width: 0; min-height: 100svh; margin-left: var(--sidebar-width); padding: 0 clamp(28px, 4.3vw, 72px) 112px; }
.main__topline { display: flex; justify-content: space-between; gap: 20px; padding: 26px 0; border-bottom: 1px solid var(--line); color: var(--quiet); }
.main__head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); margin: 0 auto var(--space-5); padding: clamp(40px, 5vw, 72px) 0 0; max-width: 1440px; }
.main__head-text { min-width: 0; }
.main__eyebrow { margin: 0 0 var(--space-2); color: var(--muted); }
.main__title { margin: 0; font-size: clamp(34px, 3.6vw, 56px); font-weight: 600; line-height: 1.15; letter-spacing: -.055em; }
.main__desc { max-width: 62ch; margin: var(--space-2) 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.main__actions { display: flex; flex-wrap: wrap; gap: var(--space-1); padding-bottom: 4px; }
.main__body { display: grid; gap: var(--space-3); max-width: 1440px; margin: 0 auto; }

/* Settings / forms */
.group { padding: 0 clamp(20px, 3vw, 40px); background: var(--surface); }
.group__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); padding: var(--space-4) 0 var(--space-3); }
.group__head span:first-child { font-size: 20px; font-weight: 600; line-height: 1.35; letter-spacing: -.02em; }
.group__head span:last-child { flex: none; font: 400 12px/1.5 var(--mono); color: var(--quiet); }
.group__hint { margin: 0 0 var(--space-3); max-width: 68ch; color: var(--muted); font-size: 14px; line-height: 1.65; }
.group__body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); padding: 0 0 var(--space-4); }
.field { display: grid; align-content: start; gap: 9px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.5; }
.field__hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.field__hint--warn { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.input, .textarea, .select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #d2d2d2;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: #767676; opacity: 1; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--quiet); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.textarea { min-height: 112px; resize: vertical; }
.select { appearance: none; cursor: pointer; }

/* Data table */
.table-wrap { max-width: 100%; overflow-x: auto; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.table th { padding: 20px 16px; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .03em; text-align: left; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 28px; }
.table th:last-child, .table td:last-child { padding-right: 28px; text-align: right; }
.table td { padding: 18px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafafa; }
.table__num { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table__text { max-width: 400px; color: #383838; overflow-wrap: anywhere; }
.table__strong { font-weight: 600; }
.table__actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.table__actions .btn--plain { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.table__actions .btn--plain:hover { border-color: var(--ink); text-decoration: none; }
.table__empty { padding: 72px 24px !important; color: var(--muted); font-size: 15px; text-align: center !important; }
.cell-avatar { display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; background: var(--soft); font-size: 16px; font-weight: 600; }
.cell-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(100%); }
.tag { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag--ghost { border: 1px solid var(--line); background: var(--surface); color: var(--muted); }

/* Notices */
.notice { padding: 14px 16px; background: var(--ink); color: var(--surface); font-size: 14px; line-height: 1.6; }
.notice--error { border: 1px solid var(--ink); background: var(--surface); color: var(--ink); font-weight: 600; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; max-width: min(420px, calc(100vw - 32px)); padding: 16px 22px; background: var(--ink); color: var(--surface); font-size: 14px; line-height: 1.6; box-shadow: 0 10px 28px #00000026; }
.toast--error { border: 1px solid var(--ink); background: var(--surface); color: var(--ink); font-weight: 600; }

/* Edit drawer */
.drawer { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: flex-end; }
.drawer__scrim { position: absolute; inset: 0; background: #00000080; }
.drawer__panel { position: relative; display: flex; flex-direction: column; width: min(640px, 100%); height: 100%; height: 100dvh; background: var(--surface); transform: translateX(100%); transition: transform .22s var(--ease); }
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); padding: 32px clamp(20px, 4vw, 40px) 24px; border-bottom: 1px solid var(--line); }
.drawer__eyebrow { margin: 0 0 8px; color: var(--muted); }
.drawer__title { margin: 0; font-size: clamp(25px, 3vw, 34px); font-weight: 600; letter-spacing: -.04em; line-height: 1.2; }
.drawer__close { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 26px; line-height: 1; }
.drawer__close:hover { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.drawer__body { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: var(--space-3); overflow-y: auto; padding: var(--space-4) clamp(20px, 4vw, 40px); }
.drawer__body .field--full { grid-column: 1 / -1; }
.drawer .notice { margin: 0 clamp(20px, 4vw, 40px) var(--space-2); }
.drawer__foot { display: flex; justify-content: flex-end; gap: 12px; padding: 20px clamp(20px, 4vw, 40px) calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }

@media (max-width: 1100px) {
  :root { --sidebar-width: 236px; }
  .main { padding-right: 32px; padding-left: 32px; }
  .group__body { gap: 24px; }
  .table th, .table td { padding-left: 12px; padding-right: 12px; }
  .table th:first-child, .table td:first-child { padding-left: 20px; }
  .table th:last-child, .table td:last-child { padding-right: 20px; }
}

@media (max-width: 900px) {
  .side { position: relative; inset: auto; width: 100%; padding: 24px 24px 0; }
  .side__brand { flex-direction: row; align-items: center; gap: 20px; padding: 0; }
  .side__brand .wordmark { font-size: 32px; }
  .side__brand-text { line-height: 1.25; }
  .side__nav-area { margin-top: 24px; }
  .side__section { margin-left: 0; margin-right: 0; }
  .side__nav { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 0 0 12px; scrollbar-width: thin; }
  .nav__item { flex: none; width: auto; min-height: 44px; }
  .side__foot { display: flex; justify-content: flex-end; gap: 16px; padding: 4px 0 8px; border-top: 1px solid var(--line-dark); }
  .side__link, .side__logout { width: auto; gap: 12px; }
  .main { min-height: auto; margin-left: 0; padding: 0 32px 80px; }
  .main__head { padding-top: 48px; }
}

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login__masthead { min-height: 240px; padding: 32px; }
  .login__masthead-bottom > span:first-child { font-size: 36px; }
  .login__entry { min-height: calc(100svh - 240px); padding: 64px 32px; }
}

@media (max-width: 700px) {
  .login { grid-template-columns: 1fr; }
  .login__masthead { min-height: 210px; padding: 24px; }
  .login__masthead-top .wordmark { font-size: 42px; }
  .login__masthead-bottom > span:first-child { font-size: 27px; }
  .login__masthead-bottom > span:last-child { font-size: 12px; }
  .login__entry { min-height: calc(100svh - 210px); padding: 48px 24px; }
  .login__brand { margin-bottom: 48px; }
  .login__head { margin-bottom: 32px; }
  .login__title { font-size: clamp(38px, 9vw, 52px); }
  .login__foot { margin-top: 40px; }
  .main__head { display: block; margin-bottom: 32px; }
  .main__actions { margin-top: 24px; }
  .group__body, .drawer__body { grid-template-columns: minmax(0, 1fr); }
  .drawer__body .field--full { grid-column: 1; }
  .table-wrap { overflow: visible; background: transparent; }
  .table, .table tbody, .table tbody tr { display: block; }
  .table thead { display: none; }
  .table tbody { display: grid; gap: 16px; }
  .table tbody tr { padding: 12px 20px; background: var(--surface); }
  .table tbody tr:hover { background: var(--surface); }
  .table td, .table td:first-child, .table td:last-child { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; min-width: 0; padding: 11px 0; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); flex: 0 0 82px; color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; }
  .table td:last-child { align-items: center; border-bottom: 0; }
  .table td:last-child::before { align-self: center; }
  .table__text { max-width: min(60%, 380px); }
  .table__actions { flex-wrap: wrap; gap: 4px; white-space: normal; }
  .table__empty, .table td.table__empty { display: block; padding: 40px 0 !important; border: 0; text-align: center !important; }
  .table__empty::before { display: none; }
}

@media (max-width: 480px) {
  .side { padding: 20px 16px 0; }
  .side__section { margin-top: 0; }
  .side__foot { justify-content: space-between; gap: 4px; }
  .side__link, .side__logout { padding-left: 0; padding-right: 0; font-size: 12px; }
  .main { padding: 0 16px 72px; }
  .main__topline { padding: 20px 0; font-size: 10px; }
  .main__topline span:last-child { display: none; }
  .main__head { padding-top: 40px; }
  .main__title { font-size: 38px; }
  .main__actions .btn { width: 100%; }
  .group { padding: 0 20px; }
  .group__head { padding-top: 28px; }
  .group__body { padding-bottom: 32px; }
  .table tbody tr { padding: 12px 16px; }
  .table td::before { flex-basis: 68px; }
  .drawer__head { padding-top: 24px; }
  .drawer__body { padding-top: 24px; }
  .drawer__foot .btn { flex: 1; }
  .toast { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
