/*
 * The company's front page and the client area pages: ordinary documents,
 * not the dense GIS chrome in app.css. Same palette, so the two feel like
 * one site when a client steps from a project into its map.
 */

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f8fafb;
  --ink: #1b2733;
  --ink-2: #566575;
  --ink-3: #8996a5;
  --line: #dde3ea;
  --line-2: #eceff3;
  --accent: #2f6f4e;
  --accent-dark: #276042;
  --accent-ink: #ffffff;
  --accent-soft: #e6f1eb;
  --topbar: #23303d;
  --topbar-ink: #dfe6ee;
  --danger: #b4451f;
  --warn: #9a6b12;
  --warn-soft: #fbf3e0;
  /* The flat field the logo master sits on, read off its corner pixel. */
  --logo-bg: #f5f1e8;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 4px 14px rgba(20, 30, 40, .07);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent); }

/* ------------------------------ site bar ------------------------------ */

.site-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 56px;
  background: var(--topbar);
  color: var(--topbar-ink);
}
.site-mark {
  display: inline-flex; align-items: center; gap: 10px;
  color: inherit; text-decoration: none; font-weight: 600; letter-spacing: .2px;
}
.site-mark svg { flex: none; }
.site-nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.site-nav-link {
  color: var(--topbar-ink); text-decoration: none;
  padding: 7px 12px; border-radius: var(--radius); font-weight: 500;
}
.site-nav-link:hover { background: #31404f; }
.site-nav-cta { background: var(--accent); color: #fff; }
.site-nav-cta:hover { background: var(--accent-dark); }
.site-nav .who { color: #a9b8c7; font-size: 13px; padding: 0 6px; }
.site-nav button {
  background: transparent; border: 1px solid #3d4d5d; color: var(--topbar-ink);
  padding: 6px 11px; border-radius: var(--radius); font: inherit; cursor: pointer;
}
.site-nav button:hover { background: #31404f; }

/* ------------------------------ landing ------------------------------- */

.landing { background: var(--logo-bg); }
.hero {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(24px, 6vh, 64px) clamp(16px, 5vw, 48px);
  background: var(--logo-bg);
}
.hero-logo { display: block; width: min(720px, 100%); }
.hero-logo img { display: block; width: 100%; height: auto; }

.site-foot {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  font-size: 13px; color: var(--ink-2);
  border-top: 1px solid rgba(20, 30, 40, .08);
}
.landing .site-foot { background: var(--logo-bg); }

/* ---------------------------- client pages ---------------------------- */

.page {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 48px;
  flex: 1;
}
.page h1 { font-size: 24px; margin: 0 0 4px; }
.page h2 { font-size: 17px; margin: 28px 0 10px; }
.page .lede { color: var(--ink-2); margin: 0 0 18px; }
.page p { margin: 0 0 10px; }

.attention {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--warn-soft); border: 1px solid #ecd9a8; color: #5c4306;
  padding: 10px 14px; border-radius: var(--radius); margin: 0 0 18px;
}
.attention a { color: #5c4306; font-weight: 600; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px;
}
.card h2:first-child { margin-top: 0; }
.empty { color: var(--ink-3); font-size: 14px; padding: 6px 0; }

/* project tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 26px; border-left: 2px solid var(--line-2); padding-left: 14px; }
.tree li { margin: 0 0 8px; }
.project {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2);
}
.project.root { background: var(--panel); }
.project .nm { font-weight: 600; font-size: 15px; flex: 1 1 260px; min-width: 0; }
.project .nm small { display: block; font-weight: 400; color: var(--ink-2); font-size: 13px; }
.project .meta { color: var(--ink-3); font-size: 12.5px; }
.project .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: var(--line-2); color: var(--ink-2); vertical-align: middle; margin-left: 6px;
}
.tag.warn { background: var(--warn-soft); color: #5c4306; }
.tag.ok { background: var(--accent-soft); color: #1f5238; }
.tag.status-active { background: var(--accent-soft); color: #1f5238; }
.tag.status-delivered { background: #e3ecf7; color: #234a7a; }
.tag.status-closed { background: var(--line-2); color: var(--ink-3); }

.btn, button.btn {
  display: inline-block; padding: 6px 12px; border-radius: var(--radius); font: inherit; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--line-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }
.btn.primary:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: default; }

/* tables */
.rows { width: 100%; border-collapse: collapse; font-size: 14px; }
.rows th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.rows td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.rows td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows .sub { color: var(--ink-3); font-size: 12.5px; }
@media (max-width: 640px) {
  .rows thead { display: none; }
  .rows tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .rows td { display: block; border: 0; padding: 3px 0; }
  .rows td.num { text-align: left; }
}

/* sign-in gate on the client pages */
.gate {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: var(--topbar); padding: 16px;
}
.gate-card {
  background: var(--panel); border-radius: 10px; box-shadow: var(--shadow);
  padding: 26px 28px; width: min(420px, 100%);
}
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.gate-brand strong { display: block; font-size: 15px; }
.gate-brand span { display: block; font-size: 12px; color: var(--ink-3); }
.gate-tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.gate-tab {
  flex: 1; padding: 8px 6px; background: none; border: none; border-bottom: 2px solid transparent;
  font: inherit; color: var(--ink-2); cursor: pointer;
}
.gate-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.gate-form label { display: block; margin-bottom: 11px; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.gate-form input {
  width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.gate-form small { display: block; margin-top: 3px; color: var(--ink-3); font-weight: 400; }
.gate-form button.primary {
  width: 100%; margin-top: 4px; background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius); padding: 9px 14px; font: inherit; font-weight: 550; cursor: pointer;
}
.gate-form button.primary:hover { background: var(--accent-dark); }
.gate-form button.primary:disabled { opacity: .55; cursor: default; }
.turnstile-slot { margin: 4px 0 12px; }
.turnstile-failed { font-size: 12px; color: var(--danger); line-height: 1.5; }
.gate-error { color: var(--danger); font-size: 13px; margin: 10px 0 0; min-height: 16px; }
.gate-error.ok { color: var(--accent); }
.gate-note {
  font-size: 12.5px; color: var(--ink-3); line-height: 1.55;
  margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line-2);
}

/* signing page */
.doc-frame {
  width: 100%; height: min(70vh, 720px); border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff;
}
.doc-frame.short { height: 240px; }
.sign-form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink-2); font-weight: 550; }
.sign-form input[type=text], .sign-form input[type=tel], .sign-form textarea {
  width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.sign-form .consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--ink); }
.sign-form .consent input { margin-top: 4px; flex: none; }
.sign-form .signature input { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 22px; }
.sign-form .req { color: var(--danger); font-weight: 700; }
.sign-form .opt { color: var(--ink-3); font-weight: 400; font-size: 12px; }
.sign-form .hint { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.form-error { color: var(--danger); min-height: 18px; margin: 8px 0; }
.form-error.ok { color: var(--accent); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }
.scroll-note { font-size: 13px; color: var(--ink-2); margin: 6px 0 14px; }

/* ------------------------------ dashboard ------------------------------ */

.dash-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.dash-summary .stat {
  flex: 1 1 140px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; box-shadow: var(--shadow);
}
.dash-summary .stat b { display: block; font-size: 22px; line-height: 1.2; }
.dash-summary .stat span { font-size: 12.5px; color: var(--ink-2); }
.dash-summary .stat.warn { border-color: #ecd9a8; background: var(--warn-soft); }

.client-card h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.client-card h2 .meta { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.client-card h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3);
  margin: 18px 0 8px; font-weight: 650;
}
.client-card h3:first-of-type { margin-top: 8px; }

.project .desc { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.project .desc-text {
  background: none; border: 0; padding: 2px 0; font: inherit; font-size: 13px; color: var(--ink-2);
  text-align: left; cursor: text; border-radius: 4px;
}
.project .desc-text:hover { color: var(--ink); text-decoration: underline dotted; }
.project .desc-text.empty { color: var(--ink-3); font-style: italic; }
.project .desc textarea {
  flex: 1 1 320px; font: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.project .products { flex-basis: 100%; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.project .products .prod { display: inline-block; margin: 2px 8px 2px 0; padding: 1px 7px; border-radius: 4px; background: var(--line-2); }
.project .products .prod i { font-style: normal; color: var(--ink-3); margin-right: 4px; }
.project .viewers { flex-basis: 100%; font-size: 12.5px; color: var(--ink-2); }
.chips { margin: 4px 0 8px; line-height: 2; }
.viewer-card h3 { margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; margin: 2px 6px 2px 0;
  padding: 1px 4px 1px 8px; border-radius: 12px; background: var(--line-2); color: var(--ink);
  font-size: 12.5px; white-space: nowrap;
}
.chip.off { opacity: .6; }
.chip small { color: var(--ink-3); font-size: 11px; padding-right: 4px; }
.chip-x {
  border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 15px; line-height: 1;
  width: 18px; height: 18px; border-radius: 9px; cursor: pointer; padding: 0;
}
.chip-x:hover { background: #f3d9cf; color: var(--danger); }

.access-panel {
  flex-basis: 100%; margin-top: 6px; padding: 10px 12px; border-top: 1px dashed var(--line);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px;
}
.access-panel label { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.access-panel label > span { white-space: nowrap; }
.access-panel label small { color: var(--ink-3); min-width: 0; overflow-wrap: anywhere; }
.access-panel .settings { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; color: var(--ink-2); }
.access-panel .naming { display: grid; grid-template-columns: 1fr; gap: 6px; }
.access-panel .naming label { display: block; }
.access-panel .naming input, .access-panel .naming textarea {
  width: 100%; margin-top: 3px; font: inherit; font-size: 13.5px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.access-panel .naming button { justify-self: start; }
.page .lede .subtitle { color: var(--ink); font-weight: 500; }
.access-panel select { font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; }

.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; }
.inline-form input[type=text], .inline-form input[type=search], .inline-form select {
  font: inherit; font-size: 13.5px; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); min-width: 0;
}
.inline-form input[type=text], .inline-form input[type=search] { flex: 1 1 200px; }
.inline-form select { flex: 0 1 auto; max-width: 100%; }

.rows td .sub.mono { font-family: var(--mono); font-size: 11px; }
.viewer-row .em { color: var(--ink-3); font-size: 12.5px; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--topbar); color: var(--topbar-ink); padding: 9px 16px; border-radius: var(--radius);
  font-size: 13.5px; box-shadow: var(--shadow); z-index: 3000; max-width: min(640px, 92vw);
}
.toast.err { background: #7a2412; color: #ffd2c4; }

/* ------------------------- clients list and pages ------------------------ */

.clients-table td a strong { color: var(--ink); }
.clients-table td a:hover strong { color: var(--accent); }

.jump {
  display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px;
  position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg);
}
.jump a {
  text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 550;
  padding: 5px 11px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
}
.jump a:hover { border-color: var(--accent); color: var(--accent); }

/* The rarely used actions on a row live behind one button. */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: " ▾"; color: var(--ink-3); }
details.menu > div {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  display: flex; flex-direction: column; gap: 4px; min-width: 220px;
  padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
details.menu > div .btn { text-align: left; }
