:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #6f7e76;
  --muted-2: #94a098;
  --surface: #ffffff;
  --canvas: #f3f4ef;
  --line: #e5e8e1;
  --emerald-950: #082f25;
  --emerald-900: #0d4938;
  --emerald-800: #126048;
  --emerald-700: #177258;
  --emerald-100: #dceee6;
  --amber-500: #e2a23a;
  --amber-100: #fff1d1;
  --red-600: #c44949;
  --red-100: #fbe2df;
  --blue-600: #326bb5;
  --blue-100: #e0ecfb;
  --shadow: 0 16px 42px rgba(28, 44, 36, 0.08);
  --shadow-sm: 0 5px 16px rgba(28, 44, 36, 0.07);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --sidebar-width: 268px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 12%, rgba(226, 162, 58, 0.15), transparent 26%),
    linear-gradient(165deg, #0d4938 0%, #092f27 100%);
  color: #fff;
  transition: transform 180ms ease;
}

.sidebar::after {
  position: absolute;
  right: -100px;
  bottom: -100px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 42px rgba(255, 255, 255, 0.025), 0 0 0 84px rgba(255, 255, 255, 0.018);
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  color: #f5bd5b;
}

.brand strong {
  display: block;
  font-size: 21px;
  line-height: 1.1;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.61);
  font-size: 11px;
}

.nav-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow: auto;
  padding: 16px 14px;
  scrollbar-width: thin;
}

.nav-section-title {
  margin: 11px 12px 8px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  text-align: right;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset -3px 0 #f2b84f;
}

.nav-item .icon {
  color: #a8cfc0;
}

.nav-item.active .icon {
  color: #f2b84f;
}

.nav-badge {
  min-width: 22px;
  margin-right: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(226, 162, 58, 0.2);
  color: #ffd995;
  font-size: 10px;
  text-align: center;
}

.sidebar-footer {
  position: relative;
  z-index: 1;
  padding: 14px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.09);
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 12px;
  background: #e2a23a;
  color: #193128;
  font-size: 12px;
  font-weight: 800;
}

.user-card strong {
  display: block;
  font-size: 12px;
}

.user-card span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 10px;
}

.main-shell {
  min-height: 100vh;
  margin-right: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 72px;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(219, 224, 216, 0.85);
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(18px);
}

.mobile-menu {
  display: none;
}

.topbar-title h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.topbar-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: auto;
}

.portal-logout {
  white-space: nowrap;
}

.global-search {
  position: relative;
  width: min(29vw, 300px);
}

.global-search .icon {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--muted-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.global-search input {
  width: 100%;
  height: 40px;
  padding: 0 41px 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  transition: border 140ms ease, box-shadow 140ms ease;
}

.global-search input:focus {
  border-color: #5d9f88;
  box-shadow: 0 0 0 3px rgba(23, 114, 88, 0.1);
}

.icon-button {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

.icon-button:hover {
  border-color: #cbd3cc;
  background: #fafbf8;
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border: 2px solid white;
  border-radius: 50%;
  background: #d25d50;
}

.main-content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 26px 28px 46px;
  outline: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 22px;
}

.page-head h2 {
  margin: 0;
  font-size: clamp(23px, 2vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.page-head p {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-right: auto;
}

.btn {
  display: inline-flex;
  min-height: 41px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

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

.btn-primary {
  background: var(--emerald-900);
  color: #fff;
  box-shadow: 0 7px 15px rgba(13, 73, 56, 0.16);
}

.btn-primary:hover {
  background: var(--emerald-800);
}

.btn-secondary {
  border-color: var(--line);
  background: #fff;
  color: #314139;
}

.btn-danger {
  background: var(--red-100);
  color: var(--red-600);
}

.btn-ghost {
  min-height: 34px;
  padding: 5px 9px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 17px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  min-height: 146px;
  padding: 19px;
  border: 1px solid rgba(226, 231, 223, 0.9);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.kpi-card.featured {
  border-color: transparent;
  background:
    radial-gradient(circle at 15% 120%, rgba(226, 162, 58, 0.23), transparent 38%),
    linear-gradient(145deg, #0f5843, #0a3d31);
  color: #fff;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.featured .kpi-label {
  color: rgba(255, 255, 255, 0.67);
}

.kpi-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: #eef4f0;
  color: var(--emerald-800);
}

.featured .kpi-icon {
  background: rgba(255, 255, 255, 0.12);
  color: #f6c66e;
}

.kpi-value {
  margin-top: 15px;
  font-size: clamp(23px, 2.1vw, 31px);
  font-weight: 800;
  line-height: 1;
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 10px;
}

.trend-up {
  color: #13805f;
  font-weight: 700;
}

.featured .trend-up {
  color: #ffd78f;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 17px;
  margin-bottom: 17px;
}

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

.panel {
  overflow: hidden;
  border: 1px solid rgba(226, 231, 223, 0.9);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 15px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.panel-body {
  padding: 18px;
}

.chart-area {
  display: flex;
  height: 238px;
  flex-direction: column;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-700);
}

.legend-dot.amber {
  background: var(--amber-500);
}

.bars {
  display: flex;
  flex: 1;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  background-image: linear-gradient(to top, var(--line) 1px, transparent 1px);
  background-size: 100% 25%;
}

.bar-group {
  display: flex;
  height: 100%;
  flex: 1;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.bar {
  position: relative;
  width: min(16px, 38%);
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(to top, #0d4938, #2a8b6d);
  transition: height 400ms ease;
}

.bar.secondary {
  background: linear-gradient(to top, #c88924, #f0bd64);
}

.bar:hover::after {
  position: absolute;
  right: 50%;
  bottom: calc(100% + 6px);
  z-index: 4;
  padding: 3px 6px;
  border-radius: 5px;
  background: #1e2924;
  color: #fff;
  content: attr(data-value);
  font-size: 9px;
  white-space: nowrap;
  transform: translateX(50%);
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 9px;
  text-align: center;
}

.chart-labels span {
  flex: 1;
}

.progress-list {
  display: grid;
  gap: 19px;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
}

.progress-head strong {
  font-size: 12px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0eb;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f5c45, #36a17d);
}

.progress-fill.amber {
  background: linear-gradient(90deg, #c68520, #edb753);
}

.progress-fill.red {
  background: linear-gradient(90deg, #b84141, #e4776d);
}

.stock-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.mini-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbf8;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.mini-stat strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.quick-action {
  display: flex;
  min-height: 75px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  text-align: right;
  transition: border 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.quick-action:hover {
  border-color: #b5c9bf;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.quick-action-icon {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border-radius: 12px;
  background: var(--emerald-100);
  color: var(--emerald-800);
}

.quick-action:nth-child(2) .quick-action-icon {
  background: var(--amber-100);
  color: #a96c0d;
}

.quick-action:nth-child(3) .quick-action-icon {
  background: var(--blue-100);
  color: var(--blue-600);
}

.quick-action:nth-child(4) .quick-action-icon {
  background: #eee8f9;
  color: #7653a8;
}

.quick-action strong,
.quick-action span {
  display: block;
}

.quick-action strong {
  font-size: 12px;
}

.quick-action span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.data-table th {
  background: #fafbf8;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.data-table td {
  font-size: 11px;
}

.data-table tbody tr:hover {
  background: #fcfdfb;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-id {
  color: var(--emerald-800);
  font-weight: 800;
  direction: ltr;
  text-align: right;
}

.status {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf4f0;
  color: #176348;
  font-size: 9px;
  font-weight: 700;
}

.status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status.warning {
  background: var(--amber-100);
  color: #a3650a;
}

.status.danger {
  background: var(--red-100);
  color: var(--red-600);
}

.status.info {
  background: var(--blue-100);
  color: var(--blue-600);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.toolbar-search {
  position: relative;
  width: min(100%, 330px);
}

.toolbar-search .icon {
  position: absolute;
  top: 50%;
  right: 11px;
  color: var(--muted-2);
  transform: translateY(-50%);
}

.toolbar-search input,
.toolbar select {
  height: 37px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fafbf9;
}

.toolbar-search input {
  width: 100%;
  padding: 0 36px 0 12px;
}

.toolbar select {
  padding: 0 10px 0 28px;
  color: var(--muted);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 17px;
}

.summary-item {
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 19px;
}

.summary-item small {
  color: var(--muted-2);
  font-size: 9px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 30px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 18px;
  background: #edf4f0;
  color: var(--emerald-700);
}

.empty-state h3 {
  margin: 0;
}

.empty-state p {
  max-width: 360px;
  margin: 6px auto 0;
  color: var(--muted);
  font-size: 11px;
}

.trace-search-card {
  position: relative;
  overflow: hidden;
  padding: 27px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 10% 130%, rgba(226, 162, 58, 0.26), transparent 39%),
    linear-gradient(135deg, #0d4938, #082f27);
  color: #fff;
  box-shadow: 0 18px 45px rgba(10, 56, 44, 0.19);
}

.trace-search-card h3 {
  margin: 0;
  font-size: 20px;
}

.trace-search-card p {
  margin: 7px 0 18px;
  color: rgba(255, 255, 255, 0.66);
}

.trace-search-form {
  display: flex;
  max-width: 720px;
  gap: 9px;
}

.trace-search-form input {
  min-width: 0;
  height: 47px;
  flex: 1;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  direction: ltr;
}

.trace-search-form input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.trace-search-form input:focus {
  border-color: #f0bd64;
  box-shadow: 0 0 0 3px rgba(240, 189, 100, 0.14);
}

.trace-search-form .btn {
  background: #e4aa49;
  color: #1a342b;
}

.trace-result {
  display: grid;
  grid-template-columns: minmax(230px, 0.58fr) minmax(0, 1.42fr);
  gap: 17px;
  margin-top: 17px;
}

.trace-meta {
  display: grid;
  gap: 10px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

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

.meta-row span {
  color: var(--muted);
  font-size: 10px;
}

.meta-row strong {
  font-size: 11px;
  text-align: left;
}

.timeline {
  position: relative;
  padding: 3px 10px 3px 0;
}

.timeline::before {
  position: absolute;
  top: 18px;
  right: 27px;
  bottom: 18px;
  width: 2px;
  background: #e2e8e3;
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: start;
  padding: 8px 0 18px;
}

.timeline-icon {
  z-index: 1;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--emerald-700);
  color: #fff;
  box-shadow: 0 0 0 1px #dce4de;
}

.timeline-item h4 {
  margin: 3px 0 0;
  font-size: 12px;
}

.timeline-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.timeline-item time {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 9px;
  direction: ltr;
}

.alert-list {
  display: grid;
  gap: 9px;
}

.flour-distribution-hero {
  position: relative;
  display: flex;
  min-height: 215px;
  align-items: center;
  gap: 34px;
  overflow: hidden;
  margin-bottom: 17px;
  padding: 28px 30px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 7% 140%, rgba(226, 162, 58, 0.3), transparent 40%),
    radial-gradient(circle at 78% -30%, rgba(255, 255, 255, 0.09), transparent 35%),
    linear-gradient(135deg, #0b503d, #082f27);
  color: #fff;
  box-shadow: 0 20px 46px rgba(10, 56, 44, 0.17);
}

.bakery-request-bridge {
  display: flex;
  min-height: 210px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.bakery-request-bridge > div:first-child {
  max-width: 700px;
}

.bakery-request-bridge .hero-eyebrow {
  margin-bottom: 11px;
}

.request-bridge-state {
  display: flex;
  width: min(100%, 260px);
  flex: 0 0 260px;
  align-items: center;
  gap: 12px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.09);
}

.request-bridge-state > span {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  background: rgba(226, 162, 58, 0.18);
  color: #f3c36e;
}

.request-bridge-state small,
.request-bridge-state strong,
.request-bridge-state p {
  display: block;
}

.request-bridge-state small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 8px;
}

.request-bridge-state strong {
  margin-top: 2px;
  font-size: 15px;
}

.request-bridge-state p {
  margin: 2px 0 0;
  color: #f2c472;
  font-size: 9px;
  direction: ltr;
}

.flour-request-notice {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 17px;
  padding: 13px 15px;
  border: 1px solid #cee2d8;
  border-radius: 13px;
  background: #f2f8f5;
  color: var(--primary);
}

.flour-request-notice > span:first-child {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border-radius: 11px;
  background: #fff;
}

.flour-request-notice > div {
  min-width: 0;
  flex: 1;
}

.flour-request-notice small,
.flour-request-notice strong,
.flour-request-notice p {
  display: block;
  margin: 0;
}

.flour-request-notice small {
  color: var(--muted);
  font-size: 8px;
}

.flour-request-notice strong {
  margin-top: 2px;
  font-size: 11px;
}

.flour-request-notice p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.flour-request-notice.warning {
  border-color: #ead9ad;
  background: #fff9eb;
  color: #9a6b18;
}

.flour-request-notice.danger {
  border-color: #efcfc7;
  background: #fff3f0;
  color: #a54433;
}

.flour-distribution-hero::after {
  position: absolute;
  top: -85px;
  left: -50px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 35px rgba(255, 255, 255, 0.025), 0 0 0 70px rgba(255, 255, 255, 0.015);
}

.allocation-hero-copy {
  position: relative;
  z-index: 1;
  flex: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f6ca7b;
  font-size: 9px;
  font-weight: 700;
}

.allocation-hero-copy h3 {
  max-width: 670px;
  margin: 13px 0 7px;
  font-size: clamp(21px, 2.1vw, 29px);
  line-height: 1.35;
}

.allocation-hero-copy > p {
  max-width: 650px;
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.hero-pills span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.76);
  font-size: 9px;
}

.hero-stock-card {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(100%, 310px);
  flex: 0 0 310px;
  align-items: center;
  gap: 15px;
  padding: 19px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(10px);
}

.hero-stock-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 15px;
  background: rgba(226, 162, 58, 0.18);
  color: #f4c470;
}

.hero-stock-card span,
.hero-stock-card strong,
.hero-stock-card p {
  display: block;
}

.hero-stock-card > div > span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 9px;
}

.hero-stock-card strong {
  margin-top: 4px;
  font-size: 25px;
  line-height: 1.2;
}

.hero-stock-card strong small {
  font-size: 11px;
}

.hero-stock-card p {
  margin: 4px 0 0;
  color: #f4cb81;
  font-size: 9px;
}

.flour-allocation-summary .summary-item {
  position: relative;
  overflow: hidden;
}

.flour-allocation-summary .summary-item::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(23, 114, 88, 0.45));
  content: "";
}

.allocation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.65fr);
  gap: 17px;
  align-items: start;
}

.allocation-layout > .panel {
  min-width: 0;
}

.quota-panel {
  overflow: visible;
}

.bakery-quota-list {
  display: grid;
  gap: 12px;
}

.bakery-quota-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafbf8;
}

.bakery-quota-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.bakery-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--emerald-100);
  color: var(--emerald-800);
  font-size: 11px;
  font-weight: 800;
}

.bakery-quota-head strong,
.bakery-quota-head span {
  display: block;
}

.bakery-quota-head strong {
  font-size: 11px;
}

.bakery-quota-head div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.quota-values {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 7px;
  color: var(--muted);
  font-size: 9px;
}

.quota-values strong {
  color: var(--ink);
}

.quota-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 8px;
}

.table-subtext {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 400;
}

.alert-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.alert-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--amber-100);
  color: #a66a0d;
}

.alert-item strong,
.alert-item span {
  display: block;
}

.alert-item strong {
  font-size: 11px;
}

.alert-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.activity-list {
  display: grid;
  gap: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: #eef4f0;
  color: var(--emerald-700);
}

.activity-item strong {
  display: block;
  font-size: 10px;
}

.activity-item p,
.activity-item time {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  overflow: auto;
  place-items: center;
  padding: 20px;
  background: rgba(7, 25, 19, 0.56);
  backdrop-filter: blur(6px);
  animation: fade-in 150ms ease;
}

.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(4, 21, 16, 0.28);
  animation: modal-in 180ms ease;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head-icon {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 12px;
  background: var(--emerald-100);
  color: var(--emerald-800);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.modal-close {
  margin-right: auto;
}

.modal-body {
  padding: 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  background: #fafbf8;
}

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

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #34433c;
  font-size: 10px;
  font-weight: 700;
}

.field label small {
  color: var(--muted-2);
  font-weight: 400;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #dce1dc;
  border-radius: 10px;
  outline: none;
  background: #fff;
  transition: border 140ms ease, box-shadow 140ms ease;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #5d9f88;
  box-shadow: 0 0 0 3px rgba(23, 114, 88, 0.1);
}

.field-hint {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 9px;
}

.form-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 17px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #eef4f0;
}

.form-total span {
  color: var(--muted);
  font-size: 11px;
}

.form-total strong {
  color: var(--emerald-900);
  font-size: 20px;
}

.toast-root {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 120;
  display: grid;
  gap: 9px;
}

.toast {
  display: flex;
  width: min(360px, calc(100vw - 36px));
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: #17362c;
  color: #fff;
  box-shadow: 0 15px 40px rgba(9, 35, 27, 0.2);
  animation: toast-in 180ms ease;
}

.toast .icon {
  color: #f2bd61;
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  font-size: 11px;
}

.toast span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 9px;
}

.screen-overlay {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .allocation-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 940px) {
  .sidebar {
    transform: translateX(105%);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main-shell {
    margin-right: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .screen-overlay {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    visibility: hidden;
    background: rgba(7, 25, 19, 0.45);
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  body.sidebar-open .screen-overlay {
    visibility: visible;
    opacity: 1;
  }

  .content-grid,
  .content-grid.equal,
  .trace-result {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    height: 64px;
    gap: 10px;
    padding: 0 14px;
  }

  .topbar-title p,
  .topbar-actions .notification-button {
    display: none;
  }

  .global-search {
    width: 40px;
  }

  .portal-logout {
    min-width: auto;
    padding: 0 10px;
    font-size: 8px;
  }

  .global-search input {
    padding: 0;
    color: transparent;
    cursor: pointer;
  }

  .global-search:focus-within {
    position: absolute;
    right: 62px;
    left: 14px;
    z-index: 3;
    width: auto;
  }

  .global-search:focus-within input {
    padding: 0 41px 0 14px;
    color: var(--ink);
    cursor: text;
  }

  .main-content {
    padding: 20px 14px 36px;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 17px;
  }

  .page-actions {
    width: 100%;
    margin-right: 0;
  }

  .page-actions .btn {
    flex: 1;
  }

  .kpi-grid,
  .summary-strip {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi-card {
    min-height: 132px;
    padding: 15px;
  }

  .kpi-value {
    font-size: 22px;
  }

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

  .stock-summary {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-search {
    width: 100%;
  }

  .trace-search-card {
    padding: 20px;
  }

  .flour-distribution-hero {
    align-items: stretch;
    flex-direction: column;
    gap: 20px;
    padding: 21px;
  }

  .bakery-request-bridge {
    align-items: stretch;
    flex-direction: column;
  }

  .request-bridge-state {
    width: 100%;
    flex: auto;
  }

  .hero-stock-card {
    width: 100%;
    flex: auto;
  }

  .bakery-quota-list {
    grid-template-columns: 1fr;
  }

  .trace-search-form {
    flex-direction: column;
  }

  .timeline-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .timeline-item time {
    grid-column: 2;
  }

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

  .field.full {
    grid-column: auto;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }
}

@media (max-width: 430px) {
  .kpi-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 124px;
  }

  .page-actions {
    flex-direction: column;
  }
}

@media print {
  .sidebar,
  .topbar,
  .page-actions,
  .toolbar,
  .quick-actions {
    display: none !important;
  }

  .main-shell {
    margin: 0;
  }

  .main-content {
    width: 100%;
    padding: 0;
  }

  .panel,
  .kpi-card {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* Individual user permissions */
.access-summary {
  margin-bottom: 17px;
}

.access-panel {
  overflow: hidden;
}

.user-access-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.access-user-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 15px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.access-user-card:hover {
  transform: translateY(-2px);
  border-color: rgba(10, 106, 84, 0.34);
  box-shadow: 0 14px 30px rgba(16, 51, 42, 0.08);
}

.access-user-card.current {
  border-color: rgba(10, 106, 84, 0.45);
  background: linear-gradient(160deg, #fff 0%, #f2faf6 100%);
}

.access-user-card.current::after {
  position: absolute;
  top: 0;
  right: 18px;
  width: 54px;
  height: 3px;
  border-radius: 0 0 5px 5px;
  background: var(--primary);
  content: "";
}

.access-user-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.access-user-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
}

.access-user-head > div {
  min-width: 0;
}

.access-user-head strong,
.access-user-head span[dir="ltr"] {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-user-head span[dir="ltr"] {
  margin-top: 3px;
  color: var(--muted);
  font: 600 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-align: right;
}

.access-user-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.access-user-meta > span {
  padding: 10px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
}

.access-user-meta strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-preview {
  display: flex;
  min-height: 52px;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-preview span {
  height: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(10, 106, 84, 0.12);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 8.5px;
  font-weight: 700;
}

.access-user-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.access-user-actions .btn:first-child {
  flex: 1;
}

.access-user-actions .btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.access-modal {
  width: min(920px, calc(100vw - 32px));
}

.access-user-fields {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.permission-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 1px 13px;
}

.permission-section-head h4,
.permission-section-head p {
  margin: 0;
}

.permission-section-head h4 {
  font-size: 13px;
}

.permission-section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.permission-section-head > span {
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
}

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

.permission-group {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.permission-group legend {
  padding: 0 7px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
}

.permission-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 11px;
  padding: 9px 7px;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}

.permission-toggle:last-child {
  border-bottom: 0;
}

.permission-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.permission-toggle span,
.permission-toggle b,
.permission-toggle small {
  display: block;
  min-width: 0;
}

.permission-toggle b {
  font-size: 9.5px;
}

.permission-toggle small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font: 500 7.5px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
}

.permission-toggle i {
  position: relative;
  width: 36px;
  height: 21px;
  border-radius: 99px;
  background: #d7dfdb;
  transition: background 150ms ease;
}

.permission-toggle i::after {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(16, 51, 42, 0.18);
  content: "";
  transition: transform 150ms ease;
}

.permission-toggle input:checked ~ i {
  background: var(--primary);
}

.permission-toggle input:checked ~ i::after {
  transform: translateX(-15px);
}

.permission-toggle:focus-within {
  border-radius: 9px;
  outline: 2px solid rgba(10, 106, 84, 0.18);
  outline-offset: 1px;
}

@media (max-width: 1080px) {
  .user-access-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .user-access-grid,
  .permission-matrix {
    grid-template-columns: 1fr;
  }

  .user-access-grid {
    padding: 12px;
  }

  .permission-section-head,
  .access-user-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .access-user-actions .btn {
    width: 100%;
  }
}
