:root {
  --bg: #10161d;
  --card: #1a2330;
  --card-2: #223044;
  --text: #eef3f8;
  --muted: #93a4bb;
  --green: #64be44;
  --blue: #2b84c8;
  --yellow: #f1c619;
  --red: #fc2407;
  --line: #2c3b4f;
  --radius: 16px;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1c3a28 0%, transparent 50%),
              radial-gradient(900px 500px at 100% 0%, #16324a 0%, transparent 45%),
              var(--bg);
  color: var(--text);
  min-height: 100dvh;
  touch-action: manipulation;
}
a { color: #9fd0ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(16, 22, 29, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 15px;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-logo {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  display: block;
}
.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-end { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 12px; }
.signout {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--card-2);
  color: var(--text);
  font-size: 13px;
}
.signout:hover { text-decoration: none; }

.tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: rgba(16, 22, 29, 0.98);
  border-top: 1px solid var(--line);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
}
.tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
}
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active {
  background: #1e3a28;
  color: var(--green);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 12px 24px;
}
body.role-tech .wrap,
body.role-hr .wrap {
  padding-bottom: calc(88px + var(--safe-bottom));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.login-card { max-width: 420px; margin: 24px auto; }
h1, h2, h3 { margin: 0 0 10px; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin-top: 16px; }
h3 { font-size: 1rem; margin-top: 14px; color: var(--green); }
.muted { color: var(--muted); }
.small, .hint { font-size: 13px; color: var(--muted); }
.hint { margin-top: 10px; }

label { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input:not([type]) {
  width: 100%;
  margin-top: 6px;
  padding: 14px 12px;
  min-height: var(--tap);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f1620;
  color: var(--text);
  font-size: 16px;
}
input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--green);
  flex-shrink: 0;
}
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f1620;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  min-height: 72px;
}
.note-fold {
  margin: 12px 0;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 4px 12px;
}
.note-fold summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}
.note-fold[open] summary { color: var(--text); }
.job-number {
  font-size: 28px !important;
  letter-spacing: 0.12em;
  text-align: center;
  font-weight: 700;
  min-height: 64px !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  padding: 12px 16px;
  min-height: var(--tap);
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
  width: 100%;
}
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--green); color: #102010; border-color: transparent; font-weight: 700; }
.btn.big { padding: 16px; font-size: 17px; margin-top: 4px; }
.btn.tiny { padding: 10px 12px; font-size: 14px; min-height: 40px; width: auto; }
.btn.danger { background: #3a1512; color: #ffd0c8; border-color: #6a2a22; }
.btn-row { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.action-bar {
  position: sticky;
  bottom: calc(64px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, var(--card) 18%);
  padding-top: 12px;
  margin: 8px -4px 0;
  z-index: 5;
}
.sticky {
  position: sticky;
  top: calc(48px + var(--safe-top));
  background: var(--card);
  padding: 8px 0;
  z-index: 5;
}
.check-all { color: var(--text); display: flex; align-items: center; gap: 10px; min-height: var(--tap); }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; }
.flash.ok { background: #1d3a22; color: #c8f0b8; }
.flash.error { background: #3a1512; color: #ffd0c8; }

.grid-2 { display: grid; gap: 12px; }
.link-card { display: block; color: inherit; }
.link-card h2 { margin-top: 0; }
.link-card:hover { text-decoration: none; border-color: var(--blue); }

.facts { display: grid; gap: 10px; margin: 12px 0 16px; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 2px 0 0; font-size: 16px; word-break: break-word; }

.labour-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.labour-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #0f1620;
  color: var(--text);
  margin: 0;
}
.labour-card input { margin-top: 2px; }
.labour-card:has(input:checked) {
  border-color: var(--green);
  background: #14261a;
}
.labour-card.saved { opacity: 0.7; }
.labour-card .when { font-size: 15px; font-weight: 600; }
.labour-card .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.labour-card .duration {
  margin-left: auto;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.entry-list { display: flex; flex-direction: column; gap: 10px; }
.entry-card {
  background: #0f1620;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.entry-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.entry-card .job { font-weight: 700; font-size: 16px; }
.entry-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 0;
}
.entry-card dt { color: var(--muted); font-size: 11px; }
.entry-card dd { margin: 0; font-size: 14px; }

.table-wrap { overflow-x: auto; margin: 12px 0; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
tfoot td { font-weight: 700; background: #152233; }
tr.already td { color: var(--muted); }
.inline-form { display: flex; flex-direction: column; gap: 8px; }
.inline-form input { max-width: none; margin-top: 0; }

.desktop-only { display: none; }
.mobile-only { display: block; }
.email-preview {
  background: #f4f6f8;
  color: #1a2332;
  border-radius: 16px;
  padding: 8px;
  overflow: auto;
}
.email-preview h1, .email-preview h2, .email-preview h3 { color: #1a2332; }

@media (max-width: 799px) {
  .responsive-table thead,
  .responsive-table tfoot { display: none; }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    background: #0f1620;
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 10px;
    padding: 10px 12px;
  }
  .responsive-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 6px 0;
    font-size: 14px;
  }
  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    flex: 0 0 40%;
  }
  .responsive-table td.td-check {
    justify-content: flex-start;
    align-items: center;
    min-height: var(--tap);
  }
  .responsive-table td.td-check::before { content: "Include"; }
  .responsive-table td[data-label="Note"]:empty { display: none; }
  .brand-name { white-space: normal; line-height: 1.2; font-size: 13px; }
}

@media (min-width: 800px) {
  .desktop-only { display: block; }
  .mobile-only { display: none; }
  .tabs {
    position: static;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
  }
  body.role-tech .wrap,
  body.role-hr .wrap { padding-bottom: 32px; }
  .btn, .btn.big { width: auto; min-width: 220px; }
  .btn-row { flex-direction: row; align-items: center; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .inline-form { flex-direction: row; align-items: center; }
  .inline-form input { max-width: 140px; }
  .action-bar {
    position: static;
    background: none;
    margin: 0;
    padding-top: 0;
  }
  .who { font-size: 14px; }
  .brand-name { font-size: 16px; }
  .brand-logo { height: 40px; }
}
