:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #f4f6fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f4f6fa;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 12%, rgba(47, 140, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 18%, rgba(18, 201, 134, 0.16), transparent 24rem),
    #f4f6fa;
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(28, 43, 70, 0.12);
}

.login-copy {
  display: grid;
  align-content: center;
}

.login-copy p:not(.eyebrow) {
  max-width: 520px;
  margin-top: 18px;
  color: #6b7280;
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 14px;
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  padding: 20px;
  background: #f8fbff;
}

.login-form button {
  width: 100%;
  min-height: 42px;
}

.login-error {
  min-height: 20px;
  color: #d92d20;
  font-weight: 800;
}

.login-hint {
  display: grid;
  gap: 4px;
  color: #6b7280;
  font-size: 13px;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 46px;
  padding: 0 26px;
  color: #fff;
  background: #20242c;
}

.nav-center {
  grid-column: 2;
  display: flex;
  height: 46px;
  align-items: center;
  gap: 44px;
}

.nav-actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-center a,
.quick-actions a {
  color: inherit;
  text-decoration: none;
}

.nav-center a {
  height: 100%;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 800;
}

.nav-center a.active {
  color: #2f8cff;
  border-bottom-color: #2f8cff;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px 26px 42px;
}

.main-column,
.side-column,
.pending-list,
.employee-list,
.leader-rows {
  display: grid;
  gap: 16px;
}

.panel {
  border: 1px solid #e8edf5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 26px rgba(28, 43, 70, 0.06);
}

.view-hidden {
  display: none !important;
}

.login-user {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.logout-button {
  min-height: 32px;
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  background: transparent;
}

.overview {
  padding: 26px;
}

.panel-head,
.section-head,
.top-actions,
.quick-actions,
.record-actions,
.employee-row,
.pending-card footer,
.secretary-card,
.leader-line,
.leader-tabs {
  display: flex;
  align-items: center;
}

.panel-head,
.section-head,
.secretary-card,
.pending-card footer,
.employee-row,
.leader-line {
  justify-content: space-between;
  gap: 14px;
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  color: #1f7cff;
  font-size: 13px;
  font-weight: 800;
}

h1 {
  margin-top: 8px;
  color: #111827;
  font-size: clamp(34px, 4.8vw, 62px);
  line-height: 1;
}

h2 {
  margin-top: 4px;
  color: #111827;
  font-size: 21px;
}

button,
.quick-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  color: #fff;
  background: #1f7cff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.quick-actions {
  gap: 12px;
  flex-wrap: wrap;
}

.quick-actions a,
.ghost {
  border: 1px solid #12c986;
  color: #08a66d;
  background: #fff;
}

.danger {
  color: #d92d20;
  background: #fff0ef;
}

.approve {
  color: #047857;
  background: #ecfdf5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.metric-card {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  border-radius: 6px;
  padding: 26px 28px;
  color: #fff;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: -24px;
  right: -10px;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  border: 22px solid rgba(255, 255, 255, 0.22);
}

.metric-card span,
.metric-card em {
  display: block;
  position: relative;
  z-index: 1;
}

.metric-card strong {
  display: block;
  position: relative;
  z-index: 1;
  margin: 26px 0 12px;
  font-size: 26px;
  line-height: 1;
}

.metric-card em {
  font-style: normal;
  opacity: 0.9;
}

.blue {
  background: linear-gradient(120deg, #1f6fff, #04b7ec);
}

.green {
  background: linear-gradient(120deg, #10c878, #03cfa7);
}

.coral {
  background: linear-gradient(120deg, #f36b5e, #fb7a72);
}

.teal {
  background: linear-gradient(120deg, #2589eb, #69df6b);
}

.reviewer-panel {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  padding: 16px 18px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.review-panel,
.employee-panel,
.data-panel,
.subsidy-panel,
.leaderboard {
  padding: 18px;
}

.review-panel {
  min-height: 0;
}

label {
  display: grid;
  gap: 8px;
  color: #566276;
  font-weight: 800;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid #d8e0ec;
  border-radius: 6px;
  padding: 0 12px;
  color: #1f2937;
  background: #fff;
  font: inherit;
  outline: none;
}

input:focus,
select:focus {
  border-color: #1f7cff;
  box-shadow: 0 0 0 3px rgba(31, 124, 255, 0.12);
}

.muted,
.pending-card p,
.employee-meta,
.secretary-card span {
  color: #6b7280;
}

.pending-card {
  border: 1px solid #ffd7d1;
  border-radius: 6px;
  padding: 14px;
  background: #fff8f7;
}

.pending-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.employee-form,
.filters {
  display: grid;
  gap: 12px;
}

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

#parentField {
  display: grid;
}

.collapse-toggle {
  width: 100%;
  margin-bottom: 10px;
}

.panel-toggle {
  min-height: 30px;
  padding: 0 14px;
}

.employee-panel-body.collapsed,
.employee-list.collapsed {
  display: none;
}

.employee-row {
  border: 1px solid #d8e0ec;
  border-radius: 6px;
  padding: 10px;
  background: #fbfdff;
}

.employee-row strong,
.employee-meta {
  display: block;
}

.employee-meta {
  margin-top: 3px;
  font-size: 12px;
}

.filters {
  grid-template-columns: minmax(260px, 1fr) 170px 170px 150px;
  margin-bottom: 14px;
}

.analytics-panel {
  padding: 18px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.compare-grid div,
.subsidy-summary div {
  border: 1px solid #d8e0ec;
  border-radius: 6px;
  padding: 14px;
  background: #f8fbff;
}

.compare-grid span,
.compare-grid b,
.subsidy-summary span,
.subsidy-summary b {
  display: block;
}

.compare-grid b,
.subsidy-summary b {
  margin-top: 8px;
  color: #1f7cff;
  font-size: 24px;
}

.subsidy-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.subsidy-wrap table {
  min-width: 980px;
}

.year-summary {
  margin-top: 18px;
}

.month-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  align-items: end;
}

.month-bar {
  display: grid;
  gap: 6px;
  min-height: 128px;
  align-content: end;
  text-align: center;
  color: #6b7280;
  font-size: 12px;
}

.month-bar i {
  display: block;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #2f8cff, #12c986);
}

.month-bar b {
  color: #1f2937;
}

.month-bar em {
  color: #6b7280;
  font-style: normal;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #d8e0ec;
  border-radius: 6px;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
}

th {
  color: #4b5563;
  background: #f8fafc;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.badge-new {
  color: #b45309;
  background: #fff7ed;
}

.badge-old {
  color: #047857;
  background: #ecfdf5;
}

.badge-pending {
  color: #b42318;
  background: #fff0ef;
}

.badge-approved {
  color: #155eef;
  background: #e8f1ff;
}

.thumb,
.thumb-button {
  width: 70px;
  height: 44px;
  border-radius: 6px;
}

.thumb {
  object-fit: cover;
  border: 1px solid #d8e0ec;
}

.thumb-button {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.record-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.record-actions button,
.employee-row button,
.pending-card button {
  min-height: 32px;
  padding: 0 12px;
}

.empty {
  color: #98a2b3;
  text-align: center;
}

.leader-tabs {
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 999px;
  background: #eaf2ff;
}

.leader-tabs button {
  flex: 1;
  min-height: 30px;
  background: transparent;
  color: #1f7cff;
}

.leader-tabs button.active {
  color: #fff;
  background: #2f8cff;
}

.leader-line {
  border-bottom: 1px solid #edf1f6;
  padding: 10px 0;
}

.leader-line strong,
.leader-line span {
  display: block;
}

.leader-line span {
  margin-top: 3px;
  color: #6b7280;
  font-size: 12px;
}

.image-dialog {
  width: min(920px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(23, 32, 51, 0.26);
}

.image-dialog::backdrop {
  background: rgba(15, 23, 42, 0.56);
}

.image-dialog button {
  display: block;
  margin: 0 0 12px auto;
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  background: #eef3f8;
}

@media (max-width: 1180px) {
  .page,
  .work-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 860px) {
  .app-nav {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 16px;
  }

  .nav-center,
  .nav-actions {
    grid-column: auto;
    justify-self: start;
  }

  .nav-center {
    gap: 18px;
    height: auto;
    flex-wrap: wrap;
  }

  .page,
  .overview {
    padding: 16px;
  }

  .metric-grid,
  .reviewer-panel,
  .filters,
  .compare-grid,
  .subsidy-summary,
  .month-bars,
  .side-column,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: start;
    flex-direction: column;
  }
}
