:root {
  --ink: #101010;
  --muted: #5b625e;
  --line: #cfcfcf;
  --green: #274f39;
  --green-dark: #163526;
  --yellow: #ffe600;
  --paper: #f6f4ef;
  --shadow: 0 24px 60px rgba(28, 35, 29, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Cambria, Georgia, serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(
      90deg,
      rgba(39, 79, 57, 0.03) 0,
      rgba(39, 79, 57, 0.03) 1px,
      transparent 1px,
      transparent 72px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(39, 79, 57, 0.03) 0,
      rgba(39, 79, 57, 0.03) 1px,
      transparent 1px,
      transparent 34px
    ),
    #ebe9e3;
}

button,
input,
select {
  font: inherit;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #ebe9e3;
}

.auth-screen.hidden {
  display: none;
}

.auth-shell {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(340px, 420px);
  overflow: hidden;
  border: 1px solid rgba(16, 16, 16, 0.14);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(19, 31, 24, 0.18);
}

.auth-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 48px 42px;
  color: white;
  background:
    linear-gradient(135deg, rgba(22, 53, 38, 0.92), rgba(39, 79, 57, 0.82)),
    linear-gradient(180deg, rgba(255, 230, 0, 0.15), rgba(255, 230, 0, 0));
}

.auth-kicker {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.auth-title {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
  color: white;
}

.auth-copy {
  margin: 0;
  max-width: 34ch;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.auth-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-highlights span {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.92);
}

.auth-card {
  width: 100%;
  padding: 40px 34px;
  border-left: 1px solid rgba(16, 16, 16, 0.1);
  background: #f6f4ef;
}

.auth-head {
  margin-bottom: 24px;
}

.auth-head h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.auth-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  font-weight: 700;
  color: #223129;
}

.auth-card input {
  min-height: 54px;
  border: 1px solid #b9c8be;
  border-radius: 16px;
  padding: 0 16px;
  background: #ffffff;
  font: inherit;
  font-size: 1.05rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.auth-card input::placeholder {
  color: #7c857f;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(39, 79, 57, 0.12);
  transform: translateY(-1px);
}

.auth-card button {
  width: 100%;
  margin-top: 10px;
  padding-block: 15px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background:
    linear-gradient(135deg, #101010, #274f39 68%, #3f7b59);
  box-shadow: 0 16px 30px rgba(22, 53, 38, 0.2);
}

.auth-card button:hover {
  filter: brightness(1.04);
}

.auth-status {
  min-height: 22px;
  margin: 16px 0 0;
  font-size: 0.92rem;
  color: #5a4438;
}

.auth-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.shell {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 20px;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  font-size: 0.8rem;
}

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

  .auth-panel {
    padding: 34px 28px 26px;
  }

  .auth-card {
    padding: 30px 24px;
    border-left: 0;
    border-top: 1px solid rgba(16, 16, 16, 0.1);
  }
}

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 6vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.subtitle {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.turn-card,
.panel,
.post-repair,
.summary,
.workspace {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(16, 16, 16, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.turn-card {
  border-radius: 28px;
  padding: 24px;
  color: white;
  background: linear-gradient(180deg, rgba(22, 53, 38, 0.97), rgba(39, 79, 57, 0.94));
}

.turn-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2.45rem;
}

.turn-card small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.8);
}

.panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  margin-top: 20px;
  padding: 20px;
  border-radius: 26px;
}

.import-box label,
.post-repair label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.import-box input,
.post-repair input,
.post-repair select {
  min-height: 48px;
  width: 100%;
  border: 2px solid #a7b9ad;
  border-radius: 14px;
  padding: 0 14px;
  color: #0d2418;
  background: #ffffff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(22, 53, 38, 0.04);
}

.post-repair input:focus,
.post-repair select:focus,
.import-box input:focus {
  outline: 3px solid rgba(39, 79, 57, 0.18);
  border-color: #274f39;
}

.import-box p {
  margin: 8px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  color: white;
  background: var(--green-dark);
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#exportPdfBtn {
  background: #101010;
}

#clearBtn {
  color: #101010;
  background: #ded7c4;
}

#logoutBtn {
  color: #101010;
  background: #e9e9e9;
}

.post-repair {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 20px;
  border-radius: 26px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 240px));
  gap: 16px;
  align-items: end;
}

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

.team-field {
  padding: 14px;
  border: 1px solid rgba(16, 16, 16, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 14px rgba(28, 35, 29, 0.08);
}

.team-field span {
  display: block;
  color: var(--green-dark);
  font-size: 0.92rem;
  font-weight: 700;
}

.section-title span {
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

.section-title h2 {
  margin: 4px 0 0;
  font-size: 1.8rem;
}

.summary {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  margin-top: 18px;
  border-radius: 22px;
  overflow: hidden;
}

.summary div {
  padding: 16px 18px;
  border-right: 1px solid rgba(16, 16, 16, 0.08);
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.summary strong {
  display: block;
  margin-top: 6px;
}

.workspace {
  margin-top: 20px;
  border-radius: 28px;
  overflow: hidden;
}

.tabs {
  padding: 16px 16px 0;
}

.tab {
  background: #ddd5c0;
  color: #101010;
}

.tab.active {
  background: var(--green-dark);
  color: white;
}

.hidden {
  display: none !important;
}

.production-view {
  padding: 18px;
}

.sheet-mock {
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(
      0deg,
      white 0,
      white 33px,
      #efefef 33px,
      #efefef 34px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 79px,
      #efefef 79px,
      #efefef 80px
    ),
    white;
  padding: 14px;
}

.summary-sheet {
  width: 440px;
  margin-bottom: 18px;
  border-collapse: collapse;
  background: transparent;
  table-layout: fixed;
}

.summary-label-col,
.summary-value-col {
  width: 220px;
}

.summary-sheet td {
  height: auto;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #2f2f2f;
  text-align: center;
  font-size: 0.98rem;
  overflow: hidden;
  vertical-align: middle;
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: normal;
}

.sheet-title {
  font-weight: 700;
  text-align: center;
  background: #d9d9d9 !important;
}

.sheet-label {
  font-weight: 700;
  text-align: center;
  background: #d9d9d9 !important;
}

.leader-inline {
  display: block;
  margin-top: 2px;
}

.sheet-value,
.sheet-money {
  text-align: center;
  font-weight: 700;
  vertical-align: middle;
  min-height: 28px;
}

.sheet-value.yellow {
  background: var(--yellow);
}

.blank-cell {
  border-left: 0 !important;
  border-right: 0 !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
  background: transparent !important;
}

.sheet-value.red {
  color: #d40000;
}

.sheet-money {
  display: table-cell;
  padding-right: 12px;
  white-space: nowrap;
  text-align: right;
}

.sheet-money strong {
  display: inline;
  margin-left: 18px;
}

.dry-matrix-wrap {
  width: 780px;
  margin: -6px 0 18px;
}

.dry-matrix-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: white;
}

.dry-matrix-table th,
.dry-matrix-table td {
  padding: 6px 8px;
  border: 1px solid #2f2f2f;
  text-align: center;
  font-size: 0.9rem;
}

.dry-matrix-table th {
  background: #ffffff;
  font-weight: 700;
}

.table-wrap {
  max-height: 620px;
  overflow: auto;
  padding: 0;
}

.compact {
  padding: 0;
}

table {
  width: auto;
  border-collapse: collapse;
  background: white;
  table-layout: fixed;
}

th,
td {
  padding: 4px 6px;
  border: 1px solid #2f2f2f;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.12;
  overflow: hidden;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

th {
  background: #bfbfbf;
  position: sticky;
  top: 0;
  z-index: 1;
}

#repairedView table {
  min-width: 980px;
}

#productionTable th:nth-child(1),
#productionTable td:nth-child(1) {
  width: 42px;
}

#productionTable th:nth-child(2),
#productionTable td:nth-child(2) {
  width: 150px;
}

#productionTable th:nth-child(3),
#productionTable td:nth-child(3) {
  width: 70px;
}

#productionTable th:nth-child(4),
#productionTable td:nth-child(4) {
  width: 72px;
}

#productionTable th:nth-child(5),
#productionTable td:nth-child(5) {
  width: 145px;
}

#productionTable th:nth-child(6),
#productionTable td:nth-child(6) {
  width: 58px;
}

#productionTable th:nth-child(7),
#productionTable td:nth-child(7) {
  width: 58px;
}

#repairedView td,
#repairedView th {
  border-color: #c3c3c3;
  text-align: left;
}

@media (max-width: 980px) {
  .hero,
  .panel,
  .summary {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .team-grid,
  .post-repair {
    grid-template-columns: 1fr;
  }

  .summary-sheet {
    width: 100%;
  }

  .dry-matrix-wrap {
    width: 100%;
  }
}
