:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-subtle: #fbfbfc;
  --ink: #111113;
  --muted: #6f7177;
  --muted-2: #9a9ca3;
  --line: #e6e7eb;
  --line-strong: #d7d9df;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --sidebar: #111113;
  --sidebar-soft: #1a1b1f;
  --success-bg: #eef8f2;
  --success-fg: #17633a;
  --warn-bg: #fff7e6;
  --warn-fg: #8a5a00;
  --danger-fg: #b42318;
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.05);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: "Inter", "Geist", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

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

button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 12px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

button:hover {
  background: var(--accent-hover);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

input,
select {
  min-height: 32px;
}

textarea {
  resize: vertical;
}

::placeholder {
  color: var(--muted-2);
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f8f8f9;
}

.login-panel {
  width: min(420px, 100%);
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

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

.login-brand {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0;
}

.login-panel p,
.hint,
.section-title span {
  color: var(--muted);
}

.login-panel p {
  margin: 0 0 18px;
  font-size: 14px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: #3f4147;
  font-size: 13px;
  font-weight: 500;
}

.login-panel button {
  width: 100%;
  margin-top: 4px;
}

.hint {
  margin-top: 14px;
  font-size: 12px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 12px;
  color: #f5f5f6;
  background: var(--sidebar);
  border-right: 1px solid #202126;
}

.brand {
  padding: 4px 6px 12px;
  border-bottom: 1px solid #24252b;
}

.brand strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: #8c8f99;
  font-size: 12px;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-label {
  padding: 0 8px 5px;
  color: #777a84;
  font-size: 11px;
  font-weight: 650;
}

.nav-item {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 10px;
  color: #d5d7dd;
  background: transparent;
  text-align: left;
  font-size: 13px;
}

.nav-item:hover {
  color: #fff;
  background: var(--sidebar-soft);
}

.nav-item.active {
  color: #fff;
  background: #202127;
  border-color: #2b2d34;
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #24252b;
}

.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar > div:first-child strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.top-eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-user strong {
  color: var(--ink);
}

.top-actions,
.toolbar,
.title-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.title-controls input {
  width: 210px;
}

.title-controls select {
  width: 132px;
}

#logoutButton,
.download-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: #3f4147;
  background: var(--surface);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

#logoutButton:hover,
.download-link:hover {
  color: var(--ink);
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}

.view {
  padding: 22px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0;
}

.section-title span {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.meta-pill {
  min-height: 26px;
  display: inline-flex !important;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px !important;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
}

.panel-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.panel-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-heading-row h3 {
  margin: 0;
}

.global-filter-panel {
  display: grid;
  grid-template-columns: 140px minmax(150px, 1fr) minmax(140px, 0.9fr) minmax(140px, 0.9fr) minmax(140px, 0.9fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.global-filter-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  min-height: 28px;
  border-color: var(--line);
  border-radius: 999px;
  color: #3f4147;
  background: var(--surface);
  font-size: 12px;
}

.filter-chip:hover,
.filter-chip.active {
  color: var(--ink);
  background: #eef3ff;
  border-color: rgba(37, 99, 235, 0.28);
}

.ghost-button {
  color: #3f4147;
  background: var(--surface);
  border-color: var(--line);
}

.ghost-button:hover {
  color: var(--ink);
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.compact-kpi-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.kpi {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 13px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.kpi:hover {
  background: #fbfcff;
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 6px 18px rgba(17, 17, 19, 0.06);
}

.kpi.active {
  background: #f7faff;
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 680;
}

.metric-detail-panel {
  margin-top: -4px;
}

.employee-panel {
  margin-bottom: 14px;
}

.compact-section-title {
  margin-bottom: 10px;
}

.compact-section-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.employee-action-row {
  grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1fr) minmax(280px, 1.1fr);
}

.mini-kpi {
  min-height: 66px;
}

.mini-kpi strong {
  font-size: 20px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.panel .table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

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

tbody tr:hover {
  background: #fafafa;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #4d5057;
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 650;
}

.bar-list {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 104px 1fr 42px;
  gap: 10px;
  align-items: center;
  color: #3f4147;
  font-size: 13px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceef2;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.inline-form,
#importForm {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

#importForm {
  grid-template-columns: minmax(220px, 1.2fr) 120px 100px minmax(220px, 1fr) auto;
}

#importForm label,
.review-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.review-form {
  display: grid;
  grid-template-columns: 160px minmax(280px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.import-safety-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #f1d58a;
  border-radius: var(--radius);
  color: #76520d;
  background: #fff9e8;
  font-size: 12px;
}

.batch-download {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.todo-list {
  display: grid;
  gap: 8px;
}

.action-list {
  display: grid;
  gap: 8px;
}

.action-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr) minmax(240px, 0.9fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.action-row strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
}

.action-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.action-row p {
  margin: 0;
  color: #3f4147;
}

.action-row mark {
  justify-self: end;
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: #4d5057;
  background: #f0f1f3;
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.action-row mark.high {
  color: var(--danger-fg);
  background: #fff1f0;
}

.action-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.small-button {
  min-height: 26px;
  padding: 0 8px;
  color: #3f4147;
  background: var(--surface);
  border-color: var(--line);
  font-size: 12px;
}

.small-button:hover {
  color: var(--ink);
  background: #f6f7f9;
  border-color: var(--line-strong);
}

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

.danger-small {
  color: var(--danger-fg);
  background: #fff1f0;
  border-color: #ffc9c5;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
}

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

.fact-grid div {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.fact-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.fact-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.todo-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}

.todo-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.todo-item p {
  margin: 7px 0;
  color: #3f4147;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: #f0f1f3;
  color: #4d5057;
  font-size: 12px;
  font-weight: 600;
}

.badge.high {
  background: #fff1f0;
  color: var(--danger-fg);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.badge.ok {
  background: var(--success-bg);
  color: var(--success-fg);
}

.editable-table td {
  white-space: normal;
}

.editable-table input,
.editable-table select {
  min-width: 120px;
}

.editable-table textarea {
  min-width: 340px;
  min-height: 58px;
}

.editable-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.needs-review {
  background: #fffaf0;
}

pre {
  max-height: 220px;
  margin: 10px 0 0;
  overflow: auto;
  border: 1px solid #25272f;
  border-radius: var(--radius);
  padding: 10px;
  color: #e8e9ed;
  background: #111113;
  font-size: 12px;
  white-space: pre-wrap;
}

.release-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 180px;
}

.release-copy h3 {
  margin: 14px 0 8px;
  font-size: 24px;
}

.release-hash {
  max-width: 760px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.release-public-url {
  margin: 10px 0 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.release-download-button {
  display: inline-flex;
  min-width: 210px;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0 24px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand,
  .sidebar-footer {
    border: 0;
    padding: 0;
  }

  .nav-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .nav-label {
    display: none;
  }

  .nav-item {
    min-width: max-content;
  }

  .grid-two,
  .detail-grid,
  .global-filter-panel,
  .inline-form,
  #importForm {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-title,
  .panel-heading-row,
  .release-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-controls,
  .title-controls input,
  .title-controls select {
    width: 100%;
  }

  .action-row {
    width: 100%;
    grid-template-columns: 1fr;
  }
}
