:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --text: #18211f;
  --muted: #66736f;
  --line: #dfe6e2;
  --primary: #0f766e;
  --primary-dark: #0b5d56;
  --accent: #d97706;
  --danger: #b42318;
  --success: #15803d;
  --shadow: 0 18px 45px rgba(20, 33, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

input,
select,
button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.nav a {
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--muted);
}

.nav a:hover,
.tabs a.active {
  background: #e7f2ef;
  color: var(--primary-dark);
}

.user-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 20px;
}

.head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-head h1,
.auth-panel h1 {
  margin: 4px 0 6px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.alert {
  margin-bottom: 16px;
  padding: 13px 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.alert-success {
  border-color: #bbf7d0;
  color: #166534;
}

.alert-error {
  border-color: #fecaca;
  color: var(--danger);
}

.panel,
.form-card,
.job-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.narrow {
  max-width: 760px;
  margin-bottom: 18px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 420px);
  align-items: center;
  gap: clamp(24px, 7vw, 82px);
  min-height: calc(100vh - 180px);
}

.form-card {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #31403c;
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid #cad5d0;
  border-radius: 7px;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid var(--primary);
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.button:hover {
  background: var(--primary-dark);
}

.button-light {
  background: #fff;
  color: var(--primary-dark);
}

.button-light:hover {
  background: #eef7f4;
}

.button-danger {
  border-color: var(--danger);
  background: var(--danger);
}

.button-danger:hover {
  background: #8f1d14;
}

.button-wide {
  width: 100%;
}

.button-small {
  min-height: 34px;
  padding: 6px 10px;
}

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

.stats-grid-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat {
  padding: 17px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.stat-red {
  border-color: #fecaca;
  background: #fff7f7;
}

.filters {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr)) auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.bulkbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 300px) auto;
  gap: 12px;
  align-items: end;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}

.checkline input,
td input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 22px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.admin-table {
  min-width: 1320px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #52615d;
  background: #f7faf8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.row-done {
  background: #f3fbf6;
}

.row-failed {
  background: #fff1f1;
}

.empty-row {
  text-align: center;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.badge-gray {
  background: #edf1ef;
  color: #52615d;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.subline {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 700;
}

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

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.team-save {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 230px;
}

.reset-details {
  min-width: 190px;
}

.reset-details summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 800;
}

.reset-details form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

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

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.team-chip span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  background: #e8eeeb;
  border-radius: 8px;
}

.tabs a {
  padding: 9px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}

.job-list {
  display: grid;
  gap: 12px;
}

.job-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px;
}

.compact-jobs {
  gap: 8px;
}

.compact-jobs .job-card {
  padding: 12px;
}

.job-card.done {
  background: #f3fbf6;
}

.job-card h2 {
  margin: 10px 0 12px;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.18;
}

.job-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.job-title-row h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 0;
}

.job-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.job-card dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.job-actions {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 150px;
}

.issue-form {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) auto;
  gap: 8px;
}

.done-time {
  color: var(--success);
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: start center;
  gap: 10px;
  padding: 54px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state h1,
.empty-state h2 {
  margin: 0;
  color: var(--text);
}

.status-code {
  color: var(--primary);
  font-size: 58px;
  font-weight: 900;
}

.code-line {
  margin-top: 8px;
  padding: 11px 12px;
  overflow-x: auto;
  border-radius: 7px;
  background: #111c1a;
  color: #eafff8;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .topbar,
  .page-head,
  .user-menu {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .brand {
    min-width: 0;
  }

  .nav,
  .user-menu,
  .user-menu form,
  .button,
  .tabs {
    width: 100%;
  }

  .nav a,
  .tabs a {
    flex: 1;
    text-align: center;
  }

  .main {
    padding: 12px 8px 24px;
  }

  .employee-head {
    gap: 8px;
    margin-bottom: 10px;
  }

  .employee-head h1 {
    margin-bottom: 0;
    font-size: 24px;
  }

  .auth-panel,
  .split,
  .bulkbar,
  .filters,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .job-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .job-card dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .job-card dt {
    font-size: 10px;
  }

  .job-card dd {
    font-size: 13px;
  }

  .job-actions {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
    gap: 8px;
  }

  .job-actions form {
    display: contents;
  }

  .issue-form {
    display: grid !important;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .head-actions,
  .head-actions .button,
  .team-save {
    width: 100%;
  }

  .team-save {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}
