/* ============================================================
   MRC Nexus — Global Styles
   Typeface: Inter throughout (tabular figures for numbers)
   Brand green (#0B7A53) sampled directly from the MRC logo mark —
   every green in this file is a tint/shade of that one hue (159°),
   not an invented palette.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand green — every green here is a tint or shade of the MRC logo colour */
  --brand:        #0B7A53;
  --green:        #0B5B3F;   /* sidebar, headings accents, pressed buttons */
  --green-mid:    #0E7350;   /* buttons, links, focus */
  --green-bright: #1E9468;   /* active navigation, positive indicators */
  --green-hover:  #073E2C;
  --green-btn:    var(--green-mid);
  --mint:         #CFEBDE;
  --green-light:  #E6F4EC;

  /* Meaning — one colour per meaning, used the same way everywhere */
  --ok:            #0E5C3D;   --ok-bg:     #DCF3E4;   /* done / saved */
  --info:          #136F82;   --info-bg:   #DCEFF2;   /* information: deep teal, a neighbour of the brand green */
  --info-soft:     #EEF7F8;   --info-border: #9CCBD3;
  --accent:        #8A5D0C;   --accent-bg: #FBF0DC;   /* in progress / still needed: warm gold */
  --accent-strong: #C98F1E;                            /* gold for progress strokes */
  --danger:        #9C3423;   --danger-bg: #FBECE9;   /* errors / delete */
  --danger-border: #E5BDB5;   --danger-hover: #822C1E;
  --alert:         #E5484D;                            /* unread count */
  --violet:        #7A3E6B;   --violet-bg: #F3E5EF;   /* soft plum — category colour only */
  --success:       var(--green-mid);

  /* Neutrals */
  --bg:            #F0F3F1;
  --white:         #ffffff;
  --border:        #DFE6E1;
  --border-strong: #C5D0CA;
  --neutral-bg:    #E9EDEA;
  --neutral-hover: #D8DEDA;
  --text:          #14211B;
  --muted:         #4A5952;
  --muted-soft:    #8A968F;   /* decorative only: icons, placeholders */
  --sidebar-text:  #C9E2D3;
  --sidebar-muted: #9FCAB2;

  --ring:      rgba(14,115,80,.18);
  --shadow-sm: 0 1px 2px rgba(15,30,24,.04);
  --shadow:    0 1px 2px rgba(15,30,24,.04), 0 2px 10px rgba(15,30,24,.04);
  --shadow-lg: 0 2px 6px rgba(15,30,24,.06), 0 12px 28px rgba(15,30,24,.10);
  --radius:    12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;

  /* Type — seven sizes, one typeface */
  --fs-2xs: 11px;   /* uppercase micro-labels */
  --fs-xs:  12px;   /* meta, chips */
  --fs-sm:  13px;   /* secondary text */
  --fs-md:  14px;   /* body */
  --fs-lg:  16px;   /* card titles */
  --fs-xl:  20px;   /* page titles */
  --fs-2xl: 26px;   /* project name */
  --font-disp: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

html, body { height: 100%; }
body { font-family: var(--font-body); font-size: var(--fs-md);
       color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
       font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-disp); letter-spacing: -.01em; }

/* ---- Scrollbars ---- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--border-strong); border-radius: 20px;
  border: 2px solid var(--bg); background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--muted-soft); }
.sidebar ::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.25); border-color: var(--green); }
.sidebar ::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.4); }

::selection { background: var(--mint); color: var(--green); }

:focus-visible { outline: 2px solid var(--green-mid); outline-offset: 2px; }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--green);
  border-right: 1px solid rgba(0,0,0,.14);
  display: flex; flex-direction: column;
  z-index: 100;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 15px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-logo img { height: 34px; background: var(--white); border-radius: 6px; padding: 4px; }
.sidebar-logo-text { font-family: var(--font-disp); color: var(--white); font-weight: 800; font-size: var(--fs-lg); line-height: 1.2; letter-spacing: -.01em; }
.sidebar-logo-text span { display: block; font-size: var(--fs-2xs); font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--sidebar-muted); margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 12px 10px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 13px; margin-bottom: 1px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-weight: 500; font-size: var(--fs-md);
  transition: background .12s ease, color .12s ease;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: var(--white); }
.sidebar-nav a.active {
  background: var(--green-bright);
  color: var(--white); font-weight: 650;
}
.sidebar-nav a svg { flex-shrink: 0; opacity: .9; }
.sidebar-bottom {
  padding: 15px 18px 18px;
  border-top: 1px solid rgba(255,255,255,.12);
  color: var(--sidebar-muted); font-size: var(--fs-xs);
}
.sidebar-bottom strong { display: block; color: var(--white); font-family: var(--font-disp); font-size: var(--fs-md); margin-bottom: 2px; }

/* ---- Mobile nav drawer (toggle + backdrop hidden on desktop) ---- */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  padding: 7px; border-radius: var(--radius-sm); color: var(--text);
  transition: background .12s ease, color .12s ease;
}
.nav-toggle:hover { background: var(--green-light); color: var(--green); }
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(11,20,16,.45);
  z-index: 99; opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
body.nav-open { overflow: hidden; }

/* ---- Main layout ---- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 30px; height: 58px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title { font-family: var(--font-disp); font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.notif-btn {
  position: relative; background: none; border: none; cursor: pointer;
  padding: 7px; border-radius: var(--radius-sm); color: var(--muted);
  display: flex; transition: background .12s ease, color .12s ease;
}
.notif-btn:hover { background: var(--green-light); color: var(--green); }
.notif-badge {
  position: absolute; top: -2px; right: -4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--alert); font-family: var(--font-disp); font-size: var(--fs-xs); font-weight: 700;
  min-width: 14px; height: 14px; line-height: 1;
}
.notif-badge-nav {
  position: static; margin-left: auto;
  min-width: 16px; height: 16px; font-size: var(--fs-sm);
  color: var(--white);
}
.content { padding: 28px 32px; flex: 1; }

/* ---- Cards ---- */
.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px;
}
.card-title {
  font-family: var(--font-disp); font-size: var(--fs-lg); font-weight: 700; color: var(--text); letter-spacing: -.01em; margin-bottom: 16px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm); border: none;
  font-family: var(--font-disp); font-size: var(--fs-sm); font-weight: 600; letter-spacing: -.005em;
  cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green-btn); color: var(--white); }
.btn-primary:hover { background: var(--green); }
.btn-outline { background: transparent; color: var(--green); border: 1.5px solid var(--border-strong); }
.btn-outline:hover { background: var(--green-light); border-color: var(--green); }
.btn-sm { padding: 6px 13px; font-size: var(--fs-sm); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-muted { background: var(--neutral-bg); color: var(--muted); }
.btn-muted:hover { background: var(--neutral-hover); }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.form-row input, .form-row select, .form-row textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 7px;
  font-family: var(--font-body); font-size: var(--fs-md); background: var(--white); color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease; width: 100%;
}
.form-row input:hover, .form-row select:hover, .form-row textarea:hover { border-color: var(--border-strong); }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px var(--ring);
}
.form-row textarea { resize: vertical; min-height: 90px; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,20,16,.5);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  z-index: 1000; align-items: center; justify-content: center;
  animation: modal-fade .15s ease;
}
.modal {
  background: var(--white); border-radius: var(--radius); padding: 26px;
  width: 480px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 2px 6px rgba(11,20,16,.12), 0 24px 48px -16px rgba(11,20,16,.35);
  animation: modal-in .16s cubic-bezier(.2,.8,.2,1);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-family: var(--font-disp); font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.modal-close {
  background: none; border: none; font-size: var(--fs-xl); line-height: 1; cursor: pointer;
  color: var(--muted); padding: 5px 8px; border-radius: var(--radius-sm);
  transition: background .12s ease, color .12s ease;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---- Flash messages ---- */
/* Messages stay in view even when the page reopens part-way down after a save. */
.flash-list { list-style: none; margin-bottom: 16px; position: sticky; top: 70px; z-index: 40; }
.flash-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: var(--shadow-lg); }
.flash-close {
  flex-shrink: 0; border: none; background: none; cursor: pointer; color: inherit; opacity: .6;
  font-size: var(--fs-xl); line-height: 1; padding: 0 4px;
}
.flash-close:hover { opacity: 1; }
.flash-list li {
  padding: 11px 16px; border-radius: var(--radius-sm);
  background: var(--green-light); color: var(--green);
  border: 1px solid var(--mint); border-left: 3px solid var(--green); font-size: var(--fs-md); font-weight: 500;
  margin-bottom: 8px;
}
.flash-list li:last-child { margin-bottom: 0; }
.flash-list li.error {
  background: var(--danger-bg); color: var(--danger);
  border-color: var(--danger-border); border-left-color: var(--danger);
}
.flash-list li.info {
  background: var(--white); color: var(--muted);
  border-color: var(--border); border-left-color: var(--muted-soft);
}

/* ---- Small destructive action (delete a file / project) ---- */
.btn-delete { background: transparent; color: var(--danger); border: 1.5px solid var(--danger-border); }
.btn-delete:hover { background: var(--danger-bg); border-color: var(--danger); }

/* ---- Standalone error page ---- */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.error-card {
  width: 100%; max-width: 440px; text-align: center;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 34px 28px;
}
.error-logo { height: 44px; margin-bottom: 18px; }
.error-code {
  font-family: var(--font-disp); font-size: var(--fs-xs); font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px;
}
.error-card h1 { font-size: var(--fs-xl); font-weight: 800; color: var(--text); margin-bottom: 10px; }
.error-card p { font-size: var(--fs-md); line-height: 1.6; color: var(--muted); margin-bottom: 22px; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- Tables ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th {
  background: var(--green); color: var(--white); font-family: var(--font-disp);
  padding: 10px 12px; text-align: left; font-weight: 600; font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
  font-family: var(--font-body); font-size: var(--fs-sm); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--green-light); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.tbl-wrap .tbl th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
.tbl-wrap .tbl th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }

/* ---- Project detail: breadcrumb + name ---- */
.project-detail-crumb { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
.project-detail-crumb a { color: var(--muted); }
.project-detail-crumb a:hover { color: var(--green); }
.project-detail-crumb .current { color: var(--text); font-weight: 700; }
/* The project name is the page's main heading, so it takes the largest size. */
.page-header .project-detail-name, .project-detail-name {
  font-family: var(--font-disp); font-size: var(--fs-2xl); font-weight: 800; color: var(--text);
  letter-spacing: -.02em; margin-bottom: 20px;
}

/* ---- Project info bar (icon cards) ---- */
.project-info-bar {
  display: flex; flex-wrap: wrap; row-gap: 14px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 22px; margin-bottom: 20px;
}
.project-info-item { display: flex; align-items: center; gap: 11px; padding-right: 28px; }
.project-info-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--green-light); color: var(--green); display: flex; align-items: center; justify-content: center;
}
.project-info-text span { display: block; font-size: var(--fs-2xs); color: var(--muted); }
.project-info-text b { display: block; font-size: var(--fs-md); font-weight: 700; color: var(--text); white-space: nowrap; }

/* ---- Steps progress header ---- */
.steps-progress { display: flex; align-items: center; gap: 10px; }
.steps-progress-badge {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); color: var(--white); display: flex; align-items: center; justify-content: center;
}
.steps-progress-count { font-family: var(--font-disp); font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.steps-progress-bar-track { width: 100%; height: 6px; border-radius: 4px; background: var(--border); margin-top: 12px; overflow: hidden; }
.steps-progress-bar-fill { height: 100%; background: var(--green); border-radius: 4px; transition: width .2s ease; }

/* ---- Step rows ---- */
.step-rows { display: flex; flex-direction: column; margin-top: 22px; }
.step-row { position: relative; display: flex; gap: 16px; }
.step-row-left { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 34px; }
.step-num { font-family: var(--font-disp); font-size: var(--fs-2xs); font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.step-node {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--white); border: 2px solid var(--border); color: var(--muted-soft);
}
.step-node.completed { background: var(--green); border-color: var(--green); color: var(--white); }
.step-node.active { border-color: var(--green); background: var(--green-light); color: var(--green); }
.step-line { flex: 1; width: 2px; background: var(--border); margin-top: 4px; min-height: 20px; }
.step-line.completed { background: var(--green); }
.step-row:last-child .step-line { display: none; }

.step-card {
  flex: 1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
  transition: border-color .12s ease;
}
a.step-card:hover { border-color: var(--green-mid); }
.step-icon-box {
  width: 42px; height: 42px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--green-light); color: var(--green); display: flex; align-items: center; justify-content: center;
}
.step-card-body { flex: 1; min-width: 160px; }
.step-card-title { font-family: var(--font-disp); font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.step-card-desc { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.step-card-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; margin-left: auto; }
.step-status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-disp); font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 5px 12px; border-radius: 20px; white-space: nowrap;
}
.step-status-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.step-status-chip.completed { background: var(--ok-bg); color: var(--ok); }
.step-status-chip.completed .dot { background: var(--ok); }
.step-status-chip.active { background: var(--accent-bg); color: var(--accent); }
.step-status-chip.active .dot { background: var(--accent-strong); }
.step-open-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--white); color: var(--green); border: none;
  font-family: var(--font-disp); font-size: var(--fs-sm); font-weight: 700;
  padding: 8px 16px; border-radius: 20px; transition: background .12s ease;
}
.step-open-btn:hover { background: var(--green); color: var(--white); }

/* ---- Project steps: detail page ---- */
.step-detail-nav { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.step-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-disp); font-size: var(--fs-sm); font-weight: 700; color: var(--green-mid);
  padding: 7px 13px 7px 10px; border: 1.5px solid var(--border); border-radius: 20px; background: var(--white);
  transition: border-color .12s ease, color .12s ease;
}
.step-back:hover { border-color: var(--green-mid); color: var(--green); }
.step-detail-crumb { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.step-detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; }
.step-detail-footer .btn svg { flex-shrink: 0; }

/* ---- Step card head row (title left, status/action right) ---- */
.step-head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.steps-head-progress { flex-shrink: 0; min-width: 170px; }

/* ---- Step locked message ---- */
.step-locked-msg {
  text-align: center; padding: 48px 24px;
  color: var(--muted); font-size: var(--fs-md);
}
.step-locked-msg svg { margin-bottom: 10px; opacity: .4; }

/* ---- Handover files grid ---- */
.handover-grid { display: flex; flex-direction: column; gap: 10px; }
.handover-upload-help { margin: 0 0 16px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.handover-category { flex-wrap: wrap; }
.handover-category > .handover-row-info { flex-basis: 100%; }
.handover-file-list { display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; }
.handover-file-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.handover-file-info { flex: 1 1 180px; min-width: 0; }
.handover-file-name { display: block; font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; }
.handover-file-info small { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-2xs); }
.handover-add-files { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.handover-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 14px;
  padding: 13px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--white);
  transition: border-color .12s ease;
}
.handover-row:hover { border-color: var(--green-mid); }
.handover-row-info { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.handover-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--green-light); color: var(--green); font-family: var(--font-disp);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 700; flex-shrink: 0;
}
.handover-label { font-size: var(--fs-md); font-weight: 600; }
.handover-label small { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; margin-top: 2px; }
.handover-required { color: var(--danger); margin-left: 3px; }
.handover-actions {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; justify-content: flex-end;
  min-width: 0; max-width: 100%;
}
.file-input-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1.5px solid var(--green);
  border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-sm); font-weight: 500;
  color: var(--green); background: var(--white); transition: background .12s ease;
}
.file-input-label:hover { background: var(--green-light); }
.file-input-label input { display: none; }
.chip-uploaded {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px; font-family: var(--font-disp);
  background: var(--ok-bg); color: var(--ok); font-size: var(--fs-xs); font-weight: 700;
  min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-uploaded svg { flex-shrink: 0; }
.chip-pending {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px; font-family: var(--font-disp);
  background: var(--accent-bg); color: var(--accent); font-size: var(--fs-xs); font-weight: 700;
}

/* ---- Org structure ---- */
.org-chart { position: relative; display: flex; flex-direction: column; align-items: center; gap: 40px; padding: 8px 0; }
.org-chart-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.org-tier { position: relative; z-index: 1; }
.org-node {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--green); color: var(--white); font-family: var(--font-disp);
  border-radius: var(--radius-sm); padding: 10px 22px;
  text-align: left; font-size: var(--fs-md);
}
.org-node-icon {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
}
.org-node-label { font-size: var(--fs-2xs); opacity: .82; text-transform: uppercase; letter-spacing: .08em; }
.org-node-name { font-weight: 700; }
.org-children { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.org-child {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--green-light); color: var(--green); font-family: var(--font-disp);
  border: 1.5px solid var(--mint); border-radius: var(--radius-sm);
  padding: 9px 18px; text-align: left; font-size: var(--fs-sm); font-weight: 600;
}
.org-child-icon {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--white); display: flex; align-items: center; justify-content: center;
}
.org-child-label { font-size: var(--fs-2xs); color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: .06em; }

/* ---- Org form multi-select ---- */
.multi-select-box {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; max-height: 180px; overflow-y: auto;
}
.multi-select-box label {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; cursor: pointer; font-size: var(--fs-sm); border-bottom: 1px solid var(--neutral-bg);
  transition: background .12s ease;
}
.multi-select-box label:hover { background: var(--green-light); }
.multi-select-box label:last-child { border-bottom: none; }
.multi-select-box input[type=checkbox], .multi-select-box input[type=radio] {
  accent-color: var(--green); width: 16px; height: 16px;
}
.role-tag {
  font-family: var(--font-disp); font-size: var(--fs-2xs); font-weight: 700; padding: 3px 8px; border-radius: 10px;
  background: var(--green-light); color: var(--green); border: 1px solid var(--mint);
  margin-left: auto; text-transform: uppercase; letter-spacing: .04em;
}

/* ---- User management ---- */
.dept-badge {
  display: inline-block; padding: 3px 10px; border-radius: 10px; font-family: var(--font-disp);
  font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.dept-management { background: var(--info-bg); color: var(--info); }
.dept-project     { background: var(--ok-bg); color: var(--ok); }
.dept-sales       { background: var(--accent-bg); color: var(--accent); }
.dept-design      { background: var(--violet-bg); color: var(--violet); }
.status-active   { color: var(--success); font-weight: 700; }
.status-inactive { color: var(--muted); }

/* ---- Search box ---- */
.search-box { position: relative; min-width: 280px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input {
  width: 100%; padding: 10px 12px 10px 38px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--fs-md); background: var(--white); color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.search-box input:hover { border-color: var(--border-strong); }
.search-box input:focus { outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px var(--ring); }
.search-box input::placeholder { color: var(--muted-soft); }

/* ---- Project tiles ---- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 18px; }
.project-card {
  display: flex; flex-direction: column; gap: 16px; color: inherit;
  background: var(--white); border: 1px solid var(--border); border-top: 4px solid var(--green);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.project-card[hidden] { display: none; }
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.project-card:hover .project-card-name { color: var(--green-mid); }
.project-card.accent-green  { border-top-color: var(--green); }
.project-card.accent-blue   { border-top-color: var(--info); }
.project-card.accent-amber  { border-top-color: var(--accent-strong); }
.project-card.accent-purple { border-top-color: var(--violet); }

.project-tile-head { display: flex; align-items: flex-start; gap: 12px; }
.project-tile-title { flex: 1; min-width: 0; }
.project-avatar {
  width: 44px; height: 44px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-disp); font-weight: 800; font-size: var(--fs-md);
}
.project-avatar.accent-green  { background: var(--green-light); color: var(--green); }
.project-avatar.accent-blue   { background: var(--info-bg); color: var(--info); }
.project-avatar.accent-amber  { background: var(--accent-bg); color: var(--accent); }
.project-avatar.accent-purple { background: var(--violet-bg); color: var(--violet); }
.project-card-name {
  font-family: var(--font-disp); font-size: var(--fs-lg); font-weight: 800; color: var(--text);
  line-height: 1.3; overflow-wrap: anywhere; transition: color .15s ease;
}
.project-card-code { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }

.project-tile-meta { display: grid; gap: 8px; }
.project-tile-meta div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; font-size: var(--fs-sm); }
.project-tile-meta dt { color: var(--muted); flex-shrink: 0; }
.project-tile-meta dd { font-weight: 600; color: var(--text); text-align: right; min-width: 0; overflow-wrap: anywhere; }

.project-tile-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border);
}
.project-created { font-size: var(--fs-xs); color: var(--muted); }

.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; font-family: var(--font-disp);
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.status-badge .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-badge.not_started { background: var(--neutral-bg); color: var(--muted); }
.status-badge.not_started .dot { background: var(--muted-soft); }
.status-badge.in_progress { background: var(--accent-bg); color: var(--accent); }
.status-badge.in_progress .dot { background: var(--accent-strong); }
.status-badge.completed { background: var(--ok-bg); color: var(--ok); }
.status-badge.completed .dot { background: var(--ok); }

/* ---- Page header row ---- */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; gap: 16px;
}
.page-header h1 { font-family: var(--font-disp); font-size: var(--fs-xl); font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.page-subtitle { font-size: var(--fs-md); color: var(--muted); margin-top: 6px; }
.page-header-actions { display: flex; gap: 10px; flex-shrink: 0; }
.eyebrow {
  font-family: var(--font-disp); font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
  margin-bottom: 4px;
}
.eyebrow .current { color: var(--green); font-weight: 700; }

/* ---- New Project (full-width, two-column) ---- */
.np-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.np-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.np-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 24px; }

.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-head-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--green-light); color: var(--green);
  display: flex; align-items: center; justify-content: center;
}
.card-head .card-title { margin: 0; }
.card-subtitle { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; font-weight: 400; }

.textarea-wrap { position: relative; }
.char-counter {
  position: absolute; right: 10px; bottom: 8px;
  font-size: var(--fs-2xs); color: var(--muted-soft); background: var(--white); padding: 0 3px;
  pointer-events: none;
}

.np-preview-box {
  background: var(--bg); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 4px;
}
.np-summary-name { font-family: var(--font-disp); font-size: var(--fs-lg); font-weight: 800; color: var(--text); line-height: 1.3; }
.np-summary-code { font-family: var(--font-body); font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.np-summary-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm);
}
.np-summary-row:last-child { border-bottom: none; }
.np-summary-row span { color: var(--muted); }
.np-summary-row b {
  color: var(--text); font-weight: 600; text-align: right; max-width: 62%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Notifications ---- */
.notif-group { margin-bottom: 22px; }
.notif-group-label {
  font-family: var(--font-disp); font-size: var(--fs-2xs); font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; padding-left: 2px;
}
.notif-list { display: flex; flex-direction: column; gap: 6px; }
.notif-item {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 12px 14px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: border-color .12s ease, background .12s ease;
}
.notif-item.unread { border-left-color: var(--green); background: var(--white); }
.notif-item:hover { border-color: var(--border-strong); }
.notif-item.unread:hover { border-left-color: var(--green); }
.notif-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.notif-icon.project { background: var(--green-light); color: var(--green); }
.notif-icon.kickoff { background: var(--info-bg); color: var(--info); }
.notif-icon.upload  { background: var(--info-bg); color: var(--info); }
.notif-icon.boq     { background: var(--accent-bg); color: var(--accent); }
.notif-icon.org     { background: var(--violet-bg); color: var(--violet); }
.notif-icon.general { background: var(--neutral-bg); color: var(--muted); }
.notif-icon.weekly  { background: var(--info-bg); color: var(--info); }
.notif-icon.change  { background: var(--accent-bg); color: var(--accent); }
.notif-icon.comment { background: var(--violet-bg); color: var(--violet); }
.notif-icon.deadline { background: var(--danger-bg); color: var(--danger); }
a.notif-item { cursor: pointer; }
a.notif-item:hover .notif-text { color: var(--green); }
.notif-item .notif-body { flex: 1; }
.notif-item:not(.unread) .notif-text { color: var(--muted); }
.notif-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bright); flex-shrink: 0; align-self: center; }
.notif-header { align-items: center; }

/* ---- Completion checklist (under a stage's Save button) ---- */
.complete-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 20px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg);
}
.complete-panel.ready { border-color: var(--mint); background: var(--green-light); }
.complete-panel-info { flex: 1; min-width: 200px; }
.complete-panel-title { font-family: var(--font-disp); font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.complete-checklist { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.complete-checklist li { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.complete-checklist li.ok { color: var(--green); }
.complete-checklist li.missing { color: var(--accent); font-weight: 600; }
.check-mark { font-weight: 700; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 10-day handover follow-up ---- */
.deadline-card { border-left: 4px solid var(--info); }
.deadline-card.soon { border-left-color: var(--accent-strong); }
.deadline-card.overdue, .deadline-card.late { border-left-color: var(--danger); }
.deadline-card.met { border-left-color: var(--ok); }
.deadline-card .step-head-row > div { flex: 1 1 360px; }
.deadline-chip {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
  background: var(--info-bg); color: var(--info);
}
.deadline-chip.soon { background: var(--accent-bg); color: var(--accent); }
.deadline-chip.overdue, .deadline-chip.late { background: var(--danger-bg); color: var(--danger); }
.deadline-chip.met { background: var(--ok-bg); color: var(--ok); }
.deadline-items { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.deadline-items a {
  display: flex; align-items: center; gap: 8px; height: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: var(--fs-sm); color: var(--text); text-decoration: none;
}
.deadline-items a:hover { border-color: var(--border-strong); background: var(--bg); }
.deadline-items li.ok a { color: var(--green); }
.deadline-items li.missing a { color: var(--accent); font-weight: 600; }
.deadline-strip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 10px 14px;
  border: 1px solid var(--info-border); border-radius: var(--radius-sm); background: var(--info-soft);
  font-size: var(--fs-sm); color: var(--text); text-decoration: none;
}
.deadline-strip.soon { border-color: var(--accent-strong); background: var(--accent-bg); }
.deadline-strip.overdue { border-color: var(--danger-border); background: var(--danger-bg); }
.project-deadline { margin-top: 12px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
@media (max-width: 900px) { .deadline-items { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .deadline-items { grid-template-columns: 1fr; } }

/* ---- Project Execution sub-tabs ---- */
.exec-intro { margin-bottom: 20px; padding-bottom: 0; }
.subtabs { display: flex; gap: 4px; margin-top: 16px; overflow-x: auto; }
.subtab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 11px 16px; border: none; border-bottom: 3px solid transparent; background: none; cursor: pointer;
  font-family: var(--font-disp); font-size: var(--fs-md); font-weight: 600; color: var(--muted);
  transition: color .12s ease, border-color .12s ease;
}
.subtab:hover { color: var(--green); }
.subtab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.subtab-state {
  font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 8px; border-radius: 10px; background: var(--accent-bg); color: var(--accent);
}
.subtab-state.done { background: var(--ok-bg); color: var(--ok); }
.exec-panel[hidden] { display: none; }

/* ---- Weekly reports: week + note ---- */
.weekly-upload-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px;
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); }
.weekly-fields { display: flex; gap: 14px; flex-wrap: wrap; }
.weekly-fields .form-row { flex: 0 0 180px; }
.weekly-fields .weekly-note-field { flex: 1 1 260px; }
.weekly-files { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.week-chip {
  display: inline-block; margin-right: 8px; padding: 2px 9px; border-radius: 10px;
  background: var(--info-bg); color: var(--info); font-family: var(--font-disp); font-size: var(--fs-2xs); font-weight: 700;
}
.handover-label small.weekly-note-text { color: var(--text); font-size: var(--fs-sm); }

/* ---- Upload progress ---- */
.upload-modal { width: 420px; text-align: center; }
.upload-bar { height: 10px; border-radius: 6px; background: var(--border); overflow: hidden; margin: 16px 0 10px; }
.upload-bar-fill { height: 100%; width: 0; background: var(--green); border-radius: 6px; transition: width .2s ease; }
.upload-bar-fill.working { background: repeating-linear-gradient(45deg, var(--green) 0 12px, var(--green-bright) 12px 24px);
  background-size: 34px 34px; animation: upload-stripes 1s linear infinite; }
@keyframes upload-stripes { to { background-position: 34px 0; } }
.upload-detail { font-size: var(--fs-sm); color: var(--muted); }

/* ---- Projects list: status filter ---- */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 6px 13px; border: 1.5px solid var(--border); border-radius: 20px; background: var(--white);
  font-family: var(--font-disp); font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.filter-chip:hover { border-color: var(--green-mid); color: var(--green); }
.filter-chip.active { background: var(--green); border-color: var(--green); color: var(--white); }
.filter-chip span { font-size: var(--fs-2xs); opacity: .8; }

/* ---- Files picked but not yet saved ---- */
.pending-files { display: flex; flex-direction: column; gap: 6px; width: 100%; flex-basis: 100%; min-width: 0; }
.pending-files:empty { display: none; }
.pending-file {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 12px; border: 1.5px dashed var(--info-border); border-radius: var(--radius-sm);
  background: var(--info-soft);
}
.pending-file-name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.pending-file small { flex-shrink: 0; font-size: var(--fs-2xs); color: var(--info); font-weight: 600; }
.pending-file-remove {
  flex-shrink: 0; width: 24px; height: 24px; border: none; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--info); font-size: var(--fs-lg); line-height: 1;
}
.pending-file-remove:hover { background: var(--white); color: var(--danger); }
.save-row { display: flex; justify-content: flex-end; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.upload-total { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.upload-total.over { color: var(--danger); font-weight: 700; }

/* ---- Project activity (everything that happened, newest first) ---- */
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-when { flex: 0 0 142px; font-family: var(--font-body); font-size: var(--fs-xs); color: var(--muted); padding-top: 2px; }
.activity-what { flex: 1; min-width: 0; font-size: var(--fs-sm); line-height: 1.45; overflow-wrap: anywhere; }
.activity-what b { font-weight: 700; }
.activity-stage {
  display: inline-block; font-family: var(--font-disp); font-size: var(--fs-2xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--green);
  background: var(--green-light); border-radius: 10px; padding: 2px 8px; margin-right: 6px;
}
.activity-reason { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.activity-more > summary {
  cursor: pointer; font-family: var(--font-disp); font-size: var(--fs-sm); font-weight: 700; color: var(--green-mid);
  padding: 12px 0 2px; list-style: none;
}
.activity-more > summary::-webkit-details-marker { display: none; }
.activity-more[open] > summary { display: none; }
.notif-body { min-width: 0; padding-top: 1px; }
.notif-item.unread .notif-text { font-weight: 600; }
.notif-text { font-size: var(--fs-md); line-height: 1.45; }
.notif-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.notif-link { color: var(--green-mid); font-weight: 600; }
.notif-link:hover { text-decoration: underline; }

/* ---- Login ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  width: 100%;
  max-width: 100vw;
  background: #fff;
}

/* left: marketing panel */
.login-left {
  flex: 0 0 50%;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(175deg, rgba(6, 28, 22, 0.82) 0%, rgba(7, 82, 62, 0.5) 42%, rgba(3, 18, 15, 0.88) 100%),
    url('../img/login_image.jpg') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px clamp(30px, 4vw, 54px);
  color: #fff;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-disp);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: #fff;
}
.login-brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #17a672;
  box-shadow: 0 0 0 4px rgba(23, 166, 114, 0.18);
}
.login-pitch {
  max-width: 430px;
  padding-bottom: 18px;
}
.login-pitch h1 {
  font-family: var(--font-disp);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin-bottom: 18px;
  font-weight: 800;
  color: #f4f9f8;
}
.login-pitch p {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(227, 240, 232, 0.9);
  margin-bottom: 26px;
}
.login-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #edf6f1;
}
.login-features .chk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #f4f9f8;
  background: rgba(25, 160, 105, 0.35);
  border: 1px solid rgba(161, 219, 197, 0.55);
}
.login-footline {
  margin-top: 28px;
  font-family: var(--font-disp);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(209, 228, 219, 0.65);
}

/* right: form section */
.login-right {
  flex: 0 0 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
}
.login-card {
  width: 100%;
  max-width: 390px;
}
.login-mark {
  display: block;
  height: 74px;
  width: auto;
  margin: 0 auto 22px;
  filter: drop-shadow(0 8px 18px rgba(11, 122, 83, 0.08));
}
.login-card h2 {
  font-family: var(--font-disp);
  font-size: clamp(30px, 2vw, 38px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #171d1b;
  text-align: center;
  margin: 0;
}
.login-tagline {
  font-size: 14px;
  text-align: center;
  color: #617167;
  margin: 10px 0 26px;
}

.login-form .form-row {
  margin-bottom: 18px;
}
.login-form label {
  display: block;
  margin-bottom: 8px;
  color: #3e4b45;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.input-wrap {
  position: relative;
}
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #7b8a84;
  pointer-events: none;
}
.login-form input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  font-family: var(--font-body);
  font-size: 14px;
  border: 1.5px solid #dfe7e2;
  border-radius: 10px;
  background: #f3f6f4;
  color: #1b2b27;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.login-form input::placeholder {
  color: #8b9991;
}
.login-form input:hover {
  border-color: #c4d2cb;
}
.login-form input:focus {
  outline: none;
  border-color: #0d7a58;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 122, 88, 0.08);
}
.login-form input.has-toggle {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  display: flex;
  cursor: pointer;
  color: #7b8a84;
  border-radius: 6px;
  transition: color .12s ease, background .12s ease;
}
.password-toggle:hover { color: #0d7a58; background: rgba(13, 122, 88, 0.08); }
.login-forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.login-forgot {
  font-size: 12.5px;
  font-weight: 600;
  color: #0d7a58;
}
.login-forgot:hover { text-decoration: underline; }
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin-top: 8px;
  padding: 14px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #0b7a53 0%, #0a6a49 100%);
  color: #fff;
  font-family: var(--font-disp);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  box-shadow: 0 10px 24px rgba(11, 122, 83, 0.18);
}
.login-btn svg { flex-shrink: 0; transition: transform .15s ease; }
.login-btn:hover {
  filter: brightness(1.02);
  box-shadow: 0 12px 28px rgba(11, 122, 83, 0.24);
}
.login-btn:hover svg { transform: translateX(2px); }
.login-btn:active {
  transform: translateY(1px);
}
.login-foot {
  text-align: center;
  font-size: 12px;
  color: #687970;
  margin-top: 26px;
  letter-spacing: 0.01em;
}

/* ---- Misc ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state svg { margin-bottom: 10px; opacity: .35; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ---- Large laptops ---- */
@media (max-width: 1240px) {
  .content { padding: 26px 24px; }
}

/* ---- Small laptops / landscape tablets ---- */
@media (max-width: 1100px) {
  .login-left { flex-basis: 46%; }
  .login-right { flex-basis: 54%; }
  .login-card { max-width: 360px; }
  .np-layout { grid-template-columns: 1fr 300px; }
  .project-info-item { padding-right: 20px; }
}

/* ---- Tablets ---- */
@media (max-width: 960px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .project-info-text b { white-space: normal; }
}

/* ---- Sidebar becomes an off-canvas drawer ---- */
@media (max-width: 820px) {
  .sidebar {
    width: min(82vw, 290px);
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.28); }
  .main { margin-left: 0; }
  .nav-toggle { display: inline-flex; }

  .topbar { padding: 0 14px; height: 54px; gap: 8px; }
  .topbar-title { font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 12px; }

  .content { padding: 18px 16px; }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-header > .btn { justify-content: center; }
  .page-header-actions .btn { flex: 1; justify-content: center; }
  .search-box { min-width: 0; width: 100%; }

  .handover-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .handover-actions { flex-wrap: wrap; }

  .step-detail-footer .btn { flex: 1; justify-content: center; }

  /* Inline 2-column checkbox grids collapse */
  .multi-select-box[style*="grid"] { grid-template-columns: 1fr !important; }

  .modal { padding: 20px; }
  .login-page {
    flex-direction: column;
    min-height: 100vh;
    background: var(--white);
  }
  .login-left {
    display: none;
  }
  .login-right {
    flex-basis: auto;
    width: 100%;
    min-height: 100vh;
    padding: 28px 20px 40px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .login-card {
    max-width: 420px;
    width: 100%;
  }
  .login-mark {
    margin-bottom: 20px;
    height: 60px;
  }
  .login-card h2 {
    font-size: clamp(30px, 8vw, 38px);
  }
  .login-tagline {
    margin-bottom: 20px;
  }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .np-layout { grid-template-columns: 1fr; }
  .np-side { position: static; }
}

/* ---- Phones ---- */
@media (max-width: 600px) {
  .content { padding: 14px 12px; }
  .card { padding: 16px 14px; margin-bottom: 16px; }

  .page-header { margin-bottom: 18px; }
  .page-header h1 { font-size: var(--fs-xl); }
  .page-header .project-detail-name, .project-detail-name { font-size: var(--fs-xl); margin-bottom: 14px; }
  .project-detail-crumb { flex-wrap: wrap; font-size: var(--fs-sm); }

  /* Project info bar → stacked */
  .project-info-bar { flex-direction: column; row-gap: 14px; padding: 14px 16px; }
  .project-info-item { padding-right: 0; }

  /* Steps overview */
  .steps-head-progress { min-width: 100%; }
  .step-rows { margin-top: 16px; }
  .step-row { gap: 10px; }
  .step-row-left { width: 26px; }
  .step-node { width: 26px; height: 26px; }
  .step-card { padding: 13px 14px; gap: 11px; margin-bottom: 12px; }
  .step-icon-box { width: 34px; height: 34px; }
  .step-card-body { min-width: 0; flex-basis: calc(100% - 45px); }
  .step-card-title { font-size: var(--fs-md); }
  .step-card-actions { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 8px; }

  /* Step detail nav/footer */
  .step-detail-nav { flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
  .step-detail-crumb { width: 100%; }
  .step-detail-footer { flex-direction: column; align-items: stretch; }

  /* Projects list card */

  /* Org chart */
  .org-chart { gap: 28px; }
  .org-node { padding: 9px 14px; font-size: var(--fs-sm); }
  .org-child { padding: 8px 12px; font-size: var(--fs-xs); }
  .org-children { gap: 10px; }

  /* Tables */
  .tbl th { padding: 9px 10px; font-size: var(--fs-2xs); }
  .tbl td { padding: 9px 10px; font-size: var(--fs-xs); }

  /* File rows: status chip on its own line, actions share the next row evenly */
  .handover-actions { gap: 8px; }
  .handover-actions .chip-uploaded,
  .handover-actions .chip-pending { flex-basis: 100%; }
  .handover-actions .btn-sm,
  .handover-actions .file-input-label { flex: 1; justify-content: center; }

  .timeline-item { padding: 10px 12px; }
  .flash-list li { padding: 10px 13px; font-size: var(--fs-sm); }
  .notif-item { padding: 11px 12px; gap: 10px; }
  .activity-item { flex-direction: column; gap: 3px; }
  .activity-when { flex-basis: auto; }
  .notif-text { font-size: var(--fs-sm); }

  .btn { padding: 9px 15px; }
  .btn-sm { padding: 7px 12px; }
  .modal { padding: 18px 16px; max-width: 94vw; }
  .modal-title { font-size: var(--fs-md); }
}

/* ---- Small phones ---- */
@media (max-width: 400px) {
  .content { padding: 12px 10px; }
  .topbar-right span { display: none; }
}

@media (max-width: 480px) {
  .login-brand {
    letter-spacing: 0.14em;
    font-size: var(--fs-2xs);
  }
  .login-pitch h1 {
    font-size: var(--fs-2xl);
  }
  .login-card h2 {
    font-size: var(--fs-2xl);
  }
  .login-form input { font-size: var(--fs-sm); }
  .login-btn { font-size: var(--fs-md); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Change Time Log (latest entry on the page, full history in a pop-up) ---- */
.change-log-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.change-log-modal { width: 640px; }
.change-log-count { font-size: var(--fs-sm); color: var(--muted); margin: -8px 0 14px; }
.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.timeline-item {
  display: flex; border-left: 3px solid var(--green-bright);
  background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 14px;
}
.timeline-body { flex: 1; }

/* ---- Handover Comments & Corrections (a log under the completed handover) ---- */
.comment-form { margin-bottom: 18px; }
.comment-form .save-row { margin-top: 10px; }
.comment-list-head {
  font-family: var(--font-disp); font-size: var(--fs-2xs); font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; padding-top: 16px; margin-bottom: 10px;
  border-top: 1px solid var(--border);
}
.comment-text { font-size: var(--fs-sm); color: var(--text); margin-top: 4px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-more { margin-top: 10px; }
.comment-empty { font-size: var(--fs-sm); color: var(--muted); padding-top: 14px; border-top: 1px solid var(--border); }

/* ---- Small shared pieces (formerly written inline on the pages) ---- */
.form-row .field-label, .field-label { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.form-row .field-label-gap { margin-bottom: 8px; }
.req { color: var(--danger); }
.hint { color: var(--muted); font-weight: 400; }
.lead-text { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.readonly-box {
  background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: var(--fs-md); color: var(--text); min-height: 70px; white-space: pre-wrap;
}
.inline-actions { display: flex; gap: 10px; align-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-actions.spaced { margin-top: 18px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.timeline-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.timeline-who { font-weight: 700; font-size: var(--fs-sm); color: var(--text); }
.timeline-when { font-size: var(--fs-xs); color: var(--muted); }
.timeline-what { font-size: var(--fs-sm); color: var(--text); margin-top: 2px; }
.timeline-why { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; white-space: pre-wrap; }

/* ---- Projects list: progress ring beside the status ---- */
.progress-ring { flex-shrink: 0; }
.progress-ring .ring-track { fill: none; stroke: var(--neutral-bg); stroke-width: 4; }
.progress-ring .ring-fill { fill: none; stroke: var(--accent-strong); stroke-width: 4; stroke-linecap: round; }
.progress-ring.completed .ring-fill { stroke: var(--green-bright); }
.progress-ring text { font-family: var(--font-disp); font-size: 10px; font-weight: 700; fill: var(--text); }

/* ============================================================
   ALL SCREEN SIZES — additions from the device audit
   ============================================================ */
.tbl-index { color: var(--muted); }

/* ---- Very wide monitors: keep line lengths readable instead of stretching edge to edge ---- */
.content { width: 100%; max-width: 1520px; margin-inline: auto; }

/* ---- Short screens (phone held sideways): the menu scrolls rather than hiding Sign out ---- */
.sidebar { height: 100dvh; overflow-y: auto; }
.sidebar-nav { flex: 1 0 auto; }
.modal { max-height: min(88vh, 88dvh); }

/* ---- Touch screens: everything tappable is at least 40px tall ---- */
@media (max-width: 820px), (pointer: coarse) {
  .btn, .btn-sm, .file-input-label, .step-back, .filter-chip, .subtab, .step-open-btn { min-height: 40px; }
  .btn, .btn-sm, .file-input-label { align-items: center; }
  .sidebar-nav a { min-height: 44px; }
  .nav-toggle, .notif-btn, .modal-close, .flash-close, .pending-file-remove {
    min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
  }
  .pending-file-remove { width: 40px; height: 40px; }
  .multi-select-box label { min-height: 44px; }
  .form-row input, .form-row select, .search-box input { min-height: 44px; }
  .sidebar-bottom a { display: inline-flex; align-items: center; min-height: 40px; }
  /* Login: the show-password eye keeps its place but gets a full-size tap area. */
  .password-toggle { width: 40px; height: 40px; right: 4px; align-items: center; justify-content: center; }
}
/* iPhones zoom the page when a field's text is under 16px; this keeps the page still. */
@media (pointer: coarse) {
  .form-row input, .form-row select, .form-row textarea, .search-box input, .login-form input { font-size: 16px; }
}

/* ---- Phones: the users table becomes one card per person, nothing hidden off-screen ---- */
@media (max-width: 720px) {
  .tbl-wrap-cards { border: none; border-radius: 0; overflow: visible; }
  .tbl-cards, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: 100%; }
  .tbl-cards thead, .tbl-cards .tbl-index { display: none; }
  .tbl-cards tr {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px 14px 12px; margin-bottom: 10px; background: var(--white);
  }
  .tbl-cards tr:hover td { background: transparent; }
  .tbl-cards td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); text-align: right;
  }
  .tbl-cards td::before {
    content: attr(data-label); flex-shrink: 0; text-align: left;
    font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
  }
  .tbl-cards td.tbl-actions { border-bottom: none; padding-bottom: 0; }
  .tbl-cards td.tbl-actions::before { content: none; }
  .tbl-cards td.tbl-actions .inline-actions, .tbl-cards td.tbl-actions form { display: flex; flex: 1; gap: 8px; }
  .tbl-cards td.tbl-actions .btn { flex: 1; justify-content: center; }
}

/* ---- Phone held sideways: less height spent on chrome ---- */
@media (max-height: 480px) and (orientation: landscape) {
  .sidebar-logo { padding-block: 10px; }
  .sidebar-bottom { padding-block: 10px; }
  .flash-list { position: static; }
  .modal { padding: 16px 18px; }
}
