/* TGS Media dark aesthetic for the SES dashboard */
:root {
  --bg:          #0e0f12;
  --bg-card:    #15171c;
  --bg-elev:    #1c1f26;
  --border:     #262932;
  --text:       #e8eaf0;
  --text-dim:   #8e94a3;
  --text-mute:  #5a6072;
  --accent:     #e74c3c;
  --accent-2:   #ff7a4d;
  --good:       #38d39f;
  --warn:       #f5b041;
  --bad:        #e74c3c;
  --info:       #6aa9f4;
  --vm:         #f5b041;
  --na:         #5a6072;
  --hc:         #38d39f;
  --er:         #e74c3c;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; letter-spacing: 0.5px;
}
.brand-title { font-size: 18px; font-weight: 600; letter-spacing: 0.2px; }
.brand-sub   { font-size: 12px; color: var(--text-dim); }

.app-actions { display: flex; gap: 10px; align-items: center; }
.btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: #24272f; border-color: #353945; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.primary:hover { background: #d0402f; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.select {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.card-h {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.card-h .pill {
  background: var(--bg-elev);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
  font-size: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.metric .value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.metric .unit { font-size: 14px; color: var(--text-dim); margin-left: 4px; }
.metric .sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.metric .accent-bar {
  height: 3px; border-radius: 3px; margin-bottom: 14px;
  background: var(--accent);
}
.metric.hc .accent-bar { background: var(--hc); }
.metric.vm .accent-bar { background: var(--vm); }
.metric.rm .accent-bar { background: var(--accent-2); }

.row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.row.one { grid-template-columns: 1fr; }

.cycle-bar {
  height: 10px;
  background: var(--bg-elev);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--border);
}
.cycle-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--good), var(--accent-2));
}
.cycle-bar.warn > div { background: linear-gradient(90deg, var(--warn), var(--bad)); }

.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-dim); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.table-wrap { overflow-x: auto; }
table.leads {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.leads th, table.leads td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.leads th {
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.6px;
  background: #13151a;
}
table.leads tr:hover { background: rgba(255,255,255,0.02); cursor: pointer; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tag.hc  { background: rgba(56,211,159,0.13); color: var(--good); }
.tag.vm  { background: rgba(245,176,65,0.13); color: var(--vm); }
.tag.na  { background: rgba(90,96,114,0.20); color: var(--text-dim); }
.tag.er  { background: rgba(231,76,60,0.13); color: var(--bad); }
.tag.gpt { background: rgba(106,169,244,0.13); color: var(--info); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
input.search {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}
input.search::placeholder { color: var(--text-mute); }

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding-top: 5vh;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(720px, 92vw);
  max-height: 85vh;
  overflow: auto;
  padding: 22px;
}
.modal h3 { margin-top: 0; }
.modal .close { float: right; cursor: pointer; color: var(--text-dim); }
.modal pre {
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}

#login-screen {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 30px;
  width: min(420px, 92vw);
}
.login-card h2 { margin-top: 0; }
.login-card input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 12px;
  font-size: 14px;
  border-radius: 7px;
  margin-bottom: 12px;
}
.login-card .hint { color: var(--text-dim); font-size: 12px; margin-bottom: 14px; }
.login-card .status { color: var(--good); font-size: 13px; margin-top: 10px; min-height: 18px; }

.footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-mute);
  display: flex;
  justify-content: space-between;
}

@media (max-width: 880px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .row { grid-template-columns: 1fr; }
}
