/* ==========================================================================
   毛纱库存管理系统 — 样式
   ========================================================================== */

:root {
  --bg: #f2eee4;
  --bg-deep: #ece6d8;
  --surface: #fffdf7;
  --surface-2: #f9f5ea;
  --ink: #1d2a23;
  --ink-soft: #3b4a41;
  --muted: #758076;
  --line: #e1dac9;
  --line-strong: #cfc6b1;
  --green: #1d5a47;
  --green-dark: #123c2f;
  --green-soft: #e7f0ea;
  --accent: #b05e38;
  --accent-soft: #f8e9df;
  --danger: #a63d2c;
  --amber: #a2701c;
  --shadow: 0 12px 32px rgba(41, 48, 40, 0.07);
  --shadow-lg: 0 24px 70px rgba(20, 32, 26, 0.22);
  --radius: 16px;
  --sidebar: 248px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(29, 90, 71, 0.042) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--green);
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: rgba(29, 90, 71, 0.18);
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* --------------------------------------------------------------------------
   布局
   -------------------------------------------------------------------------- */

.layout {
  min-height: 100vh;
}

.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 30px 34px 64px;
  flex: 1;
}

/* --------------------------------------------------------------------------
   侧边栏
   -------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  color: #e8efe8;
  background: linear-gradient(165deg, #1a4a3b 0%, #123b2f 58%, #0d2b23 100%);
  overflow-y: auto;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    115deg,
    transparent 0 42px,
    rgba(255, 255, 255, 0.018) 42px 43px
  );
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: "STSong", "SimSun", serif;
  font-size: 21px;
  color: #e8cba2;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(238, 220, 190, 0.32);
}

.brand-copy strong {
  display: block;
  font-size: 15px;
  letter-spacing: 3px;
  font-weight: 650;
}

.brand-copy span {
  display: block;
  margin-top: 1px;
  font-size: 8.5px;
  letter-spacing: 2.4px;
  color: rgba(232, 239, 232, 0.45);
}

.nav {
  position: relative;
  z-index: 1;
  flex: 1;
  padding-top: 8px;
}

.nav-label {
  margin: 19px 10px 7px;
  font-size: 9.5px;
  letter-spacing: 2.2px;
  color: rgba(220, 235, 225, 0.4);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  margin-bottom: 3px;
  border-radius: 10px;
  color: #c6d4ca;
  font-size: 13.5px;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.065);
  color: #ffffff;
}

.nav-item.active {
  background: #f3eddc;
  color: #173f32;
  font-weight: 650;
  box-shadow: 0 5px 16px rgba(9, 26, 20, 0.22);
}

.nav-glyph {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #cfe0d5;
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active .nav-glyph {
  background: var(--green);
  color: #f7f2e4;
}

.sidebar-foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding-top: 15px;
  margin-top: 10px;
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.sidebar-account strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.sidebar-account span:not(.avatar) {
  display: block;
  font-size: 10.5px;
  color: rgba(232, 239, 232, 0.48);
}

.sidebar-logout {
  width: 100%;
  margin-top: 11px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(232, 239, 232, 0.72);
  font-size: 12px;
  transition: 0.16s;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.scrim {
  display: none;
}

/* --------------------------------------------------------------------------
   顶栏
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 70px;
  padding: 0 34px;
  background: rgba(242, 238, 228, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(207, 198, 177, 0.55);
}

.top-title {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 650;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #f7f2e4;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.avatar.small {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.menu-btn {
  display: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   页头
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2.6px;
  color: var(--accent);
}

.eyebrow.light {
  color: #d8ad7e;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.4px;
  font-weight: 700;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.page-hint {
  margin: 13px 2px 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  transition: 0.16s ease;
}

.btn.primary {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 4px 12px rgba(29, 90, 71, 0.18);
}

.btn.primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn.ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line-strong);
}

.btn.ghost:hover {
  color: var(--green);
  border-color: var(--green);
  background: var(--surface-2);
}

.btn.danger {
  color: var(--danger);
  background: transparent;
  border-color: rgba(166, 61, 44, 0.35);
}

.btn.danger:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   统计卡片
   -------------------------------------------------------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 19px 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(41, 48, 40, 0.03);
}

.stat-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--line-strong);
}

.stat-card.primary {
  color: #f6f1e3;
  background: linear-gradient(140deg, #1d5a47, #164535);
  border-color: #123c2f;
}

.stat-card.primary::after {
  background: var(--accent);
}

.stat-label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
}

.stat-card.primary .stat-label {
  color: rgba(246, 241, 227, 0.65);
}

.stat-value {
  margin-top: 3px;
  font-size: 31px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.stat-unit {
  margin-left: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

.stat-card.primary .stat-unit {
  color: rgba(246, 241, 227, 0.6);
}

/* --------------------------------------------------------------------------
   面板与表格
   -------------------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#fffdf7, #fbf7ec);
}

.toolbar-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.toolbar-meta strong {
  color: var(--ink);
  font-weight: 700;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 240px;
  max-width: 430px;
  height: 36px;
  padding: 0 11px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: 0.16s;
}

.search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29, 90, 71, 0.1);
}

.search svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

/* 列表页表格区域独立滚动，表头始终固定在顶部 */
.panel > .table-wrap {
  max-height: 65vh;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  background: #f7f2e6;
  border-bottom: 1px solid var(--line);
  color: #667166;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #eee8da;
  color: var(--ink-soft);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fcf9f1;
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.qty-strong {
  color: var(--ink);
  font-weight: 700;
}

.qty-negative {
  color: var(--danger);
}

.qty-pending {
  color: var(--amber);
  font-weight: 700;
}

.qty-over {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-weight: 650;
}

.qty-over em {
  padding: 0 5px;
  border: 1px solid rgba(29, 90, 71, 0.35);
  border-radius: 20px;
  font-size: 10px;
  font-style: normal;
  line-height: 16px;
}

.person {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.person::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

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

.hidden {
  display: none !important;
}

.empty-state {
  padding: 54px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.empty-state::before {
  content: "—";
  display: block;
  margin-bottom: 8px;
  color: var(--line-strong);
  font-size: 28px;
}

.row-actions {
  display: flex;
  gap: 13px;
  white-space: nowrap;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 650;
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn.danger {
  color: var(--danger);
}

.link-btn:disabled {
  opacity: 0.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: var(--green-soft);
  border: 1px solid rgba(29, 90, 71, 0.13);
  border-radius: 20px;
  color: var(--green);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.admin {
  background: var(--accent-soft);
  border-color: rgba(176, 94, 56, 0.18);
  color: var(--accent);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 650;
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
}

.status.ok {
  color: var(--green);
}

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

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
}

.notice {
  display: flex;
  gap: 13px;
  margin-bottom: 18px;
  padding: 15px 18px;
  background: #fbf3e2;
  border: 1px solid #e8d9bf;
  border-radius: 12px;
}

.notice-mark {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.notice strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
}

.notice p {
  margin: 0;
  color: #7c6a4c;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   加载与错误
   -------------------------------------------------------------------------- */

.loading {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-panel {
  padding: 40px;
  text-align: center;
}

.error-panel strong {
  font-size: 16px;
}

.error-panel p {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   弹窗与表单
   -------------------------------------------------------------------------- */

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(19, 31, 26, 0.52);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(780px, 100%);
  max-height: 92vh;
  overflow: hidden;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.2s ease;
}

.modal-wide {
  width: min(1180px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#fffdf7, #fbf7ec);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 24px;
  border-top: 1px solid var(--line);
  background: #faf6eb;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.field em {
  margin-left: 3px;
  color: var(--accent);
  font-style: normal;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: #fffdf8;
  color: var(--ink);
  font-size: 13px;
  transition: 0.15s;
}

.field textarea {
  height: auto;
  min-height: 78px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29, 90, 71, 0.1);
}

.field input[readonly],
.computed {
  background: #f5f1e6;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.field input:disabled,
.field textarea:disabled {
  background: #f6f2e8;
  color: var(--ink-soft);
  opacity: 0.85;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  padding: 9px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
}

.form-note strong {
  color: var(--ink);
}

.form-note span {
  opacity: 0.75;
}

.confirm-text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.confirm-text strong {
  color: var(--ink);
}

.form-error {
  margin-top: 15px;
  padding: 10px 13px;
  border: 1px solid #efc8be;
  border-radius: 9px;
  background: #fbece8;
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.65;
}

.form-error[hidden] {
  display: none;
}

/* 出库明细 */

.items-section {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.items-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.items-head h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

.items-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.items-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 320px;
  overflow: auto;
}

.items-table {
  min-width: 820px;
  font-size: 12.5px;
}

.items-table th {
  padding: 8px 7px;
  background: #f7f2e6;
}

.items-table td {
  padding: 6px;
  border-bottom: 1px solid #f1ebde;
}

.items-table tbody tr:hover td {
  background: transparent;
}

.items-table input {
  width: 100%;
  min-width: 84px;
  height: 33px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #fffdf8;
  font-size: 12.5px;
}

.items-table input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(29, 90, 71, 0.1);
}

.items-table input[type="number"] {
  min-width: 76px;
  text-align: right;
}

.avail {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.avail.insufficient {
  color: var(--danger);
  font-weight: 700;
}

.items-total {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 12px;
}

.items-total strong {
  color: var(--ink);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast-root {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: max-content;
  max-width: calc(100vw - 28px);
  pointer-events: none;
}

.toast {
  max-width: min(380px, calc(100vw - 28px));
  padding: 11px 16px;
  border-left: 3px solid #d9b98c;
  border-radius: 10px;
  background: var(--green-dark);
  color: #f5f0e2;
  font-size: 12.5px;
  box-shadow: 0 12px 30px rgba(15, 30, 24, 0.25);
  animation: toastIn 0.22s ease;
}

.toast.error {
  background: #7f2f22;
  border-left-color: #f0b7a7;
}

.toast.warn {
  background: #7a5a1d;
  border-left-color: #f0d49b;
}

.toast.out {
  opacity: 0;
  transform: translateY(-6px);
  transition: 0.25s;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   登录 / 注册
   -------------------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px 54px;
  color: #f2ecdc;
  background: linear-gradient(155deg, #1b4b3c 0%, #11362b 55%, #0d2a22 100%);
}

.auth-brand::before {
  content: "28/2";
  position: absolute;
  right: -24px;
  bottom: -55px;
  color: rgba(255, 255, 255, 0.035);
  font-size: 240px;
  font-weight: 800;
  letter-spacing: -18px;
  line-height: 1;
  pointer-events: none;
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    115deg,
    transparent 0 38px,
    rgba(255, 255, 255, 0.022) 38px 39px
  );
}

.auth-brand-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
}

.auth-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(238, 220, 190, 0.4);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #e8cba2;
  font-family: "STSong", "SimSun", serif;
  font-size: 22px;
}

.auth-logo-text strong {
  display: block;
  font-size: 15px;
  letter-spacing: 3px;
}

.auth-logo-text span {
  font-size: 8.5px;
  letter-spacing: 2.6px;
  color: rgba(242, 236, 220, 0.5);
}

.auth-hero {
  position: relative;
  z-index: 1;
  margin: auto 0;
  padding: 40px 0;
}

.auth-hero h1 {
  margin: 12px 0 18px;
  font-size: clamp(34px, 4.2vw, 54px);
  font-weight: 650;
  line-height: 1.28;
  letter-spacing: -1px;
}

.auth-hero p {
  margin: 0;
  color: rgba(242, 236, 220, 0.66);
  font-size: 13.5px;
  line-height: 1.9;
}

.auth-brand-foot {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 22px;
  color: rgba(242, 236, 220, 0.42);
  font-size: 10px;
  letter-spacing: 1.4px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--bg);
}

.auth-card {
  width: min(390px, 100%);
  padding: 30px 32px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.auth-tabs a {
  position: relative;
  padding: 0 2px 11px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.auth-tabs a.active {
  color: var(--ink);
}

.auth-tabs a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.auth-title h2 {
  margin: 0 0 5px;
  font-size: 21px;
  letter-spacing: -0.3px;
}

.auth-title p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form .field input {
  height: 42px;
}

.auth-submit {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  font-size: 14px;
  letter-spacing: 2px;
}

.auth-note {
  margin: 2px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.auth-note a {
  font-weight: 650;
}

.auth-flash {
  margin-bottom: 16px;
  padding: 9px 12px;
  background: var(--green-soft);
  border: 1px solid rgba(29, 90, 71, 0.15);
  border-radius: 8px;
  color: var(--green);
  font-size: 11.5px;
  line-height: 1.6;
}

.auth-copyright {
  margin-top: 18px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1px;
}

/* --------------------------------------------------------------------------
   动画与响应式
   -------------------------------------------------------------------------- */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1100px) {
  .page {
    padding: 26px 24px 60px;
  }

  .topbar {
    padding: 0 24px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: none;
  }

  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(15, 25, 21, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
  }

  .scrim.show {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    margin-left: 0;
  }

  .menu-btn {
    display: grid;
  }

  .auth {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 280px;
    padding: 30px;
  }

  .auth-hero {
    margin: 30px 0 10px;
    padding: 0;
  }

  .auth-hero h1 {
    font-size: 34px;
  }

  .auth-brand-foot {
    display: none;
  }

  .auth-panel {
    padding: 28px 18px 40px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 20px 14px 50px;
  }

  .topbar {
    height: 60px;
    padding: 0 14px;
  }

  .top-actions {
    gap: 8px;
  }

  .top-actions .badge {
    display: none;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
  }

  .page-head h1 {
    font-size: 23px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-value {
    font-size: 26px;
  }

  .panel-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search {
    min-width: 0;
    max-width: none;
  }

  .toolbar-meta {
    text-align: right;
  }

  .toolbar-right {
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .form-note,
  .items-section {
    grid-column: auto;
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal,
  .modal-wide {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-head,
  .modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal-foot {
    padding: 12px 16px;
  }

  .auth-brand {
    min-height: 230px;
    padding: 24px 22px;
  }

  .auth-hero {
    margin: 24px 0 0;
  }

  .auth-hero h1 {
    font-size: 29px;
  }

  .auth-hero p {
    font-size: 12px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .toast-root {
    top: 12px;
  }
}

/* --------------------------------------------------------------------------
   首页总览
   -------------------------------------------------------------------------- */

.dashboard-charts {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: stretch;
}

.chart-panel {
  display: flex;
  flex-direction: column;
  padding: 22px 24px 16px;
}

.chart-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.chart-panel-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.chart-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.chart-unit {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.bar-chart {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: end;
  min-height: 300px;
  padding: 14px 4px 0;
}

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

.bar-col {
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.bar-value {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-value span {
  margin-left: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
}

.bar-value.negative {
  color: var(--danger);
}

.bar-track {
  position: relative;
  width: 100%;
  max-width: 82px;
  height: 220px;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 9px 9px 0 0;
  background-color: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(to top, #174b3a, #2a7a5f);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18);
}

.bar-fill.yarn {
  background: linear-gradient(to top, #8f4729, #c9774f);
}

.bar-fill.unreturned {
  background: linear-gradient(to top, #7c5514, #c09338);
}

.bar-h-0 { height: 0%; }
.bar-h-1 { height: 1%; }
.bar-h-2 { height: 2%; }
.bar-h-3 { height: 3%; }
.bar-h-4 { height: 4%; }
.bar-h-5 { height: 5%; }
.bar-h-6 { height: 6%; }
.bar-h-7 { height: 7%; }
.bar-h-8 { height: 8%; }
.bar-h-9 { height: 9%; }
.bar-h-10 { height: 10%; }
.bar-h-11 { height: 11%; }
.bar-h-12 { height: 12%; }
.bar-h-13 { height: 13%; }
.bar-h-14 { height: 14%; }
.bar-h-15 { height: 15%; }
.bar-h-16 { height: 16%; }
.bar-h-17 { height: 17%; }
.bar-h-18 { height: 18%; }
.bar-h-19 { height: 19%; }
.bar-h-20 { height: 20%; }
.bar-h-21 { height: 21%; }
.bar-h-22 { height: 22%; }
.bar-h-23 { height: 23%; }
.bar-h-24 { height: 24%; }
.bar-h-25 { height: 25%; }
.bar-h-26 { height: 26%; }
.bar-h-27 { height: 27%; }
.bar-h-28 { height: 28%; }
.bar-h-29 { height: 29%; }
.bar-h-30 { height: 30%; }
.bar-h-31 { height: 31%; }
.bar-h-32 { height: 32%; }
.bar-h-33 { height: 33%; }
.bar-h-34 { height: 34%; }
.bar-h-35 { height: 35%; }
.bar-h-36 { height: 36%; }
.bar-h-37 { height: 37%; }
.bar-h-38 { height: 38%; }
.bar-h-39 { height: 39%; }
.bar-h-40 { height: 40%; }
.bar-h-41 { height: 41%; }
.bar-h-42 { height: 42%; }
.bar-h-43 { height: 43%; }
.bar-h-44 { height: 44%; }
.bar-h-45 { height: 45%; }
.bar-h-46 { height: 46%; }
.bar-h-47 { height: 47%; }
.bar-h-48 { height: 48%; }
.bar-h-49 { height: 49%; }
.bar-h-50 { height: 50%; }
.bar-h-51 { height: 51%; }
.bar-h-52 { height: 52%; }
.bar-h-53 { height: 53%; }
.bar-h-54 { height: 54%; }
.bar-h-55 { height: 55%; }
.bar-h-56 { height: 56%; }
.bar-h-57 { height: 57%; }
.bar-h-58 { height: 58%; }
.bar-h-59 { height: 59%; }
.bar-h-60 { height: 60%; }
.bar-h-61 { height: 61%; }
.bar-h-62 { height: 62%; }
.bar-h-63 { height: 63%; }
.bar-h-64 { height: 64%; }
.bar-h-65 { height: 65%; }
.bar-h-66 { height: 66%; }
.bar-h-67 { height: 67%; }
.bar-h-68 { height: 68%; }
.bar-h-69 { height: 69%; }
.bar-h-70 { height: 70%; }
.bar-h-71 { height: 71%; }
.bar-h-72 { height: 72%; }
.bar-h-73 { height: 73%; }
.bar-h-74 { height: 74%; }
.bar-h-75 { height: 75%; }
.bar-h-76 { height: 76%; }
.bar-h-77 { height: 77%; }
.bar-h-78 { height: 78%; }
.bar-h-79 { height: 79%; }
.bar-h-80 { height: 80%; }
.bar-h-81 { height: 81%; }
.bar-h-82 { height: 82%; }
.bar-h-83 { height: 83%; }
.bar-h-84 { height: 84%; }
.bar-h-85 { height: 85%; }
.bar-h-86 { height: 86%; }
.bar-h-87 { height: 87%; }
.bar-h-88 { height: 88%; }
.bar-h-89 { height: 89%; }
.bar-h-90 { height: 90%; }
.bar-h-91 { height: 91%; }
.bar-h-92 { height: 92%; }
.bar-h-93 { height: 93%; }
.bar-h-94 { height: 94%; }
.bar-h-95 { height: 95%; }
.bar-h-96 { height: 96%; }
.bar-h-97 { height: 97%; }
.bar-h-98 { height: 98%; }
.bar-h-99 { height: 99%; }
.bar-h-100 { height: 100%; }

.bar-label {
  min-height: 34px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.dashboard-note {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 11.5px;
}

@media (max-width: 780px) {
  .dashboard-charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .chart-panel {
    padding: 18px 16px 14px;
  }

  .bar-chart {
    min-height: 250px;
    gap: 10px;
    padding-left: 0;
    padding-right: 0;
  }

  .bar-track {
    height: 175px;
  }

  .bar-value {
    font-size: 14px;
  }

  .bar-label {
    min-height: 44px;
    font-size: 11px;
  }
}

/* --------------------------------------------------------------------------
   公告
   -------------------------------------------------------------------------- */

.hidden {
  display: none !important;
}

.announce-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf7;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.announce-btn:hover {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.announce-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.announce-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.announce-form {
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.announce-form-title {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: -0.1px;
}

.announce-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.announce-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announce-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf7;
}

.announce-card.is-hidden {
  background: var(--surface-2);
  border-style: dashed;
}

.announce-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.announce-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.1px;
}

.announce-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.announce-status {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}

.announce-status.on {
  background: var(--green-soft);
  color: var(--green);
}

.announce-status.off {
  background: var(--accent-soft);
  color: var(--accent);
}

.announce-content {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announce-card-foot {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.announce-empty {
  padding: 36px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 640px) {
  .announce-btn {
    padding: 0 10px;
    font-size: 11px;
  }

  .announce-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .announce-card {
    padding: 14px;
  }
}
