/* Team Epsilon brand: Husky Purple (AWS-side institutional) + teal #00d4aa
   accent. Dark theme is default; light is a toggle. Brand colors are stable
   across themes; surface/ink/border colors swap. */

:root,
:root[data-theme="dark"] {
  --purple:    #6e4ec8;      /* lifted purple for dark surfaces */
  --purple-on: #fff;
  --teal:      #00d4aa;
  --teal-soft: #2a8a7a;

  --bg:        #12121a;
  --bg-alt:    #1a1a25;
  --surface:   #1f1f2c;
  --row-bg:    #1a1a25;
  --row-alt:   #15151f;
  --ink:       #e6e6ee;
  --ink-muted: #999;
  --border:    #2c2c3a;
  --header-bg: linear-gradient(180deg, #2a1f4f 0%, #1a1430 100%);
  --header-fg: #f0eef7;
  --link:      #b8a8e8;
  --link-hov:  #fff;
  --err:       #ff6b7a;
  --ok:        #5dd39e;
  --tile-bg:   #1f1f2c;
  --code-bg:   #2c2c3a;
  --hero-overlay: linear-gradient(180deg,
                  rgba(18,18,26,0.15) 0%,
                  rgba(18,18,26,0.55) 65%,
                  rgba(18,18,26,0.95) 100%);
}

:root[data-theme="light"] {
  --purple:    #4B2E83;
  --purple-on: #fff;
  --teal:      #00d4aa;
  --teal-soft: #0a3a30;

  --bg:        #fafafa;
  --bg-alt:    #f0f0f4;
  --surface:   #fff;
  --row-bg:    #fff;
  --row-alt:   #f4f4f6;
  --ink:       #222;
  --ink-muted: #666;
  --border:    #d8d8dd;
  --header-bg: #4B2E83;
  --header-fg: #fff;
  --link:      #4B2E83;
  --link-hov:  #2c1d50;
  --err:       #b00020;
  --ok:        #2a7a2a;
  --tile-bg:   #fff;
  --code-bg:   #eee;
  --hero-overlay: linear-gradient(180deg,
                  rgba(255,255,255,0.10) 0%,
                  rgba(250,250,250,0.45) 65%,
                  rgba(250,250,250,0.92) 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  border-bottom: 4px solid var(--teal);
  position: relative;
}

header a.brand {
  color: var(--header-fg);
  font-weight: 600;
  text-decoration: none;
  font-size: 16px;
  letter-spacing: 0.2px;
}

header nav {
  display: flex;
  gap: 18px;
  flex: 1;
}
header nav a {
  color: var(--header-fg);
  text-decoration: none;
  font-size: 14px;
  opacity: 0.78;
}
header nav a:hover {
  opacity: 1;
  border-bottom: 2px solid var(--teal);
}

button.theme-toggle {
  background: transparent;
  color: var(--header-fg);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
button.theme-toggle:hover { border-color: var(--teal); }
.theme-icon { display: none; }
:root[data-theme="dark"] .theme-icon-light  { display: inline; }
:root[data-theme="light"] .theme-icon-dark  { display: inline; }

main { padding: 20px 24px; max-width: 1200px; margin: 0 auto; }

h1, h2, h3 {
  color: var(--ink);
  margin-top: 0;
}
h1 {
  font-weight: 600;
  letter-spacing: -0.2px;
  border-left: 4px solid var(--teal);
  padding-left: 12px;
}

a { color: var(--link); }
a:hover { color: var(--link-hov); }

code {
  background: var(--code-bg);
  color: var(--ink);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}

/* ---- Hero ---- */
.hero {
  margin: -20px -24px 24px -24px;
  position: relative;
  height: 320px;
  overflow: hidden;
  background-image: url("/static/images/hero-herschel-saturn.jpg");
  background-size: cover;
  background-position: center 30%;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--hero-overlay);
  pointer-events: none;
}
.hero-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px 32px;
  color: var(--ink);
  z-index: 1;
}
.hero-text h1 {
  font-size: 28px;
  margin: 0 0 6px 0;
  border-left: 4px solid var(--teal);
  padding-left: 12px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
.hero-text p {
  margin: 0;
  font-size: 14px;
  max-width: 640px;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}

/* ---- Section image (sidebar / panel) ---- */
figure.panel-image {
  margin: 0 0 16px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
figure.panel-image img {
  display: block;
  width: 100%;
  height: auto;
}
figure.panel-image figcaption {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
}

/* ---- Tables ---- */
table.ds {
  width: 100%;
  border-collapse: collapse;
  background: var(--row-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
table.ds th {
  background: var(--purple);
  color: var(--purple-on);
  text-align: left;
  padding: 8px 10px;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.3px;
}
table.ds td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.ds tbody tr:nth-child(even) { background: var(--row-alt); }
table.ds tbody tr:hover { background: var(--bg-alt); }
table.ds td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
table.ds td.err {
  color: var(--err);
  font-size: 12px;
}

tr.state-running td:nth-child(3) { color: var(--teal); font-weight: 600; }
tr.state-error   td:nth-child(3) { color: var(--err);  font-weight: 600; }
tr.state-success td:nth-child(3) { color: var(--ok);   font-weight: 600; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: var(--bg-alt);
  color: var(--ink);
  border: 1px solid var(--border);
}
.badge-async    { background: var(--purple); color: var(--purple-on); border-color: var(--purple); }
.badge-sync     { background: var(--teal); color: #0a3a30; border-color: var(--teal); }
.badge-queued   { background: var(--bg-alt); color: var(--ink-muted); }
.badge-external { background: transparent; color: var(--link); border-color: var(--link); }

/* ---- Disposition tally dots + row tinting ---- */
.disp-tally { margin-right: 14px; white-space: nowrap; }
.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid var(--border);
}
.dot-sync    { background: var(--teal); }
.dot-archive { background: var(--purple); }
.dot-ignore  { background: var(--ink-muted); }
.dot-unset   { background: transparent; }

.disp-row.disp-sync    td:first-child { border-left: 3px solid var(--teal); }
.disp-row.disp-archive td:first-child { border-left: 3px solid var(--purple); }
.disp-row.disp-ignore  td:first-child { border-left: 3px solid var(--ink-muted); }
.disp-row.disp-unset   td:first-child { border-left: 3px solid transparent; }

.disp-select {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 13px;
}
.disp-status {
  margin-left: 6px;
  font-size: 11px;
  font-variant: small-caps;
}
.disp-status-pending { color: var(--ink-muted); }
.disp-status-ok      { color: var(--ok); }
.disp-status-err     { color: var(--err); }

/* ---- Tiles ---- */
ul.tiles {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
ul.tiles li a {
  display: block;
  padding: 16px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  text-decoration: none;
  color: var(--ink);
  border-radius: 4px;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
ul.tiles li a:hover {
  transform: translateY(-1px);
  border-left-color: var(--purple);
}
ul.tiles li a strong {
  color: var(--link);
  font-size: 15px;
  display: block;
  margin-bottom: 4px;
}
ul.tiles li a span {
  color: var(--ink-muted);
  font-size: 12px;
}

/* ---- Layout helpers ---- */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 800px) {
  .row { grid-template-columns: 1fr; }
}

footer {
  padding: 20px 24px;
  color: var(--ink-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
  text-align: center;
}
