:root {
  color: #17211d;
  background: #f4f6f5;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
  --ink: #17211d;
  --muted: #65716b;
  --line: #d9dfdc;
  --surface: #ffffff;
  --accent: #087f5b;
  --accent-dark: #066849;
  --danger: #bd2c2c;
  --danger-bg: #fff1f0;
  --success-bg: #eaf8f1;
  --warning: #9a5b00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f4f6f5;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-inner,
.page-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.primary-nav { display: flex; align-self: stretch; align-items: stretch; gap: 6px; }
.primary-nav a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
}
.primary-nav a:hover { color: var(--ink); }
.primary-nav a.active { border-bottom-color: var(--accent); color: var(--ink); }
.nav-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #e4f3ec;
  color: var(--accent-dark);
  font-size: 11px;
  text-align: center;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 12px; }

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.brand-mark-small { width: 36px; height: 36px; font-size: 18px; }

.page-shell { padding: 42px 0 64px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; line-height: 1.15; }
h2 { margin-bottom: 5px; font-size: 18px; line-height: 1.25; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: 11px; font-weight: 800; }
.muted, .section-heading p { color: var(--muted); }
.section-heading p { margin-bottom: 0; }

.button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #c9d0cc;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
}
.button:hover { border-color: #9da9a3; background: #f8faf9; }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(8, 127, 91, 0.2);
  outline-offset: 1px;
}
.button-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button-primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.button-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.button-danger { border-color: #ebc7c7; color: var(--danger); }
.button-small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.button-wide { width: 100%; }
.button:disabled { cursor: wait; opacity: 0.65; }

.notice {
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 5px;
}
.notice-error { border-color: #efc5c2; background: var(--danger-bg); color: #8f2222; }
.notice-success { border-color: #bce3cf; background: var(--success-bg); color: #12613f; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 30px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.stat { min-width: 0; padding: 20px 22px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 6px; font-size: 27px; line-height: 1; }

.section {
  scroll-margin-top: 88px;
  margin-top: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.record-count { color: var(--muted); white-space: nowrap; }

.upload-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.upload-form label > span:first-child,
.login-form label > span:first-child {
  display: block;
  margin-bottom: 7px;
  color: #3f4a45;
  font-size: 12px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd3cf;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}
input, select { height: 42px; padding: 0 11px; }
textarea { min-height: 96px; padding: 10px 11px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9aa39f; }
.field-wide { grid-column: 1 / -1; }

.file-input {
  position: relative;
  display: flex;
  height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  overflow: hidden;
  padding: 0 12px;
  border: 1px dashed #aebbb5;
  border-radius: 5px;
  background: #fafcfb;
}
.file-input input { position: absolute; inset: 0; height: 100%; cursor: pointer; opacity: 0; }
.file-input span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.file-input strong { color: var(--accent); font-size: 12px; }

.option-row { display: flex; align-items: center; gap: 22px; }
.check-option { display: inline-flex; align-items: center; gap: 8px; }
.check-option input { width: 17px; height: 17px; accent-color: var(--accent); }
.check-option span { white-space: nowrap; }
.submit-button { margin-left: auto; min-width: 128px; }

.inventory { padding: 0; overflow: hidden; }
.inventory .section-heading { padding: 24px 26px 20px; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 1040px; border-collapse: collapse; text-align: left; }
th { padding: 11px 16px; background: #f7f9f8; color: #68736e; font-size: 11px; font-weight: 750; }
td { padding: 15px 16px; border-top: 1px solid #e7ebe9; vertical-align: middle; }
tbody tr:hover { background: #fbfcfc; }
.type-label, .file-name, td small { display: block; }
.type-label, td small { color: var(--muted); font-size: 11px; }
.version { display: inline-block; margin-top: 2px; font-size: 14px; }
.tag { margin-left: 5px; padding: 2px 5px; border-radius: 3px; font-size: 10px; }
.tag-warn { background: #fff2d8; color: var(--warning); }
.file-name { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }
.checksum { color: #46514c; }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; font-weight: 700; }
.status::before { width: 7px; height: 7px; border-radius: 50%; content: ""; }
.status-live { color: #13714c; }
.status-live::before { background: #1aa36f; }
.status-offline { color: #777f7b; }
.status-offline::before { background: #9aa39f; }
time { color: #505b56; font-size: 12px; white-space: nowrap; }
.actions-heading { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.empty-state { padding: 58px 24px; border-top: 1px solid var(--line); text-align: center; }
.empty-state p { margin: 7px 0 0; color: var(--muted); }

.filter-tabs {
  display: flex;
  gap: 4px;
  margin-top: 28px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.filter-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 11px 14px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
}
.filter-tabs a.active { border-bottom-color: var(--accent); color: var(--ink); }
.filter-tabs span { font-size: 11px; }
.feedback-inventory { margin-top: 18px; }
.feedback-table { min-width: 1180px; }
.ticket-id { display: block; white-space: nowrap; font-size: 12px; }
.status-pill {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.status-new { background: #fff0d3; color: #855100; }
.status-progress { background: #e9f1fb; color: #235b97; }
.status-resolved { background: #e6f5ed; color: #146846; }
.status-closed { background: #ecefed; color: #59625e; }
.description-preview { display: block; min-width: 260px; max-width: 420px; }
.delivery { color: var(--muted); white-space: nowrap; font-size: 12px; }
.delivery-sent { color: #13714c; }
.delivery-failed { color: var(--danger); }

.detail-shell { max-width: 1220px; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--accent-dark); text-decoration: none; font-weight: 650; }
.back-link:hover { text-decoration: underline; }
.ticket-heading { align-items: center; }
.ticket-heading .status-pill { margin: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 24px; align-items: start; }
.ticket-section { margin-top: 24px; }
.feedback-description { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); white-space: pre-wrap; font-size: 15px; line-height: 1.7; }
.screenshot-preview { display: block; margin-top: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: #eef1ef; }
.screenshot-preview img { display: block; width: 100%; max-height: 680px; object-fit: contain; }
.meta-section h2 { margin-bottom: 18px; }
.metadata-list { margin: 0; }
.metadata-list div { padding: 11px 0; border-top: 1px solid #e7ebe9; }
.metadata-list div:first-child { padding-top: 0; border-top: 0; }
.metadata-list dt { color: var(--muted); font-size: 11px; font-weight: 700; }
.metadata-list dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.delivery-message { margin-bottom: 15px; color: var(--muted); }
.notification-error { max-height: 110px; overflow: auto; padding: 10px; background: var(--danger-bg); color: var(--danger); font-family: Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
.status-form { display: grid; gap: 15px; }
.status-form label > span { display: block; margin-bottom: 6px; color: #3f4a45; font-size: 12px; font-weight: 700; }

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background: #eef2f0;
}
.login-panel {
  width: min(400px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(26, 39, 33, 0.08);
}
.login-panel .brand-mark { margin-bottom: 28px; }
.login-panel h1 { margin-bottom: 10px; font-size: 25px; }
.login-form { display: grid; gap: 17px; margin-top: 28px; }
.login-form .button { margin-top: 5px; }

@media (max-width: 900px) {
  .upload-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar-inner, .page-shell { width: min(100% - 28px, 1440px); }
  .topbar-inner { height: auto; min-height: 68px; flex-wrap: wrap; padding: 10px 0; }
  .primary-nav { order: 3; width: 100%; height: 40px; margin-bottom: -10px; }
  .primary-nav a { flex: 1; justify-content: center; padding: 0 8px; }
  .page-shell { padding-top: 28px; }
  .page-heading { align-items: start; }
  .page-heading .button { flex: 0 0 auto; }
  h1 { font-size: 25px; }
  .stats { grid-template-columns: 1fr; }
  .stat + .stat { border-top: 1px solid var(--line); border-left: 0; }
  .section { padding: 20px 16px; }
  .inventory { padding: 0; }
  .inventory .section-heading { padding: 20px 16px 16px; }
  .upload-form { grid-template-columns: 1fr; }
  .field-wide { grid-column: 1; }
  .option-row { align-items: stretch; flex-direction: column; gap: 13px; }
  .submit-button { width: 100%; margin: 5px 0 0; }
  .login-panel { padding: 28px 22px; }
}
