/* ============================================================
   Visual theme — placeholder brand (charcoal-navy + safety-orange).
   Neutral on purpose: no name/logo committed yet, so this is a clean
   professional skin that can be re-themed the moment branding lands.
   Palette matches the app icons (tools/gen-icons.mjs).
   ============================================================ */
:root {
  --ink:      #1f2a37;  /* charcoal-navy — chrome, active states, text */
  --ink-2:    #2b3947;  /* raised navy — hover on dark */
  --line:     #d8dee6;  /* hairline borders */
  --surface:  #ffffff;
  --canvas:   #f4f6f9;  /* very light grey behind the white plan */
  --grid:     rgba(56, 118, 189, .28); /* blueprint-blue dot grid on the canvas */
  --muted:    #667085;  /* secondary text / hints */
  --accent:   #f59e0b;  /* safety-orange — primary actions */
  --accent-d: #d97b06;  /* orange hover/border */
  --danger:   #c0392b;
  --radius:   10px;
  --shadow:   0 2px 10px rgba(16, 24, 40, 0.10);
  --shadow-l: 0 6px 22px rgba(16, 24, 40, 0.16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html { height: 100%; background: var(--canvas); }
body { margin: 0; height: 100%; overflow: hidden; font-family: var(--font); color: var(--ink);
       overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
       -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
       /* faint dot grid — reads as a drawing surface (a nod to graph paper);
          purely decorative, fixed to the viewport, and never in exports */
       background-color: var(--canvas);
       background-image: radial-gradient(circle at 1px 1px, var(--grid) 1.4px, transparent 0);
       background-size: 26px 26px; }
#c { display: block; touch-action: none; }

/* keyboard focus ring — polish + accessibility (mouse/touch stay clean) */
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- first-run empty state (guides the first tap; introduces the motif) ---- */
#emptyState { position: fixed; inset: 0; display: none; flex-direction: column;
              align-items: center; justify-content: center; gap: 2px; padding: 24px;
              pointer-events: none; text-align: center; color: var(--muted); z-index: 1; }
#emptyState svg { width: 72px; height: 72px; color: #c2cbd6; margin-bottom: 12px; }
#emptyState .es-brand { margin: 0 0 10px; font-size: 26px; font-weight: 700; letter-spacing: -.3px;
                        color: var(--ink); }
#emptyState .es-brand::first-letter { color: var(--accent); } /* orange Q */
#emptyState .es-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: .2px; }
#emptyState .es-sub { margin: 6px 0 0; font-size: 15px; max-width: 340px; line-height: 1.5; }
#emptyState b { color: var(--ink); font-weight: 600; }

/* ---- toolbar: one cohesive floating bar, not scattered boxes ---- */
/* left-anchored, content-width pill (not full-bleed) so the edit panel
   can sit at top-right without overlapping — matches the proven layout */
/* ---- TOP BAR + SIDE RAIL ---- */
/* shared pill look for both fixed bars */
#topbar, #toolrail { position: fixed; z-index: 10; padding: 7px;
           background: rgba(255, 255, 255, 0.94); border: 1px solid var(--line);
           border-radius: 14px; box-shadow: var(--shadow);
           -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
/* top bar: identity + record on the left, session/view actions pushed right */
#topbar { top: 10px; left: 10px; right: 10px;
          display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.tbBrand { display: flex; align-items: center; flex: 0 0 auto; }
.tbUtils { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
/* side rail: drawing tools, vertical on the left; its `top` is set by JS to sit
   just under the top bar (whose height varies as it wraps) */
#toolrail { left: 10px; top: 74px; display: flex; flex-direction: column; gap: 6px;
            align-items: stretch; max-height: calc(100vh - 84px); overflow-y: auto; }
#toolrail button { width: 100%; text-align: left; }
/* narrow (phone / portrait tablet): the rail becomes a horizontal strip */
@media (max-width: 700px) {
  #toolrail { flex-direction: row; flex-wrap: wrap; right: 10px; max-height: none; overflow: visible; }
  #toolrail button { width: auto; text-align: center; }
}

/* brand tile — placeholder logo (navy tile, orange room/door mark); the app's
   splash of colour and identity until real branding lands */
#brand { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; margin-right: 2px;
         background: var(--ink); display: flex; align-items: center; justify-content: center;
         box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
#brand svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; }

/* wordmark — always-visible brand name beside the tile (the app's identity) */
#wordmark { flex: 0 0 auto; display: inline-block; margin: 0 10px 0 3px; white-space: nowrap;
            font-size: 18px; font-weight: 700; letter-spacing: -.3px; color: var(--ink); }
#wordmark::first-letter { color: var(--accent); } /* orange Q */
@media (max-width: 560px) { #wordmark { display: none; } } /* tile carries the brand when cramped */

#topbar button, #toolrail button {
  font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--ink);
  padding: 10px 15px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; cursor: pointer; touch-action: manipulation;
  transition: background .12s, border-color .12s, color .12s, transform .04s;
}
#topbar button:hover:not(:disabled), #toolrail button:hover:not(:disabled) { background: #eef1f5; }
#topbar button:active:not(:disabled), #toolrail button:active:not(:disabled) { transform: translateY(1px); }
#topbar button.active, #toolrail button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
#topbar button:disabled, #toolrail button:disabled { opacity: 0.4; cursor: default; }
#topbar button.icon, #toolrail button.icon { font-size: 18px; line-height: 1; padding: 9px 13px; }

/* survey RECORD actions (Site details + Photos & files) — a soft tinted pill and
   an orange icon so they read as "the survey record", not a drawing tool */
.survGroup { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
#topbar .survBtn { display: inline-flex; align-items: center; gap: 7px; font-weight: 600;
             background: #eef2f8; border-color: #cdd8e6; color: var(--ink); padding: 9px 14px; }
#topbar .survBtn:hover:not(:disabled) { background: #e2eaf4; border-color: #b9c8dc; }
.survBtn .si { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: var(--accent);
             stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* on cramped widths keep the icons, drop the labels so the group stays compact */
@media (max-width: 640px) {
  .survBtn .lbl { display: none; }
  #topbar .survBtn { padding: 9px 12px; }
}

/* primary / completing actions carry the accent */
#btnExport, #btnClose, #btnFinishWall, #btnInstall {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
#btnExport:hover:not(:disabled), #btnClose:hover:not(:disabled),
#btnFinishWall:hover:not(:disabled), #btnInstall:hover:not(:disabled) {
  background: var(--accent-d); border-color: var(--accent-d);
}

/* ---- survey title chip ---- */
/* a subtle inset field with a pencil affordance, not a dashed "draft" box */
#title { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: .1px;
         padding: 10px 14px 10px 34px; background: #f1f4f8; border: 1px solid transparent;
         border-radius: 9px; cursor: text; max-width: 24vw; overflow: hidden;
         text-overflow: ellipsis; white-space: nowrap; margin-right: 4px;
         background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E");
         background-repeat: no-repeat; background-position: 12px center; }
#title:hover { background: #e9eef4; border-color: var(--line); }

/* ---- bottom hint ---- */
#hint { position: fixed; bottom: 14px; left: 0; right: 0; text-align: center;
        color: var(--muted); font-size: 13.5px; pointer-events: none; }

/* ---- save-failure alert ---- */
/* Prominent bottom-centre bar so it's unmissable while drawing and clear
   of the (wrap-prone) toolbar on narrow phones. */
#drawLen { position: fixed; left: 50%; transform: translateX(-50%); bottom: 44px;
           display: none; align-items: center; gap: 10px; z-index: 12;
           padding: 10px 12px; background: #fff; border: 1px solid var(--line);
           border-radius: 12px; box-shadow: var(--shadow-l); max-width: 94vw; }
#drawLen label { display: flex; align-items: center; gap: 8px; margin: 0;
                 font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
#drawLen input { width: 120px; box-sizing: border-box; font-size: 18px; color: var(--ink);
                 padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
#drawLen input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
#drawLen button { font-family: var(--font); font-size: 15px; font-weight: 600;
                  padding: 10px 16px; border: 1px solid var(--accent); border-radius: 9px;
                  background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; }
#drawLen button:hover { background: var(--accent-d); border-color: var(--accent-d); }

#saveWarning { position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
               display: none; align-items: center; gap: 12px; z-index: 20;
               max-width: 92vw; padding: 12px 16px; border-radius: var(--radius);
               background: var(--danger); color: #fff; font-size: 15px;
               box-shadow: var(--shadow-l); }
#saveWarning button { background: transparent; border: 0; color: #fff;
                      font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }

/* ---- dropdown menus (export + dimension layers) ---- */
#exportMenu, #dimsMenu { position: fixed; display: none; flex-direction: column; gap: 6px;
              background: #fff; border: 1px solid var(--line); border-radius: 12px;
              padding: 8px; box-shadow: var(--shadow-l); z-index: 15; min-width: 190px; }
#exportMenu button, #dimsMenu button { font-family: var(--font); font-size: 15px; font-weight: 500;
                     padding: 12px 16px; border: 1px solid var(--line);
                     border-radius: 8px; background: #fff; color: var(--ink);
                     text-align: left; cursor: pointer; }
#exportMenu button:hover, #dimsMenu button:hover { background: #eef1f5; }
#exportMenu { min-width: 230px; }
#exportMenu button small { display: block; margin-top: 3px; font-size: 11.5px;
                     font-weight: 400; color: var(--muted); }

/* dimension-layer menu: a heading + tickable style rows */
#dimsMenu .menuHead { margin: 2px 6px 4px; font-size: 11.5px; font-weight: 700;
                      color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
#dimsMenu button { position: relative; padding-left: 38px; }
#dimsMenu button::before { content: '\2713'; position: absolute; left: 15px; top: 50%;
                           transform: translateY(-50%); color: var(--accent);
                           font-weight: 700; opacity: 0; }
#dimsMenu button.on::before { opacity: 1; }
#dimsMenu button.on { background: #fff8ee; border-color: var(--accent); }

/* ---- side edit panel ---- */
#panel { position: fixed; right: 10px; top: 74px; width: 220px; padding: 16px;
         background: #fff; border: 1px solid var(--line); border-radius: 14px;
         box-shadow: var(--shadow-l); display: none; }
#panel h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--ink); }
#panel label { display: block; font-size: 13px; font-weight: 500; color: var(--muted);
               margin-top: 12px; }
#panel input { width: 100%; box-sizing: border-box; font-size: 18px; color: var(--ink);
               padding: 10px; margin-top: 4px; border: 1px solid var(--line);
               border-radius: 8px; }
#panel input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
#panel input:disabled { background: #f3f5f8; color: var(--muted); }
#panel button { width: 100%; margin-top: 14px; font-family: var(--font); font-size: 15px;
                font-weight: 600; padding: 12px; border: 1px solid var(--accent);
                border-radius: 9px; background: var(--accent); color: #fff; cursor: pointer; }
#panel button:hover { background: var(--accent-d); border-color: var(--accent-d); }
#panel button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line);
                          font-weight: 500; margin-top: 8px; }
#panel button.secondary:hover { background: #eef1f5; }
#panel button.secondary.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
#panel button.secondary.danger:hover { background: #fdeceb; }
#panel .note { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.45; }

/* ---- modal overlays ---- */
.overlay { position: fixed; inset: 0; background: rgba(31, 42, 55, 0.45);
           display: none; align-items: center; justify-content: center; z-index: 30;
           -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.overlay .box { background: #fff; border-radius: 16px; padding: 22px 24px;
                width: min(420px, 92vw); max-height: 80vh; overflow-y: auto;
                box-shadow: var(--shadow-l); }
.overlay p { margin: 0 0 16px; font-size: 16px; color: var(--ink); line-height: 1.5; }
.overlay button { font-family: var(--font); font-size: 15px; font-weight: 500;
                  padding: 12px 22px; margin: 0 6px 0 0; border: 1px solid var(--line);
                  border-radius: 9px; background: #fff; color: var(--ink); cursor: pointer; }
.overlay button:hover { background: #eef1f5; }
.overlay .danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.overlay .danger:hover { background: #a93226; }
.overlay .primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.overlay .primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.overlay input[type=text], .overlay input[type=number] {
                            width: 100%; box-sizing: border-box; font-size: 18px;
                            padding: 11px; margin-bottom: 16px; border: 1px solid var(--line);
                            border-radius: 8px; color: var(--ink); }
.overlay input[type=text]:focus, .overlay input[type=number]:focus {
                            outline: none; border-color: var(--accent);
                            box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.overlay .row { display: flex; justify-content: flex-end; gap: 8px; }
.overlay .row button { margin: 0; }

/* ---- pattern dialog: paired count + spacing inputs ---- */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 18px; }
.pgrid label { display: block; margin: 0; line-height: 1.3;
               font-size: 13px; font-weight: 500; color: var(--muted); }
.pgrid label > input { display: block; width: 100%; margin-top: 6px; margin-bottom: 0 !important; }
@media (max-width: 430px) { .pgrid { grid-template-columns: 1fr; } }

/* ---- site details sheet ---- */
.overlay .box.dbox { width: min(560px, 94vw); text-align: left; }
.dbox h3 { margin: 0 0 16px; font-size: 18px; color: var(--ink); }
.dbox .dsec { margin: 20px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .04em;
              text-transform: uppercase; color: var(--muted); }
.dfield { display: block; margin: 0 0 14px; font-size: 13px; font-weight: 500; color: var(--muted); }
.dnote-inline { font-weight: 400; font-size: 11px; color: var(--muted); opacity: .8; }
.dfield > input, .dfield > textarea { display: block; width: 100%; box-sizing: border-box;
              margin-top: 6px; margin-bottom: 0; font-size: 17px; padding: 11px;
              border: 1px solid var(--line); border-radius: 8px; color: var(--ink);
              font-family: var(--font); }
.dbox textarea { resize: vertical; line-height: 1.4; }
.dfield > input:focus, .dfield > textarea:focus, .dbox .pgrid input:focus {
              outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
/* a contact = a small card of four inputs + a remove control */
.dcontact { border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px 4px;
            margin-bottom: 10px; background: #fafbfc; }
.dcontact .pgrid { margin-bottom: 8px; }
.dcontact .dcrow { display: flex; justify-content: flex-end; }
.dcontact .dremove, .dnote .dremove { padding: 6px 12px; margin: 0 0 8px; font-size: 13px;
            border: 1px solid var(--line); border-radius: 8px; background: #fff;
            color: var(--danger); cursor: pointer; }
.dnote { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.dbox .dnote > input { flex: 1 1 auto; width: auto; min-width: 0; box-sizing: border-box;
            font-size: 16px; padding: 10px; margin: 0; border: 1px solid var(--line);
            border-radius: 8px; color: var(--ink); font-family: var(--font); }
.dbox .dnote > input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.dnote .dremove { margin: 0; flex: 0 0 auto; }
.dadd { display: inline-block; padding: 9px 16px; margin: 2px 0 0; font-size: 14px; font-weight: 600;
        border: 1px dashed var(--line); border-radius: 9px; background: #fff; color: var(--ink); cursor: pointer; }
.dadd:hover { background: #eef1f5; border-style: solid; }

/* ---- photos & files ---- */
.dbox .fhelp { font-size: 13px; color: var(--muted); margin: 0 0 14px; line-height: 1.45; }
.faddrow { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.fmsg { font-size: 13px; padding: 9px 12px; border-radius: 8px; margin-bottom: 12px;
        background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; }
#fileList { display: flex; flex-direction: column; gap: 10px; }
.frow { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line);
        border-radius: 10px; padding: 10px; background: #fafbfc; }
.fthumb { width: 56px; height: 56px; flex: 0 0 auto; border-radius: 8px; object-fit: cover;
          background: #eef1f5; display: flex; align-items: center; justify-content: center;
          font-size: 24px; color: var(--muted); overflow: hidden; }
.fthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fmeta { flex: 1 1 auto; min-width: 0; }
.fmeta input { width: 100%; box-sizing: border-box; font-size: 15px; padding: 7px 9px; margin: 0 0 4px;
        border: 1px solid var(--line); border-radius: 7px; color: var(--ink); font-family: var(--font); }
.fmeta input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.fsize { font-size: 12px; color: var(--muted); }
.fdel { flex: 0 0 auto; padding: 8px 12px; margin: 0; font-size: 13px; border: 1px solid var(--line);
        border-radius: 8px; background: #fff; color: var(--danger); cursor: pointer; }
.dbox .empty { font-size: 14px; color: var(--muted); text-align: center; padding: 8px 0; }

/* ---- full-page sheet: Site details / Photos & files as tabs ----
   A real page rather than a modal — the details form grows, and a full
   page works better on PC, tablet and phone in any orientation. */
.page { position: fixed; inset: 0; z-index: 20; display: none; flex-direction: column;
        background: var(--canvas); }
.page.open { display: flex; }
.pageHead { display: flex; align-items: center; justify-content: space-between; gap: 10px;
            padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line);
            box-shadow: var(--shadow); flex-wrap: wrap; }
.pageTabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pageTab { font-family: var(--font); font-size: 15px; font-weight: 500; padding: 10px 18px;
           border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted);
           cursor: pointer; }
.pageTab:hover { background: #eef1f5; }
.pageTab.active { background: #fff8ee; border-color: var(--accent); color: var(--ink); font-weight: 600; }
.pageDone { font-family: var(--font); font-size: 15px; font-weight: 600; padding: 10px 24px;
            border: 1px solid var(--accent); border-radius: 9px; background: var(--accent);
            color: #fff; cursor: pointer; }
.pageDone:hover { background: var(--accent-d); border-color: var(--accent-d); }
.pageBody { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pageCol { max-width: 640px; margin: 0 auto; padding: 22px 18px 72px; }
/* the page reuses the .dbox form styles but isn't inside .overlay, so give
   its paired-grid inputs the base styling the overlay used to provide */
.pageCol .pgrid input { box-sizing: border-box; font-family: var(--font); font-size: 17px;
            padding: 11px; border: 1px solid var(--line); border-radius: 8px;
            color: var(--ink); background: #fff; }
.pageCol .dsec:first-child { margin-top: 4px; }

/* ---- racking placement bar (bottom-centre, like the wall-length bar) ---- */
#rackBar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 44px;
           display: none; align-items: center; gap: 10px; z-index: 12;
           padding: 10px 14px; background: #fff; border: 1px solid var(--line);
           border-radius: 12px; box-shadow: var(--shadow-l); max-width: 94vw; }
#rackBar span { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
#rackBar button { font-family: var(--font); font-size: 14px; font-weight: 600; white-space: nowrap;
                  padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px;
                  background: #fff; color: var(--ink); cursor: pointer; }
#rackBar button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#rackBar button.primary:hover { background: var(--accent-d); border-color: var(--accent-d); }

/* measure style picker — two icon buttons floated beside the Measure button.
   Each icon depicts the measurement it makes (diagonal vs right-angle). */
#measureStyleBar { position: fixed; display: none; flex-direction: row; gap: 6px; z-index: 12;
           padding: 6px; background: rgba(255, 255, 255, 0.97); border: 1px solid var(--line);
           border-radius: 12px; box-shadow: var(--shadow-l); }
#measureStyleBar.on { display: flex; }
.mstyle { width: 46px; height: 46px; padding: 0; display: flex; align-items: center; justify-content: center;
          border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer;
          touch-action: manipulation; }
.mstyle:hover { background: #eef1f5; }
.mstyle svg { width: 26px; height: 26px; fill: none; stroke: var(--muted); stroke-width: 2;
              stroke-linecap: round; stroke-linejoin: round; }
.mstyle svg .dash { stroke-dasharray: 3 3; }
.mstyle svg circle { fill: var(--muted); stroke: none; }
.mstyle.active { background: #e9f6ee; border-color: #159a4b; }
.mstyle.active svg { stroke: #159a4b; }
.mstyle.active svg circle { fill: #159a4b; }

/* ---- racking dialog extras ---- */
.rkcheck { display: flex; align-items: center; gap: 8px; margin: 2px 0 16px;
           font-size: 15px; color: var(--ink); cursor: pointer; }
.rkcheck input { width: auto !important; margin: 0 !important; }
.rkTotal { font-size: 15px; font-weight: 700; color: var(--ink); margin: 6px 0 8px !important; }
.rkNote { font-size: 12.5px; color: var(--muted); margin: 0 0 16px !important; line-height: 1.45; }
.rkdir { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.rkdir button { margin: 0; }
.rkdir span { font-size: 13px; color: var(--muted); }
.rktype { display: flex; gap: 8px; margin: 0 0 16px; }
.rktype button { flex: 1; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px;
                 background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; }
.rktype button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- surveys list ---- */
#surveys h3 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
#surveys ul { list-style: none; margin: 0; padding: 0; }
#surveys li { display: flex; align-items: center; gap: 8px; padding: 12px 0;
              border-top: 1px solid #eef1f4; }
#surveys li .meta { flex: 1; min-width: 0; }
#surveys li .name { font-size: 16px; font-weight: 500; color: var(--ink); }
#surveys li .date { font-size: 12px; color: var(--muted); margin-top: 2px; }
#surveys li button { padding: 9px 16px; }
#surveys .empty { color: var(--muted); font-size: 14px; }

/* ---- login gate (Sign in with Microsoft; dormant unless AUTH.enabled) ---- */
#loginGate { position: fixed; inset: 0; z-index: 50; display: none;
             align-items: center; justify-content: center; padding: 20px; background: var(--canvas); }
#loginGate.on { display: flex; }
.lgCard { width: min(400px, 92vw); background: var(--surface); border: 1px solid var(--line);
          border-radius: 16px; box-shadow: var(--shadow-l); padding: 34px 30px; text-align: center; }
.lgBrand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; }
.lgTile { width: 40px; height: 40px; border-radius: 11px; background: var(--ink);
          display: flex; align-items: center; justify-content: center; }
.lgTile svg { width: 24px; height: 24px; stroke: var(--accent); fill: none; }
.lgWord { font-size: 22px; font-weight: 700; letter-spacing: -.3px; color: var(--ink); }
.lgWord::first-letter { color: var(--accent); }
.lgCard h1 { margin: 0 0 6px; font-size: 22px; color: var(--ink); }
#lgSub { margin: 0 0 24px; font-size: 15px; color: var(--muted); line-height: 1.5; }
.lgBtn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
         box-sizing: border-box; padding: 13px 18px; font-family: var(--font); font-size: 15px;
         font-weight: 600; color: var(--ink); background: #fff; border: 1px solid var(--line);
         border-radius: 10px; cursor: pointer; }
.lgBtn:hover { background: #f4f6f9; border-color: #c4ccd6; }
.lgBtn:disabled { opacity: .6; cursor: default; }
.lgMs { width: 20px; height: 20px; flex: 0 0 auto; }
.lgMsg { margin: 18px 0 0; font-size: 14px; line-height: 1.5; color: var(--danger); }
.lgLink { margin: 16px 0 0; background: none; border: none; color: var(--muted); font-size: 14px;
          text-decoration: underline; cursor: pointer; font-family: var(--font); }
#lgForm { display: flex; flex-direction: column; gap: 12px; }
/* username box with a locked @wickens.co.uk suffix (Wickens-trial-specific) */
.lgEmailRow { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px;
              overflow: hidden; background: #fff; }
.lgEmailRow:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.lgEmailRow #lgEmail { flex: 1 1 auto; min-width: 0; box-sizing: border-box; padding: 13px; border: none;
           border-radius: 0; font-family: var(--font); font-size: 16px; color: var(--ink); background: transparent; }
.lgEmailRow #lgEmail:focus { outline: none; box-shadow: none; }
#lgEmail::placeholder { color: var(--muted); }
.lgSuffix { display: flex; align-items: center; padding: 0 12px; background: #f1f4f8; color: var(--muted);
            font-size: 15px; white-space: nowrap; border-left: 1px solid var(--line); }
.lgBtn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.lgBtn.primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.lgSent { margin: 12px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
