:root {
  --ink: #18201d;
  --muted: #66736e;
  --line: #d9e1dc;
  --surface: #f4f7fc;
  --surface-strong: #ffffff;
  --panel: #eef4ff;
  --green: #2f7fe8;
  --green-dark: #003399;
  --coral: #c94f37;
  --yellow: #e6b341;
  --shadow: 0 1.125rem 2.8125rem rgba(24, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(47, 127, 232, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(230, 179, 65, 0.12), transparent 42%),
    var(--surface);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.625rem;
  font-size: clamp(1.875rem, 3vw, 2.875rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.landing-shell,
.intern-page,
.mentor-page {
  min-height: 100vh;
}

.landing-shell {
  display: grid;
  place-items: center;
  padding: 1.75rem;
}

.landing-panel {
  width: min(61.25rem, 100%);
  padding: 2.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.landing-copy,
.auth-copy,
.hero-copy p {
  color: var(--muted);
  font-size: 0.9375rem;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.125rem;
  margin-top: 1.75rem;
}

.entry-card {
  display: grid;
  gap: 0.5rem;
  min-height: 11.25rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 244, 255, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.entry-card:hover {
  transform: translateY(-0.125rem);
  border-color: var(--green);
}

.entry-index {
  color: var(--yellow);
  font-size: 0.75rem;
  font-weight: 800;
}

.entry-card strong {
  font-size: 1.5rem;
}

.entry-card span:last-child {
  color: var(--muted);
}

.intern-page {
  display: grid;
  grid-template-columns: minmax(22.5rem, 26.875rem) minmax(47.5rem, 1fr);
  gap: 1.5rem;
  padding: 1.75rem;
  align-items: start;
}

.hero-panel,
.intern-form-shell,
.auth-card,
.mentor-panel,
.mentor-editor {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: sticky;
  top: 1.75rem;
  padding: 1.75rem;
  display: grid;
  gap: 1.5rem;
  background:
    linear-gradient(160deg, rgba(47, 127, 232, 0.92), rgba(0, 51, 153, 0.94)),
    #003399;
  color: #f8fffb;
}

.hero-panel .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.hero-panel h1 {
  margin-bottom: 0.875rem;
}

.hero-panel p {
  color: rgba(248, 255, 251, 0.82);
}

.hero-points {
  display: grid;
  gap: 0.875rem;
}

.hero-points article {
  display: grid;
  gap: 0.25rem;
  padding-top: 0.875rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-points strong {
  font-size: 1rem;
}

.hero-points span {
  color: rgba(248, 255, 251, 0.78);
  font-size: 0.875rem;
}

.intern-form-shell {
  overflow: hidden;
}

.submission-receipt {
  display: grid;
  gap: 1rem;
}

.submission-receipt[hidden] {
  display: none;
}

.receipt-heading {
  border-bottom: 0;
}

.receipt-body {
  display: grid;
  gap: 1rem;
  padding: 1.375rem;
}

.receipt-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.receipt-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
}

.receipt-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.receipt-row span {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
}

.receipt-row strong {
  font-size: 1rem;
  word-break: break-word;
}

.receipt-actions {
  justify-content: flex-end;
  padding-top: 0.25rem;
}

.mentor-page {
  padding: 1.75rem;
}

.auth-card {
  width: min(32.5rem, 100%);
  padding: 2.125rem;
}

.mentor-access-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18.75rem;
  gap: 1.125rem;
  align-items: start;
}

.mentor-access-layout.authenticated {
  grid-template-columns: 1fr;
}

.auth-inline-shell {
  position: sticky;
  top: 1.75rem;
}

.compact-auth-card {
  width: 100%;
  padding: 1.375rem;
}

.compact-auth-card h2 {
  margin-bottom: 0.5rem;
}

.token-form {
  display: grid;
  gap: 1.125rem;
}

.compact-token-form {
  gap: 0.875rem;
}

.token-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}

.token-action-primary,
.token-action-secondary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.mentor-shell {
  display: grid;
  gap: 1.125rem;
}

.mentor-shell.locked {
  opacity: 0.56;
  pointer-events: none;
  user-select: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading {
  min-height: 4.5rem;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.inline-link {
  color: var(--green-dark);
  font-size: 0.875rem;
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.metrics article {
  min-height: 5.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}

.metrics strong {
  display: block;
  margin-top: 0.5rem;
  font-size: 1.875rem;
  line-height: 1;
}

.mentor-layout {
  display: grid;
  gap: 1.125rem;
}

.floor-plan-panel[hidden] {
  display: none;
}

.floor-plan-heading {
  align-items: flex-start;
}

.floor-plan-subtitle {
  margin: 0.375rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.floor-plan-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.floor-plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem 1rem;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.floor-plan-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.floor-plan-legend .legend-swatch,
.floor-plan-legend .legend-corner {
  width: 1rem;
  height: 1rem;
  display: inline-block;
  flex: 0 0 auto;
  border: 1px solid rgba(24, 32, 29, 0.28);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.floor-plan-legend .legend-empty {
  background-color: #ffffff;
}

.floor-plan-legend .legend-staff-partial {
  background-color: #e5e7eb;
}

.floor-plan-legend .legend-intern-partial {
  background-color: #d8f0df;
}

.floor-plan-legend .legend-intern-full {
  background-color: #2f8f5b;
  border-color: #2f8f5b;
}

.floor-plan-legend .legend-staff-full {
  background-color: #6b7280;
  border-color: #6b7280;
}

.floor-plan-legend .legend-corner {
  background: linear-gradient(135deg, #e6b341 0 50%, #ffffff 50% 100%);
}

.floor-plan-stage {
  position: relative;
  height: 320px;
  overflow: auto;
  padding: 1rem;
  background:
    linear-gradient(90deg, rgba(217, 225, 220, 0.45) 1px, transparent 1px),
    linear-gradient(rgba(217, 225, 220, 0.45) 1px, transparent 1px),
    rgba(255, 255, 255, 0.78);
  background-size: 20px 20px;
}

.floor-plan-canvas {
  position: relative;
  min-width: 760px;
  min-height: 400px;
  margin: 0 auto;
}

.floor-plan-canvas[hidden] {
  display: none;
}

.floor-plan-room {
  position: absolute;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.25rem;
  border: 2px solid rgba(24, 32, 29, 0.18);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 0.5rem 1rem rgba(24, 32, 29, 0.08);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.floor-plan-room:hover {
  transform: translateY(-0.125rem);
  border-color: var(--green);
  box-shadow: 0 0.875rem 1.5rem rgba(24, 32, 29, 0.12);
}

.floor-plan-room strong {
  font-size: 1.25rem;
}

.floor-plan-room span {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.room-empty {
  background: #ffffff;
}

.room-staff-partial {
  background: #eef0f2;
}

.room-intern-partial {
  background: #dff4e8;
}

.room-intern-full {
  background: #1f7a4d;
  color: #ffffff;
}

.room-intern-full span {
  color: rgba(255, 255, 255, 0.82);
}

.room-staff-full {
  background: #697179;
  color: #ffffff;
}

.room-staff-full span {
  color: rgba(255, 255, 255, 0.82);
}

.staff-corner {
  position: absolute;
  right: 0;
  top: 0;
  width: 0;
  height: 0;
  border-top: 1.125rem solid var(--yellow);
  border-left: 1.125rem solid transparent;
}

.floor-plan-empty {
  min-height: 100%;
}

.intern-form {
  padding: 1.375rem;
}

.field-grid {
  display: grid;
  gap: 1rem;
}

.intern-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.intern-grid label {
  grid-column: span 4;
}

.intern-grid .wide {
  grid-column: 1 / -1;
}

.field-grid.dense {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 0.375rem;
}

label span {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6875rem 0.75rem;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 7rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 0.1875rem rgba(47, 127, 232, 0.12);
}

.form-actions,
.topbar-actions,
.table-tools,
.segmented-control,
.row-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.form-actions {
  justify-content: flex-end;
  padding-top: 1.125rem;
}

.primary-button,
.secondary-button,
.icon-button,
.segment,
.table-action,
.link-button {
  border: 1px solid var(--line);
  min-height: 2.375rem;
  padding: 0 0.875rem;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 800;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.primary-button {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button,
.link-button {
  background: transparent;
}

.topbar-link-button {
  min-width: 6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-strong);
}

.secondary-button:hover,
.table-action:hover,
.entry-card:hover,
.icon-button:hover {
  transform: translateY(-0.0625rem);
}

.icon-button {
  width: 2.5rem;
  padding: 0;
  font-size: 1.25rem;
}

.icon-button.danger:hover,
.table-action.danger {
  color: #993b28;
  border-color: rgba(201, 79, 55, 0.22);
}

.table-action.success {
  color: var(--green-dark);
  border-color: rgba(47, 127, 232, 0.22);
}

.table-action.locked,
.table-action:disabled {
  cursor: not-allowed;
  background: rgba(47, 127, 232, 0.9);
  border-color: var(--green);
  color: #ffffff;
  opacity: 0.92;
  transform: none;
}

.segmented-control {
  padding: 0.1875rem;
  background: var(--panel);
  border: 1px solid var(--line);
}

.segment {
  min-height: 2rem;
  padding: 0 0.625rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
}

.segment.active {
  background: var(--surface-strong);
  color: var(--green-dark);
}

.table-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 10rem) minmax(8rem, 10rem);
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--line);
  align-items: center;
  gap: 0.625rem;
}

.search-box {
  position: relative;
  width: 100%;
  min-width: 0;
}

.search-box span {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.25rem;
}

.search-box input {
  padding-left: 2.375rem;
}

#mentorFilter,
#workstationMentorFilter {
  width: 100%;
  min-width: 0;
}

.table-wrap {
  overflow: auto;
  max-height: 38.75rem;
}

table {
  width: 100%;
  min-width: 80rem;
  border-collapse: collapse;
}

th,
td {
  padding: 0.8125rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.875rem;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.75rem;
  z-index: 1;
}

tbody tr:hover {
  background: rgba(39, 137, 149, 0.08);
}

tbody tr.record-left {
  background: rgba(201, 79, 55, 0.08);
}

tbody tr.record-left:hover {
  background: rgba(201, 79, 55, 0.12);
}

.person-cell strong,
.person-cell span {
  display: block;
}

.subtle,
.person-cell span {
  color: var(--muted);
  font-size: 0.75rem;
}

.task-cell {
  min-width: 13.75rem;
  max-width: 17.5rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(47, 127, 232, 0.2);
  background: rgba(47, 127, 232, 0.1);
  color: var(--green-dark);
}

.badge.pending {
  border-color: rgba(230, 179, 65, 0.36);
  background: rgba(230, 179, 65, 0.18);
  color: #7c5a11;
}

.badge.approved {
  border-color: rgba(47, 127, 232, 0.24);
  background: rgba(47, 127, 232, 0.12);
  color: var(--green-dark);
}

.badge.rejected {
  border-color: rgba(201, 79, 55, 0.28);
  background: rgba(201, 79, 55, 0.12);
  color: #993b28;
}

.badge.employment-active {
  border-color: rgba(47, 127, 232, 0.24);
  background: rgba(47, 127, 232, 0.12);
  color: var(--green-dark);
}

.badge.employment-left {
  border-color: rgba(201, 79, 55, 0.36);
  background: rgba(201, 79, 55, 0.2);
  color: #993b28;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 15rem;
  gap: 0.375rem;
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden],
.empty-state strong[hidden],
.empty-state span[hidden] {
  display: none;
}

.empty-state strong {
  color: var(--ink);
}

.toast {
  position: fixed;
  right: 1.375rem;
  bottom: 1.375rem;
  max-width: min(22.5rem, calc(100vw - 2.75rem));
  padding: 0.75rem 0.875rem;
  background: #17231f;
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateY(1.125rem);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .intern-page {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    position: static;
  }

  .field-grid.dense {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .entry-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .intern-grid label {
    grid-column: span 6;
  }
}

@media (max-width: 760px) {
  .landing-shell,
  .intern-page,
  .mentor-page {
    padding: 1.125rem;
  }

  .topbar,
  .section-heading,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .table-tools {
    grid-template-columns: 1fr;
  }

  .mentor-access-layout {
    grid-template-columns: 1fr;
  }

  .receipt-list {
    grid-template-columns: 1fr;
  }

  .intern-grid,
  .field-grid.dense {
    grid-template-columns: 1fr;
  }

  .intern-grid label,
  .intern-grid .wide {
    grid-column: 1 / -1;
  }

  .primary-button,
  .secondary-button,
  .link-button {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
  }

  .token-actions {
    grid-template-columns: 1fr;
  }

  #mentorFilter,
  #workstationMentorFilter {
    max-width: none;
  }

  .floor-plan-stage {
    height: 300px;
  }

  .floor-plan-canvas {
    margin: 0;
  }

  .floor-plan-legend {
    flex-direction: column;
    align-items: flex-start;
  }
}
