/* Sidelio Dev — modern, Segoe UI, light + dark */
:root {
  --font: "Segoe UI", "Segoe UI Variable", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
  --faint: #94A3B8;
  --accent: #2563EB;
  --accent-soft: #EFF6FF;
  --accent-text: #FFFFFF;
  --nav-bg: #0B1422;
  --nav-text: #CBD5E1;
  --nav-active: #FFFFFF;
  --nav-hover: #16233A;
  --ok: #16A34A; --ok-soft: #DCFCE7;
  --warn: #D97706; --warn-soft: #FEF3C7;
  --bad: #DC2626; --bad-soft: #FEE2E2;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1120; --surface: #111A2E; --surface-2: #0F172A; --border: #1F2A44;
    --text: #E2E8F0; --muted: #94A3B8; --faint: #64748B;
    --accent: #3B82F6; --accent-soft: #172554;
    --nav-bg: #070D18; --nav-hover: #121C30;
    --ok-soft: #052E16; --warn-soft: #3A2A05; --bad-soft: #3B0A0A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: .9em; background: var(--surface-2); border: 1px solid var(--border); padding: 0 .3em; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* ---- layout ---- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--nav-bg) 232px, var(--bg) 232px); }
.nav { background: var(--nav-bg); color: var(--nav-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #2563EB, #22C55E); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: .95rem; }
.brand small { display: block; color: var(--faint); font-weight: 500; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.nav a { color: var(--nav-text); padding: 8px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.nav a:hover { background: var(--nav-hover); color: var(--nav-active); text-decoration: none; }
.nav a.on { background: var(--nav-hover); color: var(--nav-active); box-shadow: inset 3px 0 0 var(--accent); }
.nav .sep { flex: 1; }
.nav .me { border-top: 1px solid #1E293B; padding: 12px 10px 0; font-size: .85rem; }
.nav .me b { color: #fff; display: block; font-weight: 600; }
.nav .me a { display: inline; padding: 0; color: var(--faint); font-weight: 400; }
.nav .me a:hover { background: none; color: #fff; text-decoration: underline; }
.nav .me .links-row { display: flex; gap: 10px; margin-top: 4px; }
.nav .me form { display: inline; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--faint); font: inherit; cursor: pointer; }
.linkbtn:hover { color: #fff; text-decoration: underline; }
.main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar p { margin: 0; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .n small { font-size: .95rem; color: var(--muted); font-weight: 500; }

/* ---- buttons & forms ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { display: block; font-weight: 600; font-size: .85rem; margin: 0 0 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 120px; resize: vertical; }
textarea.doc { min-height: 420px; font-family: "Cascadia Code", Consolas, monospace; font-size: .9rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline .field { margin: 0; flex: 1; min-width: 160px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filters input[type=search] { max-width: 280px; }
.filters select { width: auto; }

/* ---- flash ---- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.errors { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 10px 14px 10px 30px; margin: 0 0 16px; }

/* ---- pills & dots ---- */
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.pill.live, .pill.live-pilot { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.building { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.planning { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.paused, .pill.archived { opacity: .75; }
.pill.urgent { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.high { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.up { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---- portfolio ---- */
.company { margin-bottom: 26px; }
.company-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.company-head h2 { margin: 0; }
.company-head .count { color: var(--muted); font-size: .85rem; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; color: var(--text); border-top: 3px solid var(--c, var(--border)); transition: transform .12s ease, box-shadow .12s ease; }
.pcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15, 23, 42, .1); }
.pcard.dim { opacity: .62; }
.pcard .t { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.pcard .name { font-weight: 650; font-size: 1.02rem; }
.pcard .sum { color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .meta { display: flex; gap: 14px; color: var(--muted); font-size: .8rem; margin-top: auto; flex-wrap: wrap; align-items: center; }
.pcard .meta span { display: inline-flex; align-items: center; gap: 5px; }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.attention li:last-child { border-bottom: 0; }
.attention .sig { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.attention .bad .sig { background: var(--bad); }
.attention .warn .sig { background: var(--warn); }

/* ---- project ---- */
.phead { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.crumb { font-size: .85rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 14px 0 22px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .n { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-left: 4px; }
dl.facts { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .85rem; }
dl.facts dd { margin: 0; }
.links { list-style: none; padding: 0; margin: 0; }
.links li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.links li:last-child { border-bottom: 0; }
.links .u { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links .h { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.feed { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.feed li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--faint); font-size: .78rem; }
.note { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: .88rem; font-weight: 500; }
.bars { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 8px 0; }
.bars i { display: block; }
.bars .todo { background: var(--faint); } .bars .doing { background: var(--accent); } .bars .review { background: var(--warn); } .bars .done { background: var(--ok); }

/* ---- board ---- */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; justify-content: space-between; padding: 2px 4px 8px; margin: 0; }
.tcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; }
.tcard.dragging { opacity: .5; }
.tcard a.tt { color: var(--text); font-weight: 600; display: block; margin-bottom: 6px; }
.tcard .tm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.tcard .late { color: var(--bad); font-weight: 600; }
.tcard form.move { margin-top: 8px; }
.tcard form.move select { font-size: .8rem; padding: 3px 6px; }
.js .tcard form.move { display: none; }
details.add summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; }
details.add summary::-webkit-details-marker { display: none; }
details.add[open] summary { margin-bottom: 12px; }

/* ---- tables ---- */
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.list td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list select { width: auto; padding: 4px 8px; }

/* ---- docs ---- */
.prose { max-width: 760px; font-size: 1rem; line-height: 1.65; }
.prose h2 { font-size: 1.3rem; margin-top: 1.4em; } .prose h3 { font-size: 1.1rem; margin-top: 1.2em; } .prose h4 { margin-top: 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.invite-box { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.invite-box .copy { display: flex; gap: 8px; margin-top: 8px; }
.invite-box input { font-family: "Cascadia Code", Consolas, monospace; font-size: .85rem; }

/* ---- auth pages ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, .18), transparent), radial-gradient(900px 500px at 110% 110%, rgba(34, 197, 94, .14), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { color: var(--text); padding: 0 0 20px; }

@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .brand { padding: 0 8px 0 0; }
  .nav .sep, .nav .me { display: none; }
  .nav a { padding: 6px 10px; }
  .main { padding: 18px 16px 48px; }
  .board { grid-template-columns: repeat(4, 80vw); }
  dl.facts { grid-template-columns: 1fr; gap: 2px; }
  dl.facts dd { margin-bottom: 8px; }
}
.late { color: var(--bad); font-weight: 600; }

/* rights table */
table.matrix th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.matrix th:first-child, table.matrix td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 2; }
table.matrix td.cell { text-align: center; padding: 6px; }
table.matrix td.cell select { width: auto; min-width: 74px; padding: 3px 6px; font-size: .85rem; }
