:root{
  --bg:#050a22;
  --panel:#0b1538;
  --panel-2:#0e1a46;
  --border:rgba(150,170,255,.17);
  --text:#e8edff;
  --muted:#96a4d9;
  --primary:#8b5cf6;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
}
*{box-sizing:border-box}
body{font-family:Inter,system-ui,sans-serif;margin:0;background:radial-gradient(1200px 700px at 10% -10%,#251e62 0%, transparent 55%),var(--bg);color:var(--text);padding:18px}

/* Mission Control Nav */
.topnav{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;padding:10px 12px;border-radius:16px;border:1px solid var(--border);background:linear-gradient(180deg,#0b1540,#091233);box-shadow:0 14px 38px rgba(0,0,0,.28)}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;letter-spacing:.02em}
.brand .dot{width:10px;height:10px;border-radius:999px;background:#7de6ff;box-shadow:0 0 0 4px rgba(125,230,255,.14)}
.brand-text{color:#e8edff}
.tabs{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.tab{display:inline-flex;align-items:center;gap:8px;text-decoration:none;color:var(--text);padding:8px 10px;border-radius:12px;border:1px solid rgba(150,170,255,.12);background:rgba(16,26,64,.35)}
.tab.active{border-color:rgba(125,230,255,.55);background:rgba(125,230,255,.10)}

/* Views */
.view{display:none}
.view.active{display:block}
.panel{border:1px solid var(--border);border-radius:14px;background:linear-gradient(180deg,#091437,#08112d);padding:14px; min-height: 400px;}
.panel-title{font-weight:800;margin-bottom:6px}
.panel-desc{color:var(--muted);font-size:13px;margin-bottom:10px}
/* Mission Control Styles */
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.mt-4 { margin-top: 1rem; }
.full { width: 100%; }

/* Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.cal-day {
  background: var(--panel);
  min-height: 100px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-day.header {
  background: var(--panel-2);
  min-height: auto;
  padding: 8px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
}
.cal-day.empty { background: rgba(5, 10, 34, 0.5); }
.cal-date { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.cal-item {
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.2);
  color: #d8b4fe;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-item.task { border-left: 2px solid #7de6ff; background: rgba(16, 26, 64, 0.8); color: #e8edff; }
.cal-item.event { border-left: 2px solid #f472b6; background: rgba(80, 20, 60, 0.5); color: #fbcfe8; }

/* Docs */
.docs-layout { display: grid; grid-template-columns: 200px 1fr; gap: 14px; height: 70vh; }
.docs-sidebar { border-right: 1px solid var(--border); padding-right: 14px; overflow-y: auto; }
.doc-item { padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; }
.doc-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.doc-item.active { background: rgba(139, 92, 246, 0.2); color: #fff; font-weight: 600; }
.docs-main { display: flex; flex-direction: column; gap: 10px; }
.doc-title-input { font-size: 20px; font-weight: 700; background: transparent; border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 5px 0; }
.doc-content-input { flex: 1; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-family: monospace; line-height: 1.5; resize: none; color: #d1d5db; }
.empty-state { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }

/* Table */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px; color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid rgba(150, 170, 255, 0.05); }
.status-badge { padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.status-completed { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.status-queued { background: rgba(234, 179, 8, 0.2); color: #fde047; }
.status-failed { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* Content Engine */
.content-layout { display: flex; flex-direction: column; gap: 14px; }
.scout-status-text { color: var(--muted); font-size: 13px; }
.content-main-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
.content-main-column,
.content-side-column { display: flex; flex-direction: column; gap: 14px; }
.content-subpanel { min-height: 0; }
.feed-list, .briefs-list, .watchlist { display: flex; flex-direction: column; gap: 10px; }
.feed-item {
  background: rgba(16, 26, 64, 0.52);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.feed-topic { font-weight: 700; margin-bottom: 4px; }
.feed-insight { color: #cdd7ff; font-size: 13px; line-height: 1.45; margin-bottom: 8px; }
.feed-source-link { color: #7de6ff; font-size: 12px; text-decoration: none; }
.feed-source-link:hover { text-decoration: underline; }
.watch-item {
  background: rgba(16, 26, 64, 0.5);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.watch-name { font-weight: 700; margin-bottom: 4px; }
.watch-seen { color: var(--muted); font-size: 12px; }
.watch-topic { font-size: 12px; color: #cdd7ff; margin-top: 4px; }
.draft-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(7, 16, 44, 0.9);
  padding: 12px;
}
.draft-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.draft-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(150,170,255,.15);
  border-radius: 10px;
  padding: 10px;
}
.draft-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.draft-header h4 { margin: 0; color: var(--primary); font-size: 13px; }
.draft-copy-btn { padding: 8px 10px; font-size: 11px; white-space: nowrap; }
.draft-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.45;
  color: #dbe4ff;
  max-height: 220px;
  overflow: auto;
}
.draft-source { margin-top: 10px; font-size: 12px; color: var(--muted); word-break: break-all; }
.draft-source a { color: #7de6ff; text-decoration: none; }
.draft-source a:hover { text-decoration: underline; }

/* Reports */
.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.activity-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.act-row { display: flex; justify-content: space-between; padding: 8px; background: rgba(255,255,255,0.03); border-radius: 8px; font-size: 13px; }
.act-time { color: var(--muted); font-size: 11px; }
.bg-glow{position:fixed;inset:0;pointer-events:none;background:radial-gradient(700px 400px at 80% -20%,rgba(139,92,246,.35),transparent 60%);z-index:-1}
.hero{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;background:linear-gradient(180deg,#0b1540,#091233);border:1px solid var(--border);border-radius:18px;padding:24px;box-shadow:0 18px 45px rgba(0,0,0,.35)}
.eyebrow{margin:0;font-size:11px;letter-spacing:.18em;color:#afbbef}
h1{margin:8px 0 6px;font-size:44px;line-height:1.05}
.subtitle{margin:0;color:var(--muted)}
.hero-right{display:flex;flex-direction:column;gap:14px;align-items:flex-end}
.stats{display:flex;gap:10px}
.stat-card{min-width:88px;background:rgba(16,26,64,.75);border:1px solid var(--border);border-radius:12px;padding:10px 12px;text-align:center}
.num{display:block;font-size:30px;font-weight:800;color:#7de6ff;line-height:1}
.label{font-size:12px;color:#9fb0ea}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:14px 0}
.btn,select,input,textarea{background:#0f1f4d;color:var(--text);border:1px solid var(--border);border-radius:10px;padding:10px 12px}
.btn{cursor:pointer; transition: all 0.2s;}
.btn:hover{background: #1a2f6d; border-color: rgba(150,170,255,.3);}
.btn.primary{background:linear-gradient(180deg,#9b6bff,#7c4df0);border-color:#8c5dff;font-weight:700;box-shadow:0 8px 28px rgba(139,92,246,.35)}
.btn.primary:hover{background:linear-gradient(180deg,#a77cff,#895df5);}
.btn.danger{background:rgba(190,35,85,.25);border-color:rgba(255,111,156,.45)}
.btn.danger:hover{background:rgba(190,35,85,.4);}
.board{display:grid;grid-template-columns:repeat(6,minmax(250px,1fr));gap:14px;overflow:auto;padding-bottom:10px}
.col{background:linear-gradient(180deg,#091437,#08112d);border:1px solid var(--border);border-radius:14px;min-height:68vh;display:flex;flex-direction:column}
.col-header{display:flex;justify-content:space-between;align-items:center;padding:12px 12px 10px;border-bottom:1px solid rgba(144,164,255,.18)}
.col h2{margin:0;font-size:18px}
.col-desc{font-size:12px;color:#9db0ef;margin-top:2px}
.count{font-size:12px;font-weight:700;color:#d7defe;background:#111f4f;padding:4px 8px;border-radius:999px;border:1px solid var(--border)}
.col-body{padding:10px;display:flex;flex-direction:column;gap:10px;flex:1;min-height:120px}
.task{background:linear-gradient(180deg,#122254,#101d49);border:1px solid rgba(150,172,255,.28);border-radius:12px;padding:10px;box-shadow:0 10px 25px rgba(0,0,0,.24)}
.task h4{margin:0 0 6px;font-size:14px;line-height:1.35}
.task p{margin:0 0 8px;color:#a8b6ec;font-size:12px;line-height:1.35}
.meta{font-size:11px;color:#9bb0f1}
.actions{display:flex;gap:6px;margin-top:10px}
.pill{display:inline-block;font-size:10px;font-weight:700;padding:4px 7px;border-radius:999px;margin-left:6px}
.pill.high{background:rgba(239,68,68,.2);color:#ff9c9c;border:1px solid rgba(255,123,123,.4)}
.pill.medium{background:rgba(234,179,8,.18);color:#ffe08a;border:1px solid rgba(255,221,117,.35)}
.pill.low{background:rgba(34,197,94,.2);color:#8ef8ba;border:1px solid rgba(134,239,172,.3)}
dialog{border:none;border-radius:14px;max-width:520px;width:90%;background:#091233;color:var(--text);padding:18px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);}
dialog::backdrop{background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);}
form{display:flex;flex-direction:column;gap:10px}
label{display:flex;flex-direction:column;gap:4px;font-size:13px}
textarea{min-height:90px}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.end{justify-content:flex-end}
.dragover{outline:2px dashed #6ee7ff;outline-offset:-6px;background:rgba(110,231,255,.05)}
@media (max-width:980px){h1{font-size:32px}.hero{flex-direction:column}.hero-right{align-items:flex-start}}
@media (max-width:980px){.content-main-grid{grid-template-columns:1fr}.draft-columns{grid-template-columns:1fr}}

/* Auth Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 34, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(12px);
}
.auth-card {
  background: #0b1538;
  padding: 2.5rem;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  border: 1px solid rgba(150, 170, 255, 0.17);
  color: #e8edff;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.auth-card h2 { margin-bottom: 0.5rem; color: #8b5cf6; font-size: 24px; }
.auth-card p { margin-bottom: 1.5rem; color: #96a4d9; font-size: 14px; }
.auth-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 1rem;
  background: #050a22;
  border: 1px solid rgba(150, 170, 255, 0.17);
  border-radius: 10px;
  color: white;
  outline: none;
}
.auth-card input:focus { border-color: #8b5cf6; }
.error-text { color: #ff6b6b; font-size: 12px; margin-top: 1rem; }

/* Calendar View */
.calendar-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 600px;
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.calendar-day-header {
    background: var(--panel-2);
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}
.calendar-day {
    background: var(--panel);
    min-height: 100px;
    padding: 8px;
    position: relative;
    transition: background 0.2s;
}
.calendar-day:hover {
    background: var(--panel-2);
}
.calendar-day.other-month {
    opacity: 0.4;
}
.day-number {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--muted);
}
.calendar-day.today .day-number {
    color: var(--primary);
}
.cal-event {
    font-size: 11px;
    padding: 2px 4px;
    margin-bottom: 2px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.2);
    color: #d1c4e9;
    border-left: 2px solid var(--primary);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-event.task {
    background: rgba(34, 197, 94, 0.15);
    border-left-color: var(--success);
    color: #a7f3d0;
}
.cal-event.task.overdue {
    background: rgba(239, 68, 68, 0.15);
    border-left-color: var(--danger);
    color: #fecaca;
}

/* Docs View */
.docs-layout {
    display: flex;
    gap: 20px;
    height: 70vh;
}
.docs-sidebar {
    width: 250px;
    border-right: 1px solid var(--border);
    padding-right: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.doc-item {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    transition: all 0.2s;
}
.doc-item:hover, .doc-item.active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text);
}
.docs-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
}
.docs-content h1 { font-size: 28px; margin-top: 0; }
.docs-content pre { background: rgba(0,0,0,0.3); padding: 10px; border-radius: 8px; overflow-x: auto; }
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    text-align: center;
}

/* Backups View */
.backups-table {
    width: 100%;
    border-collapse: collapse;
}
.backups-table th, .backups-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.backups-table th {
    font-weight: 600;
    color: var(--muted);
    font-size: 13px;
}
.backups-table tr:last-child td { border-bottom: none; }
.status-badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.status-badge.success { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.status-badge.pending { background: rgba(234, 179, 8, 0.2); color: #fde047; }
.status-badge.failed { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* Reports View */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.report-card {
    background: rgba(16, 26, 64, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.report-card h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 500; }
.report-card .value { font-size: 32px; font-weight: 700; color: var(--text); }
.report-card.danger .value { color: #f87171; }
.report-card.warning .value { color: #facc15; }
.activity-feed {
    background: rgba(16, 26, 64, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.activity-content div { font-size: 14px; }
.activity-date { font-size: 12px; color: var(--muted); margin-top: 4px; }
