/* Ported from the original Apps Script app's Styles.html (2026-09-02 refresh) - JCC logo,
   login-page wallpaper photo, toast notifications, mobile off-canvas drawer. The two images
   below were embedded as base64 in the original; extracted here to real files
   (public/images/logo.png, public/images/wallpaper.jpg) instead - same look, much smaller
   page weight and normal browser caching.

   2026-09-15 redesign - "Rebar Tag": a neutral galvanized-steel UI (one steel-grey accent
   doing almost everything, instead of a saturated brand blue) plus a small set of
   colour-coded dots used only where the colour is already real information - your own bar
   marks are literally named after their tie-wire colour ("STARTING REBAR X' - MAGENTA",
   "ALONG Y' AXIS - RED/GREEN/BLUE"), so the Mark column across the app now shows a matching
   dot next to any mark whose name says so (markDotHtml() in app.js) instead of inventing a
   decorative colour system. One typeface throughout (IBM Plex Sans) carries hierarchy by
   weight, not by mixing faces. Every existing class name is kept as-is - only values (and a
   few component treatments that genuinely need to flip, like the sidenav going light) - so
   none of the markup already built in app.js/print.js needed to change for this. */
:root {
  --bg: #f2f3f5;
  --panel: #ffffff;
  --border: #dde1e6;
  --text: #1c2126;
  --muted: #6b7480;
  --primary: #46536b;      /* steel - the one UI accent: buttons, active nav, kpi numerals */
  --primary-dark: #35404f; /* darker steel - hover/pressed */
  --primary-light: #e7e9ec;
  --accent2: #3060c9;      /* cobalt - used sparingly (focus ring, links, "blue" mark dots) */
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 8px;

  /* ---- Mark-colour dots - the four colours this app's own rebar marks are actually named
     after (see markDotHtml() in app.js). Not a decorative palette; only shows when a mark's
     real name says so. ---- */
  --dot-magenta: #d6337c;
  --dot-red: #d64545;
  --dot-green: #2f9e6f;
  --dot-blue: var(--accent2);

  /* ---- Motion tokens - stronger, more intentional curves than the built-in CSS easings
     (`ease`/`ease-out` are too weak to read as deliberate). See animations.dev. ---- */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-fast: 140ms;
  --dur-base: 200ms;
  --dur-drawer: 260ms;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }

/* Keyboard focus gets a real, visible, on-brand ring; mouse/touch clicks don't (no ring
   flash on every button press) - :focus-visible is exactly the "was this reached via
   keyboard" signal we want here. */
:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
  border-radius: 4px;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 7px 12px;
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  button:not(:disabled):hover { border-color: var(--primary); background: var(--primary-light); }
  button.primary:not(:disabled):hover { background: var(--primary-dark); border-color: var(--primary-dark); }
  button.danger:not(:disabled):hover { filter: brightness(1.08); }
}
/* Press feedback on every clickable button - confirms the interface heard the click, the
   single highest-leverage detail in the whole file per click count. */
button:not(:disabled):active { transform: scale(0.97); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(28, 33, 38, .12); font-weight: 600; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  width: 100%;
  background: var(--panel);
  color: var(--text);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px var(--primary-light);
}
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background var(--dur-fast) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  tbody tr:hover { background: var(--bg); }
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: auto; /* a wide table inside can scroll itself instead of blowing out the page */
  box-shadow: 0 1px 2px rgba(28, 33, 38, .04);
}
.card h3 { margin-top: 0; color: var(--text); font-weight: 700; }
.grid { display: grid; gap: 16px; }
/* Auto-reflowing form grids - collapse toward 1 column as the viewport narrows. */
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-6 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel);
  color: var(--text); border-bottom: 1px solid var(--border);
  padding: 10px 20px;
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.whoami-wrap { display: flex; align-items: center; gap: 14px; }
.whoami { color: var(--muted); font-size: 12px; }
.whoami button {
  margin-left: 10px; color: var(--muted); font-size: 12px; background: transparent;
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px;
}
@media (hover: hover) and (pointer: fine) {
  .whoami button:hover { background: var(--primary-light); border-color: var(--primary); color: var(--text); }
}

.landing {
  display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 49px - 40px);
  position: relative;
}
.landing-bg {
  background-image: linear-gradient(180deg, rgba(28,33,38,.6), rgba(28,33,38,.82)), url('/images/wallpaper.jpg');
  background-size: cover;
  background-position: center;
}
.landing-card {
  max-width: 380px; width: 100%; text-align: center;
  opacity: 1; transform: scale(1) translateY(0);
  transition: opacity var(--dur-drawer) var(--ease-out), transform var(--dur-drawer) var(--ease-out);
  @starting-style {
    opacity: 0;
    transform: scale(0.97) translateY(6px);
  }
}
.landing-card h3 { margin-bottom: 2px; color: var(--text); font-weight: 700; }
.login-subtitle { color: var(--muted); font-weight: 600; margin-top: 0; }
.jcc-logo {
  width: 76px; height: 76px; margin: 0 auto 12px;
  background-image: url('/images/logo.png');
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.jcc-logo-sm { width: 26px; height: 26px; margin: 0; }

.shell { display: flex; min-height: calc(100vh - 49px - 40px); }
.sidenav { width: 210px; background: var(--panel); border-right: 1px solid var(--border); padding: 12px; flex-shrink: 0; }
.navbtn {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  padding: 9px 10px; margin-bottom: 2px; border-radius: 7px; color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .navbtn:hover { background: var(--primary-light); color: var(--text); }
}
.navbtn:active { transform: scale(0.98); }
.navbtn.active { background: var(--primary); color: #fff; font-weight: 600; }
.navgroup-label {
  color: #9aa1ab; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 14px 10px 4px;
}
.navbtn-sub { padding-left: 22px; }
.content { flex: 1; padding: 20px; max-width: 1100px; }

.appfooter {
  text-align: center; color: var(--muted); font-size: 12px; padding: 12px; height: 40px;
  box-sizing: border-box; border-top: 1px solid var(--border); background: var(--panel);
}

/* Notifications (toasts + confirm dialogs) - centered on screen, one steel family for both,
   differentiated by icon rather than a red/green split so it reads as one coherent
   notification system instead of two different UI languages.

   Entrance is deliberate (starts from a slightly-smaller, not-zero scale - see "never
   animate from scale(0)"); exit is snappier than entrance (see "asymmetric enter/exit
   timing" - the system responding should never feel slower than the user acting). Toggling
   the .hidden class jumps to `display:none` with no transition, which is intentional here:
   toast() (app.js) adds a short .closing state first so the fade actually gets seen before
   the element leaves the layout. */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(1);
  padding: 14px 22px; border-radius: 12px; color: #fff; font-size: 14px; font-weight: 600;
  z-index: 500; max-width: 420px; text-align: center; display: flex; align-items: center;
  justify-content: center; gap: 10px; box-shadow: 0 16px 40px rgba(28,33,38,.45);
  border: 1px solid rgba(255,255,255,.14);
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  @starting-style {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}
.toast.closing { opacity: 0; transform: translate(-50%, -50%) scale(0.96); transition-duration: 120ms; }
.toast.ok { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.toast.error { background: linear-gradient(135deg, #2a3138, #1c2126); }
.toast::before { font-size: 15px; }
.toast.ok::before { content: "\2713"; } /* checkmark */
.toast.error::before { content: "\26A0"; } /* warning triangle */

/* Backdrop shared by every centered modal (confirm dialog, change-passcode form, etc.) -
   .nav-overlay's dim full-screen backdrop, just given a higher stacking context than the
   sidenav's own use of that class needs. */
.modal-overlay {
  z-index: 200;
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out);
  @starting-style { opacity: 0; }
}
.modal-overlay.closing { opacity: 0; transition-duration: 120ms; }
.modal-card {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(1);
  transform-origin: center; /* modals aren't anchored to a trigger, so they stay centered */
  z-index: 201; max-width: 360px; width: 90%; border-top: 4px solid var(--primary);
  box-shadow: 0 20px 48px rgba(28,33,38,.4);
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  @starting-style {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}
.modal-card.closing { opacity: 0; transform: translate(-50%, -50%) scale(0.96); transition-duration: 120ms; }
.modal-card h3 { color: var(--text); font-weight: 700; }
.modal-card .row { justify-content: flex-end; margin-top: 16px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; background: var(--primary-light); color: var(--muted);
}
.badge.blue { background: var(--primary-light); color: var(--primary-dark); }
.badge.green { background: #dcfce7; color: var(--success); }
.badge.amber { background: #fef3c7; color: var(--warning); }
.badge.red { background: #fee2e2; color: var(--danger); }
.muted { color: var(--muted); }

/* Mark-colour dot - shown next to a Mark whose real name says which tie-wire colour it is
   (see markDotHtml() in app.js). Real information, not decoration - most marks show none. */
.mark-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; flex-shrink: 0; }
.mark-dot.magenta { background: var(--dot-magenta); }
.mark-dot.red { background: var(--dot-red); }
.mark-dot.green { background: var(--dot-green); }
.mark-dot.blue { background: var(--dot-blue); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .kpi:hover { border-color: var(--primary); box-shadow: 0 6px 16px rgba(28,33,38,.08); transform: translateY(-1px); }
}
.kpi .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.kpi .lbl { color: var(--muted); font-size: 12px; }

.section-title { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 8px; }
.section-title h3 { color: var(--text); font-weight: 700; }
.empty { color: var(--muted); font-style: italic; padding: 12px 0; }

.suggestions { position: relative; }
.suggestion-list {
  position: absolute; z-index: 10; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; margin-top: 4px; max-height: 220px; overflow-y: auto; width: 100%;
  box-shadow: 0 12px 28px rgba(28,33,38,.14);
}
.suggestion-item { padding: 7px 9px; cursor: pointer; font-size: 13px; transition: background var(--dur-fast) var(--ease-out); }
.suggestion-item:hover { background: var(--bg); }

.error-text, .error { color: var(--danger); font-size: 12px; text-align: left; margin: 8px 0 0; }

.ll-dim-block label { margin-top: 0; }
.ll-dim-block input { margin-top: 2px; }
.plan-doc-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }

.timeline-row { display: flex; gap: 9px; margin-bottom: 7px; align-items: flex-start; }
.timeline-done { color: var(--success); font-weight: 700; }
.timeline-current { color: var(--warning); font-weight: 700; }
.timeline-future { color: var(--muted); }

.nav-toggle {
  display: none;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; font-size: 16px; line-height: 1; border-radius: 7px;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .nav-toggle:hover { background: var(--primary-light); }
}
.nav-toggle:active { transform: scale(0.94); }
.nav-overlay {
  display: none; position: fixed; inset: 0; background: rgba(28,33,38,.5); z-index: 40;
  opacity: 0; transition: opacity var(--dur-drawer) var(--ease-out);
}
.nav-overlay.open { display: block; opacity: 1; }

/* ---------- Mobile / narrow viewport ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sidenav {
    position: fixed; top: 49px; bottom: 0; left: 0; width: 240px; max-width: 80vw;
    transform: translateX(-100%); transition: transform var(--dur-drawer) var(--ease-drawer); z-index: 50;
    overflow-y: auto; box-shadow: 2px 0 20px rgba(0,0,0,.15);
  }
  .sidenav.open { transform: translateX(0); }
  .content { padding: 12px; max-width: 100%; }
  .whoami { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .brand { gap: 8px; }
  button, input, select, textarea { font-size: 15px; }
  button { padding: 9px 12px; }
  input, select, textarea { padding: 9px 10px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  th, td { padding: 8px; font-size: 12px; white-space: nowrap; }
}

@media (max-width: 480px) {
  .brand-title { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .landing-card { padding: 20px 14px; }
  /* Stays centered (left:50%+transform, set in the base .toast rule) on narrow screens too
     - just cap its width to the viewport so it can't run off either edge. */
  .toast, .modal-card { max-width: calc(100vw - 24px); }
}

/* Motion sickness accommodation - keep the fades (they aid comprehension, e.g. a toast
   appearing) but drop anything that actually moves or scales. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .toast, .modal-card, .landing-card, .kpi, button, .navbtn { transform: none !important; }
}
