:root {
  --blue: #0000ff;
  --red: #ff0000;
  --pink: #f6b6c3;
  --line: #000000;
  --title: #ff00ff;
  --panel: #eeeeee;
  --text: #000000;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: "SimSun", "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
}

button,
input,
select {
  font: inherit;
}

.classic-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  background: #ffffff;
  border-bottom: 1px solid #d8d8d8;
}

.system-title {
  display: flex;
  gap: 42px;
  color: var(--title);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
}

.header-tools {
  position: absolute;
  right: 12px;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-tools button,
.classic-form button {
  min-width: 64px;
  min-height: 24px;
  padding: 2px 12px;
  border: 1px solid #888888;
  background: #efefef;
  color: #000000;
  cursor: pointer;
}

.header-tools button:hover,
.classic-form button:hover {
  background: #dddddd;
}

.classic-menu {
  display: flex;
  align-items: stretch;
  margin: 12px 4px 0;
  border-left: 1px solid var(--line);
}

.menu-item {
  min-width: 112px;
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.menu-item.active {
  background: #0000cc;
  text-decoration: underline;
}

.classic-main {
  padding: 0 4px 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.classic-panel {
  margin-top: 10px;
}

.panel-caption {
  display: inline-block;
  min-width: 120px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
  text-align: center;
}

.classic-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.classic-form label {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.classic-form label.wide {
  grid-column: span 2;
}

.classic-form span {
  text-align: right;
}

.classic-form input,
.classic-form select {
  width: 100%;
  min-height: 24px;
  border: 1px solid #999999;
  background: #ffffff;
  color: #000000;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
}

.legend-item {
  display: inline-block;
  min-width: 130px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  text-align: center;
}

.legend-item.blue {
  background: var(--blue);
  color: #ffffff;
}

.legend-item.pink {
  background: var(--pink);
}

.legend-item.red {
  background: var(--red);
}

.classic-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
}

.classic-table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  table-layout: auto;
}

.classic-table th,
.classic-table td {
  padding: 6px 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.classic-table th {
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.classic-table tr.serial-unused td {
  background: var(--blue);
  color: #ffffff;
}

.classic-table tr.serial-using td {
  background: var(--pink);
  color: #000000;
}

.classic-table tr.serial-expired td {
  background: var(--red);
  color: #000000;
}

.classic-table tr.serial-neutral td {
  background: var(--pink);
  color: #000000;
}

.classic-table tr:hover td {
  outline: 2px solid #ffff00;
  outline-offset: -2px;
}

.action-cell {
  min-width: 62px;
}

.link-button {
  border: 0;
  background: transparent;
  color: #0000ee;
  text-decoration: underline;
  cursor: pointer;
}

.serial-unused .link-button {
  color: #ffffff;
}

.edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 70px;
  background: rgba(0, 0, 0, 0.2);
}

.edit-overlay.show {
  display: flex;
}

.edit-dialog {
  width: min(880px, calc(100vw - 32px));
  border: 1px solid var(--line);
  background: #eeeeee;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
}

.edit-title {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 8px 14px;
  padding: 12px;
}

.edit-form label {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.edit-form label.wide {
  grid-column: span 2;
}

.edit-form span {
  text-align: right;
}

.edit-form input,
.edit-form select {
  width: 100%;
  min-height: 24px;
  border: 1px solid #999999;
  background: #ffffff;
  color: #000000;
}

.edit-actions {
  display: flex;
  gap: 10px;
  padding: 0 12px 12px 102px;
}

.edit-actions button {
  min-width: 76px;
  min-height: 25px;
  border: 1px solid #888888;
  background: #efefef;
  cursor: pointer;
}

.edit-help {
  padding: 0 12px 12px 102px;
  color: #333333;
}

.empty {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--pink);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid #000000;
  background: #ffffcc;
  color: #000000;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #ffd2d2;
}

@media (max-width: 900px) {
  .classic-header {
    position: static;
    display: block;
    padding: 10px 8px;
    text-align: center;
  }

  .system-title {
    justify-content: center;
    gap: 16px;
  }

  .header-tools {
    position: static;
    justify-content: center;
    margin-top: 8px;
  }

  .classic-menu {
    overflow-x: auto;
  }

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

  .classic-form label,
  .classic-form label.wide {
    grid-column: auto;
  }

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

  .edit-form label,
  .edit-form label.wide {
    grid-column: auto;
  }

  .edit-actions,
  .edit-help {
    padding-left: 12px;
  }
}
