/* Kantai Dashboard — Main Styles */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --border: #30363d;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --nav-height: 56px;
  --sidebar-width: 280px;
}

/* Master Control — Winter Ops theme */
body.theme-winter-ops {
  --bg-primary: #0c1110;
  --bg-secondary: #121a17;
  --bg-tertiary: #16201c;
  --bg-card: #16201c;
  --text-primary: #e6f4ee;
  --text-secondary: #b6c8bf;
  --text-muted: #6b7b74;
  --border: #1f2b26;
  --accent: #2bd97c;
  --accent-hover: #48e08f;
  --green: #2bd97c;
  --yellow: #d4b26d;
  --red: #ff6b6b;
  --purple: #b39ddb;
}

body.theme-winter-ops #topnav {
  background: linear-gradient(180deg, #0f1714 0%, #121a17 100%);
  border-bottom: 1px solid #1f2b26;
}

body.theme-winter-ops .nav-tab.active {
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(43, 217, 124, 0.25), 0 6px 18px rgba(43, 217, 124, 0.08);
}

body.theme-winter-ops .card {
  border-color: #20332c;
  box-shadow: 0 10px 30px rgba(6, 12, 10, 0.35);
}

body.theme-winter-ops .agent-card.active,
body.theme-winter-ops .agent-card:hover {
  border-color: rgba(43, 217, 124, 0.5);
  box-shadow: 0 0 0 1px rgba(43, 217, 124, 0.25), 0 8px 24px rgba(43, 217, 124, 0.12);
}

body.theme-winter-ops .connection-status { color: var(--accent); }
body.theme-winter-ops .brand-text { color: #9fb4aa; letter-spacing: 3px; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top Navigation */
#topnav {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-icon {
  font-size: 20px;
}

.brand-text {
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.nav-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

.nav-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-tab.active {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.tab-icon { font-size: 16px; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.connection-status {
  font-size: 10px;
  color: var(--green);
}

.connection-status.disconnected { color: var(--red); }
.connection-status.connecting { color: var(--yellow); }

/* Panels */
#panels {
  flex: 1;
  overflow: hidden;
}

.panel {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.panel.active {
  display: block;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.card-content { font-size: 14px; }

/* Stats */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.stat-row:last-child { border-bottom: none; }

.stat-label { color: var(--text-secondary); }

.stat-value {
  font-weight: 600;
  color: var(--text-primary);
}

.stat-total {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 2px solid var(--border);
}

/* Badges */
.badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.badge-yellow { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.badge-red { background: rgba(248, 81, 73, 0.15); color: var(--red); }

/* Agent Status */
.agent-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.agent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.agent-card .agent-icon { font-size: 28px; }

.agent-card .agent-info { flex: 1; }

.agent-card .agent-name {
  font-weight: 600;
  font-size: 15px;
}

.agent-card .agent-role {
  font-size: 12px;
  color: var(--text-secondary);
}

.agent-card .agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.agent-card .agent-dot.offline { background: var(--red); }

/* Activity Feed */
.activity-feed {
  max-height: 200px;
  overflow-y: auto;
}

.activity-entry {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-tertiary);
  font-size: 13px;
}

.activity-time {
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 80px;
}

.activity-text { color: var(--text-secondary); }

/* Governance */
.gov-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.gov-table th, .gov-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.gov-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.level-1 { background: rgba(63, 185, 80, 0.2); color: var(--green); }
.level-2 { background: rgba(88, 166, 255, 0.2); color: var(--accent); }
.level-3 { background: rgba(210, 153, 34, 0.2); color: var(--yellow); }
.level-4 { background: rgba(248, 81, 73, 0.2); color: var(--red); }
.level-5 { background: rgba(188, 140, 255, 0.2); color: var(--purple); }

.audit-log { max-height: 200px; overflow-y: auto; }
.audit-entry {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bg-tertiary);
  font-size: 13px;
}
.audit-time { color: var(--text-muted); min-width: 120px; }
.audit-text { color: var(--text-secondary); }

/* Responsive */
@media (max-width: 768px) {
  .nav-tabs { gap: 2px; }
  .tab-label { display: none; }
  .nav-brand .brand-text { display: none; }
  .nav-user #user-email { display: none; }
  .sidebar-width { width: 100%; }
}
