:root {
  --green: #00482b;
  --deep: #002f1d;
  --gold: #b58d16;
  --bg: #f6f7f4;
  --paper: #ffffff;
  --line: #dfe5dc;
  --muted: #66736b;
  --danger: #b13b2e;
  --ink: #17211b;
  --soft: #eef3ec;
  --soft-strong: #dfeadf;
  --shadow: 0 18px 52px rgba(21, 44, 31, 0.10);
  --shadow-soft: 0 10px 28px rgba(21, 44, 31, 0.08);
  --topbar-height: 79px;
  --sidebar-expanded: 272px;
  --sidebar-collapsed: 76px;
  --sidebar-width: var(--sidebar-expanded);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(231, 238, 230, 0.92), rgba(246, 247, 244, 0.98) 260px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

body.nav-collapsed {
  --sidebar-width: var(--sidebar-collapsed);
}

body.auth-pending .topbar,
body.auth-pending main {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(244, 246, 241, 0.96);
}

.login-screen[hidden] {
  display: none !important;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 64px rgba(0, 47, 29, 0.16);
}

.login-card .brand p {
  color: var(--green);
}

.login-card .brand > div > span {
  color: var(--muted);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  min-height: var(--topbar-height);
  width: 100%;
  background: var(--green);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px rgba(0, 47, 29, 0.18);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: block;
  padding: 3px;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
}

.login-card .brand-mark {
  filter: drop-shadow(0 8px 16px rgba(0, 47, 29, 0.14));
}

.brand p,
h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(1.45rem, 1.9vw, 1.85rem);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 1.08rem;
  line-height: 1.2;
}

.brand p {
  color: white;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.1;
}

.brand > div > span,
.eyebrow,
label,
td small {
  color: var(--muted);
}

.topbar .brand > div > span,
.topbar .meta {
  color: rgba(255, 255, 255, 0.78);
}

.app-link,
.primary,
.secondary,
.danger-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 760;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.app-link,
.secondary {
  background: var(--soft);
  color: var(--green);
}

.topbar .app-link,
.topbar .secondary {
  background: rgba(255, 255, 255, 0.13);
  color: white;
}

.topbar .app-link:hover,
.topbar .secondary:hover {
  background: rgba(255, 255, 255, 0.22);
}

.primary {
  background: var(--green);
  color: white;
  box-shadow: 0 10px 24px rgba(0, 72, 43, 0.18);
}

.app-link:hover,
.secondary:hover,
.primary:hover,
.danger-solid:hover {
  transform: translateY(-1px);
}

.app-link:hover,
.secondary:hover {
  background: var(--soft-strong);
}

.danger {
  color: var(--danger);
}

.danger-solid {
  background: var(--danger);
  color: white;
  box-shadow: 0 10px 28px rgba(177, 59, 46, 0.22);
}

.danger-solid:hover,
.danger-solid:focus-visible {
  background: #8f2f25;
}

.save-status {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0 12px;
  border-radius: 6px;
  background: #eaf0e4;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 850;
}

.save-status.saving {
  background: #fff3d6;
  color: #80610b;
}

.save-status.error {
  background: #fae8e5;
  color: var(--danger);
}

.config-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

main {
  max-width: none;
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 0 0 var(--sidebar-width);
  padding: 22px 24px 32px;
  display: block;
  transition: margin-left 0.18s ease;
}

.admin-workspace {
  width: min(100%, 1560px);
  min-width: 0;
  margin: 0 auto;
}

.side-nav {
  position: fixed;
  inset: var(--topbar-height) auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: stretch;
  gap: 20px;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: var(--green);
  color: white;
  box-shadow: 12px 0 34px rgba(0, 47, 29, 0.18);
  overflow-x: hidden;
  overflow-y: auto;
  transition: width 0.18s ease;
}

.side-controls {
  align-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.side-control {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.side-control:hover,
.side-control:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

.side-control[aria-pressed="true"] {
  background: white;
  color: var(--green);
  border-color: white;
}

.side-control[aria-pressed="false"] {
  background: rgba(181, 141, 22, 0.28);
  color: #ffe7a1;
  border-color: rgba(255, 231, 161, 0.34);
}

.side-control svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.side-control span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.side-nav section {
  display: grid;
  gap: 6px;
}

.side-nav p {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 820;
  text-transform: uppercase;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 720;
  text-align: left;
  white-space: nowrap;
}

.side-link:hover,
.side-link:focus-visible {
  background: rgba(255, 255, 255, 0.10);
  color: white;
}

.side-link.active {
  background: rgba(255, 255, 255, 0.16);
  color: white;
  box-shadow: inset 3px 0 0 var(--gold);
}

.admin-user-menu {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 720;
}

.tabs {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  background: transparent;
  color: var(--green);
  font-weight: 760;
  white-space: nowrap;
}

.side-link svg,
.tab svg,
.admin-user-menu svg,
.info-strip svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.tab.active,
.secondary.active {
  background: var(--green);
  color: white;
  box-shadow: 0 8px 22px rgba(0, 72, 43, 0.18);
}

.side-link.tab {
  color: rgba(255, 255, 255, 0.82);
}

.side-link.tab.active {
  background: rgba(255, 255, 255, 0.16);
  color: white;
  box-shadow: inset 3px 0 0 var(--gold);
}

body.nav-collapsed:not(.nav-hovering) .side-nav {
  padding-inline: 12px;
}

body.nav-collapsed.nav-hovering .side-nav {
  width: var(--sidebar-expanded);
}

body.nav-collapsed:not(.nav-hovering) .side-link {
  width: 52px;
  padding-inline: 0;
  justify-content: center;
}

body.nav-collapsed:not(.nav-hovering) .side-link span,
body.nav-collapsed:not(.nav-hovering) .side-nav p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.nav-collapsed:not(.nav-hovering) .side-link.active {
  box-shadow: inset 0 -3px 0 var(--gold);
}

.panel {
  display: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel.active {
  display: block;
}

#configPanel.active {
  display: flex;
  flex-direction: column;
}

#configPanel > .section-head {
  order: 1;
}

#configPanel > .plan-kpi-grid {
  order: 2;
}

#configPanel > .info-strip {
  order: 3;
}

#configPanel > .edit-card {
  order: 4;
  margin: 16px 20px;
}

#configPanel > .task-toolbar {
  order: 5;
}

#configPanel > #taskFilters {
  order: 6;
}

#configPanel > .table-wrap {
  order: 7;
}

#configPanel > .split {
  order: 8;
}

.plan-kpi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 14px;
  padding: 18px 20px 0;
}

.plan-kpi {
  display: grid;
  grid-template-columns: 54px minmax(104px, 0.72fr) minmax(150px, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(21, 44, 31, 0.06);
}

.plan-kpi > div {
  min-width: 0;
  overflow: hidden;
}

.plan-kpi > svg {
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: 12px;
  background: #eaf3ed;
  color: var(--green);
}

.plan-kpi.crop > svg {
  background: #fff1d7;
  color: #bd8100;
}

.plan-kpi.scouts {
  grid-template-columns: 58px 1fr;
}

.plan-kpi span,
.plan-kpi small,
.plan-kpi em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 720;
  line-height: 1.15;
}

.plan-kpi strong {
  display: grid;
  align-content: start;
  gap: 3px;
  color: var(--ink);
  min-width: 0;
}

.plan-kpi b {
  display: block;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.kpi-track {
  width: 100%;
  max-width: none;
  height: 8px;
  margin: 8px 0 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ece6;
}

.kpi-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.plan-kpi.crop .kpi-track {
  background: #f9ecd5;
}

.plan-kpi.crop .kpi-track span {
  background: #c88a00;
}

.info-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 20px 0;
  padding: 10px 12px;
  border: 1px solid #b9d9f4;
  border-radius: 8px;
  background: #eef8ff;
  color: #24506f;
  font-weight: 720;
}

.section-head,
.filters,
.task-toolbar,
.bulk-actions,
.pagination-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.task-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9c7a16;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 176px), 1fr));
  justify-content: flex-start;
  align-items: end;
  background: #fbfcf8;
}

#photoFilters {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 164px), 1fr));
}

#addTaskForm,
#userCreateForm {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

#taskFilters,
#reportFilters,
.bulk-task-controls {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.filters > *,
.filters label,
.filters .checkbox-filter,
.filters button {
  min-width: 0;
  max-width: 100%;
}

.filters button {
  width: 100%;
  min-height: 48px;
  white-space: normal;
  line-height: 1.08;
  text-align: center;
}

.bulk-actions {
  justify-content: flex-start;
  background: #ffffff;
}

.pagination-bar {
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

.pagination-bar.bottom {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 780;
}

.pagination-size select {
  min-height: 36px;
  width: 82px;
  padding: 7px 28px 7px 10px;
}

.photo-page-summary {
  flex: 1 1 auto;
  min-width: 210px;
}

.pagination-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-actions button {
  min-height: 36px;
  padding: 8px 14px;
}

.bulk-task-form {
  border-top: 1px solid var(--line);
}

.bulk-task-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcf8;
  overflow: hidden;
}

.bulk-task-details summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) 24px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 16px;
  color: var(--green);
  font-weight: 820;
  cursor: pointer;
  list-style: none;
}

.bulk-task-details summary::-webkit-details-marker {
  display: none;
}

.bulk-task-details summary svg {
  width: 20px;
  height: 20px;
  transition: transform 0.16s ease;
}

.bulk-task-details[open] summary svg {
  transform: rotate(180deg);
}

.bulk-task-details .bulk-task-form {
  border-top: 1px solid var(--line);
}

.bulk-task-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.bulk-task-head h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.bulk-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bulk-task-controls {
  border-bottom: 1px solid var(--line);
}

.bulk-task-matrix-wrap {
  padding: 0 16px 16px;
  overflow-x: auto;
}

.bulk-task-matrix {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
}

.bulk-task-matrix th,
.bulk-task-matrix td {
  min-width: 76px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.bulk-task-matrix th:first-child,
.bulk-task-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 220px;
  max-width: 300px;
  background: white;
  text-align: left;
}

.bulk-task-matrix th {
  top: 0;
  background: #f8faf5;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.bulk-task-matrix th:first-child {
  z-index: 2;
  background: #f8faf5;
}

.bulk-task-matrix td:first-child {
  color: #1b241e;
  font-weight: 800;
}

.bulk-task-matrix input[type="checkbox"] {
  display: block;
  margin: 0 auto;
}

.bulk-task-existing {
  background: #eef4e9;
}

.task-progress-cell {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

.task-progress-cell strong {
  font-size: 1.18rem;
  line-height: 1.1;
}

.task-progress-cell small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.task-progress-cell label {
  display: grid;
  grid-template-columns: auto minmax(72px, 110px);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.task-progress-cell input {
  min-height: 34px;
  padding: 6px 8px;
}

.task-row-card td {
  vertical-align: middle;
  background: #fff;
}

.task-row-card:hover td {
  background: #fbfcf8;
}

.task-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf3ed;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 820;
}

.task-type-badge.crop {
  background: #fff1d7;
  color: #996800;
}

.task-subject {
  color: var(--ink);
  font-weight: 820;
}

.task-stage {
  color: #314037;
  font-weight: 720;
}

.task-target-input {
  width: min(150px, 100%);
}

.progress-grade {
  font-weight: 900;
}

.task-progress-cell .progress-grade-0 { color: #b42318; }
.task-progress-cell .progress-grade-1 { color: #c83224; }
.task-progress-cell .progress-grade-2 { color: #d94a21; }
.task-progress-cell .progress-grade-3 { color: #e36c13; }
.task-progress-cell .progress-grade-4 { color: #c58a00; }
.task-progress-cell .progress-grade-5 { color: #a39a00; }
.task-progress-cell .progress-grade-6 { color: #7b9f1a; }
.task-progress-cell .progress-grade-7 { color: #4f9f32; }
.task-progress-cell .progress-grade-8 { color: #238b45; }
.task-progress-cell .progress-grade-9 { color: #006c3a; }

label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 0;
}

.checkbox-filter {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
  outline-color: rgba(0, 72, 43, 0.22);
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 72, 43, 0.46);
  box-shadow: 0 0 0 3px rgba(0, 72, 43, 0.10);
}

input[type="checkbox"] {
  min-height: auto;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
}

textarea {
  min-width: 100%;
  resize: vertical;
  line-height: 1.45;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 18px 20px;
  background: #f8faf6;
}

.photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 24px rgba(21, 44, 31, 0.08);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(21, 44, 31, 0.12);
}

.photo-card.is-selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 72, 43, 0.12), 0 14px 34px rgba(21, 44, 31, 0.12);
}

.photo-select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 760;
  box-shadow: 0 8px 26px rgba(0, 31, 19, 0.18);
}

.photo-preview-button {
  display: block;
  width: 100%;
  padding: 0;
  background: #dce3d7;
  cursor: zoom-in;
}

.photo-card img,
.photo-preview-button img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #dce3d7;
}

.photo-card form {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
}

.meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.section-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

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

.edit-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: white;
  box-shadow: 0 8px 22px rgba(21, 44, 31, 0.06);
}

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

.settings-card {
  align-content: start;
}

.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-card-head h2 {
  margin: 0;
}

.settings-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.settings-card-head.compact {
  align-items: center;
}

.settings-card-head svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted);
}

.tooltip-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.tooltip-icon:hover,
.tooltip-icon.is-open {
  background: #eef4e9;
  color: var(--green);
}

.tooltip-icon::after {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: min(300px, 70vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10251a;
  color: white;
  box-shadow: 0 16px 36px rgba(0, 31, 19, 0.22);
  content: attr(data-tooltip);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}

.tooltip-icon:hover::after,
.tooltip-icon.is-open::after {
  display: block;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  font-weight: 850;
}

.setting-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}

.setting-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.setting-field {
  display: grid;
  gap: 8px;
}

.setting-field select {
  min-height: 42px;
}

.setting-field input[type="range"] {
  width: 100%;
  min-height: 28px;
  padding: 0;
  accent-color: var(--green);
}

.thumbnail-progress {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.thumbnail-progress[hidden] {
  display: none !important;
}

.thumbnail-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.thumbnail-progress-head strong {
  color: var(--green);
}

.thumbnail-progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #e6ede2;
}

.thumbnail-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.25s ease;
}

.settings-actions {
  display: flex;
  justify-content: flex-start;
}

.apk-links-block {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.apk-links {
  display: grid;
  gap: 8px;
}

.apk-link-row {
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.apk-link-channel {
  color: var(--green);
  font-weight: 850;
}

.apk-link-channel small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.apk-link-row input {
  min-width: 0;
  height: 38px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.dictionary-sections {
  display: grid;
  gap: 12px;
  padding: 16px 18px 20px;
  background: #f8faf6;
}

.dictionary-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: 0 8px 22px rgba(21, 44, 31, 0.05);
}

.dictionary-section summary {
  display: grid;
  grid-template-columns: minmax(140px, auto) minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 18px;
  list-style: none;
  cursor: pointer;
  background: linear-gradient(180deg, #ffffff, #fbfcf9);
}

.dictionary-section summary::-webkit-details-marker {
  display: none;
}

.dictionary-section summary span {
  color: var(--green);
  font-size: 1.02rem;
  font-weight: 900;
}

.dictionary-section summary small {
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dictionary-section summary svg {
  justify-self: end;
  width: 18px;
  height: 18px;
  color: var(--green);
  transition: transform 0.16s ease;
}

.dictionary-section[open] summary svg {
  transform: rotate(180deg);
}

.dictionary-section-body {
  display: grid;
  gap: 12px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcf9;
}

.dictionary-stage-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.dictionary-subsection {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.dictionary-subsection h2 {
  color: var(--green);
  font-size: 0.98rem;
  font-weight: 900;
}

.dictionary-toolbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(220px, 320px);
  align-items: end;
  gap: 12px;
  min-width: 0;
}

.dictionary-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.dictionary-list {
  display: grid;
  gap: 0;
  max-height: 430px;
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.dictionary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 7px 10px 7px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
}

.dictionary-row:last-child {
  border-bottom: 0;
}

.dictionary-row:hover {
  background: #f8fbf6;
}

.dictionary-row span {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
  font-weight: 780;
}

.dictionary-row button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f2f5ef;
  color: var(--danger);
  font-size: 0.84rem;
  box-shadow: none;
}

.file-import {
  min-width: 0;
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: white;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 820;
}

.file-import input {
  min-height: 36px;
  padding: 7px 8px;
  background: #fbfcf9;
}

.table-wrap {
  overflow-x: auto;
  padding: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--green);
  font-size: 0.82rem;
}

td input {
  width: 120px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 16px 16px 0;
}

.metric {
  min-height: 72px;
  padding: 12px;
  border-radius: 8px;
  background: #eaf0e4;
}

.metric strong {
  display: block;
  color: var(--green);
  font-size: 1.5rem;
}

.danger {
  color: var(--danger);
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(8, 13, 10, 0.78);
}

.photo-viewer[hidden] {
  display: none !important;
}

.photo-viewer img {
  max-width: min(94vw, 1280px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  background: #111;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.photo-viewer-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 61;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #1b241e;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
}

body.viewer-open {
  overflow: hidden;
}

.admin-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 13, 10, 0.58);
}

.admin-dialog[hidden] {
  display: none !important;
}

.admin-dialog-card {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 80px rgba(0, 31, 19, 0.28);
}

.admin-dialog-card h2 {
  margin: 0;
  color: var(--green);
  font-size: 1.35rem;
}

.admin-dialog-card p {
  margin: 0;
  color: #314037;
  line-height: 1.45;
  white-space: pre-line;
}

.admin-dialog-input {
  display: grid;
  gap: 8px;
}

.admin-dialog-input[hidden] {
  display: none !important;
}

.admin-dialog-input small {
  color: var(--danger);
  font-weight: 760;
}

.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-dialog .danger {
  background: #c43c2f;
  color: white;
}

@media (max-width: 760px) {
  body {
    --topbar-height: 126px;
    --sidebar-expanded: min(236px, 72vw);
    --sidebar-collapsed: 64px;
  }

  main {
    padding: 14px 12px;
  }

  .side-nav {
    padding: 12px 10px;
  }

  body.nav-collapsed:not(.nav-hovering) .side-link {
    width: 44px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .plan-kpi-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .plan-kpi {
    grid-template-columns: 50px 1fr;
  }

  .plan-kpi > div:last-child {
    grid-column: 1 / -1;
  }

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

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

  .dictionary-section summary {
    grid-template-columns: minmax(0, 1fr) 24px;
  }

  .dictionary-section summary small {
    grid-column: 1 / -1;
    white-space: normal;
  }

  .dictionary-section-body,
  .dictionary-toolbar,
  .dictionary-stage-grid {
    grid-template-columns: 1fr;
  }

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

  .apk-link-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .section-head,
  .filters,
  .pagination-bar {
    align-items: stretch;
  }

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

  .pagination-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .checkbox-filter {
    justify-content: flex-start;
  }

  .task-toolbar-actions,
  .admin-dialog-actions {
    flex-direction: column;
  }

  .photo-viewer {
    padding: 18px;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  main {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .filters {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  }

  .plan-kpi-grid {
    grid-template-columns: 1fr;
  }

  .dictionary-section-body,
  .dictionary-stage-grid {
    grid-template-columns: 1fr;
  }
}
