/* ============================================================================
   Buildline Management System — Prototype Design System
   Brand: BUILD (lime green) · LINE (grey), geometric sans (Century Gothic family)
   ========================================================================== */

:root {
  /* Brand */
  --bl-green:      #8CC63F;   /* "BUILD" lime */
  --bl-green-600:  #74ad2c;
  --bl-green-700:  #5d8f22;
  --bl-green-soft: #eef7e1;
  --bl-grey:       #6d6e71;   /* "LINE" grey */
  --bl-grey-700:   #58595b;
  --bl-grey-900:   #33353a;
  --bl-ink:        #23262b;   /* primary text */

  /* Neutrals */
  --bg:        #f4f6f4;
  --surface:   #ffffff;
  --surface-2: #fafbf9;
  --line:      #e4e7e2;
  --line-2:    #eef0ec;
  --muted:     #7c8085;
  --muted-2:   #9aa0a4;

  /* Status */
  --ok:      #2f9e44;   --ok-soft:   #e7f5ea;
  --warn:    #e8920c;   --warn-soft: #fdf2dd;
  --danger:  #d6453d;   --danger-soft:#fbe7e6;
  --info:    #2f7fd6;   --info-soft: #e6f0fb;
  --purple:  #7a5cd0;   --purple-soft:#efeafa;

  /* Shape */
  --r-sm: 7px; --r: 11px; --r-lg: 16px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(35,38,43,.06), 0 1px 1px rgba(35,38,43,.04);
  --shadow:    0 2px 8px rgba(35,38,43,.07), 0 8px 24px rgba(35,38,43,.05);
  --shadow-lg: 0 12px 40px rgba(35,38,43,.16);

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --font: 'Century Gothic', 'Questrial', 'Jost', 'Twentieth Century',
          'Futura', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--bl-ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#root { height: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--bl-green); color: #fff; }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d4d8d2; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #bcc2ba; background-clip: content-box; }

/* ============================ App shell ================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }

.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar__brand { height: var(--topbar-h); display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line-2); }
.sidebar__brand img { height: 26px; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 12px 10px 24px; }
.nav-group__label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); padding: 16px 12px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: none; cursor: pointer;
  padding: 9px 12px; border-radius: var(--r-sm); color: var(--bl-grey-700); font-size: 13.5px; text-align: left;
  margin: 1px 0; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--bl-ink); }
.nav-item.active { background: var(--bl-green-soft); color: var(--bl-green-700); font-weight: 600; }
.nav-item.active .nav-item__ico { color: var(--bl-green-700); }
.nav-item__ico { width: 18px; height: 18px; flex: none; color: var(--muted); display: inline-flex; }
.nav-item__badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; border-radius: var(--r-pill); display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.nav-item.active .nav-item__badge { background: var(--bl-green-700); }

.sidebar__foot { border-top: 1px solid var(--line-2); padding: 12px 14px; font-size: 11px; color: var(--muted-2); }
.sidebar__foot b { color: var(--bl-grey); font-weight: 600; }

/* ============================ Main / topbar ============================== */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 22px; flex: none;
}
.topbar__crumbs { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.topbar__crumbs b { color: var(--bl-ink); font-weight: 600; }
.topbar__crumbs .sep { color: var(--line); }
.topbar__search { margin-left: 8px; flex: 1; max-width: 380px; position: relative; }
.topbar__search input { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-pill); padding: 8px 14px 8px 34px; font-size: 13px; outline: none; }
.topbar__search input:focus { border-color: var(--bl-green); background: #fff; }
.topbar__search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }

.iconbtn { width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid transparent; background: none; cursor: pointer; color: var(--bl-grey); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.iconbtn:hover { background: var(--surface-2); border-color: var(--line); }
.iconbtn__dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; background: var(--danger); border-radius: 50%; border: 1.5px solid #fff; }

.rolepick { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: var(--r-pill); cursor: pointer; background: #fff; }
.rolepick:hover { border-color: #d2d6cf; }
.rolepick select { border: 0; background: none; font-family: inherit; font-size: 12.5px; color: var(--bl-grey-700); cursor: pointer; outline: none; font-weight: 600; }

.content { flex: 1; overflow-y: auto; min-height: 0; }
.content__inner { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }

/* ============================ Avatars =================================== */
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; color: #fff; background: var(--bl-grey); flex: none; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.green { background: var(--bl-green-600); }
.avatar.grey  { background: var(--bl-grey); }
.avatar.ink   { background: var(--bl-grey-900); }

/* ============================ Page header =============================== */
.pagehead { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.pagehead__t { flex: 1; min-width: 0; }
.pagehead h1 { font-size: 23px; margin: 0 0 3px; font-weight: 700; letter-spacing: -.01em; }
.pagehead p { margin: 0; color: var(--muted); font-size: 13.5px; }
.pagehead__actions { display: flex; gap: 9px; align-items: center; }

/* ============================ Buttons ================================== */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--bl-grey-700); padding: 8px 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #d2d6cf; }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--bl-green); border-color: var(--bl-green); color: #fff; }
.btn--primary:hover { background: var(--bl-green-600); border-color: var(--bl-green-600); }
.btn--dark { background: var(--bl-grey-900); border-color: var(--bl-grey-900); color: #fff; }
.btn--dark:hover { background: #000; }
.btn--ghost { border-color: transparent; background: none; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn--danger:hover { background: #f7dad8; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================ Cards =================================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.card__head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card__head .sub { color: var(--muted); font-size: 12px; }
.card__head .spacer { flex: 1; }
.card__body { padding: 18px; }
.card__body.flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px){ .grid.cols-4{grid-template-columns:repeat(2,1fr)} .grid.cols-3{grid-template-columns:repeat(2,1fr)} }

/* ============================ Stat cards =============================== */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat__label { color: var(--muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat__label .ico { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--bl-green-soft); color: var(--bl-green-700); }
.stat__val { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin: 9px 0 2px; }
.stat__val small { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat__delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.stat__delta.up { color: var(--ok); }
.stat__delta.down { color: var(--danger); }
.stat__delta.flat { color: var(--muted); }

/* ============================ Badges =================================== */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); background: var(--line-2); color: var(--bl-grey-700); white-space: nowrap; line-height: 1.5; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--purple { background: var(--purple-soft); color: var(--purple); }
.badge--green { background: var(--bl-green-soft); color: var(--bl-green-700); }
.badge--grey { background: #eef0ec; color: var(--bl-grey-700); }
.badge--outline { background: #fff; border: 1px solid var(--line); color: var(--muted); }

/* ============================ Tables =================================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .strong { font-weight: 700; }
.tbl .muted { color: var(--muted); }
.tbl tfoot td { padding: 12px 14px; border-top: 2px solid var(--line); font-weight: 700; background: var(--surface-2); }
.cellmain { font-weight: 600; }
.cellsub { color: var(--muted); font-size: 11.5px; }

/* ============================ Forms =================================== */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--bl-grey-700); margin-bottom: 5px; }
.input, .select, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13.5px; font-family: inherit; outline: none; background: #fff; color: var(--bl-ink); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--bl-green); box-shadow: 0 0 0 3px var(--bl-green-soft); }
.input::placeholder { color: var(--muted-2); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* ============================ Progress / bars ========================= */
.bar { height: 8px; border-radius: var(--r-pill); background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--bl-green); }
.bar > span.warn { background: var(--warn); }
.bar > span.danger { background: var(--danger); }
.bar > span.grey { background: var(--bl-grey); }
.bar.stack { display: flex; }
.bar.stack > span { border-radius: 0; }

/* ============================ Misc ==================================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 9px 14px; border: 0; background: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--bl-ink); }
.tab.active { color: var(--bl-green-700); border-bottom-color: var(--bl-green); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg { color: var(--line); margin-bottom: 12px; }
.empty h4 { margin: 0 0 4px; color: var(--bl-grey-700); font-size: 15px; }

.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list__item:last-child { border-bottom: 0; }
.list__item .grow { flex: 1; min-width: 0; }
.list__item .t { font-weight: 600; font-size: 13.5px; }
.list__item .s { color: var(--muted); font-size: 12px; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

.divider { height: 1px; background: var(--line-2); margin: 18px 0; }
.tag-soft { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 8px; font-size: 11.5px; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}

/* Banner / callout */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.callout .ico { flex: none; color: var(--bl-green-700); }
.callout--info { background: var(--info-soft); border-color: #cfe0f6; }
.callout--info .ico { color: var(--info); }
.callout--warn { background: var(--warn-soft); border-color: #f6e2bb; }
.callout--warn .ico { color: var(--warn); }
.callout--green { background: var(--bl-green-soft); border-color: #d9ebbf; }

/* "One next step" guidance pill (mirrors the claim wizard UX) */
.nextstep { display: flex; align-items: center; gap: 14px; background: linear-gradient(100deg, var(--bl-green-soft), #fff); border: 1px solid #d9ebbf; border-radius: var(--r-lg); padding: 16px 18px; }
.nextstep__n { width: 34px; height: 34px; border-radius: 50%; background: var(--bl-green); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.nextstep__t b { display: block; font-size: 14px; }
.nextstep__t span { color: var(--muted); font-size: 12.5px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(35,38,43,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { max-width: 880px; }
.modal__head { padding: 18px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; }
.modal__head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }

/* Stamp (invoice approval marker) */
.stamp { border: 2px solid var(--bl-green); color: var(--bl-green-700); border-radius: 8px; padding: 8px 14px; transform: rotate(-7deg); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 13px; display: inline-block; background: rgba(140,198,63,.06); }
.stamp.danger { border-color: var(--danger); color: var(--danger); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.cal__dow { background: var(--surface-2); text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 0; }
.cal__cell { background: #fff; min-height: 92px; padding: 6px 7px; font-size: 11px; }
.cal__cell.dim { background: var(--surface-2); color: var(--muted-2); }
.cal__cell.today .cal__num { background: var(--bl-green); color: #fff; }
.cal__num { display: inline-flex; width: 21px; height: 21px; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; margin-bottom: 4px; }
.cal__ev { display: block; font-size: 10.5px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; background: var(--bl-green-soft); color: var(--bl-green-700); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__ev.info { background: var(--info-soft); color: var(--info); }
.cal__ev.warn { background: var(--warn-soft); color: var(--warn); }
.cal__ev.grey { background: #eef0ec; color: var(--bl-grey-700); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login__brandside { background: linear-gradient(150deg, var(--bl-grey-900), #2c2f34 60%, #232a1c); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 46px; position: relative; overflow: hidden; }
.login__brandside::after { content:""; position:absolute; right:-120px; bottom:-120px; width:420px; height:420px; border-radius:50%; background: radial-gradient(circle, rgba(140,198,63,.22), transparent 70%); }
.login__formside { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login__card { width: 100%; max-width: 380px; }
@media (max-width: 820px){ .login{grid-template-columns:1fr} .login__brandside{display:none} }

/* Skeleton (file preview placeholder) */
.pdfph { background: repeating-linear-gradient(180deg, #fff, #fff 16px, var(--surface-2) 16px, var(--surface-2) 17px); border: 1px solid var(--line); border-radius: var(--r); min-height: 460px; padding: 26px; position: relative; }
.pdfph__line { height: 9px; background: var(--line-2); border-radius: 4px; margin: 0 0 11px; }
.pdfph__line.short { width: 40%; } .pdfph__line.mid { width: 70%; }

.prototype-flag { position: fixed; bottom: 14px; right: 16px; background: var(--bl-grey-900); color: #fff; font-size: 11px; padding: 6px 12px; border-radius: var(--r-pill); box-shadow: var(--shadow); z-index: 40; opacity: .9; display:flex; gap:7px; align-items:center; }
.prototype-flag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bl-green); }
