:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #18221f;
  --muted: #63716b;
  --line: #d9dfd8;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #bc7a16;
  --red: #b42318;
  --red-soft: #fde8e7;
  --green-soft: #e6f4ef;
  --amber-soft: #fff2d6;
  --shadow: 0 18px 40px rgba(24, 34, 31, 0.11);
}

/* Modern visual refresh */
:root {
  --bg: #f3f6f1;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --ink: #17211e;
  --muted: #65746e;
  --line: #d8e1dc;
  --line-strong: #c1cec7;
  --teal: #0b7a6f;
  --teal-dark: #075f57;
  --amber: #b56d12;
  --amber-soft: #fff2d1;
  --red: #b3261e;
  --red-soft: #fde9e7;
  --green-soft: #e5f5ec;
  --shadow: 0 18px 48px rgba(23, 33, 30, 0.1);
  --shadow-soft: 0 10px 28px rgba(23, 33, 30, 0.07);
}

html {
  background:
    linear-gradient(180deg, #f7faf6 0%, #eef5f1 42%, #f8faf7 100%);
}

body {
  background:
    linear-gradient(90deg, rgba(11, 122, 111, 0.05) 0, transparent 34%, rgba(181, 109, 18, 0.04) 100%);
}

button,
input,
select {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

button {
  box-shadow: 0 8px 18px rgba(11, 122, 111, 0.16);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

input,
select {
  border-color: #d3ded8;
  box-shadow: 0 1px 0 rgba(23, 33, 30, 0.03);
}

input:focus,
select:focus {
  border-color: rgba(11, 122, 111, 0.75);
  box-shadow: 0 0 0 4px rgba(11, 122, 111, 0.12);
  outline: none;
}

.login-shell {
  padding: 28px;
}

.login-panel {
  border-color: rgba(216, 225, 220, 0.9);
  box-shadow: 0 28px 72px rgba(23, 33, 30, 0.14);
  overflow: hidden;
  position: relative;
}

.login-panel::before {
  background: linear-gradient(90deg, var(--teal), #66bfae 55%, #f2b84d);
  content: "";
  height: 5px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.login-logo {
  filter: drop-shadow(0 12px 18px rgba(23, 33, 30, 0.12));
}

.app {
  padding: 24px;
}

.topbar {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(216, 225, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
  padding: 16px;
}

.main-logo {
  border-color: #dfe7e2;
  box-shadow: 0 12px 26px rgba(23, 33, 30, 0.08);
}

.session-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

#sessionUser {
  color: var(--teal-dark);
  font-weight: 800;
}

.ghost-button {
  box-shadow: none;
}

.ghost-button:hover {
  border-color: #bfd1c8;
  box-shadow: 0 8px 18px rgba(23, 33, 30, 0.07);
}

.tabs {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px;
}

.tab {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  min-width: 124px;
}

.tab:hover {
  background: #f4f8f5;
  border-color: #d6e3dd;
}

.tab.active {
  background: #e8f5f1;
  border-color: #b7d9d0;
  box-shadow: inset 0 -2px 0 var(--teal);
  color: var(--teal-dark);
}

.panel {
  gap: 18px;
}

.toolbar,
.week-controls,
.report-card,
.catalog-box,
.permission-card,
.new-product {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(216, 225, 220, 0.95);
  box-shadow: var(--shadow-soft);
}

.toolbar,
.inline-form {
  border-radius: 8px;
}

.toolbar {
  padding: 16px;
}

.inline-form:not(.catalog-form) {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.report-card .inline-form,
.catalog-box .inline-form,
.permission-card .inline-form {
  box-shadow: none;
}

label {
  color: #53655e;
}

.table-status {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(216, 225, 220, 0.8);
  border-radius: 8px;
  padding: 10px 12px;
}

.due-reminders {
  background: linear-gradient(135deg, #fff8e8 0%, #fffdf7 100%);
  border-color: #efd18a;
  box-shadow: var(--shadow-soft);
}

.due-reminder-item {
  box-shadow: 0 6px 16px rgba(23, 33, 30, 0.05);
}

.week-controls {
  padding: 14px 16px;
}

.week-toggle {
  box-shadow: none;
}

.week-toggle.active {
  box-shadow: 0 8px 18px rgba(11, 122, 111, 0.18);
}

.table-wrap {
  background: white;
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

th {
  background: #eef5f1;
  border-bottom: 1px solid var(--line-strong);
  color: #2f453d;
}

td {
  color: #1d2925;
}

tbody tr:nth-child(even) td {
  background: #fbfdfb;
}

tbody tr:hover td {
  background: #f3faf7;
}

.orders-table td.product-cell,
.orders-table th.product-head {
  box-shadow: 8px 0 14px -12px rgba(23, 33, 30, 0.36);
}

.product-name,
.product-name-button {
  color: #142521;
}

.product-meta {
  color: #72817b;
}

.cell-input {
  border-color: rgba(193, 206, 199, 0.9);
  font-weight: 700;
}

.cell-input[data-field="S"] {
  background: #fde7e4;
}

.cell-input[data-field="P"] {
  background: #fff1c9;
}

.cell-input[data-field="I"] {
  background: #e2f5ea;
}

.group-signature-row td {
  background: #f5f8f6;
}

.catalog-head h2,
.permission-head h2,
.due-reminders h2 {
  color: var(--teal-dark);
}

.catalog-search {
  max-width: 520px;
}

.scope-list,
.report-weeks-block {
  background: #f8fbf9;
}

.scope-option,
.report-week-selector label {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.scope-option:hover,
.report-week-selector label:hover {
  background: #eef7f4;
}

.danger-button {
  box-shadow: none;
}

.danger-button:hover {
  border-color: #e79890;
}

@media (max-width: 980px) {
  .app {
    padding: 12px;
  }

  .topbar,
  .toolbar,
  .week-controls,
  .table-status,
  .report-card,
  .catalog-box,
  .permission-card,
  .inline-form:not(.catalog-form) {
    box-shadow: 0 8px 20px rgba(23, 33, 30, 0.07);
  }

  .topbar {
    padding: 14px;
  }

  .session-box {
    padding: 8px 10px;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .tab {
    min-width: 112px;
  }

  .toolbar {
    padding: 14px;
  }

  .week-selector {
    gap: 8px;
  }

  .orders-table th,
  .orders-table td {
    padding: 8px 5px;
  }

  .cell-input {
    border-radius: 7px;
  }

  .mobile-week-label {
    border-radius: 7px;
  }
}

.editor-motivation {
  background:
    linear-gradient(135deg, rgba(11, 122, 111, 0.09) 0%, rgba(255, 242, 209, 0.78) 100%),
    white;
  border: 1px solid #c9ddd5;
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 6px;
  margin-top: 2px;
  padding: 16px 18px;
}

.editor-motivation span {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-motivation p {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  margin: 0;
}

@media (max-width: 980px) {
  .editor-motivation {
    padding: 14px;
  }

  .editor-motivation p {
    font-size: 0.94rem;
  }
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: var(--teal-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  min-height: 40px;
  padding: 0 10px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: #eef2ee;
  color: #30413a;
  font-size: 0.78rem;
  position: sticky;
  top: 0;
  z-index: 2;
}

td {
  background: white;
  font-size: 0.88rem;
}

.hidden {
  display: none !important;
}

.access-hidden {
  display: none !important;
}

.eyebrow {
  color: var(--amber);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 26px;
  margin: 0 auto;
  max-width: 430px;
  padding: 34px;
  width: 100%;
}

.login-logo {
  align-self: center;
  display: block;
  height: auto;
  justify-self: center;
  max-height: 190px;
  max-width: min(310px, 100%);
  object-fit: contain;
  width: 100%;
}

.login-form {
  display: grid;
  gap: 16px;
}

.form-error {
  color: var(--red);
  min-height: 20px;
}

.form-help {
  color: var(--muted);
  min-height: 20px;
}

.app {
  margin: 0 auto;
  max-width: 1580px;
  padding: 22px;
}

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

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

.main-logo {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(24, 34, 31, 0.08);
  display: block;
  flex: 0 0 auto;
  height: 78px;
  object-fit: contain;
  padding: 8px;
  width: 150px;
}

.session-box {
  align-items: center;
  display: flex;
  gap: 12px;
}

.ghost-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost-button:hover {
  background: #f0f3ef;
}

.tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  min-width: 118px;
}

.tab:hover,
.tab.active {
  background: transparent;
  border-bottom-color: var(--teal);
  color: var(--ink);
}

.panel {
  display: grid;
  gap: 16px;
}

.due-reminders {
  background: #fff8e8;
  border: 1px solid #f1d287;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.due-reminders h2 {
  font-size: 1rem;
  margin: 0;
}

.due-reminders p {
  color: var(--muted);
  margin: 0;
}

.due-reminders ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.due-reminders li {
  line-height: 1.35;
}

.due-reminders strong {
  color: var(--ink);
}

.due-reminders-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.due-reminders-counter {
  align-items: center;
  background: white;
  border: 1px solid #f1d287;
  border-radius: 999px;
  color: var(--amber);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.due-reminders-list {
  display: grid;
  gap: 10px;
}

.due-reminder-item {
  align-items: start;
  background: white;
  border: 1px solid #f1d287;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 12px 14px;
}

.due-reminder-item.is-done {
  background: #f3fbf8;
  border-color: #b8dfcf;
}

.due-reminder-check {
  margin-top: 3px;
  min-height: 0;
  width: 18px;
}

.due-reminder-body {
  display: grid;
  gap: 8px;
}

.due-reminder-main {
  display: grid;
  gap: 4px;
}

.due-reminder-meta {
  color: var(--ink);
  font-size: 0.94rem;
}

.due-reminder-note {
  color: var(--muted);
  font-size: 0.86rem;
}

.due-reminder-state {
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.toolbar,
.inline-form {
  align-items: end;
  display: grid;
  column-gap: 18px;
  row-gap: 12px;
  grid-template-columns: 170px minmax(280px, 1fr) 170px 230px auto auto auto;
}

.wide-control {
  min-width: 220px;
}

.new-product {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.new-product summary {
  cursor: pointer;
  font-weight: 800;
}

.new-product .inline-form {
  grid-template-columns: minmax(220px, 1.2fr) 120px 160px 180px 140px auto auto;
  margin-top: 14px;
}

.table-status {
  color: var(--muted);
  display: flex;
  font-size: 0.86rem;
  gap: 16px;
  justify-content: space-between;
}

.order-save-footer {
  display: flex;
  justify-content: flex-end;
}

.order-save-footer button {
  min-width: 190px;
}

.week-controls {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 12px 14px;
}

.week-controls-head {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.84rem;
  font-weight: 800;
  gap: 10px;
  white-space: nowrap;
}

.week-controls-head button {
  min-height: 34px;
  padding: 0 12px;
}

.week-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.week-toggle {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 36px;
  padding: 0 12px;
}

.week-toggle:hover {
  background: #f0f3ef;
}

.week-toggle.active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(24, 34, 31, 0.06);
  max-height: 68vh;
  overflow: auto;
}

.table-wrap.compact {
  max-height: 62vh;
}

.orders-table {
  min-width: calc(580px + (var(--week-count, 4) * 290px));
}

.orders-table th.product-head,
.orders-table td.product-cell {
  left: 0;
  min-width: 290px;
  position: sticky;
  z-index: 3;
}

.orders-table td.product-cell {
  background: white;
  z-index: 1;
}

.product-name {
  color: var(--ink);
  font-weight: 800;
  max-width: 320px;
}

.product-name-button {
  background: transparent;
  border: 0;
  color: var(--ink);
  display: block;
  font-weight: 800;
  min-height: 0;
  padding: 0;
  text-align: left;
  width: 100%;
}

.product-name-button:hover {
  background: transparent;
  color: var(--teal);
  text-decoration: underline;
}

.product-meta {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 3px;
}

.mobile-week-label {
  display: none;
}

.row-actions {
  display: flex;
  gap: 8px;
  min-width: 150px;
}

.mobile-row-actions {
  display: none;
}

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.danger-button {
  background: #fff5f4;
  border: 1px solid #f3b8b2;
  color: var(--red);
}

.danger-button:hover {
  background: #ffe6e3;
}

.week-label {
  text-align: center;
}

.field-label {
  text-align: center;
  width: 92px;
}

.cell-input {
  min-width: 84px;
  width: 100%;
}

.order-cell {
  min-width: 92px;
}

.cell-input[data-field="S"] {
  background: var(--red-soft);
}

.cell-input[data-field="P"] {
  background: var(--amber-soft);
}

.cell-input[data-field="I"] {
  background: var(--green-soft);
}

.group-signature-row td {
  background: #f8faf8;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 9px 12px;
}

.group-signature-row + tr td {
  border-top: 2px solid #eef2ee;
}

.report-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.report-form {
  align-items: end;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) minmax(280px, 1.2fr) auto;
}

.report-form > label,
.report-weeks-block {
  min-width: 0;
}

.report-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2363716b' d='M6 8 .8 1.8 2.2.4 6 4.8 9.8.4 11.2 1.8z'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 12px 8px;
  padding-right: 34px;
}

.report-form input[type="date"] {
  padding-right: 10px;
}

.report-weeks-block {
  align-self: stretch;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.report-weeks-block span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.report-week-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.report-week-selector label {
  align-items: center;
  background: white;
  border: 1px solid #d5dfda;
  border-radius: 8px;
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  min-height: 38px;
  min-width: fit-content;
  padding: 8px 10px;
  white-space: nowrap;
}

.report-week-selector input[type="checkbox"] {
  appearance: none;
  background: white;
  border: 1.5px solid #95aba5;
  border-radius: 4px;
  display: inline-grid;
  height: 14px;
  margin: 0;
  place-items: center;
  width: 14px;
}

.report-week-selector input[type="checkbox"]::before {
  background: var(--teal);
  border-radius: 2px;
  content: "";
  height: 8px;
  transform: scale(0);
  transition: transform 120ms ease;
  width: 8px;
}

.report-week-selector input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.report-week-selector input[type="checkbox"]:checked {
  border-color: var(--teal);
}

.report-week-selector label:has(input:checked) {
  background: #eef7f4;
  border-color: #b9d8cf;
  color: var(--teal-dark);
}

.report-form .ghost-button {
  align-self: end;
  white-space: nowrap;
}

@media (min-width: 1024px) {
  .report-week-selector {
    flex-wrap: nowrap;
  }
}

#reportsTable th,
#reportsTable td {
  white-space: nowrap;
}

#reportsTable td:first-child {
  font-weight: 700;
}

#reportsTable .report-total-row td {
  background: #f4f7f5;
  font-weight: 800;
}

.catalog-stack {
  display: grid;
  gap: 16px;
}

.catalog-box {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.catalog-head {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.catalog-head p {
  color: var(--muted);
  font-size: 0.86rem;
}

.catalog-search {
  max-width: 420px;
}

.catalog-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.product-catalog-form {
  grid-template-columns: minmax(220px, 1.2fr) 120px 170px 190px 140px auto auto auto;
}

.product-catalog-form.editing-active {
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
  padding: 12px;
  scroll-margin-top: 120px;
}

.catalog-form.subcategory-form {
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1fr) auto auto;
}

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

.catalog-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.checkbox-line {
  align-items: center;
  color: var(--ink);
  display: flex;
  gap: 8px;
  min-height: 40px;
}

.checkbox-line input {
  min-height: 0;
  width: auto;
}

.user-form {
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 1fr) minmax(180px, 1fr) minmax(160px, 1fr) 160px auto auto;
}

.permission-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.permission-card.scope-disabled {
  opacity: 0.65;
}

.permission-head {
  display: grid;
  gap: 4px;
}

.permission-head p {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.permission-grid h3 {
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.scope-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
}

.scope-option {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 0.86rem;
  font-weight: 600;
  gap: 8px;
}

.scope-option input {
  min-height: 0;
  width: auto;
}

.reminder-form {
  grid-template-columns: minmax(200px, 1.2fr) 160px 180px 140px minmax(180px, 1fr) auto auto auto;
}

@media (max-width: 980px) {
  .app {
    padding: 16px;
  }

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

  .brand-lockup {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }

  .main-logo {
    height: 72px;
    width: min(180px, 100%);
  }

  .toolbar,
  .inline-form,
  .new-product .inline-form,
  .catalog-stack,
  .catalog-form,
  .catalog-form.subcategory-form,
  .user-form,
  .report-form,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .week-controls {
    align-items: stretch;
    display: grid;
    gap: 10px;
  }

  .order-save-footer {
    justify-content: stretch;
  }

  .order-save-footer button {
    width: 100%;
  }

  .week-controls-head {
    justify-content: space-between;
  }

  .week-desktop-control {
    display: none;
  }

  .week-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .week-toggle {
    min-height: 40px;
    padding: 0 6px;
    width: 100%;
  }

  .table-wrap {
    background: white;
    border: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(24, 34, 31, 0.06);
    max-height: 70vh;
    overflow: auto;
  }

  .orders-table {
    border-collapse: collapse;
    border-spacing: 0;
    min-width: 0;
  }

  .orders-table thead {
    display: table-header-group;
  }

  .orders-table th,
  .orders-table td {
    padding: 7px 4px;
  }

  .orders-table th:first-child,
  .orders-table td:first-child {
    min-width: 145px;
    width: 52%;
  }

  .orders-table th:not(:first-child),
  .orders-table td.order-cell {
    min-width: 44px;
    width: 16%;
  }

  .orders-table td.product-cell {
    left: 0;
    min-width: 145px;
    position: sticky;
    z-index: 1;
  }

  .orders-table td.category-cell,
  .orders-table td.subcategory-cell,
  .orders-table td.actions-cell {
    display: none;
  }

  .product-name {
    font-size: 0.8rem;
    line-height: 1.2;
    max-width: 145px;
  }

  .product-name-button {
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .product-meta {
    display: none;
  }

  .mobile-week-label {
    background: #e6f4ef;
    color: var(--teal-dark);
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 5px;
    padding: 4px 6px;
    text-transform: uppercase;
  }

  .orders-table th:first-child {
    font-size: 0.74rem;
    line-height: 1.15;
  }

  .orders-table th:not(:first-child) {
    font-size: 0.78rem;
    padding-left: 3px;
    padding-right: 3px;
  }

  .orders-table td.order-cell {
    padding-left: 3px;
    padding-right: 3px;
  }

  .cell-input {
    font-size: 0.78rem;
    min-height: 32px;
    min-width: 0;
    padding: 0 5px;
    text-align: center;
    width: 100%;
  }

  .group-signature-row td {
    font-size: 0.68rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .mobile-row-actions,
  .row-actions {
    display: none;
  }

  .session-box {
    width: 100%;
    justify-content: space-between;
  }

  .due-reminders-head {
    align-items: stretch;
    flex-direction: column;
  }

  .due-reminder-item {
    padding: 10px 12px;
  }
}

/* Modern visual refresh - final overrides */
:root {
  --bg: #f3f6f1;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --ink: #17211e;
  --muted: #65746e;
  --line: #d8e1dc;
  --line-strong: #c1cec7;
  --teal: #0b7a6f;
  --teal-dark: #075f57;
  --amber: #b56d12;
  --amber-soft: #fff2d1;
  --red: #b3261e;
  --red-soft: #fde9e7;
  --green-soft: #e5f5ec;
  --shadow: 0 18px 48px rgba(23, 33, 30, 0.1);
  --shadow-soft: 0 10px 28px rgba(23, 33, 30, 0.07);
}

html {
  background: linear-gradient(180deg, #f7faf6 0%, #eef5f1 42%, #f8faf7 100%);
}

body {
  background: linear-gradient(90deg, rgba(11, 122, 111, 0.05) 0, transparent 34%, rgba(181, 109, 18, 0.04) 100%);
}

button,
input,
select {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

button {
  box-shadow: 0 8px 18px rgba(11, 122, 111, 0.16);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

input,
select {
  border-color: #d3ded8;
  box-shadow: 0 1px 0 rgba(23, 33, 30, 0.03);
}

input:focus,
select:focus {
  border-color: rgba(11, 122, 111, 0.75);
  box-shadow: 0 0 0 4px rgba(11, 122, 111, 0.12);
  outline: none;
}

.login-shell {
  padding: 28px;
}

.login-panel {
  border-color: rgba(216, 225, 220, 0.9);
  box-shadow: 0 28px 72px rgba(23, 33, 30, 0.14);
  overflow: hidden;
  position: relative;
}

.login-panel::before {
  background: linear-gradient(90deg, var(--teal), #66bfae 55%, #f2b84d);
  content: "";
  height: 5px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.login-logo {
  filter: drop-shadow(0 12px 18px rgba(23, 33, 30, 0.12));
}

.app {
  padding: 24px;
}

.topbar {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(216, 225, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
  padding: 16px;
}

.main-logo {
  border-color: #dfe7e2;
  box-shadow: 0 12px 26px rgba(23, 33, 30, 0.08);
}

.session-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

#sessionUser {
  color: var(--teal-dark);
  font-weight: 800;
}

.ghost-button {
  box-shadow: none;
}

.ghost-button:hover {
  border-color: #bfd1c8;
  box-shadow: 0 8px 18px rgba(23, 33, 30, 0.07);
}

.tabs {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px;
}

.tab {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  min-width: 124px;
}

.tab:hover {
  background: #f4f8f5;
  border-color: #d6e3dd;
}

.tab.active {
  background: #e8f5f1;
  border-color: #b7d9d0;
  box-shadow: inset 0 -2px 0 var(--teal);
  color: var(--teal-dark);
}

.panel {
  gap: 18px;
}

.toolbar,
.week-controls,
.report-card,
.catalog-box,
.permission-card,
.new-product {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(216, 225, 220, 0.95);
  box-shadow: var(--shadow-soft);
}

.toolbar,
.inline-form {
  border-radius: 8px;
}

.toolbar {
  padding: 16px;
}

.inline-form:not(.catalog-form) {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.report-card .inline-form,
.catalog-box .inline-form,
.permission-card .inline-form {
  box-shadow: none;
}

label {
  color: #53655e;
}

.table-status {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(216, 225, 220, 0.8);
  border-radius: 8px;
  padding: 10px 12px;
}

.due-reminders {
  background: linear-gradient(135deg, #fff8e8 0%, #fffdf7 100%);
  border-color: #efd18a;
  box-shadow: var(--shadow-soft);
}

.due-reminder-item {
  box-shadow: 0 6px 16px rgba(23, 33, 30, 0.05);
}

.week-controls {
  padding: 14px 16px;
}

.week-toggle {
  box-shadow: none;
}

.week-toggle.active {
  box-shadow: 0 8px 18px rgba(11, 122, 111, 0.18);
}

.table-wrap {
  background: white;
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

th {
  background: #eef5f1;
  border-bottom: 1px solid var(--line-strong);
  color: #2f453d;
}

td {
  color: #1d2925;
}

tbody tr:nth-child(even) td {
  background: #fbfdfb;
}

tbody tr:hover td {
  background: #f3faf7;
}

.orders-table td.product-cell,
.orders-table th.product-head {
  box-shadow: 8px 0 14px -12px rgba(23, 33, 30, 0.36);
}

.product-name,
.product-name-button {
  color: #142521;
}

.product-meta {
  color: #72817b;
}

.cell-input {
  border-color: rgba(193, 206, 199, 0.9);
  font-weight: 700;
}

.cell-input[data-field="S"] {
  background: #fde7e4;
}

.cell-input[data-field="P"] {
  background: #fff1c9;
}

.cell-input[data-field="I"] {
  background: #e2f5ea;
}

.group-signature-row td {
  background: #f5f8f6;
}

.catalog-head h2,
.permission-head h2,
.due-reminders h2 {
  color: var(--teal-dark);
}

.catalog-search {
  max-width: 520px;
}

.scope-list,
.report-weeks-block {
  background: #f8fbf9;
}

.scope-option,
.report-week-selector label {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.scope-option:hover,
.report-week-selector label:hover {
  background: #eef7f4;
}

.danger-button {
  box-shadow: none;
}

.danger-button:hover {
  border-color: #e79890;
}

@media (max-width: 980px) {
  .app {
    padding: 12px;
  }

  .topbar,
  .toolbar,
  .week-controls,
  .table-status,
  .report-card,
  .catalog-box,
  .permission-card,
  .inline-form:not(.catalog-form) {
    box-shadow: 0 8px 20px rgba(23, 33, 30, 0.07);
  }

  .topbar {
    padding: 14px;
  }

  .session-box {
    padding: 8px 10px;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .tab {
    min-width: 112px;
  }

  .toolbar {
    padding: 14px;
  }

  .week-selector {
    gap: 8px;
  }

  .orders-table th,
  .orders-table td {
    padding: 8px 5px;
  }

  .cell-input {
    border-radius: 7px;
  }

  .mobile-week-label {
    border-radius: 7px;
  }
}
