:root {
  --bg: #f6f2ea;
  --panel: #fffdf8;
  --panel-alt: #f3ede1;
  --line: #e4dacd;
  --line-strong: #d7caba;
  --ink: #243244;
  --muted: #667387;
  --accent: #216b77;
  --accent-dark: #164e58;
  --accent-soft: rgba(33, 107, 119, 0.09);
  --danger: #b14b4b;
  --shadow: 0 10px 28px rgba(24, 39, 75, 0.06);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(33, 107, 119, 0.09), transparent 24%),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
  color: var(--ink);
  line-height: 1.45;
}

body.nav-open {
  overflow: hidden;
}

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

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

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

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 26%),
    #1f3d48;
  color: #eef8fa;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  font-size: 1.16rem;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.98rem;
  color: #b8d0d6;
}

.brand-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.brand-shortcut:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  padding: 12px 14px;
  border-radius: 12px;
  color: #d7e8ec;
  font-size: 1.12rem;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-backdrop,
.nav-toggle {
  display: none;
}

.main {
  min-width: 0;
  padding: 28px 28px 40px;
}

.topbar {
  margin-bottom: 22px;
}

.topbar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar-title-group {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(33, 107, 119, 0.1);
  color: var(--accent-dark);
  font-size: 1rem;
  font-weight: 600;
}

.logout-form {
  margin: 0;
}

.topbar-button {
  min-width: 92px;
}

.page-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.flash-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.flash {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1.08rem;
  box-shadow: var(--shadow);
}

.flash-success {
  background: #e8f7ee;
  color: #24563a;
}

.flash-error {
  background: #fdeceb;
  color: #8d3737;
}

.login-shell {
  width: 100%;
  max-width: 560px;
}

.login-panel {
  background: rgba(255, 253, 248, 0.98);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(24, 39, 75, 0.12);
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-copy {
  margin-top: 20px;
}

.login-copy h1 {
  margin: 0;
  font-size: 2.2rem;
  line-height: 1.1;
}

.login-copy p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.login-submit {
  width: 100%;
  min-height: 50px;
  margin-top: 2px;
}

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

.card-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stat-card,
.soft-card,
.panel {
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 1rem;
}

.stat-value {
  margin-top: 8px;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.info-row,
.split-grid,
.form-layout {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

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

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

.form-layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.form-layout.two-col {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.soft-card {
  padding: 18px;
}

.soft-title {
  font-size: 1.08rem;
  font-weight: 700;
}

.soft-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 1.02rem;
  word-break: break-all;
}

.actions-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  padding: 18px 20px 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.22rem;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.98rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #efe8dd;
  text-align: left;
  font-size: 1.04rem;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #faf7f1;
  z-index: 1;
  color: var(--muted);
  font-weight: 600;
}

tbody tr:hover {
  background: #fcfaf5;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 20px 14px;
}

.form-panel {
  padding-bottom: 14px;
}

.data-form {
  padding: 0 20px 20px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-grid.single {
  grid-template-columns: 1fr;
}

label span {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

input[type="file"] {
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(33, 107, 119, 0.12);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.search-form {
  display: flex;
  gap: 12px;
  padding: 0 20px 18px;
  align-items: center;
  flex-wrap: wrap;
}

.search-form input {
  max-width: 360px;
}

.search-summary {
  margin-left: auto;
  min-width: 320px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(243, 237, 225, 0.96));
}

.search-summary-head {
  color: var(--muted);
  font-size: 0.98rem;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.search-summary-card {
  padding: 12px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(215, 202, 186, 0.82);
}

.search-summary-label {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.35;
}

.search-summary-value {
  margin-top: 5px;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.preview-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.preview-label {
  color: var(--muted);
  font-size: 0.96rem;
}

.preview-value {
  margin-top: 8px;
  font-size: 1.3rem;
  font-weight: 700;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.helper-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1rem;
}

.steam-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.steam-layout {
  align-items: start;
}

.panel-stack {
  display: grid;
  gap: 16px;
}

.field-span-two {
  grid-column: span 2;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.96rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-approved {
  background: #e8f7ee;
  color: #24563a;
}

.status-not-approved {
  background: #fdeceb;
  color: #8d3737;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.button:hover,
button.button:hover {
  background: #faf6ef;
}

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

.button.primary:hover,
button.button.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.actions-cell {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.actions-cell form {
  margin: 0;
}

.tiny-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1rem;
}

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

.narrow-panel {
  max-width: 760px;
}

.import-meta {
  padding: 0 20px 20px;
  color: var(--muted);
  font-size: 1.04rem;
  display: grid;
  gap: 6px;
}

@media (max-width: 1280px) {
  .card-grid.six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 960px) {
  html {
    font-size: 16px;
  }

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 360px);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 18px 40px rgba(17, 28, 36, 0.28);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(22, 32, 40, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 35;
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 253, 248, 0.92);
    color: var(--ink);
    box-shadow: var(--shadow);
  }

  .main {
    padding: 18px 18px 28px;
  }

  .topbar {
    margin-bottom: 14px;
  }

  .topbar-row {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .topbar-title-group {
    gap: 12px;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .page-title {
    font-size: 1.7rem;
  }

  .page-subtitle {
    margin-top: 5px;
    font-size: 1rem;
  }

  .info-row,
  .split-grid,
  .form-layout,
  .form-layout.two-col,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-span-two {
    grid-column: auto;
  }

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

  .card-grid.six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

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

  .stat-card,
  .soft-card,
  .panel {
    border-radius: 15px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    margin-top: 6px;
    font-size: 1.52rem;
  }

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

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

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 16px 12px;
  }

  .brand {
    align-items: flex-start;
  }

  .login-body {
    padding: 18px;
  }

  .login-panel {
    border-radius: 20px;
    padding: 22px;
  }

  .data-form,
  .import-meta {
    padding-left: 16px;
    padding-right: 16px;
  }

  .search-form {
    padding-left: 16px;
    padding-right: 16px;
  }

  .search-form input {
    max-width: none;
    width: 100%;
  }

  .search-summary {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .button-row {
    gap: 10px;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  table thead {
    display: none;
  }

  table tbody {
    display: grid;
    gap: 12px;
    padding: 14px;
  }

  table tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
  }

  table tbody tr:hover {
    background: #fff;
  }

  table tbody tr.empty-row {
    border: none;
    background: transparent;
  }

  td {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    white-space: normal;
    word-break: break-word;
    border-bottom: 1px dashed #ece3d6;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.96rem;
    line-height: 1.35;
  }

  td:last-child {
    border-bottom: none;
  }

  td.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }

  td.actions-cell::before {
    content: attr(data-label);
    flex: 0 0 100%;
  }

  .empty-cell {
    display: block;
    padding: 18px 12px;
    border-bottom: none;
    text-align: center;
  }

  .empty-cell::before {
    content: none;
  }
}

@media (max-width: 640px) {
  .preview-grid {
    grid-template-columns: 1fr;
  }

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

  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form .button {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
  }

  .session-badge,
  .topbar-button {
    width: 100%;
    justify-content: center;
  }

  .search-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .card-grid.six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steam-summary-grid {
    grid-template-columns: 1fr;
  }

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

  td {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
  }

  .button,
  button.button,
  .nav-toggle {
    min-height: 40px;
  }
}
