/* ======================================================================
   Global variables
   ====================================================================== */

:root{
  --accent: #F28C28;

  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;

  --shadow: 0 18px 50px rgba(17, 24, 39, 0.10);
}

/* ======================================================================
   Base / reset
   ====================================================================== */

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(242,140,40,0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(17,24,39,0.06), transparent 60%),
    var(--bg);
}

a{ text-decoration: none; color: inherit; }

/* ======================================================================
   Small helpers
   ====================================================================== */

.fineprint{
  font-size: 12px;
  color: #9ca3af;
}

.link{
  font-size: 13px;
  color: #374151;
}

.link:hover{ color: #111827; }

/* ======================================================================
   Buttons (pill + modern)
   ====================================================================== */

.btn{
  border: 1px solid rgba(242,140,40,0.30);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  background: rgba(242,140,40,0.92);
  color: #1a0f05;
  box-shadow: 0 10px 24px rgba(242,140,40,0.18);
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}

.btn:hover{
  filter: brightness(1.03);
  box-shadow: 0 14px 30px rgba(242,140,40,0.22);
}

.btn:active{ transform: translateY(1px); }

.btn--small{
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 650;
}

/* ======================================================================
   Auth layout (login)
   ====================================================================== */

.shell{
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.card{
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand{
  padding: 26px 26px 12px;
  border-bottom: 1px solid var(--line);
}

.brand-logos{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}

.brand-logo{
  height: 42px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
}

.brand-divider{
  width: 1px;
  height: 34px;
  background: var(--line);
}

.title{
  margin: 6px 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
  text-align: center;
}

.subtitle{
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.form{
  padding: 18px 26px 10px;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

label{
  font-size: 13px;
  color: var(--muted);
}

input{
  appearance: none;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 14px;
  padding: 12px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input::placeholder{ color: #9ca3af; }

input:focus{
  border-color: rgba(242,140,40,0.55);
  box-shadow: 0 0 0 4px rgba(242,140,40,0.18);
}

.meta{
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.footer{
  padding: 12px 26px 20px;
  text-align: center;
}

/* Feedback */
.error-banner{
  border: 1px solid #f3caca;
  background: #fff5f5;
  color: #8a1f1f;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
}

/* ======================================================================
   App layout (full-width pages)
   ====================================================================== */

.app-body{
  margin: 0;
  background: #fff;
  color: var(--text);
}

.site-header{
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.site-header__inner{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}

.brandmark{
  display: inline-flex;
  align-items: center;
  color: inherit;
}

.brandmark__logos{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brandmark__logo{
  height: 30px;
  width: auto;
  display: block;
}

.brandmark__divider{
  width: 1px;
  height: 26px;
  background: var(--line);
  display: inline-block;
}

/* Nav */
.nav-toggle{
  margin-left: auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 16px;
  cursor: pointer;
  display: none;
}

.site-nav{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-nav__link{
  color: #111;
  padding: 8px 10px;
  border-radius: 999px;
}

.site-nav__user{
  color: var(--muted);
  font-size: 14px;
  padding: 8px 6px;
}

.site-nav__link--danger{
  border: 1px solid var(--line);
  border-radius: 999px;
}

.site-nav__link:hover{
  background: var(--accent);
  color: #1a0f05;
}

.site-nav__link.is-active{
  background: var(--accent);
  color: #1a0f05;
  font-weight: 700;
}

.site-nav__link--danger:hover{
  background: #111;
  color: #fff;
}

.site-main{ width: 100%; }

.page{
  width: 100%;
  padding: 18px 16px 28px;
}

.page__head{ padding: 6px 0 14px; }

.page__title{
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.page__subtitle{
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page__head--split{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page__head--split > div:first-child{
  flex: 1 1 360px;
  min-width: 0;
}

.page__actions{
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Footer */
.site-footer{
  width: 100%;
  border-top: 1px solid var(--line);
  background: #fff;
}

.site-footer__inner{
  width: 100%;
  padding: 12px 16px;
}

/* ======================================================================
   Dashboard tiles (generic cards)
   ====================================================================== */

.dash-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dash-tile{
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}

.dash-tile__title{
  margin: 0;
  font-size: 16px;
}

.dash-tile__text{
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.dash-tile__link{
  color: var(--accent);
  font-weight: 650;
}

/* ======================================================================
   Programmes (tile grid) – UPDATED (image pinned top-right to border)
   ====================================================================== */

.programme-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.programme-card{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;

  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);

  background: #fff;
  background-image: none !important;
  min-height: 190px;

  box-shadow: 0 8px 22px rgba(17,24,39,0.06);
  overflow: hidden; /* ensures image clips to rounded corner */
}

.programme-card--link{
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease;
}

.programme-card--link:hover{
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(17,24,39,0.10);
}

.programme-card--link:focus-visible{
  outline: none;
  box-shadow: 0 18px 45px rgba(17,24,39,0.12);
}

/* Title row: title left, image pinned top-right */
.programme-card__toprow{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* bigger title + a touch of top padding */
.programme-card__title{
  margin: 2px 0 0;
  padding-top: 2px;
  font-size: 19px;
  line-height: 1.15;
  font-weight: 800;
  color: #111827;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  /* reserve space so the title/content doesn't run under the image */
  padding-right: 110px; /* keep this >= thumb width */
}

/* Image: sticks to top-right corner and touches borders */
.programme-card__thumb{
  position: absolute;
  top: 0;
  right: 0;

  width: 112px;
  height: 84px;

  object-fit: cover;

  /* only round the inner corner; outer corner is handled by tile overflow */
  border-radius: 0 0 0 18px;

  border: 0;
  background: #f3f4f6;

  pointer-events: none;
  user-select: none;
}

/* Summary sits under title and flows down the left of the image */
.programme-card__summary{
  margin: 0;
  padding-right: 110px; /* match title so text wraps beside image */
  font-size: 13px;
  color: rgba(17,24,39,0.72);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Badge becomes a fixed-size pill (consistent width/height) */
.rag-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 140px;  /* consistent pill width */
  height: 34px;      /* consistent pill height */
  padding: 0 14px;

  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;

  color: #fff;
  background: #6b7280; /* default if no class */
}

.rag-green{ background: rgba(16,185,129,0.90); }
.rag-amber{ background: rgba(245,158,11,0.92); }
.rag-red  { background: rgba(239,68,68,0.90); }

.programme-meta{
  display: grid;
  gap: 6px; /* squeeze up */
}

.programme-meta__item{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 0; /* tighter */
}

.programme-meta__label{
  color: #111827;
  opacity: 0.80;
}

.programme-meta__value{
  font-weight: 650;
  color: rgba(17,24,39,0.92);
  text-align: right;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress + status on same line */
.programme-progress{
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.programme-progress__row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* bar left, pill right */
.programme-progress__bar{
  height: 14px;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.programme-progress__bar canvas{
  width: 100% !important;
  height: 14px !important;
  display: block;
}

/* optional: keep % tiny or hide if you prefer */
.programme-progress__value{
  display: none;
}

/* ======================================================================
   Responsive behaviour (keep as-is)
   ====================================================================== */

@media (max-width: 980px){
  .programme-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px){
  .programme-grid{ grid-template-columns: 1fr; }
}

/* ======================================================================
   Timeline (below programmes)
   ====================================================================== */

.timeline-card{
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.timeline-card__head{
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.timeline-card__title{
  margin: 0;
  font-size: 16px;
}

.timeline-card__subtitle{
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.timeline-card__chart{
  padding: 12px 12px 16px;
  height: 340px;
}

.timeline-card__chart canvas{
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ======================================================================
   Responsive behaviour
   ====================================================================== */

@media (max-width: 980px){
  .dash-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .programme-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px){
  .dash-grid{ grid-template-columns: 1fr; }
  .programme-grid{ grid-template-columns: 1fr; }

  .nav-toggle{ display: inline-flex; }

  .site-nav{
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--line);
  }

  .site-nav.is-open{ display: flex; }

  .site-header__inner{ flex-wrap: wrap; }

  .site-nav__user{ padding: 6px 10px; }
}