@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #0f8f61;
  --primary-dark: #086345;
  --secondary: #0b7894;
  --ink: #18212f;
  --muted: #5f6d7a;
  --line: #dfe8e4;
  --paper: #ffffff;
  --wash: #f6faf8;
  --mint: #e4f8ed;
  --danger: #b42318;
  --radius: 8px;
  --shadow: 0 12px 32px rgba(15, 74, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #ffffff;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f7fbf8 0%, #dff5ea 100%);
}

.login-panel {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.login-logo-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.brand-mark {
  display: block;
  object-fit: contain;
}

.brand-mark-nitr {
  width: 92px;
}

.brand-mark-ffdg {
  width: 210px;
  max-width: 100%;
}

.login-text-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #cfded6;
  font-size: 16px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
}

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #314033;
}

.field-help {
  display: block;
  margin: 6px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input,
textarea,
.Select-control {
  border-radius: var(--radius);
}

.large-text-input {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid #cfded6;
  font-size: 15px;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  border-radius: var(--radius);
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  margin-top: 20px;
  color: white;
  background: var(--primary);
  border: 1px solid var(--primary);
}

.ghost-button {
  padding: 0 14px;
  color: var(--primary-dark);
  background: white;
  border: 1px solid var(--line);
}

.form-message {
  margin-top: 12px;
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 30px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  display: block;
}

.portal-title {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid #e6efe9;
  border-radius: 999px;
  background: #f8fcfa;
}

.topnav a {
  color: #334155;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.topnav a:hover,
.site-footer a:hover {
  color: var(--primary);
}

.topnav a:hover {
  background: #e7f6ee;
}

.topnav .nav-cta,
.topnav .btn--primary {
  color: white;
  background: var(--primary);
}

.topnav .nav-cta:hover,
.topnav .btn--primary:hover {
  color: white;
  background: var(--primary-dark);
}

.session-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 210px;
}

.logout-button {
  min-height: 34px;
  padding: 0 13px;
  color: var(--primary-dark);
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.logout-button:hover {
  color: white;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.topbar h1 {
  margin-bottom: 2px;
  font-size: 21px;
}

.topbar p,
.dataset-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  padding: 24px 18px 32px;
  background: linear-gradient(180deg, #f7fbf8 0%, #ffffff 420px);
}

.filters,
.results {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.filters {
  align-self: start;
  position: sticky;
  top: 100px;
  padding: 18px;
}

.clean-slider {
  margin: 6px 2px 20px;
  padding: 6px 8px 16px;
}

.clean-slider .rc-slider-mark {
  top: 23px;
  font-size: 11px;
  color: #64748b;
}

.clean-slider .rc-slider-mark-text {
  min-width: 34px;
  white-space: nowrap;
}

.clean-slider.year-slider .rc-slider-mark-text {
  transform: translateX(-50%) rotate(-28deg) !important;
  transform-origin: top center;
}

.clean-slider .rc-slider-track {
  background-color: var(--primary);
}

.clean-slider .rc-slider-handle {
  border-color: var(--primary);
  opacity: 1;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.filter-header h2 {
  margin-bottom: 0;
}

.results {
  min-width: 0;
  padding: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metrics div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--mint);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.tab-content {
  padding-top: 14px;
}

.food-picker {
  max-height: 260px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 12px;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.empty-state {
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.assignment-workspace {
  display: grid;
  gap: 16px;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.assignment-column {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.assignment-panel {
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.assignment-panel h3 {
  margin-bottom: 8px;
}

.assignment-panel p {
  margin-bottom: 12px;
  font-size: 13px;
}

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

.assignment-context {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: 18px;
}

.context-controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr);
  gap: 14px;
}

.compact-button {
  width: auto;
  min-width: 150px;
  margin-top: 14px;
  padding: 0 16px;
}

.code-area {
  width: 100%;
  min-height: 92px;
  padding: 12px;
  border: 1px solid #cfded6;
  border-radius: var(--radius);
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  resize: vertical;
}

.notebook-code-area {
  min-height: 132px;
}

.filter-instructions {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #d9e7df;
  border-radius: var(--radius);
  background: #f8fcfa;
  color: var(--muted);
  font-size: 13px;
}

.filter-instructions code {
  display: block;
  white-space: normal;
  color: #153d2d;
  font-family: Consolas, "Liberation Mono", monospace;
  line-height: 1.55;
}

.assignment-output {
  margin-top: 14px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.assignment-output pre {
  white-space: pre-wrap;
  padding: 12px;
  border: 1px solid #d9e7df;
  border-radius: var(--radius);
  background: #f8fcfa;
  font-size: 13px;
}

.assignment-output .dash-table-container {
  max-width: 100%;
}

.assignment-output .dash-spreadsheet-container,
.assignment-output .dash-spreadsheet-inner {
  max-width: 100%;
}

.upload-box {
  padding: 22px;
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  background: #f7fbf8;
  color: var(--primary-dark);
  font-weight: 800;
  text-align: center;
}

.batch-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-top: 12px;
}

.site-footer {
  color: rgba(255, 255, 255, 0.88);
  background: #10291f;
  padding: 42px 28px 26px;
}

.footer-grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(150px, 1fr));
  gap: 32px;
}

.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.footer-logo {
  display: block;
  object-fit: contain;
}

.footer-logo-nitr {
  width: 88px;
  background: white;
  border-radius: 6px;
  padding: 6px;
}

.footer-logo-ffdg {
  width: 190px;
  max-width: 100%;
  background: white;
  border-radius: 6px;
  padding: 8px;
}

.footer-brand p {
  max-width: 300px;
  color: rgba(255, 255, 255, 0.72);
}

.site-footer h3 {
  margin: 0 0 12px;
  color: #ffffff;
  font-size: 15px;
}

.site-footer a {
  display: block;
  margin: 9px 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.footer-bottom {
  max-width: 1180px;
  margin: 28px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  text-align: center;
}

.footer-bottom p {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 13px;
}

@media (max-width: 900px) {
  .workspace {
    display: block;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topnav {
    flex-wrap: wrap;
    justify-content: flex-start;
    border-radius: var(--radius);
    gap: 6px;
  }

  .dataset-status {
    margin-top: 10px;
  }

  .session-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    position: static;
    margin-bottom: 16px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .assignment-grid,
  .batch-controls,
  .assignment-context,
  .context-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar-brand {
    min-width: 0;
  }

  .portal-title {
    padding-left: 10px;
  }

  .nav-logo {
    width: 50px;
    height: 50px;
  }

  .metrics,
  .footer-grid,
  .two-col {
    grid-template-columns: 1fr;
  }
}
