/* RenoViz — lightweight mobile-first styles (no external dependencies). */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1c2530;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #b4531f;      /* Arizona clay */
  --brand-ink: #8a3f18;
  --accent: #0f766e;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .35rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

/* Layout */
.topbar {
  background: var(--brand); color: #fff; padding: .7rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar a { color: #fff; }
.brand { font-weight: 700; letter-spacing: .3px; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
/* Project-scoped nav (immersive within a project) */
.projnav { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; }
.projnav-inner { max-width: 1000px; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.projnav-title { font-weight: 700; color: var(--ink); }
.projnav-title:hover { text-decoration: none; color: var(--brand-ink); }
.projnav-links { display: flex; gap: .25rem; flex-wrap: wrap; }
.projnav-links a { color: var(--muted); padding: .3rem .6rem; border-radius: 7px; font-size: .9rem; font-weight: 600; }
.projnav-links a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }

.container { max-width: 1000px; margin: 0 auto; padding: 1rem; }
.wrap { max-width: 1000px; margin: 0 auto; }

/* Cards & grids */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Tables → responsive (scroll on small screens) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }

/* Badges */
.badge {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.badge.gray   { background: #f1f5f9; color: #475569; }
.badge.blue   { background: #e0f2fe; color: #075985; }
.badge.amber  { background: #fef3c7; color: #92400e; }
.badge.green  { background: #dcfce7; color: #166534; }
.badge.red    { background: #fee2e2; color: #991b1b; }
.badge.teal   { background: #ccfbf1; color: #115e59; }
.badge.purple { background: #ede9fe; color: #5b21b6; }

/* Buttons & forms */
.btn {
  display: inline-block; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; font-size: .9rem;
}
.btn:hover { text-decoration: none; border-color: #cbd5e1; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
form .field { margin-bottom: .8rem; display: flex; flex-direction: column; gap: .25rem; }
label { font-weight: 600; font-size: .85rem; }
input, select, textarea {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; width: 100%; max-width: 100%;
}
textarea { min-height: 90px; }
.help { color: var(--muted); font-size: .78rem; }
.errorlist { color: var(--danger); margin: .2rem 0; padding-left: 1rem; font-size: .82rem; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem .8rem; border-radius: 8px; margin-bottom: .5rem; border: 1px solid var(--line); }
.messages .success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.messages .error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.messages .info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.messages .warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* Gantt */
.gantt { overflow-x: auto; }
.gantt table { min-width: 640px; }
.gantt .bar { height: 16px; border-radius: 4px; background: var(--accent); opacity: .85; }
.gantt .bar.actual { background: var(--brand); }
.gantt .track { position: relative; background: #f1f5f9; border-radius: 4px; height: 16px; }
.gantt .cell { padding: .3rem .4rem; }

/* Day-grid Gantt (weekend shading + dependency arrows) */
.gantt2-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0; }
.gantt2 { position: relative; font-size: .8rem; }
.gantt2 .g-wknd { position: absolute; background: rgba(220, 38, 38, .09); border-left: 1px solid rgba(220,38,38,.18); border-right: 1px solid rgba(220,38,38,.18); z-index: 0; }
.gantt2 .g-head { position: absolute; top: 0; left: 0; right: 0; border-bottom: 1px solid var(--line); }
.gantt2 .g-month { position: absolute; top: 0; text-align: center; font-size: .68rem; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .4px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f8fafc; line-height: 18px; overflow: hidden; white-space: nowrap; }
.gantt2 .g-day { position: absolute; text-align: center; color: var(--muted); padding-top: 3px; }
.gantt2 .g-day .g-dow { font-size: .62rem; text-transform: uppercase; letter-spacing: .3px; }
.gantt2 .g-day .g-dom { font-size: .74rem; font-weight: 600; color: var(--ink); }
.gantt2 .g-day-wknd .g-dow, .gantt2 .g-day-wknd .g-dom { color: var(--danger); }
/* Pinned task-label column: stays put while the timeline scrolls sideways */
.gantt2 .g-labelcol { position: sticky; left: 0; top: 0; z-index: 5; background: var(--surface); border-right: 1px solid var(--line); }
.gantt2 .g-label { position: absolute; left: 0; width: 100%; background: var(--surface); padding-right: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt2 .g-bar { position: absolute; display: block; height: 16px; border-radius: 4px; background: var(--accent); opacity: .9; z-index: 2; cursor: pointer; }
.gantt2 .g-bar:hover { opacity: 1; outline: 2px solid rgba(15,23,42,.25); }
.gantt2 .g-stop { position: absolute; width: 15px; height: 16px; z-index: 4; font-size: 12px; line-height: 16px; text-align: center; cursor: pointer; text-decoration: none; filter: drop-shadow(0 0 1px #fff); }
.gantt2 .g-stop:hover { transform: scale(1.25); }
.gantt2 .g-check { position: absolute; width: 16px; height: 16px; z-index: 4; font-size: 13px; line-height: 16px; text-align: center; cursor: pointer; text-decoration: none; filter: drop-shadow(0 0 1px #fff); }
.gantt2 .g-check:hover { transform: scale(1.2); }
.gantt2 .g-today { position: absolute; background: rgba(37, 99, 235, .13); border-left: 1px solid rgba(37, 99, 235, .35); border-right: 1px solid rgba(37, 99, 235, .35); z-index: 0; }
.gk-today { display: inline-block; width: 12px; height: 10px; background: rgba(37, 99, 235, .18); border: 1px solid rgba(37, 99, 235, .4); border-radius: 2px; vertical-align: middle; }
.gantt2 .g-arrows { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 2; overflow: visible; }
.gantt2 .g-arrow { fill: none; stroke: #94a3b8; stroke-width: 1.5; }
.gantt2 .g-arrows marker path { fill: #94a3b8; }
/* legend swatches */
.gk-plan, .gk-actual, .gk-wknd, .gk-arrow { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: middle; }
.gk-plan { background: var(--accent); }
.gk-actual { background: var(--brand); }
.gk-wknd { background: rgba(220,38,38,.18); border: 1px solid rgba(220,38,38,.35); }
.gk-arrow { background: #94a3b8; height: 2px; border-radius: 0; }
/* trade legend + row color dots */
.g-legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin: .1rem 0 .6rem; }
.g-legend-item { font-size: .76rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.g-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.gantt2 .g-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .4rem; vertical-align: baseline; }

/* Gantt drag-to-move / resize-to-extend overlays (managers) */
.gantt2 .g-bar-hit { position: absolute; height: 16px; z-index: 3; pointer-events: none; cursor: grab; border-radius: 4px; }
.gantt2.drag-ready .g-bar-hit { pointer-events: auto; }
.gantt2 .g-bar-hit:hover { outline: 2px solid rgba(37,99,235,.35); }
.gantt2 .g-bar-hit.dragging { cursor: grabbing; outline: 2px solid rgba(37,99,235,.75); background: rgba(37,99,235,.14); }
.gantt2 .g-bar-resize { position: absolute; right: -2px; top: 0; width: 9px; height: 100%; cursor: ew-resize; }
.gantt2 .g-bar-resize::after { content: ""; position: absolute; right: 3px; top: 2px; bottom: 2px; width: 2px; border-radius: 2px; background: rgba(255,255,255,.9); opacity: 0; }
.gantt2 .g-bar-hit:hover .g-bar-resize::after { opacity: .95; }
.g-drag-tip { position: absolute; z-index: 10; background: #0f172a; color: #fff; font-size: .7rem; padding: .15rem .4rem; border-radius: 4px; pointer-events: none; white-space: nowrap; }

/* Inline status select (work item header) — looks like a pill, edits in place */
.status-select { font: inherit; font-size: .78rem; padding: .16rem 1.5rem .16rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; }

input[type="checkbox"], input[type="radio"] { width: auto; }
/* Long checkbox multi-selects (e.g. blocked tasks) scroll instead of sprawl */
#id_blocked_work_items, #id_trades { max-height: 190px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; background: #fff; }
#id_blocked_work_items label, #id_trades label { font-weight: 400; }
#id_blocked_work_items > div, #id_trades > div { display: flex; align-items: center; gap: .45rem; padding: .1rem 0; }

.crumb { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.stat { font-size: 1.6rem; font-weight: 700; }
.list-reset { list-style: none; padding: 0; margin: 0; }
.divider { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }

/* Messaging */
.msg { display: flex; margin: .5rem 0; }
.msg-mine { justify-content: flex-end; }
.msg-theirs { justify-content: flex-start; }
.msg-bubble { max-width: 72%; padding: .5rem .7rem; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.msg-mine .msg-bubble { background: #eef4ff; border-color: #d5e2ff; }
.msg-body { white-space: pre-wrap; }
.msg-meta { font-size: .72rem; color: var(--muted); margin-top: .25rem; }
