:root {
  --page: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #edf0f3;
  --ink: #15212d;
  --muted: #586573;
  --line: #dce2e8;
  --brand: #101820;
  --brand-2: #087a62;
  --orange: #f97316;
  --red: #c84b4b;
  --blue: #326f9f;
  --yellow: #ba7c18;
  --shadow: 0 10px 30px rgba(36, 48, 38, 0.12);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
}

body {
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: #101820;
}

.auth-panel {
  width: min(100%, 430px);
  padding: 28px;
  border-top: 4px solid var(--orange);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--orange);
  color: white;
  font-weight: 800;
}

.auth-brand h1 {
  font-size: 21px;
}

.auth-brand p,
.server-details summary,
.remember-row {
  color: var(--muted);
  font-size: 14px;
}

.server-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.server-details summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 12px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-error {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  background: var(--page);
  position: relative;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #f7f3e8;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  box-shadow: var(--shadow);
}

.brand-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

.brand-row h1 {
  font-size: 18px;
  line-height: 1.1;
}

.brand-row p {
  color: #cbd6c6;
  font-size: 12px;
  margin-top: 2px;
}

.field-label {
  display: block;
  margin: 14px 0 6px;
  color: #d7dfd0;
  font-size: 12px;
  font-weight: 700;
}

.project-select,
.control,
textarea.control,
select.control {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.project-select {
  border-color: #596755;
  background: #f7f3e8;
  font-weight: 700;
}

textarea.control {
  min-height: 92px;
  resize: vertical;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fffaf0;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.view-root {
  padding: 14px 14px 4px;
  outline: none;
}

.view-root:focus {
  outline: none;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}

.page-title h2 {
  font-size: 21px;
}

.page-title p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 8px;
  padding: 5px 9px;
  background: var(--surface-2);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

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

.card,
.panel,
.photo-card,
.list-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(36, 48, 38, 0.04);
}

.metric {
  padding: 12px;
  min-height: 86px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

.metric.orange {
  border-left: 5px solid var(--orange);
}

.metric.green {
  border-left: 5px solid var(--brand-2);
}

.metric.red {
  border-left: 5px solid var(--red);
}

.metric.blue {
  border-left: 5px solid var(--blue);
}

.panel {
  padding: 13px;
  margin-bottom: 12px;
}

.panel h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.field-stack {
  display: grid;
  gap: 10px;
}

.field-group label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.primary,
.secondary,
.danger,
.plain {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 12px;
  font-weight: 800;
}

.primary {
  background: var(--orange);
  color: #fffaf0;
}

.secondary {
  background: var(--brand);
  color: #fffaf0;
}

.danger {
  background: var(--red);
  color: white;
}

.plain {
  background: var(--surface-2);
  color: var(--brand);
  border-color: var(--line);
}

.list {
  display: grid;
  gap: 10px;
}

.list-row {
  padding: 12px;
}

.row-top {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.row-top strong {
  min-width: 0;
  font-size: 15px;
}

.row-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.tag {
  border-radius: 8px;
  padding: 4px 7px;
  background: var(--surface-2);
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.tag.red {
  background: #f6dddd;
  color: #923737;
}

.tag.yellow {
  background: #f3e4c9;
  color: #7a4e0a;
}

.tag.green {
  background: #dcedd7;
  color: #236b40;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.photo-card {
  overflow: hidden;
  min-height: 184px;
}

.photo-card button {
  border: 0;
  padding: 0;
  width: 100%;
  background: transparent;
  color: inherit;
  text-align: left;
}

.photo-thumb {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.photo-copy {
  padding: 9px;
}

.photo-copy strong {
  display: block;
  font-size: 13px;
}

.photo-copy span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 3px;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: var(--brand);
  font-weight: 900;
}

.empty-state h2 {
  color: var(--ink);
  font-size: 17px;
  margin-bottom: 4px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 30;
}

.tab {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
}

.tab span {
  font-size: 19px;
  line-height: 1;
}

.tab strong {
  font-size: 11px;
}

.tab.active {
  background: var(--brand);
  color: #fffaf0;
}

.photo-dialog {
  width: min(94vw, 640px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
}

.photo-dialog::backdrop {
  background: rgba(36, 48, 38, 0.72);
}

.photo-dialog img {
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
  background: #111;
  display: block;
}

.close-dialog {
  position: absolute;
  right: 10px;
  top: 10px;
  background: rgba(0, 0, 0, 0.58);
}

.dialog-copy {
  padding: 12px 14px 16px;
}

.dialog-copy h2 {
  font-size: 18px;
}

.dialog-copy p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.hidden-input {
  display: none;
}

@media (min-width: 700px) {
  .view-root {
    padding: 18px;
  }

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

/* Field workspace: graphite, paper, and construction orange. */
body { font-size: 1rem; line-height: 1.5; }
.auth-shell { background-image: linear-gradient(135deg, transparent 60%, #17232e 60%); padding: max(24px, env(safe-area-inset-top)) 20px; }
.auth-panel { padding: 30px; border: 1px solid #33404b; border-top: 4px solid var(--orange); border-radius: 18px; }
.auth-brand { margin-bottom: 32px; }
.auth-brand > span, .brand-mark { color: var(--brand); border-radius: 12px; font-weight: 900; letter-spacing: -2px; }
.auth-brand h1 { font-size: 1.45rem; letter-spacing: -.04em; }
.auth-brand p { font-size: .75rem; letter-spacing: .15em; font-weight: 700; }
.eyebrow { font-size: .75rem; font-weight: 800; letter-spacing: .1em; color: #9e4105; }
.auth-heading h2 { font-size: clamp(2rem, 6vw, 2.7rem); letter-spacing: -.055em; line-height: 1.1; margin: 12px 0; }
.auth-heading p { color: var(--muted); margin-bottom: 24px; }
.auth-footer { padding-top: 24px; margin-top: 22px; border-top: 1px solid var(--line); font-size: .875rem; display: flex; gap: 8px; align-items: center; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--brand-2); }
.text-button { min-height: 44px; background: none; border: none; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; font-size: .875rem; }
.install-help { width: 100%; color: var(--muted); }
.field-group label, .field-label, .row-meta, .page-title p, .remember-row, .server-details summary { font-size: .875rem; }
.control, .project-select { min-height: 50px; font-size: 1rem; border-radius: 10px; }
button, select, input, textarea { touch-action: manipulation; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: #bf4b07; }
:focus-visible { outline: 3px solid #2781ca; outline-offset: 3px; }
.control:focus, .project-select:focus { border-color: #2781ca; outline: 2px solid #2781ca; outline-offset: 1px; }
.primary { color: #151d26; min-height: 50px; display: flex; justify-content: center; align-items: center; gap: 18px; }
button:disabled { opacity: .55; cursor: wait; }
.topbar { box-shadow: none; padding-bottom: 18px; }
.brand-row { grid-template-columns: 40px minmax(0,1fr) auto; }
.brand-row p { font-size: .75rem; color: #c7d1dc; }
.project-select { background: #23313e; color: white; border-color: #43515e; font-weight: 600; }
.project-select option { color: white; background: #23313e; }
.view-root { padding: 22px 18px 12px; }
.page-title { margin-bottom: 20px; }
.page-title h2 { font-size: 1.65rem; letter-spacing: -.04em; }
.page-title p { overflow-wrap: anywhere; }
.card, .panel, .list-row, .photo-card { border-radius: 14px; box-shadow: none; }
.panel { padding: 18px; margin-bottom: 18px; }
.panel h3 { font-size: 1rem; letter-spacing: -.02em; }
.metric { padding: 16px; min-height: 104px; }
.metric span { font-size: .875rem; }
.metric strong { font-size: 2rem; font-variant-numeric: tabular-nums; }
.metric.orange, .metric.green, .metric.blue, .metric.red { border-left-width: 1px; border-bottom: 3px solid var(--line); }
.metric.orange { border-bottom-color: var(--orange); }
.metric.green { border-bottom-color: var(--brand-2); }
.metric.blue { border-bottom-color: var(--blue); }
.metric.red { border-bottom-color: var(--red); }
.status-pill, .tag, .photo-copy span, .tab strong { font-size: .75rem; }
.status-pill { border-radius: 20px; }
.row-top { flex-wrap: wrap; align-items: flex-start; }
.row-meta, .row-top strong, .photo-copy strong { overflow-wrap: anywhere; }
.tag { border-radius: 6px; }
.photo-copy { display: block; }
.photo-copy strong { font-size: .875rem; }
.tab { border-radius: 10px; padding: 6px 0; }
.tab.active { color: #a84004; background: #fff0e5; }
.tab span { display: flex; }
.tabbar { box-shadow: 0 -5px 20px #10182008; }
.icon { width: 23px; height: 23px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.empty-state { font-size: .875rem; }
.help-dialog { width: min(92vw,460px); border: none; border-radius: 18px; padding: 24px; color: var(--ink); max-height: 85dvh; }
.help-dialog::backdrop, .photo-dialog::backdrop { background: #101820b3; }
.help-dialog h2 { margin: 16px 0; }
.help-dialog li { margin-bottom: 16px; }
.dialog-dismiss { float: right; }
.toast { position: fixed; bottom: calc(90px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: #101820; color: white; z-index: 100; box-shadow: 0 4px 16px #10182030; }
.sync-banner { padding: 10px 18px; background: #fff0d8; color: #6e4304; font-size: .875rem; border-bottom: 1px solid #ead6b1; }
.project-hero { background: var(--brand); color: white; padding: 22px; border-radius: 16px; margin-bottom: 18px; position: relative; overflow: hidden; }
.project-hero .eyebrow { color: #ff9e57; }
.project-hero h3 { font-size: 1.45rem; letter-spacing: -.035em; line-height: 1.25; margin: 10px 0 6px; overflow-wrap: anywhere; }
.project-hero p { color: #bbc8d5; font-size: .875rem; }
.progress-row { margin-top: 24px; display: flex; align-items: baseline; justify-content: space-between; font-size: .875rem; }
.progress-row strong { color: white; font-size: 1.8rem; letter-spacing: -.04em; }
progress { width: 100%; height: 6px; border: 0; appearance: none; border-radius: 6px; overflow: hidden; background: #35424e; color: var(--orange); }
progress::-webkit-progress-bar { background: #35424e; }
progress::-webkit-progress-value { background: var(--orange); }
progress::-moz-progress-bar { background: var(--orange); }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.quick-action { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 12px; color: var(--ink); text-align: left; font-size: .875rem; font-weight: 700; }
.quick-action:first-child { background: var(--orange); border-color: var(--orange); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-heading h3 { font-size: 1rem; }
.section-heading .text-button { color: var(--muted); }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; }
.filter { white-space: nowrap; border-radius: 24px; background: white; border: 1px solid var(--line); min-height: 44px; padding: 8px 15px; font-size: .875rem; }
.filter.active { background: var(--brand); color: white; }
.photo-placeholder { aspect-ratio: 4/3; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.form-note { color: var(--muted); font-size: .875rem; }
.account-row { display: flex; gap: 12px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; }
.queue-row { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.queue-row strong { display: block; }
.queue-row p { color: var(--muted); }
.save-status { font-size: .75rem; color: var(--muted); }
@media (max-width: 360px) { .auth-panel { padding: 22px; } .view-root { padding: 18px 12px; } .two-col { grid-template-columns: 1fr; } .quick-action { padding: 12px; gap: 7px; } }
@media (min-width: 800px) { .app-shell { border-inline: 1px solid var(--line); } .auth-panel { width: 450px; } }
@media (prefers-reduced-motion: no-preference) { button { transition: background .15s ease, opacity .15s ease; } .view-root { animation: appear .2s ease; } @keyframes appear { from { opacity: .7; transform: translateY(4px); } to { opacity: 1; transform: none; } } }
