/* ============================================================
   Dev Portal — Stylesheet  (Enhanced)
   dev.tmlhub.com
============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1419;
  --surface:  #1a2030;
  --surface2: #222b3a;
  --border:   #2a3a52;
  --border2:  #3a4f6a;
  --text:     #c9d6e8;
  --text-dim: #7a95b0;
  --text-muted: #4a6080;
  --text-hi:  #eaf2ff;
  --accent:   #00e5bb;
  --blue:     #5b9cf6;
  --purple:   #b088fc;
  --orange:   #ff9944;
  --yellow:   #f9d44a;
  --red:      #ff5f5f;
  --green:    #00e5bb;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;
  --radius:   10px;
  --shadow:   0 2px 16px rgba(0,0,0,0.3);
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── FLASH ─────────────────────────────────────────────── */
.flash {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  padding: 11px 22px; border-radius: 8px;
  font-family: var(--font-mono); font-weight: 800; font-size: 13px;
  color: #060a0f;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slideIn .25s ease;
}
.flash--ok  { background: var(--accent); }
.flash--err { background: var(--red); }
@keyframes slideIn { from { transform: translateY(-16px); opacity:0; } to { transform:none; opacity:1; } }

/* ── SHELL ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 1200;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--accent); border-radius: 8px; padding: 8px 10px;
  cursor: pointer; font-size: 16px;
}

/* ── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  width: 240px; min-width: 240px;
  background: #131c28;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: transform 0.25s ease;
  z-index: 1100;
}

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 1050;
  background: rgba(0,0,0,.5);
}
.sidebar-backdrop.open { display: block; }

.sidebar__logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-hex  { font-size: 24px; color: var(--accent); text-shadow: 0 0 16px var(--accent); }
.logo-name { font-family: var(--font-mono); font-size: 13px; font-weight: 900; color: var(--text-hi); }
.logo-sub  { font-size: 9px; color: var(--text-muted); margin-top: 1px; letter-spacing: 1px; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; }

.nav-btn {
  display: block; padding: 10px 18px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-dim);
  border-left: 3px solid transparent;
  transition: all .12s; letter-spacing: 0.2px;
}
.nav-btn:hover       { color: var(--text); background: rgba(255,255,255,.04); }
.nav-btn--active     { color: var(--accent); background: rgba(0,229,187,.07); border-left-color: var(--accent); }
.nav-btn--action     { color: var(--blue); }
.nav-btn--action:hover { color: var(--blue); background: rgba(91,156,246,.07); }

.nav-rule { height: 1px; background: var(--border); margin: 8px 18px; }

.sidebar__projects { flex: 1; overflow-y: auto; }
.sidebar__label    { font-size: 9px; color: var(--text-muted); padding: 12px 18px 5px; letter-spacing: 2.5px; font-family: var(--font-mono); }

.side-proj {
  display: block; padding: 8px 18px; width: 100%;
  border-left: 3px solid transparent;
  transition: all .1s;
}
.side-proj:hover      { background: rgba(255,255,255,.025); }
.side-proj--active    { background: rgba(255,255,255,.03); border-left-color: var(--blue); }
.side-proj__row       { display: flex; justify-content: space-between; }
.side-proj__name      { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.side-proj__meta      { font-size: 9px; color: var(--text-muted); margin-top: 3px; font-family: var(--font-mono); }

.mini-track { height: 3px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.mini-fill  { height: 100%; border-radius: 3px; }

.sidebar__signout {
  display: block; margin: 10px 18px 0; padding: 8px; text-align: center;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 10px; color: var(--text-muted); font-family: var(--font-mono);
  transition: all .12s; letter-spacing: 1px;
}
.sidebar__signout:hover { color: var(--red); border-color: var(--red); background: rgba(255,95,95,.05); }

/* ── MAIN ──────────────────────────────────────────────── */
.main { flex: 1; padding: 32px 36px; overflow-y: auto; min-width: 0; }

/* ── PAGE HEADER ───────────────────────────────────────── */
.page-head { margin-bottom: 26px; }
.page-head h1 { font-family: var(--font-mono); font-size: 22px; font-weight: 900; color: var(--text-hi); letter-spacing: -.5px; }
.page-head .sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); letter-spacing: 0.5px; }

/* ── STAT ROW ──────────────────────────────────────────── */
.stat-row { display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 100px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
  transition: border-color .15s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-card__val   { font-family: var(--font-mono); font-size: 34px; font-weight: 900; line-height: 1; }
.stat-card__label { font-size: 10px; color: var(--text-muted); margin-top: 4px; letter-spacing: 0.5px; }

/* ── FILTER CHIPS ──────────────────────────────────────── */
.chip-row { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px; border-radius: 20px; font-size: 10px;
  font-weight: 800; cursor: pointer; font-family: var(--font-mono);
  letter-spacing: .5px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  text-decoration: none; transition: all .12s;
}
.chip:hover, .chip--active { background: #1a3460; color: var(--blue); border-color: var(--blue); }

/* ── PROJECT GRID ──────────────────────────────────────── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 16px; }

.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  transition: all .15s; cursor: pointer;
  display: block; color: inherit;
}
.project-card:hover { border-color: var(--border2); box-shadow: var(--shadow); transform: translateY(-1px); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.card-key  { font-family: var(--font-mono); font-size: 10px; font-weight: 900; letter-spacing: 1.5px; }
.card-name { font-size: 15px; font-weight: 700; color: var(--text-hi); margin-top: 3px; }
.card-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* ── PIPELINE — no scrollbar, wraps fully ──────────────── */
.pipeline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  overflow: visible;
  margin-top: 10px;
  margin-bottom: 2px;
}
.pipe-step {
  padding: 4px 10px; font-size: 10px; font-weight: 800;
  border-radius: 5px; letter-spacing: .5px; white-space: nowrap;
  font-family: var(--font-mono);
}
.pipe-connector { display: none; } /* hide connectors, gap handles spacing */

/* ── PROGRESS BAR ──────────────────────────────────────── */
.progress-track { height: 5px; background: var(--border); border-radius: 5px; overflow: hidden; margin-top: 8px; }
.progress-fill  { height: 100%; border-radius: 5px; transition: width .4s; }
.progress-row   { display: flex; justify-content: space-between; margin: 6px 0 10px; }
.progress-pct   { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

/* ── TAGS / BADGES ─────────────────────────────────────── */
.tag-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.tag {
  font-size: 10px; padding: 3px 10px; border-radius: 20px;
  font-weight: 700; background: var(--border); font-family: var(--font-mono);
}
.health-pill {
  font-size: 10px; font-weight: 800; padding: 3px 10px;
  border-radius: 20px; font-family: var(--font-mono); letter-spacing: .5px; white-space: nowrap;
}
.deadline-text { font-size: 11px; font-family: var(--font-mono); }

/* ── BLOCKER BANNER ────────────────────────────────────── */
.blocker-banner {
  background: rgba(255,95,95,.07); border: 1px solid rgba(255,95,95,.2);
  color: var(--red); border-radius: 7px; padding: 8px 12px;
  font-size: 11px; margin-top: 6px; line-height: 1.5;
}

/* ── LATEST BOX ────────────────────────────────────────── */
.latest-box { background: var(--bg); border-radius: 7px; padding: 10px 13px; margin-top: 10px; border: 1px solid var(--border); }
.latest-box__label { font-size: 9px; color: var(--text-muted); margin-bottom: 3px; letter-spacing: 1.5px; font-family: var(--font-mono); }
.latest-box__text  { font-size: 11px; color: var(--text-dim); line-height: 1.5; }

/* ── DETAIL PAGE ───────────────────────────────────────── */
.btn-row { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px;
  font-size: 12px; font-family: var(--font-mono); font-weight: 700;
  border: 1px solid var(--border); color: var(--text-dim); cursor: pointer;
  background: none; transition: all .12s; text-decoration: none;
}
.btn:hover          { border-color: var(--border2); color: var(--text); }
.btn--primary       { background: var(--accent); color: #060a0f; border-color: var(--accent); }
.btn--primary:hover { opacity: .9; color: #060a0f; }
.btn--blue          { color: var(--blue); border-color: rgba(91,156,246,.4); }
.btn--blue:hover    { background: rgba(91,156,246,.08); }
.btn--green         { color: var(--accent); border-color: rgba(0,229,187,.4); }
.btn--green:hover   { background: rgba(0,229,187,.06); }
.btn--red           { color: var(--red); border-color: rgba(255,95,95,.4); }
.btn--red:hover     { background: rgba(255,95,95,.06); }

.detail-head {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 28px; margin-bottom: 22px;
}
.detail-head__title { font-size: 22px; font-weight: 900; color: var(--text-hi); margin-top: 2px; font-family: var(--font-mono); }
.detail-head__desc  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.detail-head__top   { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.detail-head__badges { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.info-grid { display: flex; gap: 24px; margin-top: 14px; flex-wrap: wrap; }
.info-cell__label { font-size: 9px; color: var(--text-muted); letter-spacing: 1.5px; margin-bottom: 3px; font-family: var(--font-mono); }
.info-cell__val   { font-size: 12px; color: var(--text-dim); }

/* ── SECTION ───────────────────────────────────────────── */
.section-title {
  font-size: 10px; color: var(--text-muted); letter-spacing: 2px;
  text-transform: uppercase; margin-bottom: 14px; font-family: var(--font-mono);
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.empty-state { color: var(--text-muted); font-size: 13px; padding: 24px 0; font-family: var(--font-mono); }

/* ── FEED CARD ─────────────────────────────────────────── */
.feed-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px;
  border-left: 3px solid var(--border);
  transition: border-color .15s;
  position: relative;
}
.feed-card:hover { border-color: var(--border2); }
.feed-card__top  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.feed-card__proj { font-family: var(--font-mono); font-weight: 900; font-size: 12px; }
.feed-card__proj a { text-decoration: none; }
.feed-card__proj a:hover { text-decoration: underline; }
.feed-card__meta { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.feed-card__actions { display: flex; gap: 6px; align-items: center; margin-top: 2px; }

/* Date/time display */
.feed-card__datetime {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
}
.feed-card__date { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.feed-card__time { font-size: 9px; color: var(--text-muted); font-family: var(--font-mono); opacity: 0.65; }
.feed-card__ago  { font-size: 10px; color: var(--blue); font-family: var(--font-mono); font-weight: 700; }

/* edited mark */
.feed-edited-mark {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; color: var(--yellow); font-family: var(--font-mono);
  background: rgba(249,212,74,.10); border: 1px solid rgba(249,212,74,.2);
  padding: 2px 8px; border-radius: 4px; letter-spacing: .3px;
  margin-top: 3px;
}

.type-tag {
  font-size: 9px; color: var(--text-muted); background: var(--border);
  padding: 2px 8px; border-radius: 4px; letter-spacing: .5px; font-family: var(--font-mono);
}
.general-tag {
  font-size: 9px; color: var(--accent); background: rgba(0,229,187,.1);
  padding: 2px 8px; border-radius: 4px; letter-spacing: .5px; font-family: var(--font-mono);
}
.feed-card__body { font-size: 13px; color: var(--text); line-height: 1.6; margin-bottom: 8px; }
.feed-card__done { color: var(--accent); font-weight: 800; }
.feed-card__next { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.feed-card__blocker { font-size: 12px; color: var(--red); }

/* feed image */
.feed-img { margin-top: 10px; }
.feed-img img {
  max-width: 100%; max-height: 360px; object-fit: contain;
  border-radius: 8px; border: 1px solid var(--border); cursor: pointer;
}

/* changelog lines */
.cl-line { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 7px; }
.cl-badge {
  font-size: 9px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; min-width: 60px; text-align: center;
  flex-shrink: 0; font-family: var(--font-mono);
}
.cl-text { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* ── EDIT FEED MODAL ───────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.72); align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 28px 30px; width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-title {
  font-family: var(--font-mono); font-size: 15px; font-weight: 900;
  color: var(--text-hi); margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--red); }

/* ── DOCUMENTS ─────────────────────────────────────────── */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; gap: 10px;
}
.doc-item__icon { font-size: 18px; flex-shrink: 0; }
.doc-item__info { flex: 1; min-width: 0; }
.doc-item__label { font-size: 13px; color: var(--text-hi); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item__meta  { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.doc-item__actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── FORMS ─────────────────────────────────────────────── */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 32px; max-width: 720px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fg { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.fg label {
  font-size: 9px; color: var(--text-muted); letter-spacing: 1.5px;
  text-transform: uppercase; font-family: var(--font-mono);
}
.fg input, .fg select, .fg textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 9px 12px; font-size: 13px;
  font-family: var(--font-sans); outline: none;
  transition: border-color .12s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--blue); }
.fg textarea { resize: vertical; }
.fg select option { background: var(--surface); }

/* type toggle */
.type-toggle-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.type-toggle {
  padding: 8px 16px; border-radius: 7px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: var(--font-mono); border: 1px solid var(--border);
  background: var(--bg); color: var(--text-muted); transition: all .12s;
}
.type-toggle--active { background: #1a3460; color: var(--blue); border-color: var(--blue); }

/* changelog editor */
.cl-editor-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.cl-editor-row select { width: 110px; flex-shrink: 0; font-family: var(--font-mono); font-size: 12px; }
.cl-editor-row input  { flex: 1; }
.cl-editor-row .remove-btn {
  background: none; border: 1px solid var(--border); color: var(--red);
  padding: 5px 8px; border-radius: 5px; cursor: pointer; font-size: 11px; flex-shrink: 0;
}
.add-line-btn {
  background: none; border: 1px solid var(--border); color: var(--blue);
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-size: 11px; font-family: var(--font-mono); margin-bottom: 14px;
}
.add-line-btn:hover { background: rgba(91,156,246,.07); }

/* image preview */
.img-preview { margin-top: 8px; display: none; }
.img-preview img { max-width: 200px; max-height: 150px; border-radius: 6px; border: 1px solid var(--border); }

/* form actions */
.form-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* ── IMAGE LIGHTBOX ────────────────────────────────────── */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 9990;
  background: rgba(0,0,0,.90); align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img  { max-width: 90vw; max-height: 90vh; border-radius: 10px; }
.lightbox__close {
  position: absolute; top: 20px; right: 24px; font-size: 28px;
  color: #fff; cursor: pointer; line-height: 1; background: none; border: none;
}

/* ── LOGIN PAGE ────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #080d14; font-family: var(--font-mono);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 44px 48px; display: flex; flex-direction: column;
  align-items: center; gap: 14px; min-width: 320px; max-width: 90vw;
  box-shadow: 0 40px 100px rgba(0,0,0,.7);
}
.login-hex   { font-size: 44px; color: var(--accent); text-shadow: 0 0 24px var(--accent); }
.login-title { font-size: 18px; font-weight: 900; color: var(--text-hi); }
.login-sub   { font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }
.login-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-hi); padding: 12px 14px; font-size: 16px;
  font-family: var(--font-mono); outline: none; letter-spacing: 3px; text-align: center;
}
.login-input:focus { border-color: var(--blue); }
.login-err { color: var(--red); font-size: 12px; }
.login-btn {
  width: 100%; background: var(--accent); color: #060a0f; border: none;
  padding: 13px; border-radius: 8px; cursor: pointer;
  font-weight: 900; font-size: 14px; font-family: var(--font-mono);
  transition: opacity .12s;
}
.login-btn:hover { opacity: .9; }
.login-hint { font-size: 10px; color: var(--border2); }

/* ── UTILITIES ─────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
  .main { padding: 24px 20px; }
  .project-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (max-width: 680px) {
  .sidebar-toggle { display: block; }

  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    width: 260px; z-index: 1100;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.7); }

  .main { padding: 60px 16px 24px; }

  .form-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .stat-row { flex-wrap: wrap; }
  .stat-card { min-width: calc(50% - 6px); }

  .detail-head__top { flex-direction: column; }
  .detail-head__badges { align-items: flex-start; }

  .form-card { padding: 20px 18px; }
  .feed-card { padding: 14px 16px; }

  .btn-row { gap: 6px; }
  .btn { padding: 7px 12px; font-size: 11px; }

  .feed-card__top { flex-direction: column; gap: 10px; }
  .feed-card__meta { align-items: flex-start; }
  .feed-card__datetime { align-items: flex-start; }
}

@media (max-width: 400px) {
  .stat-card { min-width: 100%; }
  .login-card { padding: 30px 22px; }
}
