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

:root {
  --green: #174c3d;
  --green-2: #2f7d59;
  --green-3: #e8f4ed;
  --ink: #16312a;
  --muted: #667a72;
  --line: #d8e4de;
  --paper: #fff;
  --bg: #f3f7f4;
  --danger: #a43b2a;
  --shadow: 0 18px 50px rgba(20, 62, 48, 0.1);
  font-family:
    Manrope,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
.survey-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(#174c3d0a 1px, transparent 1px),
    linear-gradient(90deg, #174c3d0a 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}
.app-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px max(28px, calc((100% - 1120px) / 2));
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--green);
}
.brand-mark span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
}
.brand-mark strong {
  font-size: 20px;
  letter-spacing: 0.09em;
}
.app-header .title {
  padding-left: 28px;
  border-left: 1px solid var(--line);
  line-height: 1.15;
}
.app-header .title small,
.eyebrow {
  display: block;
  margin: 0 0 5px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 11px;
  font-weight: 800;
  color: var(--green-2);
}
.app-header h1 {
  font-size: 22px;
  margin: 0;
}
.user-menu {
  position: relative;
  margin-left: auto;
}
.user-menu form {
  margin: 0;
}
.user-chip {
  display: block;
  border: 1px solid var(--line);
  background: #f8fbf9;
  border-radius: 999px;
  padding: 10px 15px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.user-chip::-webkit-details-marker {
  display: none;
}
.user-chip::after {
  content: "⌄";
  margin-left: 7px;
}
.user-menu-panel {
  position: absolute;
  z-index: 40;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  padding: 7px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 15px 40px #173e3030;
}
.user-menu-panel button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.user-menu-panel button:hover {
  background: var(--green-3);
  color: var(--green);
}
.app-main {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 40px));
  margin: 28px auto 90px;
}
.tabs {
  display: inline-flex;
  padding: 5px;
  background: #e7eeea;
  border-radius: 13px;
  gap: 4px;
}
.tab {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 11px 18px;
  font-weight: 700;
  color: #50645c;
}
.tab.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 3px 12px #1e4a3820;
}
.panel {
  display: none;
}
.panel.active {
  display: block;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 30px 0 18px;
}
.section-head h2 {
  font-size: 27px;
  margin: 0;
}
.badge {
  padding: 8px 12px;
  background: var(--green-3);
  color: var(--green);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.work-form {
  padding: 26px;
}
.entity-switch {
  display: inline-flex;
  gap: 5px;
  margin: 0 0 20px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #edf3ef;
}
.entity-switch legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.entity-switch label {
  display: block;
  cursor: pointer;
}
.entity-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.entity-switch span {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: #50645c;
  font-size: 13px;
  font-weight: 800;
}
.entity-switch input:checked + span {
  background: #fff;
  color: var(--green);
  box-shadow: 0 3px 12px #1e4a3820;
}
.entity-switch input:focus-visible + span {
  outline: 3px solid #2f7d5925;
}
.form-grid {
  display: grid;
  gap: 18px;
}
.form-grid.number-grid {
  grid-template-columns: repeat(3, minmax(0, 170px));
}
.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}
.wide {
  grid-column: 1/-1;
}
label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  color: #42584f;
}
input,
select,
textarea {
  width: 100%;
  min-height: 45px;
  border: 1px solid #bdcec5;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  font-size: 14px;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
input::placeholder {
  color: #91a49b;
  opacity: 1;
}
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #2f7d5925;
  border-color: var(--green-2);
}
.form-note {
  font-size: 12px;
  color: var(--muted);
  margin: 9px 0 0;
}
.subnumber-suggestion {
  display: inline-block;
  margin-left: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-3);
  color: var(--green);
  font-weight: 800;
}
.subnumber-suggestion[hidden] {
  display: none;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.primary {
  border: 0;
  background: var(--green-2);
  color: #fff;
  border-radius: 10px;
  padding: 12px 20px;
  font-weight: 800;
  box-shadow: 0 7px 18px #2f7d5930;
}
.primary:hover {
  background: #246b4b;
}
.primary:disabled {
  opacity: 0.55;
  cursor: wait;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 15px;
  margin-bottom: 16px;
}
.search-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}
.search-tools .search-box {
  margin-bottom: 0;
}
.search-entity-filter {
  display: flex;
  gap: 7px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #edf3ef;
}
.search-entity-filter button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  padding: 8px 12px;
  background: transparent;
  color: #50645c;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.search-entity-filter button[aria-pressed="true"] {
  background: var(--green-2);
  color: #fff;
  box-shadow: 0 4px 12px #1e4a3830;
}
.search-entity-filter button:focus-visible {
  outline: 3px solid #2f7d5935;
}
.search-box input {
  border: 0;
  background: transparent;
  padding-inline: 0;
  min-height: 52px;
}
.search-box input:focus {
  outline: 0;
}
.work-list {
  display: grid;
  gap: 12px;
}
.work-card {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
}
.work-number {
  font-weight: 800;
  color: var(--green);
  font-size: 17px;
}
.entity-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--green-3);
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.entity-badge.ev {
  background: #fff1d6;
  color: #7a4d00;
}
.work-card h3 {
  font-size: 15px;
  margin: 0 0 6px;
}
.work-meta {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.work-meta span + span:before {
  content: "·";
  margin-right: 9px;
}
.milestone-controls {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.status-step {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #53675e;
  font-size: 11px;
  text-align: left;
}
.status-step strong {
  font-weight: 800;
}
.status-step:hover:not(:disabled) {
  border-color: #79a98f;
  background: var(--green-3);
}
.status-step.done {
  border-color: #8fc1a5;
  background: #e5f5eb;
  color: #185f3d;
}
.status-step:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.status-dot {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #e7eeea;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.status-step.done .status-dot {
  background: var(--green-2);
}
.work-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.secondary,
.call-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 9px 12px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}
.call-button {
  color: var(--green-2);
  border-color: #afd0bd;
  background: #f2faf5;
}
.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed #b8cbc1;
  border-radius: 14px;
}
.processing-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
}
.processing-layout aside {
  padding: 20px;
  align-self: start;
}
.processing-layout aside select {
  margin-bottom: 18px;
}
.processing-entity-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}
.processing-entity-switch span {
  height: 100%;
  padding: 10px 8px;
  text-align: center;
}
.summary {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  font-size: 13px;
}
.summary b {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
}
.summary p {
  margin: 6px 0;
  color: var(--muted);
}
.document-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.document-card {
  display: grid;
  text-align: left;
  gap: 8px;
  min-height: 135px;
  padding: 22px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px #1a493614;
}
.document-card b {
  font-size: 17px;
  color: var(--green);
}
.document-card span {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.document-card:hover {
  border-color: #77aa8f;
  transform: translateY(-1px);
}
.document-card.accent {
  background: var(--green);
  border-color: var(--green);
}
.document-card.accent b,
.document-card.accent span {
  color: #fff;
}
.hidden {
  display: none !important;
}
dialog {
  width: min(690px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 90px #102b2260;
}
dialog::backdrop {
  background: #102b2278;
  backdrop-filter: blur(3px);
}
.dialog-shell {
  position: relative;
  padding: 26px;
  margin: 0;
  overflow: auto;
  max-height: calc(100vh - 36px);
}
.dialog-shell h2 {
  margin: 0 40px 20px 0;
}
.dialog-close {
  position: absolute;
  right: 18px;
  top: 15px;
  border: 0;
  background: #edf3ef;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 24px;
  line-height: 1;
}
.stack {
  display: grid;
  gap: 15px;
}
.tool-dialog {
  width: min(1240px, calc(100% - 28px));
  height: calc(100vh - 30px);
}
.tool-dialog .dialog-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.tool-dialog iframe {
  width: 100%;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.kituzes-download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -8px 48px 14px 0;
  padding: 11px 14px;
  border: 1px solid #9cc9ae;
  border-radius: 10px;
  background: #edf8f1;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}
.kituzes-download-bar[hidden] {
  display: none;
}
.kituzes-download-bar a {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--green-2);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}
.kituzes-download-bar a:hover {
  background: var(--green);
}
.alert {
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 13px;
}
.alert.error {
  background: #fff0ec;
  color: var(--danger);
}
#toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: 380px;
  padding: 13px 17px;
  border-radius: 11px;
  background: #173f33;
  color: #fff;
  box-shadow: 0 14px 35px #0c2e2260;
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
  transition: 0.2s;
}
#toast.show {
  opacity: 1;
  transform: none;
}
#toast.error {
  background: #8b3023;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 20% 10%, #e2f0e8, transparent 40%),
    linear-gradient(140deg, #f8faf9, #edf4f0);
}
.login-card {
  width: min(430px, 100%);
  padding: 36px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 28px 80px #173e3025;
}
.login-card .brand-mark {
  margin-bottom: 36px;
}
.login-card h1 {
  font-size: 30px;
  margin: 0 0 8px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 22px;
}
.mobile-nav {
  display: none;
}

.work-card-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #53675e;
}
.icon-button:hover {
  border-color: #8cb69f;
  background: var(--green-3);
  color: var(--green-2);
}
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 760px) {
  .app-header {
    padding: 14px 18px;
    gap: 13px;
  }
  .brand-mark span {
    width: 36px;
    height: 36px;
  }
  .brand-mark strong {
    display: none;
  }
  .app-header .title {
    padding-left: 13px;
  }
  .app-header .title h1 {
    font-size: 17px;
  }
  .app-header .title small {
    font-size: 9px;
  }
  .user-chip {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app-main {
    width: min(100% - 24px, 680px);
    margin-top: 16px;
  }
  .desktop-only {
    display: none;
  }
  .tabs {
    display: none;
  }
  .section-head {
    align-items: flex-start;
    margin-top: 18px;
  }
  .section-head h2 {
    font-size: 22px;
  }
  .badge {
    display: none;
  }
  .work-form {
    padding: 18px;
  }
  .form-grid.number-grid {
    grid-template-columns: 2fr 1.3fr 1.5fr;
    gap: 10px;
  }
  .form-grid.two {
    grid-template-columns: 1fr;
  }
  .form-grid.two .wide {
    grid-column: auto;
  }
  .work-card {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }
  .work-number {
    grid-column: 1/-1;
  }
  .work-main {
    grid-column: 1/-1;
  }
  .milestone-controls {
    display: grid;
    grid-template-columns: 1fr;
  }
  .status-step {
    min-height: 42px;
  }
  .work-actions {
    flex-direction: column;
  }
  .processing-layout {
    grid-template-columns: 1fr;
  }
  .search-tools {
    grid-template-columns: 1fr;
  }
  .search-entity-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .document-grid {
    grid-template-columns: 1fr;
  }
  .mobile-nav {
    position: fixed;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px max(12px, env(safe-area-inset-left))
      calc(8px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .mobile-nav button {
    border: 0;
    background: transparent;
    color: #73847d;
    font-size: 22px;
  }
  .mobile-nav button.active {
    color: var(--green-2);
  }
  .mobile-nav small {
    display: block;
    font-size: 10px;
    font-weight: 800;
    margin-top: 2px;
  }
  .form-actions {
    flex-direction: column;
  }
  .form-actions .primary,
  .form-actions .secondary {
    width: 100%;
    text-align: center;
  }
  #toast {
    left: 12px;
    right: 12px;
    bottom: 78px;
  }
  .dialog-shell {
    padding: 22px 18px;
  }
  #kituzes-card {
    display: none !important;
  }
  .kituzes-download-bar {
    margin: -8px 42px 12px 0;
    align-items: stretch;
    flex-direction: column;
  }
  .kituzes-download-bar a {
    text-align: center;
  }
}
