:root {
  --navy: #142338;
  --teal: #008b89;
  --border: #dce3eb;
  --muted: #66758a;
  --bg: #f5f7fa;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: #152338;
  font:
    16px/1.5 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--border);
  background: white;
  color: var(--navy);
  padding: 11px 17px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 46px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
}
button:hover,
.button:hover {
  filter: brightness(0.96);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}
.danger {
  color: #a42b34;
}
.subtle {
  background: transparent;
}
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
aside {
  background: var(--navy);
  color: white;
  padding: 26px 15px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand {
  font-size: 23px;
  font-weight: 800;
  padding: 0 8px 30px;
  letter-spacing: -0.8px;
}
.brand span {
  color: #00d2bb;
  font-size: 32px;
}
aside nav {
  display: grid;
  gap: 8px;
}
aside button {
  justify-content: flex-start;
  color: #dee6f0;
  background: transparent;
  border: 0;
  text-align: left;
}
aside button.active {
  background: #354862;
  color: white;
}
aside footer {
  margin-top: auto;
  padding: 20px 8px 0;
  border-top: 1px solid #354862;
}
.workspace {
  padding: 28px 32px;
  max-width: 1550px;
  width: 100%;
  margin: auto;
}
.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  margin-bottom: 20px;
}
.sync {
  font-size: 13px;
  border: 0;
  background: transparent;
  padding: 5px;
  color: #237245;
  min-height: 35px;
}
.sync.warn {
  color: #a26412;
}
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
h1 {
  font-size: 31px;
  letter-spacing: -1px;
  line-height: 1.2;
  margin: 0 0 7px;
}
h2 {
  font-size: 21px;
  line-height: 1.3;
  margin: 0 0 18px;
}
h3 {
  font-size: 17px;
  margin: 0 0 12px;
}
p {
  margin: 8px 0 16px;
}
.muted,
small {
  color: var(--muted);
}
.badge {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  background: #e5f4f2;
  color: #006b68;
}
.badge.open {
  background: #fff0d3;
  color: #925900;
}
.badge.invoiced {
  background: #e9edf5;
  color: #54647d;
}
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.quick button {
  flex: 1;
  padding: 17px;
  font-size: 18px;
  white-space: nowrap;
}
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow: auto;
}
.tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
  font-weight: 500;
}
.tabs button.active {
  color: var(--teal);
  box-shadow: inset 0 -3px var(--teal);
  font-weight: 700;
}
.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(290px, 1fr);
  gap: 22px;
}
.stack {
  display: grid;
  gap: 20px;
  align-content: start;
}
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 24px;
  min-width: 0;
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f4;
}
.row:last-child {
  border: 0;
}
.total {
  background: #f0f3f7;
  padding: 15px;
  border-radius: 10px;
  font-size: 24px;
  font-weight: 800;
  margin: 12px 0 20px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #eaf0f4;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  gap: 12px;
}
.metrics strong {
  display: block;
  font-size: 25px;
}
.metrics > div + div {
  border-left: 1px solid #cdd7e1;
}
.full {
  width: 100%;
}
.empty {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}
.job-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.job-card:hover {
  border-color: var(--teal);
}
.job-card h3 {
  margin: 12px 0 5px;
}
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.filters input {
  flex: 1;
  min-width: 180px;
}
input,
textarea,
select {
  padding: 11px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  background: white;
  color: var(--navy);
  width: 100%;
  min-height: 46px;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
input[type="checkbox"] {
  width: 21px;
  height: 21px;
  min-height: 0;
  vertical-align: middle;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 15px;
}
label input,
label select,
label textarea {
  margin-top: 6px;
}
label.check {
  display: flex;
  gap: 10px;
  align-items: center;
}
.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.formgrid .span {
  grid-column: 1/-1;
}
.hint {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}
.tablewrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
}
td button {
  font-size: 12px;
  padding: 7px 10px;
  min-height: 36px;
}
td input {
  max-width: 110px;
}
dialog {
  border: 0;
  border-radius: 16px;
  padding: 28px;
  width: min(720px, 94vw);
  max-height: 92vh;
  box-shadow: 0 20px 90px #14233844;
}
dialog::backdrop {
  background: #101c2d88;
}
.dialoghead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.dialoghead h2 {
  margin: 0;
}
.dialoghead button {
  border: 0;
}
.dialogfoot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.error {
  color: #a42b34;
  background: #fff0f1;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.notice {
  background: #fff5dd;
  border: 1px solid #efdcad;
  border-radius: 9px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}
.login {
  max-width: 430px;
  margin: 10vh auto;
  padding: 35px;
}
.login .brand {
  color: var(--navy);
}
.loading {
  padding: 50px;
}
.count {
  font-size: 34px;
  font-weight: 800;
}
.pending {
  border-left: 4px solid #dea035;
  padding-left: 12px;
  margin: 14px 0;
}
.signature {
  width: 100%;
  height: 180px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  touch-action: none;
  background: #fff;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  z-index: 999;
  display: none;
  max-width: 90vw;
}
video {
  width: 100%;
  max-height: 300px;
  background: #111;
  border-radius: 10px;
}
.previewheader {
  background: var(--navy);
  color: white;
  padding: 18px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.customerpage {
  max-width: 900px;
  margin: 30px auto;
  background: white;
  padding: 35px;
}
.lineitems {
  display: grid;
  gap: 8px;
}
.lineitem {
  display: grid;
  grid-template-columns: 1fr 110px 45px;
  gap: 8px;
  align-items: end;
}
.mobilemenu {
  display: none;
}
.moneyhint {
  background: #eaf6f4;
  padding: 12px;
  border-radius: 8px;
  margin: 0 0 15px;
}
.attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
details summary {
  cursor: pointer;
  font-weight: 600;
}
details[open] summary {
  margin-bottom: 14px;
}
.searchresults button {
  display: block;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  margin: 8px 0;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 195px 1fr;
  }
  .workspace {
    padding: 22px;
  }
  .brand {
    font-size: 20px;
  }
  .quick button {
    font-size: 15px;
  }
  .columns {
    grid-template-columns: 1fr;
  }
  .metrics {
    margin-bottom: 0;
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  aside {
    display: none;
    height: auto;
    position: relative;
  }
  body.menu aside {
    display: flex;
  }
  .mobilemenu {
    display: inline-flex;
  }
  .workspace {
    padding: 18px 14px;
  }
  .titlebar {
    align-items: flex-start;
  }
  h1 {
    font-size: 25px;
  }
  .quick {
    gap: 6px;
  }
  .quick button {
    font-size: 13px;
    padding: 12px 8px;
  }
  .card {
    padding: 18px;
  }
  .formgrid {
    grid-template-columns: 1fr;
  }
  .formgrid .span {
    grid-column: auto;
  }
  .customerpage {
    margin: 0;
    padding: 20px;
  }
  .metrics strong {
    font-size: 21px;
  }
  dialog {
    padding: 20px;
  }
  .topline {
    font-size: 12px;
  }
  .filters select {
    width: auto;
    max-width: 100%;
  }
  .lineitem {
    grid-template-columns: 1fr 70px 40px;
  }
}
@media print {
  aside,
  .actions,
  .topline,
  .tabs,
  button {
    display: none !important;
  }
  .shell {
    display: block;
  }
  .workspace {
    padding: 0;
  }
  .card {
    break-inside: avoid;
  }
}

.badge.created { background: #edf0f3; color: #526070; }
.badge.planned { background: #e3edff; color: #2455a0; }

.badge.paid { background: #dcf4e2; color: #236738; }
.paid-archive { margin-top: 32px; }
.paid-archive td { white-space: nowrap; }
