@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg: #0a0a0a; --card: #141414; --border: #262626; --border-hover: #363636;
  --text: #e5e5e5; --muted: #737373; --dim: #525252;
  --red: #dc2626; --green: #22c55e; --blue: #3b82f6; --yellow: #eab308;
  --red-bg: rgba(220,38,38,.1); --green-bg: rgba(34,197,94,.1);
  --blue-bg: rgba(59,130,246,.1); --yellow-bg: rgba(234,179,8,.1);
  --radius: 8px; --radius-sm: 4px;
}

html { font-size: 14px; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, -apple-system, sans-serif; line-height: 1.5; min-height: 100vh; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--card); border-right: 1px solid var(--border); padding: 16px 0; position: fixed; top: 0; left: 0; bottom: 0; display: flex; flex-direction: column; z-index: 100; }
.main { margin-left: 220px; flex: 1; padding: 24px; max-width: 1400px; }

/* Sidebar */
.sidebar-logo { padding: 0 16px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.sidebar-logo .shield { width: 28px; height: 28px; background: var(--red); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.sidebar-logo span { font-weight: 700; font-size: 13px; letter-spacing: -.02em; }
.sidebar-logo .dot { color: var(--red); }

.nav-section { padding: 8px 0; }
.nav-section-title { padding: 4px 16px; font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 6px 16px; font-size: 13px; color: var(--muted); text-decoration: none; transition: all .15s; cursor: pointer; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--text); background: rgba(255,255,255,.06); }
.nav-item .icon { width: 16px; text-align: center; font-size: 14px; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px; }

.sidebar-footer { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--dim); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: border-color .15s; }
.card:hover { border-color: var(--border-hover); }

/* Stat Cards */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.stat-card .value { font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono', monospace; letter-spacing: -.02em; }
.stat-card .sub { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.stat-card .sub .err { color: var(--red); font-weight: 600; }
.stat-card .sub .ok { color: var(--green); }

/* Two Column */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }

/* Section Headers */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text); }
.section-subtitle { font-size: 11px; color: var(--dim); }

/* Activity Feed */
.feed-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.feed-item:last-child { border-bottom: none; }
.feed-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--dim); white-space: nowrap; min-width: 48px; padding-top: 1px; }
.feed-body { flex: 1; min-width: 0; }
.feed-action { font-size: 12px; color: var(--text); line-height: 1.4; }
.feed-type { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.badge-success { background: var(--green-bg); color: var(--green); }
.badge-error { background: var(--red-bg); color: var(--red); }
.badge-warning { background: var(--yellow-bg); color: var(--yellow); }
.badge-info { background: var(--blue-bg); color: var(--blue); }
.badge-running { background: var(--blue-bg); color: var(--blue); }
.badge-neutral { background: rgba(255,255,255,.06); color: var(--muted); }

/* Status Dot */
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.4); }
.dot-red { background: var(--red); box-shadow: 0 0 6px rgba(220,38,38,.4); }
.dot-yellow { background: var(--yellow); box-shadow: 0 0 6px rgba(234,179,8,.4); }
.dot-gray { background: var(--dim); }

/* Cron Grid */
.cron-grid { display: grid; grid-template-columns: 1fr; gap: 2px; }
.cron-cell { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; font-size: 12px; }
.cron-cell:hover { background: rgba(255,255,255,.04); }
.cron-cell .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cron-cell .time { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--dim); }
.cron-detail { display: none; padding: 8px 8px 8px 24px; font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; background: rgba(0,0,0,.3); border-radius: var(--radius-sm); margin: 2px 0; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow-y: auto; }
.cron-detail.open { display: block; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kanban-col { background: rgba(255,255,255,.02); border-radius: var(--radius); padding: 10px; }
.kanban-col-title { font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.kanban-col-title .count { background: rgba(255,255,255,.08); padding: 0 6px; border-radius: 8px; font-size: 10px; }
.kanban-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 6px; font-size: 12px; transition: border-color .15s; }
.kanban-card:hover { border-color: var(--border-hover); }

/* Quick Actions */
.actions-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 12px; color: var(--muted); cursor: pointer; transition: all .15s; font-family: inherit; }
.action-btn:hover { border-color: var(--border-hover); color: var(--text); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; padding: 8px 10px; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { color: var(--text); }
th .sort-arrow { font-size: 10px; margin-left: 3px; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: rgba(255,255,255,.02); }
tr.error-row td { background: var(--red-bg); }

/* Search & Filter */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search-input { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12px; color: var(--text); font-family: inherit; min-width: 200px; outline: none; transition: border-color .15s; }
.search-input:focus { border-color: var(--blue); }
.search-input::placeholder { color: var(--dim); }
.filter-btn { background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 10px; font-size: 11px; color: var(--muted); cursor: pointer; font-family: inherit; transition: all .15s; }
.filter-btn:hover, .filter-btn.active { border-color: var(--blue); color: var(--text); background: var(--blue-bg); }

/* Brief / Content Cards */
.brief-list { display: flex; flex-direction: column; gap: 6px; }
.brief-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s; }
.brief-item:hover { border-color: var(--border-hover); }
.brief-item .date { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--dim); white-space: nowrap; }
.brief-item .title { font-size: 13px; font-weight: 500; flex: 1; }
.brief-item .preview { font-size: 11px; color: var(--muted); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brief-content { display: none; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px; font-size: 13px; line-height: 1.7; }
.brief-content.open { display: block; }
.brief-content h1, .brief-content h2, .brief-content h3 { margin: 16px 0 8px; color: var(--text); }
.brief-content h1 { font-size: 20px; } .brief-content h2 { font-size: 16px; } .brief-content h3 { font-size: 14px; }
.brief-content p { margin-bottom: 8px; color: var(--text); }
.brief-content ul, .brief-content ol { margin: 8px 0; padding-left: 20px; }
.brief-content li { margin-bottom: 4px; }
.brief-content code { background: rgba(255,255,255,.08); padding: 1px 4px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.brief-content pre { background: rgba(0,0,0,.4); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; margin: 8px 0; }
.brief-content pre code { background: none; padding: 0; }

/* Memory */
.memory-content { font-size: 13px; line-height: 1.7; }
.memory-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* Venture Cards */
.venture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.venture-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.venture-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.venture-card .status-line { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.venture-card .content { font-size: 13px; line-height: 1.6; }

/* Timeline */
.timeline { position: relative; height: 60px; background: rgba(255,255,255,.02); border-radius: var(--radius-sm); margin-top: 16px; overflow: hidden; }
.timeline-hour { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); }
.timeline-hour-label { position: absolute; top: 2px; font-size: 9px; color: var(--dim); font-family: 'JetBrains Mono', monospace; transform: translateX(2px); }
.timeline-block { position: absolute; height: 16px; border-radius: 3px; top: 28px; min-width: 4px; cursor: pointer; }
.timeline-block:hover { filter: brightness(1.3); }

/* Page header */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.page-header p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* Mobile menu toggle */
.mobile-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 200; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; color: var(--text); font-size: 18px; line-height: 1; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99; }

/* Responsive */
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .kanban { grid-template-columns: 1fr; }
  .venture-grid { grid-template-columns: 1fr; }
  .brief-item .preview { display: none; }
}
@media (max-width: 768px) {
  .mobile-toggle { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; padding: 16px; padding-top: 56px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .value { font-size: 22px; }
  .two-col { grid-template-columns: 1fr; gap: 12px; }
  .kanban { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-input { min-width: unset; width: 100%; }
  .actions-grid { flex-direction: column; }
  .action-btn { width: 100%; text-align: center; }
  .page-header h1 { font-size: 18px; }
  .feed-item { gap: 6px; }
  .feed-time { min-width: 40px; font-size: 10px; }
  .cron-cell { padding: 8px 6px; }
  .cron-cell .name { font-size: 11px; }
  table { font-size: 11px; }
  th, td { padding: 6px 6px; }
  .venture-grid { grid-template-columns: 1fr; }
  .brief-item { padding: 8px 10px; }
  .brief-item .preview { display: none; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 20px; }
  .main { padding: 12px; padding-top: 52px; }
}

/* Empty states */
.empty { text-align: center; padding: 32px; color: var(--dim); font-size: 13px; }

/* Loading shimmer */
.shimmer { background: linear-gradient(90deg, var(--card) 25%, rgba(255,255,255,.04) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
