:root {
  color-scheme: light;
  --nav: #101e36;
  --nav-active: #243b65;
  --paper: #fff;
  --background: #f3f6fb;
  --ink: #18263c;
  --muted: #53647b;
  --line: #dce4ef;
  --blue: #234fa9;
  --blue-light: #eaf1ff;
  --amber: #785000;
  --green: #145c3d;
  --red: #982e38;
  --sidebar: 243px;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--ink); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.08; letter-spacing: -.046em; }
h2 { font-size: 1.05rem; letter-spacing: -.015em; }
p { color: var(--muted); }
button, a.primary, input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid #cbd6e6;
  border-radius: 8px;
  padding: .53rem .75rem;
}
button, a.primary, select, summary { cursor: pointer; }
button, a.primary { font-size: .875rem; font-weight: 650; }
button:hover { border-color: #8099c0; background: #f4f7fd; }
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 3px solid #5486e0; outline-offset: 2px; }
.primary, a.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  text-decoration: none;
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.primary:hover { background: #173c84; border-color: #173c84; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  padding: 26px 16px 19px;
  background: var(--nav);
  color: #d9e4fa;
}
.brand { padding: 0 8px; margin-bottom: 32px; }
.logo-frame {
  width: 160px;
  max-width: 100%;
  padding: 9px 12px;
  background: white;
  border-radius: 10px;
}
.logo-frame img { display: block; width: 100%; height: auto; }
nav { display: grid; gap: 4px; }
nav button {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 45px;
  padding-left: 12px;
  text-align: left;
  background: transparent;
  color: #d8e4f8;
  border: 1px solid transparent;
}
nav button span { width: 21px; text-align: center; font-size: 1.08rem; color: #a4bfff; }
nav button[aria-current], nav button:hover { background: var(--nav-active); color: white; border-color: transparent; }
nav button[aria-current] { box-shadow: inset 3px 0 #8fb2ff; }
.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid #344462;
  font-size: .875rem;
}
.online-dot { width: 8px; height: 8px; border-radius: 100%; background: #f0c778; }

main { margin-left: var(--sidebar); max-width: 1670px; padding: 0 clamp(18px, 3.4vw, 50px) 42px; }
.top {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  font-size: .875rem;
  color: var(--muted);
}
.top b { color: var(--ink); }
.top span span { padding-inline: .3rem; }
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 31px 0 25px;
}
.page-heading p { margin-top: 7px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 21px; }
.metric {
  text-align: left;
  min-height: 112px;
  padding: 14px 15px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 6px #15315a08;
}
.metric span { display: block; color: var(--muted); font-size: .875rem; font-weight: 650; }
.metric strong { font-size: 2.1rem; line-height: 1.25; letter-spacing: -.055em; }
.metric-blue strong { color: var(--blue); }
.metric-amber strong { color: var(--amber); }
.metric-green strong { color: var(--green); }

.panel { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); overflow: hidden; box-shadow: 0 2px 6px #15315a08; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.sub { display: block; color: var(--muted); font-size: .875rem; }
.scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; min-width: 600px; }
th, td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-size: .875rem; }
th { font-weight: 650; color: var(--muted); background: #f7f9fd; }
tbody tr:last-child td { border-bottom: 0; }
time { white-space: nowrap; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 30px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.tag.neutral { background: #edf2f7; color: #3a506e; }
.tag.blue { background: var(--blue-light); color: #20488f; }
.tag.amber { background: #fff2d5; color: var(--amber); }
.tag.green { background: #dff4e8; color: var(--green); }
.tag.red { background: #ffe7e8; color: var(--red); }
.empty { padding: 27px 17px; text-align: center; color: var(--muted); }
.empty button { margin-top: 10px; }
.buttons, .filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter { margin-bottom: 13px; }
.filter input { width: min(100%, 340px); }
.link { padding: 0; text-align: left; color: var(--blue); background: none; border: 0; }
.history-list { padding-left: 1.3rem; margin-bottom: .25rem; }
.history-list li + li { margin-top: .45rem; }
.history-list .link { display: block; }
details summary { font-size: .875rem; font-weight: 650; }
.selected { background: var(--blue-light); border-color: #a9bdea; color: var(--blue); }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); min-width: 660px; }
.weekday { text-align: center; padding: 8px; background: #f2f6fd; font-size: .875rem; font-weight: 750; }
.cell { padding: 6px; min-height: 112px; min-width: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.cell:nth-child(7n) { border-right: 0; }
.cell.today { background: #eaf2ff; }
.cell.other { background: #f8fafc; }
.date { border-color: transparent; padding: 3px 5px; background: transparent; }
.event { display: block; width: 100%; padding: 4px 6px; margin-top: 3px; text-align: left; background: #f0f5ff; border-color: #d9e6fd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.notice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 13px 16px;
  background: #eaf1ff;
  border: 1px solid #cfddf7;
  border-radius: 10px;
}
.notice p { margin-top: 2px; }

dialog { border: 1px solid var(--line); border-radius: 14px; width: min(650px, calc(100% - 24px)); max-height: 90dvh; padding: 0; color: var(--ink); }
dialog::backdrop { background: #09173199; }
dialog .bar > button[aria-label="Fechar"] { font-size: 1.2rem; padding: 0 .55rem; }
dialog .form-actions { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.fields label { display: grid; gap: 5px; font-size: .875rem; font-weight: 700; }
.fields input, .fields select, textarea { width: 100%; min-width: 0; font-size: 1rem; font-weight: 400; }
.full { grid-column: 1 / -1; }
.fields textarea { min-height: 84px; }
.quote-total { display: grid; align-content: end; justify-items: end; font-size: .875rem; color: var(--muted); }
.quote-total strong { font-size: 1.28rem; color: var(--ink); }
.pad { padding: 16px; }
#msgText { min-height: 175px; margin: 10px 0; resize: vertical; }
#messageStatus:not(:empty) { margin-top: 10px; }
.dialog-feedback { padding: 9px 16px; color: var(--red); background: #fff3f4; }
#toast:empty { display: none; }
#toast { position: fixed; bottom: 18px; right: 18px; z-index: 2; max-width: min(420px, calc(100% - 36px)); background: var(--nav); color: white; padding: 11px 14px; border-radius: 9px; }

@media (max-width: 980px) {
  :root { --sidebar: 208px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .sidebar { position: static; width: auto; padding: 10px 11px 6px; }
  .brand { margin-bottom: 8px; padding: 0 3px; }
  .logo-frame { width: 118px; padding: 6px 8px; border-radius: 6px; }
  nav { display: flex; overflow-x: auto; padding-bottom: 4px; }
  nav button { white-space: nowrap; min-height: 39px; padding: .35rem .7rem; }
  nav button span { width: auto; }
  .sidebar-foot { display: none; }
  main { margin: 0; padding: 0 12px 24px; }
  .top { min-height: 49px; }
  .page-heading { flex-wrap: wrap; margin: 18px 0 16px; }
  .metric { min-height: 98px; padding: 11px; }
  .metrics { gap: 9px; }
  .calendar-bar { flex-wrap: wrap; }
  .calendar-bar h2 { order: -1; width: 100%; }
  .notice { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 420px) {
  .fields { grid-template-columns: 1fr; }
  .quote-total { justify-items: start; }
}

.login-screen { min-height: 100dvh; display: grid; align-items: center; justify-items: center; padding: 18px; background: var(--nav); }
.access-card { width: min(100%, 440px); padding: 30px clamp(19px, 5vw, 34px); border-radius: 16px; background: white; box-shadow: 0 16px 50px #070d22a0; }
.access-card h1 { font-size: 1.73rem; margin: 6px 0 17px; letter-spacing: -.035em; }
.access-brand { display: block; margin: 0 auto 15px; width: 185px; max-width: 100%; height: auto; }
.access-card form, .access-card section, .access-detail, #photoForm { display: grid; gap: 12px; }
.access-card label, .access-detail label, #photoForm label { display: grid; gap: 5px; font-size: .875rem; font-weight: 650; }
.access-card input, .access-detail input, #photoForm input { width: 100%; font-size: 1rem; font-weight: 450; }
.access-card form button, #activate { min-height: 44px; }
.access-card section h1 { margin-bottom: 0; }
.feedback { margin-top: 10px; color: var(--blue); }
#authError { color: var(--red); }
.install-button { display: block; margin: 15px auto 0; border-color: transparent; background: var(--blue-light); color: var(--blue); }
.sidebar-install { background: transparent; color: #d9e4fa; border: 1px solid #41577d; padding: 4px 7px; }
.sidebar-install:hover { background: var(--nav-active); color: #fff; }
.install-help p + p { margin-top: 12px; }
.install-help strong { display: block; margin-bottom: 3px; color: var(--ink); }
.account-actions { display: flex; align-items: center; gap: 8px; }
#accountName { font-weight: 700; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 275px), 1fr)); gap: 13px; }
.work-card { margin: 0; padding: 15px; }
.work-meta { display: flex; justify-content: space-between; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .875rem; font-weight: 650; margin-bottom: 8px; }
.work-card h2 span { color: var(--muted); font-size: .875rem; font-weight: 600; }
.work-card p { white-space: pre-line; overflow-wrap: anywhere; margin: 5px 0 11px; }
.job-instructions { margin-bottom: 18px; }
.job-instructions h3, #job h3 { margin: 10px 0 3px; font-size: 1rem; }
.job-instructions p { white-space: pre-wrap; overflow-wrap: anywhere; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 8px; }
.photo-grid figure { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.photo-grid a { display: block; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #e5eefb; }
.photo-grid figcaption { padding: 6px 8px; overflow-wrap: anywhere; }
#photoForm { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
#photoForm input[type="file"] { padding: 5px; }
#photoForm input::file-selector-button { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; margin-right: 6px; background: var(--blue-light); color: var(--blue); }
#photoForm button { justify-self: start; }
.access-panel { max-width: 750px; }
.owners { margin: 0; padding: 0; list-style: none; }
.owners li { display: flex; flex-wrap: wrap; gap: 7px; justify-content: space-between; align-items: center; padding: 11px 16px; }
.owners li + li { border-top: 1px solid var(--line); }

@media (max-width: 700px) {
  .sidebar-foot { display: flex; margin-top: 6px; padding: 3px; border: none; }
  #accountName { display: none; }
}

@media (display-mode: standalone) {
  [data-install] { display: none; }
}

.startup {
  --startup-time: 3400ms;
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
}
.startup-logo {
  width: min(100%, 310px);
  height: auto;
  margin-bottom: 32px;
  animation: startup-enter 650ms ease-out both;
}
.startup-track {
  height: 4px;
  width: 140px;
  overflow: hidden;
  border-radius: 10px;
  background: #e7edf5;
}
.startup-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #052464 0%, #285fba 83%, #d69627 100%);
  transform-origin: left;
  animation: startup-fill var(--startup-time) cubic-bezier(.18, .66, .39, .97) both;
}
.startup p { margin-top: 12px; font-size: .875rem; color: var(--muted); }

@keyframes startup-enter {
  from { opacity: .2; transform: translateY(7px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes startup-fill {
  from { transform: scaleX(.06); }
  to { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .startup-logo, .startup-track span { animation: none; }
  .startup-track span { transform: scaleX(.65); }
}
