/* 橘猫值班室：深墨侧栏、暖橙印记与纸质值班簿。 */
:root {
  color-scheme: light;
  --ink: #12141f;
  --ink-raised: #1c1f2d;
  --ink-muted: #a9abb8;
  --page: #f4f1eb;
  --surface: #fffdf9;
  --surface-warm: #f7eee2;
  --orange: #e59449;
  --orange-deep: #984b16;
  --orange-dark: #7d3c10;
  --orange-pale: #f7e4ce;
  --text: #24252c;
  --muted: #6e6b66;
  --line: #ddd7cd;
  --line-strong: #bcb3a6;
  --green: #e6efe7;
  --green-deep: #326448;
  --yellow: #f6ecd5;
  --yellow-deep: #765415;
  --red: #f6e5df;
  --red-deep: #923f31;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Hiragino Sans GB", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", serif;
  --font-mono: Consolas, "SFMono-Regular", "Liberation Mono", "PingFang SC", "Microsoft YaHei", monospace;
  font-family: var(--font-sans);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  scroll-padding-top: 24px;
  background: var(--page);
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  touch-action: manipulation;
}

@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 700;
}

strong {
  font-weight: 700;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

h3 {
  line-height: 1.4;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--orange-deep);
  outline-offset: 3px;
}

.sidebar :focus-visible,
.login-art :focus-visible {
  outline-color: #f2b77d;
}

::selection {
  color: var(--ink);
  background: #efc391;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1400;
  min-height: 44px;
  padding: 9px 16px;
  color: #fff;
  border: 1px solid var(--orange);
  border-radius: var(--radius-sm);
  background: var(--ink);
  transform: translateY(-150%);
  transition: transform 120ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.cloud-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.cloud-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(244, 241, 235, 0.22);
}

.cloud-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  filter: saturate(1.08) contrast(1.06) brightness(0.96);
}

#main-content {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.eyebrow,
.section-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--orange-deep);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* 通用控件 */
.button,
.icon-button,
.day-option {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.button:hover:not(:disabled),
.day-option:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled),
.day-option:active:not(:disabled),
.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

.button.primary {
  color: #fff;
  border-color: var(--orange-deep);
  background: var(--orange-deep);
}

.button.primary:hover:not(:disabled) {
  border-color: var(--orange-dark);
  background: var(--orange-dark);
}

.button.secondary {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface);
}

.button.secondary:hover:not(:disabled) {
  color: var(--orange-deep);
  border-color: var(--orange-deep);
  background: var(--surface-warm);
}

.button.danger {
  color: var(--red-deep);
  border-color: #cfa79b;
  background: var(--red);
}

.button.danger:hover:not(:disabled) {
  color: #fff;
  border-color: var(--red-deep);
  background: var(--red-deep);
}

.button.wide {
  width: 100%;
}

.button:disabled,
.icon-button:disabled,
.day-option:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button[aria-busy="true"]::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  animation: busy-pulse 160ms ease-in-out infinite alternate;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: #444139;
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  font-weight: 500;
}

.field input:focus {
  border-color: var(--orange-deep);
  box-shadow: 0 0 0 3px rgba(152, 75, 22, 0.16);
}

.field input::placeholder {
  color: #928b81;
}

#custom-days {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 70px;
}

.password-control .icon-button {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 60px;
  min-height: 44px;
  padding: 6px 10px;
  color: var(--orange-deep);
  border: 0;
  background: transparent;
  font-size: 12px;
}

.form-message {
  min-height: 0;
  margin: 10px 0 0;
  color: var(--red-deep);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.form-message:empty {
  display: none;
}

.field-help {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* 登录：深色插画版与浅色表单版的不对称拼版 */
.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: clamp(22px, 4vw, 56px) 24px;
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(360px, 0.78fr);
  width: min(1160px, 100%);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 12px 12px 0 rgba(229, 148, 73, 0.2);
}

.login-art {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 640px;
  flex-direction: column;
  padding: 34px 40px 28px;
  overflow: hidden;
  color: #fffaf2;
  background: var(--ink);
}

.login-art::before {
  content: "DUTY\A ROOM";
  position: absolute;
  top: 108px;
  right: -8px;
  color: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: clamp(72px, 9vw, 126px);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.09em;
  text-align: right;
  white-space: pre;
  pointer-events: none;
}

.login-art::after {
  content: "";
  position: absolute;
  top: 96px;
  bottom: 30px;
  left: 22px;
  width: 1px;
  background: rgba(229, 148, 73, 0.32);
  pointer-events: none;
}

.brand-lockup,
.mobile-brand,
.sidebar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-lockup {
  position: relative;
  z-index: 2;
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
}

.brand-lockup small {
  display: block;
  margin-top: 6px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.brand-lockup img,
.sidebar-brand img,
.mobile-brand img {
  flex: 0 0 auto;
  object-fit: contain;
}

.login-edition {
  position: absolute;
  top: 38px;
  right: 34px;
  z-index: 2;
  color: #858896;
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.11em;
  text-align: right;
}

.login-art-copy {
  position: relative;
  z-index: 2;
  max-width: 460px;
  margin-top: 78px;
}

.login-art-copy .eyebrow {
  color: var(--orange);
}

.login-art-copy h2 {
  margin-bottom: 18px;
  color: #fffaf2;
  font-size: clamp(36px, 4vw, 50px);
  line-height: 1.3;
  letter-spacing: -0.045em;
}

.login-art-copy p {
  max-width: 350px;
  color: #b9bac3;
  font-size: 14px;
}

.login-mascot {
  position: absolute;
  right: 22px;
  bottom: 54px;
  z-index: 1;
  width: min(290px, 48%);
  max-height: 285px;
  object-fit: contain;
}

.login-duty-note {
  position: absolute;
  bottom: 86px;
  left: 40px;
  z-index: 3;
  width: 218px;
  padding: 15px 17px 14px;
  color: var(--ink);
  background: #f2d5b2;
  box-shadow: 5px 5px 0 #090a11;
  transform: rotate(-1.2deg);
}

.login-duty-note > span {
  display: block;
  margin-bottom: 8px;
  color: #744118;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.login-duty-note strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 18px;
}

.login-duty-note p {
  margin: 6px 0 0;
  color: #564738;
  font-size: 11px;
  line-height: 1.65;
}

.art-note {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  margin-top: auto;
  padding-top: 12px;
  color: #9698a5;
  border-top: 1px solid #343745;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.login-form-wrap {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 58px 48px 48px;
  background: var(--surface);
}

.login-form-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 48px;
  width: 52px;
  height: 4px;
  background: var(--orange);
}

.login-form-heading {
  margin-bottom: 30px;
}

.login-form-wrap h1 {
  margin-bottom: 10px;
  font-size: 37px;
}

.login-form-wrap > .muted,
.login-form-heading > .muted {
  margin-bottom: 0;
}

.login-form-wrap form {
  display: grid;
  gap: 17px;
}

.login-form-wrap .form-message {
  margin: -4px 0 0;
}

.security-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 27px 0 0;
  padding-top: 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.security-note span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green-deep);
}

.login-form-index {
  position: absolute;
  right: 22px;
  bottom: 18px;
  color: #b1aaa0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.mobile-brand {
  display: none;
}

.mobile-brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

/* 后台：独立深色侧栏与账簿内容区 */
.admin-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  width: min(1680px, 100%);
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  background: rgba(244, 241, 235, 0.38);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  min-width: 0;
  height: 100vh;
  height: 100svh;
  flex-direction: column;
  padding: 30px 20px 22px;
  overflow-y: auto;
  color: #f8f3eb;
  background: var(--ink);
}

.sidebar-brand {
  min-height: 66px;
  padding: 0 6px 24px;
  border-bottom: 1px solid #343745;
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.sidebar-brand strong {
  color: #fffaf2;
  font-family: var(--font-serif);
  font-size: 27px;
  line-height: 1.1;
}

.sidebar-brand small {
  margin-top: 6px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.sidebar-caption {
  margin: 25px 10px 10px;
  color: #717482;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.side-nav {
  display: grid;
  gap: 5px;
  margin-top: 0;
}

.nav-link {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 13px;
  padding: 11px 13px;
  color: #b7b9c4;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 650;
  transition: transform 120ms ease, opacity 120ms ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 8px;
  left: 48px;
  height: 1px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 120ms ease;
}

.nav-link > span {
  display: grid;
  width: 24px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  color: #777a88;
  font-family: var(--font-mono);
  font-size: 10px;
}

.nav-link:hover {
  color: #fff;
  transform: translateX(2px);
}

.nav-link.active {
  color: #fff8ee;
  border-color: #383b49;
  background: var(--ink-raised);
}

.nav-link.active > span {
  color: var(--orange);
}

.nav-link.active::after {
  transform: scaleX(1);
}

.sidebar-note {
  margin: auto 6px 26px;
  padding: 18px 4px 0;
  border-top: 1px solid #343745;
}

.sidebar-note > span {
  color: var(--orange);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
}

.sidebar-note p {
  margin: 8px 0 0;
  color: #9294a1;
  font-size: 11px;
  line-height: 1.8;
}

.sidebar-bottom {
  margin-top: 0;
}

.sidebar-bottom p {
  margin-bottom: 12px;
  color: #81838f;
  font-size: 10px;
  text-align: center;
}

.sidebar .button.secondary {
  color: #e6e2dc;
  border-color: #464957;
  background: transparent;
}

.sidebar .button.secondary:hover:not(:disabled) {
  color: #fff;
  border-color: var(--orange);
  background: var(--ink-raised);
}

.workspace {
  min-width: 0;
  padding: 40px clamp(28px, 4vw, 64px) 26px;
}

.workspace-header {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 0 0 30px;
  border-bottom: 1px solid var(--line);
}

.workspace-title {
  min-width: 0;
}

.workspace-header h1 {
  margin-bottom: 8px;
}

.workspace-header p {
  max-width: 530px;
  margin-bottom: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding-top: 15px;
}

.session-chip,
.soft-badge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.session-chip {
  color: #4e584d;
  border: 1px solid #c8d1c5;
  background: #f1f5ef;
}

.online-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #487454;
}

.section-block,
.panel {
  scroll-margin-top: 24px;
}

.section-block {
  margin-top: 30px;
}

.section-heading,
.panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin: 0 0 14px;
}

.section-kicker {
  margin-bottom: 4px;
}

#last-refreshed {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.stat-card {
  display: flex;
  min-width: 0;
  min-height: 132px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 17px;
  padding: 20px 22px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}

.stat-card:last-child {
  border-right: 0;
}

.stat-card > div {
  min-width: 0;
}

.stat-card span:not(.stat-icon) {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 1px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 37px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-icon {
  display: block;
  width: auto;
  height: auto;
  flex: 0 0 auto;
  color: var(--orange-deep);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.stat-total {
  background: var(--surface-warm);
}

.stat-active .stat-icon {
  color: var(--green-deep);
}

.stat-unused .stat-icon {
  color: var(--yellow-deep);
}

.stat-revoked .stat-icon {
  color: var(--red-deep);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(260px, 0.72fr);
  align-items: start;
  gap: 22px;
  margin-top: 24px;
}

.panel {
  min-width: 0;
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.generator-panel .panel-heading,
.cards-panel .panel-heading {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.soft-badge {
  color: #754314;
  border: 1px solid #e2c39e;
  background: var(--orange-pale);
}

.days-fieldset {
  min-width: 0;
  margin: 23px 0 19px;
  padding: 0;
  border: 0;
}

.days-fieldset legend {
  margin-bottom: 10px;
  color: #444139;
  font-size: 13px;
  font-weight: 700;
}

.day-options {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.day-option {
  min-width: 0;
  padding: 8px 5px;
  color: #5c5750;
  border-color: var(--line);
  background: #faf7f2;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.day-option:hover:not(:disabled) {
  color: var(--orange-deep);
  border-color: #d5a474;
  background: var(--surface-warm);
}

.day-option.selected {
  color: #fff;
  border-color: var(--orange-deep);
  background: var(--orange-deep);
}

.generate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.custom-days {
  max-width: 270px;
}

.input-with-unit {
  position: relative;
  display: block;
}

.input-with-unit input {
  padding-right: 42px;
}

.input-with-unit > span {
  position: absolute;
  top: 50%;
  right: 15px;
  color: var(--muted);
  font-weight: 500;
  transform: translateY(-50%);
  pointer-events: none;
}

.flow-panel {
  position: relative;
  margin-top: 9px;
  padding: 26px 25px 22px;
  overflow: hidden;
  border-color: #d8b991;
  background: #f2ddc2;
  transform: rotate(0.35deg);
}

.flow-panel .section-kicker {
  color: #85501e;
}

.flow-panel h2 {
  color: #2d261f;
}

.flow-list {
  display: grid;
  gap: 18px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.flow-list li {
  position: relative;
  display: flex;
  min-width: 0;
  gap: 12px;
}

.flow-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 32px;
  bottom: -17px;
  left: 14px;
  width: 1px;
  background: #c8a67f;
}

.flow-list li > span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  color: #754314;
  border: 1px solid #bc956a;
  border-radius: 50%;
  background: #f8e9d5;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.flow-list strong {
  display: block;
  color: #352b22;
  font-size: 14px;
}

.flow-list p {
  margin: 2px 0 0;
  color: #6d5c49;
  font-size: 12px;
  line-height: 1.55;
}

.flow-footnote {
  position: relative;
  z-index: 2;
  margin: 24px 100px 0 0;
  padding-top: 13px;
  color: #765d43;
  border-top: 1px dashed #c5a077;
  font-size: 10px;
  line-height: 1.6;
}

.flow-mascot {
  position: absolute;
  right: 13px;
  bottom: 9px;
  width: 102px;
  max-height: 105px;
  object-fit: contain;
}

/* 卡密列表：记录行而非嵌套卡片 */
.cards-panel {
  margin-top: 24px;
}

.cards-heading {
  align-items: flex-start;
}

.cards-heading p {
  margin: 7px 0 0;
}

.cards-list {
  display: grid;
  margin-top: 4px;
}

.license-card {
  min-width: 0;
  padding: 22px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.license-card:last-child {
  border-bottom: 0;
}

.license-card-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.license-hint {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-badge {
  display: inline-flex;
  min-height: 29px;
  flex: 0 0 auto;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-active {
  color: var(--green-deep);
  border-color: #c5d4c5;
  background: var(--green);
}

.status-unused {
  color: var(--yellow-deep);
  border-color: #dfcda6;
  background: var(--yellow);
}

.status-revoked {
  color: var(--red-deep);
  border-color: #dfbcb1;
  background: var(--red);
}

.status-expired {
  color: #66635e;
  border-color: #d4d0c9;
  background: #efede8;
}

.license-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 20px;
  margin: 0;
}

.license-meta > div {
  min-width: 0;
}

.license-meta dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.license-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #45433f;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.license-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px dashed var(--line);
}

.license-actions .button {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 12px;
}

.loading-state,
.empty-state {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
}

.loading-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange-deep);
  animation: loading-pulse 160ms ease-in-out infinite alternate;
}

.empty-state img {
  width: 140px;
  height: 118px;
  margin: 0 auto 10px;
  object-fit: contain;
}

.empty-state h3 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 20px;
}

.empty-state p {
  margin-bottom: 18px;
  font-size: 13px;
}

/* 安全设置 */
.password-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(30px, 5vw, 70px);
  margin-top: 24px;
}

.password-intro p {
  max-width: 350px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.password-form {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.password-form .field-help,
.password-form .form-message {
  margin-top: -5px;
}

.password-form .button {
  justify-self: start;
}

.workspace-footer {
  padding: 30px 0 4px;
  color: #847e75;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: right;
}

/* 对话框 */
.dialog {
  width: min(530px, calc(100% - 32px));
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 30px;
  overflow: auto;
  color: var(--text);
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 10px 10px 0 rgba(229, 148, 73, 0.28);
}

.dialog::backdrop {
  background: rgba(18, 20, 31, 0.68);
}

.dialog h2 {
  margin-bottom: 11px;
  font-size: 28px;
}

.dialog > p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.dialog > p strong {
  color: var(--orange-deep);
}

.dialog-decoration,
.confirm-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  place-items: center;
  border: 1px solid #dfbd94;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}

.dialog-decoration {
  color: var(--green-deep);
  border-color: #b8ccb9;
  background: var(--green);
}

.confirm-symbol {
  color: var(--red-deep);
  border-color: #d8aea2;
  background: var(--red);
}

.generated-card {
  display: block;
  width: 100%;
  min-height: 66px;
  padding: 18px 14px;
  overflow-wrap: anywhere;
  color: #713b12;
  border: 1px dashed #b77b43;
  border-radius: var(--radius-sm);
  background: var(--orange-pale);
  font-family: var(--font-mono);
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  user-select: all;
}

.dialog .form-message {
  margin: 10px 0 0;
  text-align: center;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}

.card-dialog .dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* 页面提示 */
.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: grid;
  width: min(390px, calc(100% - 36px));
  pointer-events: none;
}

/* 连续操作只呈现最新提示，避免多条 Toast 覆盖表单与手机操作区。 */
.toast {
  grid-area: 1 / 1;
  min-width: 0;
  padding: 13px 16px;
  color: #f8f4ed;
  border: 1px solid #454855;
  border-radius: var(--radius-sm);
  background: var(--ink);
  box-shadow: 5px 5px 0 rgba(229, 148, 73, 0.2);
  font-size: 13px;
  overflow-wrap: anywhere;
  animation: toast-in 140ms ease-out;
}

/* 登录页已有内联状态信息，不再显示上一会话的旧 Toast。 */
body:has(#login-view:not([hidden])) .toast-region {
  display: none;
}

.toast.info {
  color: #f8f4ed;
  border-color: #454855;
}

.toast.success {
  color: #eff8ef;
  border-color: #58785c;
}

.toast.error {
  color: #fff1ec;
  border-color: #a65e4c;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 2000;
  margin: 0;
  padding: 16px;
  color: var(--red-deep);
  border: 1px solid #cfa79b;
  border-radius: var(--radius-sm);
  background: var(--red);
  text-align: center;
}

@keyframes busy-pulse {
  from { opacity: 0.35; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes loading-pulse {
  from { opacity: 0.3; transform: translateY(1px); }
  to { opacity: 1; transform: translateY(-1px); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 中等屏幕 */
@media (max-width: 1180px) {
  .admin-layout {
    grid-template-columns: 214px minmax(0, 1fr);
  }

  .sidebar {
    padding-right: 15px;
    padding-left: 15px;
  }

  .workspace {
    padding-right: 28px;
    padding-left: 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 116px;
  }

  .stat-card:nth-child(2) {
    border-right: 0;
  }

  .stat-card:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-panel {
    margin-top: 0;
    transform: none;
  }

  .flow-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flow-list li:not(:last-child)::after {
    top: 14px;
    right: -10px;
    bottom: auto;
    left: auto;
    width: 20px;
    height: 1px;
  }

  .flow-footnote {
    margin-right: 0;
  }

  .flow-mascot {
    display: none;
  }

  .license-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .login-card {
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  }

  .login-art {
    padding-right: 30px;
    padding-left: 30px;
  }

  .login-duty-note {
    left: 30px;
    width: 190px;
  }

  .login-mascot {
    width: 43%;
  }

  .login-form-wrap {
    padding-right: 34px;
    padding-left: 34px;
  }

  .login-form-wrap::before {
    left: 34px;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .session-chip {
    justify-content: center;
  }
}

/* 手机与窄平板：单栏工作区 */
@media (max-width: 820px) {
  html {
    scroll-padding-top: 16px;
  }

  .login-shell {
    padding: 22px 16px;
  }

  .login-card {
    grid-template-columns: minmax(0, 1fr);
    width: min(540px, 100%);
    background: transparent;
  }

  .login-art {
    display: none;
  }

  .login-form-wrap {
    min-height: 540px;
    gap: 18px;
    padding: 42px 36px;
    background: transparent;
  }

  .login-form-wrap::before {
    left: 36px;
  }

  .mobile-brand {
    display: flex;
    margin-bottom: 50px;
    padding: 14px 16px;
    border: 1px solid rgba(70, 61, 45, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 247, 0.9);
    font-family: var(--font-serif);
    font-size: 21px;
    font-weight: 700;
  }

  .login-form-heading {
    padding: 14px 16px;
    border: 1px solid rgba(70, 61, 45, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 247, 0.9);
  }

  .login-form-wrap form {
    padding: 20px;
    border: 1px solid rgba(70, 61, 45, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 247, 0.94);
  }

  .security-note {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 247, 0.88);
  }

  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    height: auto;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    overflow: visible;
  }

  .sidebar-brand {
    min-height: 52px;
    padding: 0;
    border: 0;
  }

  .sidebar-brand img {
    width: 42px;
    height: 42px;
  }

  .sidebar-brand strong {
    font-size: 22px;
  }

  .sidebar-brand small,
  .sidebar-caption,
  .sidebar-note,
  .sidebar-bottom p {
    display: none;
  }

  .side-nav {
    display: flex;
    min-width: 0;
    justify-content: center;
    gap: 5px;
    margin: 0;
  }

  .nav-link {
    min-height: 44px;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .nav-link::after,
  .nav-link > span {
    display: none;
  }

  .nav-link:hover {
    transform: none;
  }

  .sidebar-bottom {
    margin: 0;
  }

  .sidebar-bottom .button {
    width: auto;
    padding: 8px 12px;
    font-size: 12px;
  }

  .workspace {
    padding: 28px 24px 22px;
  }

  .workspace-header {
    padding-bottom: 25px;
  }

  .header-actions {
    align-items: center;
    flex-direction: row;
    padding-top: 12px;
  }

  .password-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 25px;
  }

  .password-intro p {
    max-width: none;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 23px;
  }

  .login-shell {
    padding: 0;
  }

  .login-card {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-form-wrap {
    min-height: 100vh;
    min-height: 100svh;
    padding: 36px 25px 30px;
  }

  .login-form-wrap::before {
    left: 25px;
  }

  .login-form-wrap h1 {
    font-size: 34px;
  }

  .mobile-brand {
    margin-bottom: 46px;
  }

  .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 11px;
    padding: 14px;
  }

  .side-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }

  .sidebar-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .sidebar-bottom {
    grid-column: 2;
    grid-row: 1;
  }

  .workspace {
    padding: 24px 15px 20px;
  }

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 22px;
  }

  .workspace-header p {
    font-size: 13px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    padding-top: 0;
  }

  .section-block {
    margin-top: 25px;
  }

  .section-heading,
  .panel-heading {
    align-items: flex-start;
  }

  .stats-grid {
    gap: 0;
  }

  .stat-card {
    min-height: 112px;
    gap: 13px;
    padding: 16px;
  }

  .stat-card strong {
    font-size: 31px;
  }

  .panel {
    padding: 21px 18px;
  }

  .generator-panel .panel-heading {
    flex-direction: column;
    gap: 11px;
  }

  .day-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .generate-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .custom-days {
    max-width: none;
  }

  .generate-row .button {
    width: 100%;
  }

  .flow-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-list li:not(:last-child)::after {
    top: 32px;
    right: auto;
    bottom: -17px;
    left: 14px;
    width: 1px;
    height: auto;
  }

  .cards-heading {
    flex-direction: column;
  }

  .cards-heading .button {
    width: 100%;
  }

  .license-card-header {
    align-items: flex-start;
  }

  .license-hint {
    font-size: 13px;
  }

  .license-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
  }

  .license-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .license-actions .button:only-child {
    grid-column: 1 / -1;
  }

  .password-form .button {
    width: 100%;
    justify-self: stretch;
  }

  .workspace-footer {
    line-height: 1.7;
    text-align: left;
  }

  .dialog {
    padding: 25px 21px;
    box-shadow: 6px 6px 0 rgba(229, 148, 73, 0.24);
  }

  .card-dialog .dialog-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog-actions .button {
    width: 100%;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
}

@media (max-width: 400px) {
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions .button,
  .header-actions .header-skin-switch,
  .session-chip {
    width: 100%;
    justify-content: center;
  }

  .session-chip {
    white-space: normal;
  }
}

@media (max-width: 380px) {
  .login-form-wrap {
    padding: 30px 21px 26px;
  }

  .login-form-wrap::before {
    left: 21px;
  }

  .mobile-brand {
    margin-bottom: 38px;
    font-size: 19px;
  }

  .sidebar {
    gap: 9px;
    padding: 12px 10px;
  }

  .sidebar-brand {
    gap: 8px;
  }

  .sidebar-brand img {
    width: 36px;
    height: 36px;
  }

  .sidebar-brand strong {
    font-size: 19px;
  }

  .sidebar-bottom .button {
    padding-right: 10px;
    padding-left: 10px;
    font-size: 11px;
  }

  .nav-link {
    min-width: 0;
    padding: 8px 3px;
    font-size: 11px;
    white-space: normal;
  }

  .workspace {
    padding-right: 12px;
    padding-left: 12px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .stat-card {
    min-height: 106px;
    padding: 14px 12px;
  }

  .stat-card strong {
    font-size: 29px;
  }

  .stat-icon {
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions .button,
  .session-chip {
    width: 100%;
    justify-content: center;
  }

  .session-chip {
    white-space: normal;
  }

  .panel {
    padding-right: 15px;
    padding-left: 15px;
  }

  .soft-badge {
    white-space: normal;
  }

  .license-card-header {
    flex-wrap: wrap;
  }

  .license-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .license-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog {
    width: calc(100% - 24px);
    padding: 23px 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .cloud-background video {
    display: none;
  }

  .login-duty-note,
  .flow-panel {
    transform: none;
  }
}
