/* Same red/black JEJORS visual language as the original Apps Script app (Dashboard.html
   etc.), rebuilt as a proper single-page app instead of full-page server reloads. The
   login wallpaper and logo were embedded as base64 in the original's <style> blocks;
   extracted here to real files (public/images/login-bg.jpg, logo.png) - same look, much
   smaller page weight and normal browser caching (per the migration notes on this). */
:root {
  --primary: #b91c1c; --primary-dark: #7f1d1d; --black: #1a1a1a;
  --border: #ddd2d2; --bg: #f7f5f5; --text: #1f1a1a; --muted: #7a6e6e;
  --amber: #b45309; --amber-bg: #fef3c7; --green: #15803d; --green-bg: #dcfce7;
  --blue: #1d4ed8; --blue-bg: #dbeafe; --gray: #57534e; --gray-bg: #e7e2e2;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
.hidden { display: none !important; }

button { cursor: pointer; font-family: inherit; font-size: 13px; border-radius: 6px; border: 1px solid var(--border); background: #fff; padding: 8px 14px; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--primary-dark); }
button.danger { background: #fee2e2; border-color: var(--primary); color: var(--primary-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font-family: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; width: 100%; }
label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 12px 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #faf7f7; cursor: pointer; }

.card { background: #fff; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 18px 20px; margin-bottom: 16px; overflow-x: auto; }
.card h2, .card h3 { margin-top: 0; }
.content { max-width: 900px; margin: 0 auto; padding: 24px; }

.topbar { display: flex; justify-content: space-between; align-items: center; background: var(--black); color: #fff; padding: 14px 24px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar .brand img { height: 28px; }
.topbar .nav-links { display: flex; gap: 8px; align-items: center; }
.topbar a, .topbar button.link { color: #fff; text-decoration: none; background: var(--primary); padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; border: none; cursor: pointer; }
.topbar button.link.logout { background: rgba(255,255,255,.12); }
.whoami { font-size: 0.8rem; opacity: .8; margin-left: 8px; }

/* Login screen */
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(rgba(247,245,245,.6), rgba(247,245,245,.6)),
    url(/images/login-bg.jpg) left top/cover no-repeat fixed;
}
.login-card { max-width: 340px; width: 100%; text-align: center; background: #fff; padding: 32px 28px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.login-card img { height: 48px; margin-bottom: 12px; }
.error-text { color: var(--primary); font-size: 0.85rem; margin-top: 10px; }
.success-text { color: var(--green); font-size: 0.85rem; }

/* Status pills - same classes/colors the original used, still keyed off the status text
   with spaces/slashes turned into hyphens for the class name. */
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.status-Not-Started { background: var(--gray-bg); color: var(--gray); }
.status-Active, .status-In-Progress { background: var(--amber-bg); color: var(--amber); }
.status-Submitted { background: var(--blue-bg); color: var(--blue); }
.status-Approved, .status-Completed { background: var(--green-bg); color: var(--green); }
.status-N-A { background: var(--gray-bg); color: var(--muted); }

/* Progress bar - a <div> for the fill, not a <span>: a span is inline by default and
   silently ignores the `width` CSS property regardless of what's set inline, which is
   exactly the bug that shipped in the original Dashboard.html the first time around. */
.bar-track { background: #eee; border-radius: 5px; height: 8px; width: 120px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.bar-fill { background: var(--green); height: 100%; display: block; }

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

.attachment-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.attachment-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--gray-bg); color: var(--text); text-decoration: none; padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; }
.attachment-chip:hover { background: var(--border); }
.upload-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.upload-row input[type=file] { font-size: 0.78rem; }
.upload-row button { padding: 5px 12px; font-size: 0.8rem; }
.upload-note { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.company-doc-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.company-doc-row:last-child { border-bottom: none; }
.company-doc-row .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.company-doc-row .name { font-size: 0.92rem; font-weight: 600; }
.company-doc-row .meta { font-size: 0.8rem; color: var(--muted); }
.company-doc-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.company-doc-edit input[type=text] { flex: 1; min-width: 160px; }
