:root {
  --green:       #9DC4B5;
  --green-dark:  #0F6E56;
  --green-mid:   #1D9E75;
  --green-light: #E8F3EE;
  --black:       #131615;
  --off-white:   #F4F2ED;
  --white:       #ffffff;
  --border:      rgba(19,22,21,0.12);
  --muted:       #6B7280;
  --red:         #A32D2D;
  --red-light:   #FCEBEB;
  --amber:       #BA7517;
  --amber-light: #FEF3C7;
  --radius:      12px;
}

* { box-sizing: border-box; }
a { color: var(--green-dark); }

/* Minimal top bar used only on the logged-out auth pages (login/register). */
.auth-topbar {
  display: flex; align-items: center;
  padding: 16px 28px; background: var(--black);
}
.auth-topbar .brand-logo { height: 22px; width: auto; display: block; }

.auth-container { max-width: 420px; margin: 8vh auto; padding: 0 24px; }

h1 { font-size: 26px; margin: 0 0 6px; }
.lead { color: var(--muted); margin: 0 0 28px; }
h2.section { font-size: 14px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 32px 0 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile {
  display: block; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 20px; text-decoration: none; color: var(--black);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.tile:hover { border-color: var(--green-mid); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(19,22,21,0.06); }
.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tile-icon {
  width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center;
  justify-content: center; background: var(--green-light); color: var(--green-dark);
}
.tile .title { font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.tile .desc { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.tile .tag { display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--off-white); color: var(--muted); border: 1px solid var(--border); }
.tile .tag.public { background: var(--amber-light); color: var(--amber); border-color: transparent; }

.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.card h1 { margin-bottom: 16px; }

label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 6px; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; background: var(--white);
}
.btn {
  display: inline-block; border: none; cursor: pointer; font-size: 14px; font-weight: 500;
  padding: 10px 18px; border-radius: 8px; background: var(--green-dark); color: var(--white);
  text-decoration: none;
}
.btn:hover { background: var(--green-mid); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--red); }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-error { background: var(--red-light); color: var(--red); }
.flash-success { background: var(--green-light); color: var(--green-dark); }
.flash-info { background: var(--amber-light); color: var(--amber); }

.muted-note { color: var(--muted); font-size: 13px; margin-top: 16px; }

table.users { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
table.users th, table.users td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.users th { background: var(--green-light); color: var(--green-dark); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.users tr:last-child td { border-bottom: none; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.badge-admin { background: var(--green-dark); color: var(--white); }
.badge-pending { background: var(--amber-light); color: var(--amber); }
.inline-form { display: inline; }
.add-user { display: flex; gap: 10px; align-items: flex-end; margin: 18px 0 28px; }
.add-user label { margin: 0 0 6px; }
.add-user .grow { flex: 1; }

/* Recent activity */
.activity-list { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.activity-row { display: grid; grid-template-columns: 30px minmax(0,1fr) auto auto auto; align-items: center; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--border); font-size: 14px; }
.activity-row:last-child { border-bottom: none; }
/* Colour encodes the action type — green = story, blue = pack, amber = ROI. */
.act-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.act-icon.act-story_added { background: var(--green-light); color: var(--green-dark); }
.act-icon.act-pack_generated { background: #E6F1FB; color: #185FA5; }
.act-icon.act-roi_run { background: var(--amber-light); color: var(--amber); }
.activity-name { color: var(--black); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.activity-user { color: var(--muted); font-size: 12.5px; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.activity-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 640px) {
  .activity-row { grid-template-columns: 30px minmax(0,1fr) auto; gap: 4px 12px; }
  .activity-meta { grid-column: 2 / -1; }
  .activity-user { grid-column: 2 / -1; }
}
