:root {
  --green-950: #043b2a;
  --green-900: #07523a;
  --green-800: #076746;
  --green-700: #087b51;
  --green-600: #119463;
  --green-500: #2cab73;

  --gold-600: #b88b22;
  --gold-500: #d5a936;
  --gold-100: #fbf2d6;

  --cream: #f7f8f3;
  --white: #ffffff;
  --text: #102c27;
  --muted: #6b7d77;
  --border: #dfe9e3;
  --danger: #c83d3d;

  --shadow: 0 8px 28px rgba(4, 62, 43, .08);
  --shadow-lg: 0 18px 50px rgba(4, 62, 43, .13);
  --radius: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--cream);
  line-height: 1.5;
}

img {
  max-width: 100%;
  display: block;
}

button, input, select {
  font: inherit;
}

.container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

/* HERO */
.hero {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  color: #fff;
  background: var(--green-900);
}

.hero-image {
  position: absolute;
  inset: 0 0 0 54%;
  background:
    linear-gradient(90deg, var(--green-900) 0%, rgba(7,82,58,.88) 16%, rgba(7,82,58,.28) 68%, rgba(7,82,58,.08) 100%),
    url("./assets/ui-rektorat.jpg") center center / cover no-repeat;
  opacity: .95;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 8% 20%, rgba(213,169,54,.14), transparent 25%),
    linear-gradient(180deg, rgba(3,55,39,.05), rgba(3,55,39,.20));
}

.hero-inner {
  position: relative;
  z-index: 2;
  min-height: 420px;
  padding: 28px 0 56px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: #fff;
  text-decoration: none;
}

.brand-logo-wrap {
  display: grid;
  place-items: center;
  width: 122px;
  height: 48px;
  padding: 5px 9px;
  background: rgba(255,255,255,.96);
  border-radius: 10px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-copy strong {
  font-size: 18px;
  line-height: 1.15;
}

.brand-copy span {
  font-size: 11px;
  color: rgba(255,255,255,.76);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(4,53,38,.74);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4be38d;
  box-shadow: 0 0 0 4px rgba(75,227,141,.13);
  animation: pulse 1.8s infinite;
}

.status-badge.offline .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(200,61,61,.13);
  animation: none;
}

.status-badge.offline {
  color: #ffd3d3;
}

.hero-content {
  width: min(650px, 65%);
  margin-top: 72px;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  color: #f1cf62;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

.hero-kicker::before {
  content: "";
  width: 34px;
  height: 3px;
  border-radius: 99px;
  background: var(--gold-500);
}

.hero h1 {
  max-width: 700px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.03;
  letter-spacing: -.04em;
  font-weight: 850;
  margin-bottom: 16px;
}

.hero-content p {
  max-width: 610px;
  color: rgba(255,255,255,.82);
  font-size: 17px;
}

/* MAIN */
.main {
  position: relative;
  z-index: 5;
  margin-top: -54px;
  padding-bottom: 26px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
  min-height: 126px;
  padding: 21px;
  background: rgba(255,255,255,.98);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.summary-icon,
.heading-icon,
.update-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--green-800);
  background: #e5f5ec;
}

.summary-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
}

.summary-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.summary-card > div:last-child {
  min-width: 0;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .13em;
}

.summary-card strong {
  display: block;
  margin: 2px 0;
  font-size: 36px;
  line-height: 1.08;
}

.summary-caption {
  color: #84928e;
  font-size: 11px;
}

.panel {
  margin-bottom: 18px;
  padding: 24px;
  background: rgba(255,255,255,.98);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.heading-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.heading-icon {
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: var(--green-800);
  color: #fff;
}

.heading-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--green-800);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .17em;
}

.panel h2 {
  font-size: 23px;
  line-height: 1.2;
}

.panel-note {
  color: #8a9994;
  font-size: 11px;
}

/* CANDIDATES */
.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.candidate-card {
  display: grid;
  grid-template-columns: 58px minmax(170px, 1fr) minmax(180px, 1.4fr) 90px;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.candidate-number {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--gold-100);
  color: var(--green-900);
  font-size: 20px;
  font-weight: 850;
}

.candidate-info {
  min-width: 0;
}

.candidate-name {
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 800;
}

.candidate-votes {
  color: #8a9894;
  font-size: 11px;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7edeb;
}

.progress-bar {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-800), var(--green-500));
  transition: width .7s ease;
}

.candidate-result {
  text-align: right;
}

.candidate-result strong {
  display: block;
  font-size: 14px;
}

.candidate-result span {
  display: block;
  color: var(--green-800);
  font-size: 17px;
  font-weight: 850;
}

/* CHARTS */
.charts-grid {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 15px;
}

.chart-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fcfdfb;
}

.chart-card h3 {
  margin-bottom: 18px;
  font-size: 15px;
}

.bar-chart {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 17px;
}

.bar-chart-item {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 72px;
  align-items: center;
  gap: 9px;
}

.bar-chart-label {
  color: var(--green-900);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.bar-chart-track {
  height: 24px;
  overflow: hidden;
  border-radius: 7px;
  background: #e8efeb;
}

.bar-chart-bar {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-900), var(--green-500));
  transition: width .7s ease;
}

.bar-chart-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.donut-chart {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.donut-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.donut-svg {
  width: 190px;
  height: 190px;
  flex: 0 0 auto;
}

.donut-center-number {
  fill: var(--text);
  font-size: 24px;
  font-weight: 850;
}

.donut-center-label {
  fill: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 120px;
}

.donut-legend-item {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.donut-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.donut-legend-name {
  color: var(--muted);
}

.donut-legend-value {
  font-weight: 800;
}

/* UPDATE */
.update-card {
  display: grid;
  grid-template-columns: auto minmax(170px,1fr) 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.update-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.update-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.update-text {
  display: flex;
  flex-direction: column;
}

.update-text span {
  color: #8a9894;
  font-size: 10px;
}

.update-text strong {
  font-size: 13px;
}

.update-quote {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

.update-brand {
  padding-left: 14px;
  border-left: 2px solid var(--gold-500);
  color: var(--green-800);
  font-size: 11px;
  font-weight: 800;
}

/* FOOTER */
.footer {
  background: linear-gradient(120deg, #043b2a, #075c40);
  color: #fff;
}

.footer-inner {
  min-height: 105px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand img {
  width: 85px;
  height: 38px;
  object-fit: contain;
  padding: 3px 6px;
  background: #fff;
  border-radius: 7px;
}

.footer-brand div {
  display: flex;
  flex-direction: column;
}

.footer-brand strong {
  font-size: 13px;
}

.footer-brand span,
.footer-meta {
  color: rgba(255,255,255,.65);
  font-size: 10px;
}

.loading {
  min-height: 90px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid #dce8e1;
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.error-state,
.empty-state {
  padding: 25px 15px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.error-state {
  color: var(--danger);
  background: #fff3f3;
  border: 1px solid #f0cccc;
  border-radius: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  50% { transform: scale(.72); opacity: .65; }
}

/* TABLET */
@media (max-width: 900px) {
  .hero-image {
    inset: 0 0 0 48%;
  }

  .hero-content {
    width: 70%;
  }

  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .summary-card {
    padding: 17px;
  }

  .summary-icon {
    width: 48px;
    height: 48px;
  }

  .summary-card strong {
    font-size: 30px;
  }

  .candidate-card {
    grid-template-columns: 52px minmax(140px,1fr) minmax(120px,1.2fr) 82px;
    gap: 11px;
  }

  .candidate-number {
    width: 50px;
    height: 50px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* PHONE */
@media (max-width: 640px) {
  .container {
    width: calc(100% - 24px);
  }

  .hero {
    min-height: 465px;
  }

  .hero-image {
    inset: auto 0 0 0;
    height: 55%;
    opacity: .42;
    background:
      linear-gradient(180deg, var(--green-900) 0%, rgba(7,82,58,.45) 55%, rgba(7,82,58,.18) 100%),
      url("./assets/ui-rektorat.jpg") center / cover no-repeat;
  }

  .hero-overlay {
    background: linear-gradient(180deg, rgba(4,59,42,.08), rgba(4,59,42,.55));
  }

  .hero-inner {
    min-height: 465px;
    padding: 18px 0 35px;
  }

  .hero-top {
    align-items: flex-start;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo-wrap {
    width: 92px;
    height: 39px;
    padding: 4px 7px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .brand-copy span {
    display: none;
  }

  .status-badge {
    padding: 7px 10px;
    font-size: 9px;
  }

  .hero-content {
    width: 100%;
    margin-top: 62px;
  }

  .hero-kicker {
    font-size: 9px;
    letter-spacing: .11em;
  }

  .hero-kicker::before {
    width: 24px;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(34px, 10vw, 46px);
    line-height: 1.02;
  }

  .hero-content p {
    max-width: 92%;
    font-size: 14px;
  }

  .main {
    margin-top: -26px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .summary-card {
    min-height: 92px;
    padding: 15px 16px;
    border-radius: 16px;
    box-shadow: var(--shadow);
  }

  .summary-icon {
    width: 45px;
    height: 45px;
    border-radius: 13px;
  }

  .summary-icon svg {
    width: 23px;
    height: 23px;
  }

  .summary-card strong {
    font-size: 28px;
  }

  .panel {
    padding: 16px;
    border-radius: 17px;
  }

  .panel-heading {
    align-items: flex-start;
    margin-bottom: 15px;
  }

  .heading-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .heading-icon svg {
    width: 20px;
    height: 20px;
  }

  .panel h2 {
    font-size: 19px;
  }

  .panel-note {
    display: none;
  }

  .candidate-card {
    grid-template-columns: 48px minmax(0,1fr);
    gap: 10px;
    padding: 12px;
  }

  .candidate-number {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 17px;
  }

  .candidate-name {
    font-size: 14px;
  }

  .candidate-votes {
    font-size: 10px;
  }

  .candidate-progress {
    grid-column: 2 / -1;
  }

  .candidate-result {
    grid-column: 2 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .candidate-result strong,
  .candidate-result span {
    display: inline;
  }

  .candidate-result span {
    font-size: 15px;
  }

  .charts-grid {
    gap: 10px;
  }

  .chart-card {
    padding: 14px;
  }

  .bar-chart {
    min-height: 180px;
    gap: 14px;
  }

  .bar-chart-item {
    grid-template-columns: 32px minmax(0,1fr) 62px;
    gap: 6px;
  }

  .bar-chart-track {
    height: 21px;
  }

  .bar-chart-value {
    font-size: 10px;
  }

  .donut-chart {
    min-height: auto;
    padding: 8px 0;
  }

  .donut-wrapper {
    flex-direction: column;
    gap: 12px;
  }

  .donut-svg {
    width: 175px;
    height: 175px;
  }

  .donut-legend {
    width: 100%;
    max-width: 240px;
  }

  .update-card {
    grid-template-columns: 42px 1fr;
    gap: 10px;
    padding: 14px;
  }

  .update-quote {
    grid-column: 1 / -1;
    text-align: left;
    padding-top: 5px;
  }

  .update-brand {
    display: none;
  }

  .footer-inner {
    min-height: 90px;
    padding: 18px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-meta {
    display: none;
  }
}

@media (max-width: 380px) {
  .brand-copy {
    display: none;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero-content p {
    font-size: 13px;
  }

  .summary-card strong {
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================
   MOBILE CHART FIX
   ===================================================== */

@media (max-width: 640px) {

  .bar-chart {
    width: 100%;
    min-height: 190px;
    padding: 4px 0;
    gap: 18px;
  }

  .bar-chart-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 68px;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .bar-chart-label {
    color: var(--green-900);
    font-size: 11px;
    font-weight: 850;
    text-align: left;
    white-space: nowrap;
  }

  .bar-chart-track {
    position: relative;
    width: 100%;
    height: 24px;
    overflow: hidden;
    border-radius: 7px;
    background: #e8efeb;
  }

  .bar-chart-bar {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: 7px;
    background: linear-gradient(
      90deg,
      var(--green-900),
      var(--green-500)
    );
    transition: width .7s ease;
  }

  .bar-chart-value {
    color: var(--text);
    font-size: 10px;
    font-weight: 750;
    text-align: right;
    white-space: nowrap;
  }

  .donut-wrapper {
    width: 100%;
    flex-direction: column;
    gap: 16px;
  }

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  width: 100%;
  max-width: 270px;
}

.donut-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 9px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.35;
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-legend-name {
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.donut-legend-value {
  margin-left: 6px;
  color: var(--green-800);
  font-weight: 800;
  white-space: nowrap;
}
}