/* ============================================================
   民族纹样素材管理与过程记录系统 V1.0
   样式表：变量 → 基础 → 布局 → 组件 → 页面 → 响应式
   ============================================================ */

:root {
  --ink: #1d2125;
  --ink-2: #4a5158;
  --ink-3: #868e96;
  --line: #e2ddd4;
  --line-2: #efeae1;
  --paper: #faf8f4;
  --paper-2: #ffffff;
  --red: #9b1b1e;
  --red-2: #b52b2f;
  --red-soft: #f7ecea;
  --gold: #b0803a;
  --green: #2f6f4f;
  --green-soft: #e9f2ec;
  --amber: #9a6a1c;
  --amber-soft: #fbf2e2;
  --shadow: 0 1px 2px rgba(29, 33, 37, 0.05), 0 6px 18px rgba(29, 33, 37, 0.05);
  --radius: 10px;
  --side: 208px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.2px;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.boot {
  display: grid;
  place-items: center;
  height: 100vh;
  color: var(--ink-3);
}

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-side {
  position: relative;
  background: linear-gradient(160deg, #7d1518 0%, #9b1b1e 45%, #5d0f12 100%);
  color: #f6ece4;
  padding: 56px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.login-side::after {
  content: "";
  position: absolute;
  inset: -30% -10% auto auto;
  width: 520px;
  height: 520px;
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 236, 210, 0.16) 0 2px, transparent 2px);
  background-size: 22px 22px;
  opacity: 0.5;
  transform: rotate(12deg);
}

.login-brand {
  position: relative;
  z-index: 1;
}

.login-brand h1 {
  font-size: 26px;
  line-height: 1.5;
  letter-spacing: 3px;
}

.login-brand .ver {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 2px;
  color: rgba(246, 236, 228, 0.7);
}

.login-points {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: rgba(246, 236, 228, 0.86);
}

.login-points li {
  margin-bottom: 12px;
  padding-left: 18px;
  position: relative;
}

.login-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(246, 236, 228, 0.7);
  transform: rotate(45deg);
}

.login-main {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.login-card {
  width: 100%;
  max-width: 348px;
}

.login-card h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.login-card .sub {
  color: var(--ink-3);
  font-size: 13px;
  margin-bottom: 26px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(155, 27, 30, 0.08);
}

.field textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.7;
}

.field .hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--ink-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  border-color: #cfc7ba;
  background: #fcfbf9;
}

.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--red-2);
  border-color: var(--red-2);
}

.btn-primary:disabled {
  background: #d8b6b4;
  border-color: #d8b6b4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  padding: 11px;
  font-size: 15px;
}

.btn-danger {
  color: var(--red);
  border-color: #e5c8c6;
}

.btn-danger:hover {
  background: var(--red-soft);
}

/* ---------------- 主框架 ---------------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.side {
  width: var(--side);
  flex: 0 0 var(--side);
  background: #fff;
  border-right: 1px solid var(--line-2);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 0 10px 20px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 16px;
}

.side-brand .t {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.5px;
}

.side-brand .s {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 1px;
  margin-top: 4px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.side-nav a:hover {
  background: #faf8f4;
}

.side-nav a.active {
  background: var(--red-soft);
  color: var(--red);
  font-weight: 500;
}

.side-nav .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}

.side-user {
  border-top: 1px solid var(--line-2);
  padding-top: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.side-user .name {
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
}

.side-user .ops {
  margin-top: 8px;
  display: flex;
  gap: 10px;
}

.side-user .ops button {
  border: none;
  background: none;
  padding: 0;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 12.5px;
}

.side-user .ops button:hover {
  color: var(--red);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 60px;
}

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

.page-head h2 {
  font-size: 20px;
  letter-spacing: 1px;
}

.page-head .desc {
  color: var(--ink-3);
  font-size: 12.5px;
  margin-top: 5px;
}

/* ---------------- 卡片与通用块 ---------------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 20px 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-2);
}

.card-head h3 {
  font-size: 14px;
}

.card-head .sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 3px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

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

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

/* ---------------- 看板 ---------------- */
.stat {
  padding: 18px 20px;
}

.stat .label {
  font-size: 12.5px;
  color: var(--ink-3);
}

.stat .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.stat .value small {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 3px;
}

.stat .foot {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line-2);
  overflow: hidden;
  margin-top: 10px;
}

.bar > i {
  display: block;
  height: 100%;
  background: var(--red);
  border-radius: 3px;
}

.list-plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-plain li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-2);
  font-size: 13px;
}

.list-plain li:last-child {
  border-bottom: none;
}

.list-plain .time {
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}

.kv {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px 14px;
  font-size: 13px;
}

.kv dt {
  color: var(--ink-3);
}

.kv dd {
  margin: 0;
  word-break: break-word;
}

/* ---------------- 表格 ---------------- */
.table-wrap {
  overflow-x: auto;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.tbl th,
table.tbl td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
  white-space: nowrap;
}

table.tbl th {
  font-weight: 500;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.4px;
  background: #fcfbf8;
}

table.tbl tbody tr:hover {
  background: #fdfcfa;
  cursor: pointer;
}

table.tbl td.wrap {
  white-space: normal;
}

.mono {
  font-family: Menlo, Consolas, "Courier New", monospace;
  font-size: 12px;
}

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.7;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag-red {
  background: var(--red-soft);
  color: var(--red);
}

.tag-green {
  background: var(--green-soft);
  color: var(--green);
}

.tag-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag-gray {
  background: #f1f0ed;
  color: var(--ink-2);
}

.tag-line {
  border-color: var(--line);
  color: var(--ink-2);
  background: #fff;
}

/* ---------------- 工具栏 ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar input[type="search"],
.toolbar select {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  min-width: 132px;
}

.toolbar input[type="search"] {
  min-width: 220px;
}

.toolbar .spacer {
  flex: 1;
}

/* ---------------- 素材详情 ---------------- */
.crumb {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 10px;
}

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

.tabs button {
  border: none;
  background: none;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13.5px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs button.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 500;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.version-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.version-item:hover {
  border-color: #d9d0c2;
}

.version-item.active {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(155, 27, 30, 0.06);
}

.version-item .code {
  font-weight: 600;
  font-size: 14px;
  min-width: 46px;
}

.version-item .meta {
  flex: 1;
  min-width: 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

.version-item .meta b {
  color: var(--ink-2);
  font-weight: 500;
}

.rounds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.round-card {
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.round-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  background: #fcfbf8;
}

.round-card header .t {
  font-weight: 600;
  font-size: 13.5px;
}

.round-card header .m {
  font-size: 12px;
  color: var(--ink-3);
}

.round-body {
  padding: 14px 16px;
}

.field-row {
  margin-bottom: 12px;
}

.field-row:last-child {
  margin-bottom: 0;
}

.field-row .k {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-row .v {
  font-size: 13px;
  color: var(--ink);
  background: #fbfaf7;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 8px 10px;
  min-height: 34px;
  white-space: pre-wrap;
  word-break: break-word;
}

.field-row .v.empty {
  color: #b9b2a8;
}

.field-row textarea {
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  resize: vertical;
  line-height: 1.65;
  outline: none;
  font-size: 13px;
}

.field-row textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(155, 27, 30, 0.07);
}

.seal-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--line-2);
  background: #fcfbf8;
  font-size: 12.5px;
  color: var(--ink-3);
}

.diff-row {
  display: grid;
  grid-template-columns: 150px 1fr 1fr 74px;
  gap: 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}

.diff-row > div {
  padding: 11px 14px;
  border-right: 1px solid var(--line-2);
  word-break: break-word;
}

.diff-row > div:last-child {
  border-right: none;
}

.diff-row.head > div {
  background: #fcfbf8;
  color: var(--ink-3);
  font-size: 12px;
}

.diff-row.changed {
  background: #fdf7f1;
}

.side-note {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.8;
}

.notice {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.7;
  margin-bottom: 10px;
  border: 1px solid transparent;
}

.notice.warn {
  background: var(--amber-soft);
  border-color: #f0dcb8;
  color: #7a5314;
}

.notice.info {
  background: #f4f7f9;
  border-color: #dfe8ee;
  color: #40596b;
}

.license-table td select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.license-table td input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}

.license-table td input:focus {
  border-color: var(--line);
  background: #fff;
  outline: none;
}

/* ---------------- 弹层 / 提示 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(29, 33, 37, 0.42);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
  font-weight: 600;
}

.modal .body {
  padding: 18px 20px;
  overflow: auto;
}

.modal footer {
  padding: 13px 20px;
  border-top: 1px solid var(--line-2);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fcfbf8;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(10px);
  background: #26292d;
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 80;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.bad {
  background: #8c2226;
}

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.empty b {
  display: block;
  color: var(--ink-2);
  font-size: 14px;
  margin-bottom: 6px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .diff-row {
    grid-template-columns: 118px 1fr 1fr 66px;
  }
}

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
  }

  .side {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line-2);
  }

  .side-brand {
    padding: 0;
    border: none;
    margin: 0;
  }

  .side-brand .s {
    display: none;
  }

  .side-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .side-nav a {
    padding: 7px 10px;
    white-space: nowrap;
  }

  .side-user {
    border: none;
    padding: 0;
  }

  .side-user .name,
  .side-user .ops .pwd {
    display: none;
  }

  .main {
    padding: 20px 16px 50px;
  }

  /* 窄屏隐藏次要列，避免列宽被挤压导致行高暴涨 */
  table.tbl th:nth-child(3),
  table.tbl td:nth-child(3),
  table.tbl th:nth-child(4),
  table.tbl td:nth-child(4),
  table.tbl th:nth-child(5),
  table.tbl td:nth-child(5),
  table.tbl th:nth-child(6),
  table.tbl td:nth-child(6),
  table.tbl th:nth-child(8),
  table.tbl td:nth-child(8),
  table.tbl th:nth-child(9),
  table.tbl td:nth-child(9) {
    display: none;
  }

  table.tbl th,
  table.tbl td {
    white-space: normal;
    padding: 10px 8px;
  }

  .side-nav {
    flex: 1;
    min-width: 0;
  }

  .side-user > div:not(.ops) {
    display: none;
  }

  table.tbl td:nth-child(2),
  table.tbl th:nth-child(2) {
    min-width: 132px;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .login-wrap {
    grid-template-columns: 1fr;
  }

  .login-side {
    padding: 34px 26px;
    gap: 26px;
  }

  .login-side h1 {
    font-size: 21px;
  }
}
