:root {
  --navy: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --background: #f5f7fb;
  --primary: #2854c5;
  --primary-dark: #173f9e;
  --blue-soft: #eaf1ff;
  --green: #14866d;
  --green-soft: #e7f7f2;
  --orange: #d97706;
  --violet: #6941c6;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--navy);
  background: var(--background);
  font-family: "Manrope", Arial, sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand span:last-child { display: grid; }
.brand strong { font-size: 0.95rem; }
.brand small { color: var(--muted); font-size: 0.72rem; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; color: white; font-size: 0.82rem; font-weight: 800;
  background: linear-gradient(145deg, #2e63dd, #143b94);
  box-shadow: 0 8px 18px rgba(40, 84, 197, 0.24);
}

.version {
  padding: 7px 11px; border-radius: 999px; color: var(--primary);
  background: var(--blue-soft); font-size: 0.72rem; font-weight: 700;
}

.page-shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.hero { min-height: 310px; display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.hero > div:first-child { max-width: 720px; }
.eyebrow {
  margin: 0 0 8px; color: var(--primary); font-size: 0.75rem;
  font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
}
h1 { margin: 0; max-width: 700px; font-size: clamp(2.2rem, 5vw, 4.25rem); line-height: 1.04; letter-spacing: -0.055em; }
.hero-copy { max-width: 640px; margin: 22px 0 0; color: var(--muted); line-height: 1.7; }
.privacy-note {
  max-width: 300px; display: flex; gap: 14px; padding: 20px;
  border: 1px solid #cfe9e1; border-radius: 18px; background: var(--green-soft);
}
.privacy-note p { margin: 5px 0 0; color: #3d6f62; font-size: 0.8rem; line-height: 1.5; }
.privacy-icon {
  flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; color: white; background: var(--green); font-weight: 800;
}

.control-panel, .panel {
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow);
}
.control-panel { margin-bottom: 32px; padding: 30px; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
h2, h3 { margin: 0; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.05rem; }
.dashboard-heading p:last-child, .panel-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 0.82rem; }
.configuration-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 24px; margin-top: 28px; }
.field { display: grid; align-content: start; gap: 9px; }
.field > span, .source-card legend, .filter-controls label { font-size: 0.82rem; font-weight: 700; }
.field small { color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
input[type="number"], input[type="url"] {
  width: 100%; padding: 14px 15px; border: 1px solid #d0d5dd; border-radius: 10px;
  color: var(--navy); background: white; outline: none; transition: 0.2s;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(40, 84, 197, 0.12); }

.source-card { min-width: 0; margin: 0; padding: 0; border: 0; }
.source-card legend { margin-bottom: 9px; }
.source-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 11px; background: #f2f4f7; }
.source-tab { padding: 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 0.78rem; font-weight: 700; }
.source-tab.active { color: var(--navy); background: white; box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08); }
.source-content { margin-top: 12px; }
.drop-zone {
  min-height: 145px; display: grid; place-items: center; align-content: center; gap: 6px;
  border: 1px dashed #98a2b3; border-radius: 12px; color: var(--muted); background: #fafbfc;
  text-align: center; transition: 0.2s; cursor: pointer;
}
.drop-zone:hover { border-color: var(--primary); background: var(--blue-soft); }
.drop-zone strong { color: var(--navy); font-size: 0.86rem; }
.drop-zone span:last-of-type { font-size: 0.7rem; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-symbol { color: var(--primary); font-size: 1.7rem; font-weight: 500; }

.primary-button, .secondary-button {
  border-radius: 9px; padding: 11px 15px; font-size: 0.76rem; font-weight: 800; transition: 0.2s;
}
.primary-button { border: 1px solid var(--primary); color: white; background: var(--primary); }
.primary-button:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.secondary-button { border: 1px solid #d0d5dd; color: #344054; background: white; }
.secondary-button:hover { border-color: #98a2b3; background: #f9fafb; }
.full-width { width: 100%; margin-top: 14px; }
.status-message { margin-top: 20px; padding: 12px 14px; border-radius: 9px; color: #475467; background: #f2f4f7; font-size: 0.78rem; }
.status-message.success { color: #087055; background: var(--green-soft); }
.status-message.error { color: var(--danger); background: #fef3f2; }

.dashboard { padding: 36px 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 24px 0; }
.metric-card {
  position: relative; overflow: hidden; min-height: 155px; display: grid; align-content: space-between;
  padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: white;
}
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.accent-blue { --accent: var(--primary); }
.accent-violet { --accent: var(--violet); }
.accent-green { --accent: var(--green); }
.accent-orange { --accent: var(--orange); }
.metric-label { color: var(--muted); font-size: 0.74rem; font-weight: 700; }
.metric-value { font-size: 2.25rem; letter-spacing: -0.06em; }
.metric-detail { color: var(--muted); font-size: 0.68rem; }
.chart-grid { display: grid; grid-template-columns: 1.8fr 1fr; gap: 16px; }
.panel { padding: 22px; }
.chart-wrapper { position: relative; height: 330px; margin-top: 20px; }
.donut-wrapper { position: relative; height: 290px; margin-top: 20px; }
.donut-label { position: absolute; inset: 50% auto auto 50%; display: grid; text-align: center; transform: translate(-50%, -50%); pointer-events: none; }
.donut-label strong { font-size: 2rem; letter-spacing: -0.055em; }
.donut-label span { color: var(--muted); font-size: 0.7rem; }

.filter-panel { margin-top: 16px; }
.filter-result { display: grid; min-width: 150px; text-align: right; }
.filter-result strong { color: var(--primary); font-size: 2rem; letter-spacing: -0.055em; }
.filter-result span { color: var(--muted); font-size: 0.7rem; }
.filter-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; margin: 24px 0; padding: 16px; border-radius: 12px; background: #f8f9fc; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.attendance-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.guide-card { display: grid; align-content: start; gap: 9px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfe; }
.guide-card .attendance-pill { justify-self: start; }
.guide-card strong { font-size: 0.78rem; }
.guide-card p { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.55; }
.guide-low { border-top: 3px solid #d92d20; }
.guide-medium { border-top: 3px solid #f79009; }
.guide-high { border-top: 3px solid #12b76a; }
.status-filter { display: grid; gap: 10px; margin-bottom: 18px; }
.status-filter > span { color: #475467; font-size: 0.75rem; font-weight: 800; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.status-filter-button {
  padding: 8px 12px; border: 1px solid #d0d5dd; border-radius: 999px;
  color: #475467; background: white; font-size: 0.72rem; font-weight: 700;
}
.status-filter-button strong { margin-left: 4px; }
.status-filter-button.active { border-color: var(--primary); color: white; background: var(--primary); }
.table-wrapper { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: #475467; background: #f9fafb; font-size: 0.67rem; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.attendance-pill { display: inline-block; min-width: 62px; padding: 5px 8px; border-radius: 999px; text-align: center; font-weight: 800; }
.pill-high { color: #087055; background: #e7f7f2; }
.pill-medium { color: #b54708; background: #fffaeb; }
.pill-low { color: #b42318; background: #fef3f2; }
.email-panel { margin-top: 16px; }
.email-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
.copy-field { display: grid; align-content: start; gap: 9px; }
.copy-field label { font-size: 0.78rem; font-weight: 800; }
.copy-field textarea {
  width: 100%; resize: vertical; padding: 14px; border: 1px solid #d0d5dd; border-radius: 12px;
  color: var(--navy); background: #f9fafb; font: 0.76rem/1.55 "Manrope", Arial, sans-serif; outline: none;
}
.copy-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(40, 84, 197, 0.12); }
.copy-button { justify-self: start; }
.copy-feedback { min-height: 18px; margin: 10px 0 0; color: var(--green); font-size: 0.72rem; font-weight: 700; }
.empty-row { padding: 25px; color: var(--muted); text-align: center; }
.hidden { display: none !important; }
footer { padding: 34px 20px; color: var(--muted); text-align: center; font-size: 0.72rem; }

@media (max-width: 900px) {
  .hero { min-height: auto; align-items: flex-start; flex-direction: column; padding: 60px 0 38px; }
  .privacy-note { max-width: none; }
  .configuration-grid, .chart-grid, .email-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .attendance-guide { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { height: 66px; padding: 0 16px; }
  .page-shell { width: min(100% - 20px, 1240px); }
  h1 { font-size: 2.35rem; }
  .control-panel, .panel { padding: 18px; border-radius: 16px; }
  .section-heading, .panel-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .filter-result { text-align: left; }
  .filter-controls { grid-template-columns: 1fr; }
}
