:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --border: #e3e6eb;
  --accent: #3355cc;
  --accent-text: #ffffff;
  --up: #1f7a4d;
  --up-bg: #e5f5ec;
  --down: #b42318;
  --down-bg: #fdecea;
  --none-bg: #eef0f3;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1d2129;
    --text: #e6e8ec;
    --muted: #9aa3b2;
    --border: #2f3541;
    --accent: #7c95f0;
    --accent-text: #0f1320;
    --up: #6fd3a0;
    --up-bg: #183326;
    --down: #f39a90;
    --down-bg: #3a1d1a;
    --none-bg: #2a2f39;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.5rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
/* Suite name, then the current tool: "EE Tools / Persona Rating" */
.topbar .brand { display: flex; align-items: baseline; gap: .4rem; font-weight: 700; }
.topbar .brand a { color: var(--text); }
.topbar .brand .sep { color: var(--muted); font-weight: 400; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 1rem; flex: 1; }
.topbar .account { display: flex; align-items: center; gap: .75rem; }
.topbar .account form { margin: 0; }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card.narrow { max-width: 420px; margin: 2rem auto; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.crumbs { display: flex; justify-content: space-between; margin-bottom: .75rem; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.crumbs .pager { margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

.description p:first-child { margin-top: 0; }

/* Forms */
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
input[type=text], input[type=password], textarea {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; }
input[type=file] { margin: .25rem 0; }
form > div { margin-bottom: .5rem; }
.helptext { display: block; color: var(--muted); font-size: .85rem; }

button, .button {
  display: inline-block;
  margin-top: .75rem;
  padding: .5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.button:hover { text-decoration: none; filter: brightness(1.05); }
.page-head .button, .actions .button, .actions button { margin-top: 0; }
.secondary { background: transparent; color: var(--accent); }
.danger { background: var(--down); border-color: var(--down); color: #fff; }
button.link {
  margin: 0; padding: 0; border: 0; background: none;
  color: var(--accent); font-weight: normal;
}

.thumbs { display: flex; gap: .75rem; flex-wrap: wrap; }
.thumb {
  display: flex; align-items: center; gap: .4rem;
  margin: 0; padding: .5rem .9rem;
  border: 1px solid var(--border); border-radius: 999px;
  font-weight: 600; cursor: pointer;
}
.thumb.up:has(input:checked) { background: var(--up-bg); border-color: var(--up); color: var(--up); }
.thumb.down:has(input:checked) { background: var(--down-bg); border-color: var(--down); color: var(--down); }
.rating-form .muted { margin-left: .75rem; }

.errorlist { color: var(--down); margin: .25rem 0; padding-left: 1.1rem; font-size: .9rem; }

/* Dashboard tiles, one per tool */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .4rem;
  height: 100%;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile-title { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

/* Tables */
table.list {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table.list th, table.list td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.list tr:last-child td { border-bottom: 0; }
.col-num { text-align: center !important; width: 3.5rem; }
.col-status { width: 8rem; }
.persona-name { font-weight: 600; }

.badge {
  display: inline-block;
  padding: .1rem .55rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--none-bg);
  white-space: nowrap;
}
.badge.up { background: var(--up-bg); color: var(--up); }
.badge.down, .badge.action-removed { background: var(--down-bg); color: var(--down); }
.badge.action-added, .badge.action-imported { background: var(--up-bg); color: var(--up); }

.flash { padding: .65rem .9rem; border-radius: 6px; margin-bottom: 1rem; background: var(--none-bg); }
.flash-success { background: var(--up-bg); color: var(--up); }
.flash-error { background: var(--down-bg); color: var(--down); }

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .75rem;
  overflow-x: auto;
}

details summary { cursor: pointer; color: var(--accent); }

@media (max-width: 640px) {
  table.list .small { font-size: .8rem; }
  .col-status { width: auto; }
}
