/* CLC Projects stylesheet. CLC palette locked 4-28-2026: navy #1F3864, coastal #1FA3DC, gray #595959, fill #F2F2F2. */
:root {
  --navy: #1F3864;
  --navy-dark: #162949;
  --coastal: #1FA3DC;
  --coastal-light: #E6F5FC;
  --gray: #595959;
  --gray-light: #8A8A8A;
  --fill: #F2F2F2;
  --line: #DDDDDD;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --green: #2E8B57;
  --green-bg: #E6F4EC;
  --red: #C0392B;
  --red-bg: #FBE9E7;
  --amber: #B7791F;
  --amber-bg: #FDF3E1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,32,64,.06), 0 4px 14px rgba(16,32,64,.06);
  --border: 1px solid #E6E9EF;
  --nav-h: 62px;
  --top-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
a { color: var(--coastal); }
h1, h2, h3, h4 { margin: 0 0 8px; color: var(--navy); font-weight: 700; }
h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 8px; }
.muted { color: var(--gray); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(31,163,220,.35), transparent 60%), linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 60%, #0F1C33 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 32px 26px; width: 100%; max-width: 380px; border-top: 5px solid var(--coastal);
  box-shadow: 0 10px 40px rgba(0,0,0,.35); text-align: center;
}
.login-logo { max-width: 240px; width: 100%; margin: 0 auto 10px; display: block; }
.login-card h1 { font-size: 24px; margin-bottom: 2px; }
.login-sub { color: var(--gray); margin-bottom: 18px; font-size: 13px; }
.login-card form { text-align: left; }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.btn-link { background: none; border: none; color: var(--coastal); font-size: 13px; margin-top: 10px; cursor: pointer; }

/* ---------- Layout ---------- */
.app { min-height: 100%; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 50;
  background: linear-gradient(90deg, var(--navy-dark), var(--navy) 60%, #27497F); color: #fff; display: flex; align-items: center; padding: 0 12px;
  gap: 10px; padding-top: env(safe-area-inset-top, 0px); box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--coastal), #7FD3F2); }
.topbar-emblem { width: 30px; height: 30px; border-radius: 8px; background: #fff; padding: 2px; flex: 0 0 auto; }
.topbar-title { flex: 1; font-weight: 700; font-size: 17px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-back { background: none; border: none; color: #fff; font-size: 30px; line-height: 1; padding: 0 8px 4px 0; cursor: pointer; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-user {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--coastal);
  background: var(--navy-dark); color: #fff; font-weight: 700; font-size: 13px; cursor: pointer;
}
.offline-pill, .sync-pill { font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 600; }
.offline-pill { background: var(--amber); color: #fff; }
.sync-pill { background: var(--coastal); color: #fff; }

main#pages { padding: calc(var(--top-h) + env(safe-area-inset-top, 0px) + 12px) 12px calc(var(--nav-h) + var(--safe-b) + 16px); max-width: 1100px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; animation: fade .15s ease; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + var(--safe-b)); z-index: 50;
  background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b);
}
.nav-item {
  flex: 1; border: none; background: none; color: var(--gray); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 6px 2px;
}
.nav-item .nav-ico { height: 22px; display: flex; align-items: center; }
.nav-item .nav-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .nav-ico svg circle { fill: currentColor; stroke: none; }
.nav-item.active { color: var(--navy); }
.nav-item.active .nav-ico { color: var(--coastal); }
.nav-item.active::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--coastal); }
.nav-item { position: relative; }

/* ---------- Cards, lists ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: var(--border); padding: 16px; margin-bottom: 12px; }
.card.tight { padding: 10px 12px; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-title h3 { margin: 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: var(--border); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; position: relative; overflow: hidden; transition: transform .08s ease, box-shadow .08s ease;
}
.list-item:hover { box-shadow: 0 2px 4px rgba(16,32,64,.08), 0 8px 20px rgba(16,32,64,.08); }
.list-item.stripe-active::before, .list-item.stripe-hold::before, .list-item.stripe-complete::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.list-item.stripe-active::before { background: var(--coastal); } .list-item.stripe-hold::before { background: var(--amber); } .list-item.stripe-complete::before { background: var(--gray-light); }
.avatar { width: 38px; height: 38px; border-radius: 10px; background: var(--coastal-light); color: var(--navy); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.list-item:active { background: var(--fill); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { font-size: 12px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-right { text-align: right; font-size: 13px; }
.chev { color: var(--gray-light); font-size: 20px; }
.empty { text-align: center; color: var(--gray); padding: 30px 10px; font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 6px; color: var(--line); }
.empty { background: #fff; border-radius: var(--radius); border: 1px dashed var(--line); }
.greeting { margin: 2px 0 12px; }
.greeting h2 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.greeting .muted { font-size: 13px; }
h3 { font-size: 16px; letter-spacing: -.1px; }
.card-title h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray); font-weight: 700; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: var(--border); padding: 14px 14px 12px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -18px; top: -18px; width: 60px; height: 60px; border-radius: 50%; background: var(--coastal-light); opacity: .7; }
.stat .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--gray); font-weight: 600; }
.stat .stat-value { font-size: 22px; font-weight: 800; color: var(--navy); margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; position: relative; }
.stat .stat-sub { font-size: 12px; color: var(--gray); }
.stat.accent { background: linear-gradient(135deg, var(--navy), #27497F); border: none; }
.stat.accent .stat-label, .stat.accent .stat-sub { color: rgba(255,255,255,.8); } .stat.accent .stat-value { color: #fff; } .stat.accent::after { background: rgba(255,255,255,.12); }

/* ---------- Badges, pills ---------- */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--fill); color: var(--gray); white-space: nowrap; }
.badge.navy { background: var(--navy); color: #fff; }
.badge.coastal { background: var(--coastal-light); color: #0F6E95; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--gray); }
.pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tab { border: none; background: none; padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--gray); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--navy); border-bottom-color: var(--coastal); }
.tabs { background: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 0 6px; border: var(--border); border-bottom: 2px solid var(--line); }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--fill); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: linear-gradient(135deg, var(--navy), #2C5188); color: #fff; box-shadow: 0 2px 6px rgba(31,56,100,.3); }
.btn-coastal { background: var(--coastal); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--line); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 8px; font-size: 18px; line-height: 1; background: none; }
.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 40;
  width: 54px; height: 54px; border-radius: 50%; background: var(--coastal); color: #fff; border: none;
  font-size: 30px; line-height: 1; box-shadow: 0 4px 14px rgba(31,163,220,.45); cursor: pointer;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--gray); margin-bottom: 10px; }
label > input, label > select, label > textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font-size: 15px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); font-family: inherit;
}
label > textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--coastal); outline-offset: 0; border-color: var(--coastal); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.form-grid .full { grid-column: 1 / -1; }
.btn.full { display: block; width: 100%; }
.pill-row.scroll { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.pill-row.scroll::-webkit-scrollbar { display: none; }
.pill-row.scroll .pill { flex: 0 0 auto; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: 18px; height: 18px; margin: 0; }
.money-input { text-align: right; font-variant-numeric: tabular-nums; }
.help { font-size: 12px; color: var(--gray-light); margin-top: -6px; margin-bottom: 10px; }

/* ---------- Modal / sheet ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,20,40,.55); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@media (min-width: 700px) { .modal-backdrop { align-items: center; } }
.modal {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); animation: up .18s ease;
}
@media (min-width: 700px) { .modal { border-radius: 16px; max-height: 88vh; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--gray); cursor: pointer; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: up .2s; max-width: 90vw; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- Tables (SOV) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table.grid { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 13px; }
table.grid th, table.grid td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th { background: var(--navy); color: #fff; font-weight: 600; text-align: left; position: sticky; top: 0; font-size: 12px; }
table.grid th.num, table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.section td { background: var(--fill); font-weight: 700; color: var(--navy); }
table.grid tr.total td { background: var(--coastal-light); font-weight: 700; }
table.grid tr.co td { background: #FFF9EC; }
table.grid tr.nis td { color: var(--gray-light); text-decoration: line-through; }
table.grid td.desc { white-space: normal; min-width: 220px; }
table.grid td.edit { cursor: pointer; }
table.grid td.edit:hover { background: var(--coastal-light); }
table.grid input.cell { width: 96px; padding: 4px 6px; font-size: 13px; text-align: right; border: 1px solid var(--coastal); border-radius: 4px; }
.bar { height: 6px; background: var(--fill); border-radius: 3px; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; background: var(--coastal); }
.bar.over > i { background: var(--red); }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 8px; }
.photo-grid img, .photo-grid .photo-add { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--fill); cursor: pointer; }
.photo-grid .doc-chip { font-size: 11px; color: var(--navy); border-color: var(--coastal); background: var(--coastal-light); }
.photo-add { display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--gray-light); border: 2px dashed var(--line); }
.photo-view { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 300; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.photo-view img { max-width: 100%; max-height: 80vh; }
.photo-view .cap { color: #fff; padding: 10px; font-size: 14px; }

/* ---------- Schedule ---------- */
.week-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.day-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 2px; text-align: center; font-size: 12px; cursor: pointer; }
.day-btn .d { font-size: 16px; font-weight: 700; color: var(--navy); }
.day-btn.today { border-color: var(--coastal); }
.day-btn.sel { background: var(--navy); color: #fff; }
.day-btn.sel .d { color: #fff; }
.day-btn .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--coastal); margin: 2px auto 0; }
.task { border-left: 4px solid var(--coastal); }
.task.done { border-left-color: var(--green); opacity: .75; }
.task.blocked { border-left-color: var(--red); }
.task.inprogress { border-left-color: var(--amber); }
.task.sub { border-left-style: dashed; }

/* ---------- Daily log feed ---------- */
.log-card .log-date { font-weight: 700; color: var(--navy); }
.log-card .log-meta { font-size: 12px; color: var(--gray); }
.log-card .log-body { margin-top: 6px; white-space: pre-wrap; }
.crew-chip { display: inline-block; background: var(--fill); border-radius: 12px; padding: 2px 8px; font-size: 12px; margin: 2px 2px 0 0; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.search { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 14px; }
.kv .k { color: var(--gray); }
.banner { background: var(--amber-bg); color: var(--amber); padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.banner.info { background: var(--coastal-light); color: #0F6E95; }
.menu-list .list-item { padding: 14px; }
@media (min-width: 900px) {
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media print {
  .topbar, .bottom-nav, .fab { display: none; }
  main#pages { padding: 0; }
}

/* ---------- Gantt ---------- */
.gantt { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 12px; }
.g-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); min-height: 38px; cursor: pointer; }
.g-row:hover .g-track { background: #FBFCFE; }
.g-head { position: sticky; top: 0; z-index: 3; background: #fff; min-height: 42px; cursor: default; border-bottom: 2px solid var(--line); }
.g-label { flex: 0 0 var(--labelw); width: var(--labelw); position: sticky; left: 0; z-index: 2; background: #fff; border-right: 1px solid var(--line); padding: 5px 8px; overflow: hidden; }
.g-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--navy); }
.g-track { position: relative; flex: 0 0 auto; }
.g-month { position: absolute; top: 0; height: 18px; line-height: 18px; font-size: 11px; font-weight: 700; color: var(--navy); border-left: 1px solid var(--line); padding-left: 4px; white-space: nowrap; overflow: hidden; }
.g-day { position: absolute; top: 20px; height: 20px; line-height: 20px; text-align: center; font-size: 10px; color: var(--gray); border-left: 1px solid #F0F0F0; }
.g-day.we { background: var(--fill); }
.g-day.today { background: var(--coastal); color: #fff; border-radius: 4px; font-weight: 700; }
.g-we { position: absolute; top: 0; bottom: 0; background: #F7F7F7; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--coastal); z-index: 1; }
.g-bar { position: absolute; top: 8px; height: 22px; line-height: 22px; border-radius: 5px; background: var(--navy); color: #fff; font-size: 11px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 2; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.g-bar.inprogress { background: var(--amber); }
.g-bar.blocked { background: var(--red); }
.g-bar.done { background: var(--green); opacity: .7; }
.g-bar.late { outline: 2px solid var(--red); outline-offset: 1px; }
.g-bar.sub { border: 2px dashed rgba(255,255,255,.85); line-height: 18px; }
.g-group { background: var(--coastal-light); min-height: 30px; }
.g-group .g-label { background: var(--coastal-light); }
.g-span { position: absolute; top: 12px; height: 6px; border-radius: 3px; background: var(--coastal); opacity: .6; }
.g-key { display: inline-block; width: 12px; height: 10px; border-radius: 3px; background: var(--navy); vertical-align: middle; margin: 0 3px 0 8px; }
.g-key.inprogress { background: var(--amber); } .g-key.blocked { background: var(--red); } .g-key.done { background: var(--green); opacity: .7; } .g-key.sub { background: var(--navy); border: 2px dashed #fff; box-shadow: 0 0 0 1px var(--navy); }
@media (max-width: 600px) { .gantt { --labelw: 130px !important; } }
.g-bar { touch-action: none; cursor: grab; }
.g-bar.dragging { opacity: .85; cursor: grabbing; box-shadow: 0 4px 12px rgba(0,0,0,.3); z-index: 5; }
.g-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 10px; cursor: ew-resize; border-left: 1px solid rgba(255,255,255,.5); }
.g-link { position: absolute; top: 18px; height: 2px; background: var(--gray-light); z-index: 1; }
.g-link::after { content: ''; position: absolute; right: -2px; top: -3px; border: 4px solid transparent; border-left: 5px solid var(--gray-light); }
