:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --panel: #ffffff;
  --ink: #16202a;
  --muted: #647184;
  --line: #dbe1e8;
  --accent: #1264d8;
  --accent-strong: #0b4fb0;
  --danger: #f04b4b;
  --warn: #f59e0b;
  --ok: #0cbf7a;
  --soft-blue: #e8f1ff;
  --soft-green: #e9f7f0;
  --soft-red: #fff0f0;
  --soft-warn: #fff7e6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 14px 32px rgba(21, 33, 49, 0.1);
  --shadow-soft: 0 1px 2px rgba(22, 32, 42, 0.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #ffffff 0, #f3f6fa 170px),
    var(--bg);
  color: var(--ink);
}

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

button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 5px rgba(18, 100, 216, 0.08);
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-strong);
}

button[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

label input,
label select,
label textarea {
  color: var(--ink);
}

.field-label {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: var(--muted);
}

.required-mark {
  color: #d54941;
  font-weight: 700;
}

.field-disabled {
  opacity: 0.58;
}

.field-disabled .required-mark {
  display: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-title h1,
.topbar-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.topbar-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 17px;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.user-box {
  flex: 0 1 44%;
  min-width: 0;
  max-width: 44vw;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.user-name,
.user-role {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name {
  color: var(--ink);
  font-weight: 700;
}

.auth-panel {
  max-width: 720px;
  margin: 80px auto;
  padding: 0 20px;
}

.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: none;
}

.main-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  min-height: calc(100vh - 77px);
}

.side-nav {
  padding: 18px 10px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.nav-group {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.nav-item {
  position: relative;
  width: 100%;
  justify-content: flex-start;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  border-color: transparent;
  background: transparent;
  color: #263445;
  font-weight: 650;
  box-shadow: none;
}

.nav-item.active {
  background: #f7faff;
  border-color: #d7e6ff;
  color: var(--accent-strong);
  font-weight: 700;
  box-shadow: none;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateY(-50%);
}

.nav-group .nav-item {
  margin-bottom: 0;
}

.nav-parent {
  padding-right: 10px;
  border-color: transparent;
  border-radius: 10px;
}

.nav-parent:hover {
  background: #f6f9ff;
  border-color: #cfe0ff;
  box-shadow: none;
}

.nav-parent::after {
  content: "v";
  margin-left: auto;
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d7e4f8;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-group.expanded .nav-parent {
  background: #f7faff;
  border-color: #d7e6ff;
  color: var(--accent-strong);
  box-shadow: none;
}

.nav-group.expanded .nav-parent::after {
  transform: rotate(180deg);
  border-color: #9fc4ff;
  color: var(--accent-strong);
}

.nav-submenu {
  position: relative;
  display: none;
  gap: 5px;
  margin: 2px 0 4px 4px;
  padding: 5px 0 4px 16px;
}

.nav-group.expanded .nav-submenu {
  display: grid;
}

.nav-submenu::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, #c9dcf8, rgba(201, 220, 248, 0.12));
}

.nav-subitem {
  position: relative;
  width: 100%;
  min-height: 32px;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 7px 10px 7px 14px;
  border-radius: 10px;
}

.nav-subitem:hover {
  background: #f8fbff;
  border-color: #d5e4fb;
  color: var(--accent-strong);
  box-shadow: none;
}

.nav-subitem.active {
  border-color: #d7e6ff;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 700;
  box-shadow: none;
}

.nav-subitem.active::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateY(-50%);
}

.content {
  padding: 22px;
  min-width: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

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

.notice {
  border: 1px solid #f0c36d;
  background: #fff8e8;
  color: #6b4300;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.notice.error {
  border-color: #efb2b2;
  background: var(--soft-red);
  color: var(--danger);
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  box-shadow: none;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 4px;
}

.metric-action {
  width: 100%;
  min-height: 96px;
}

.metric-action:hover,
.metric-action.active {
  border-color: var(--accent);
  box-shadow: none;
}

.metric-action.active {
  background: var(--soft-blue);
}

.split {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

.split.even {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}

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

.panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: none;
}

.manager-overview,
.detail-list-panel {
  display: grid;
  gap: 16px;
}

.form-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.create-panel form {
  display: grid;
  gap: 14px;
}

.form-panel h3,
.panel h3 {
  margin-bottom: 14px;
}

.form-panel .form-panel-head h3 {
  margin-bottom: 0;
}

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

.wide {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check input {
  width: auto;
}

.department-choice {
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.department-choice legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.department-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.department-options .check {
  color: var(--ink);
}

.subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 8px;
  font-weight: 700;
}

.cost-rows {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.cost-row {
  display: grid;
  grid-template-columns: 120px repeat(4, minmax(80px, 1fr)) 42px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}

.attachment-uploader {
  display: block;
  min-height: 32px;
  border: 1px solid #edf1f5;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: #f8f9fb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.attachment-uploader input {
  display: none;
}

.attachment-uploader.compact {
  align-self: stretch;
}

.sample-design-uploader {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
}

.sample-design-uploader > p {
  margin: 0;
}

.sample-design-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sample-design-empty {
  grid-column: 1 / -1;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px dashed #cfd9e6;
  border-radius: var(--radius-sm);
  background: #fff;
}

.sample-design-preview {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.sample-design-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #f3f5f8;
}

.sample-design-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 8px 4px;
}

.sample-design-meta strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-design-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px 8px 8px;
}

.sample-design-actions button {
  min-width: 0;
  min-height: 30px;
  padding: 3px;
  box-shadow: none;
}

.sample-design-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.sample-document-status {
  display: grid;
  gap: 4px;
  border-color: #b8cce8;
  background: var(--soft-blue);
}

.sample-document-status strong {
  color: var(--accent-strong);
}

.sample-document-status span {
  color: #405166;
  font-size: 12px;
}

.sample-document-status.error {
  border-color: #efc0c0;
  background: #fff5f5;
}

.sample-document-status.error strong {
  color: #a12622;
}

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

.attachment-head strong,
.attachment-head h3 {
  color: var(--ink);
}

.attachment-head span {
  color: var(--muted);
  font-size: 12px;
}

.attachment-drop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  margin: 7px 0 5px;
  padding: 6px 12px;
  border: 1px solid #c8d8eb;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 600;
}

.attachment-drop input {
  display: none;
}

.attachment-uploader p {
  margin: 0;
  font-size: 12px;
}

[data-attachment-selection] {
  max-width: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

[data-attachment-selection].selected {
  color: #17683a;
  font-weight: 600;
}

.attachment-selection-summary {
  display: block;
  margin-bottom: 6px;
}

.attachment-selection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-selected-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(100%, 360px);
  min-height: 30px;
  padding: 4px 4px 4px 9px;
  border: 1px solid #cfe0d5;
  border-radius: var(--radius-sm);
  background: #f4faf6;
  color: #245c3b;
  font-weight: 500;
}

.attachment-selected-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-selected-file small {
  flex: 0 0 auto;
  color: #60776a;
  font-weight: 400;
}

.attachment-selected-file button {
  flex: 0 0 auto;
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #60776a;
  box-shadow: none;
  line-height: 1;
}

.attachment-selected-file button:hover {
  background: #e3f0e7;
  color: #174f30;
}

.attachment-panel {
  display: grid;
  gap: 12px;
}

.attachment-inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.attachment-inline-form .attachment-drop {
  margin: 0;
}

.attachment-inline-form .form-feedback {
  flex-basis: 100%;
}

.attachment-inline-form [data-attachment-selection] {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
}

.attachment-list,
.attachment-log {
  display: grid;
  gap: 8px;
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fafbfd;
}

.attachment-item strong {
  display: block;
  color: var(--ink);
}

.attachment-item p {
  margin-top: 4px;
  font-size: 12px;
}

.attachment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.button-link:hover {
  border-color: #9bbbe5;
  background: var(--soft-blue);
}

.attachment-actions button[disabled] {
  cursor: not-allowed;
  opacity: 0.58;
}

.attachment-event {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.attachment-event strong {
  color: var(--ink);
}

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

.flow-list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.panel .flow-list-heading h3 {
  margin-bottom: 0;
}

.flow-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.flow-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(440px, 100%);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.flow-search-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 100, 216, 0.1);
}

.flow-search-control input {
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: transparent;
  outline: 0;
}

.flow-search-control input::-webkit-search-cancel-button {
  display: none;
}

.flow-search-control button {
  min-height: 40px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--accent-strong);
  box-shadow: none;
}

.flow-search-control button:hover {
  background: var(--soft-blue);
  box-shadow: none;
}

.flow-search-summary {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.flow-bucket-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.flow-bucket-tab {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  border-color: #dce6f2;
  background: #f7f9fc;
  color: #405166;
  box-shadow: none;
  font-size: 12px;
}

.flow-bucket-tab strong {
  margin-left: 6px;
  color: var(--ink);
}

.flow-bucket-tab.active {
  border-color: rgba(18, 100, 216, 0.36);
  background: var(--soft-blue);
  color: var(--accent-strong);
}

.flow-group {
  display: grid;
  gap: 0;
}

.flow-group + .flow-group {
  margin-top: 16px;
}

.flow-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 0 2px 8px;
  color: var(--muted);
  font-size: 12px;
}

.flow-group-head strong {
  color: var(--ink);
  font-size: 13px;
}

.flow-group-list {
  display: grid;
  gap: 0;
}

.list.compact {
  gap: 0;
}

.list.compact .item {
  padding: 12px 10px;
}

.list.compact .meta {
  margin-top: 6px;
}

.item {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  background: var(--surface);
  border-radius: 0;
  padding: 13px 10px;
  box-shadow: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.item:first-child {
  border-top: 1px solid var(--line);
}

.item.status-danger {
  border-left-color: var(--danger);
}

.item.status-warn {
  border-left-color: var(--warn);
}

.item.status-progress {
  border-left-color: rgba(18, 100, 216, 0.56);
}

.item.status-ok {
  border-left-color: rgba(12, 191, 122, 0.56);
}

.item.clickable {
  cursor: pointer;
}

.item.clickable:hover {
  border-left-color: var(--accent);
  background: #f8fbff;
  box-shadow: none;
}

.item-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.item-title strong {
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}

.item-tags {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.flow-task-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #dce4ee;
}

.flow-task-status {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.flow-task-department {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.flow-task-status .tag {
  min-width: 0;
  white-space: normal;
  line-height: 1.35;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #dce4ee;
  background: #f3f6fa;
  color: #435166;
  font-size: 12px;
  font-weight: 700;
}

.tag.ok {
  border-color: rgba(12, 191, 122, 0.24);
  background: var(--soft-green);
  color: var(--ok);
}

.tag.progress {
  border-color: rgba(18, 100, 216, 0.22);
  background: var(--soft-blue);
  color: var(--accent-strong);
}

.tag.warn {
  border-color: rgba(245, 158, 11, 0.28);
  background: var(--soft-warn);
  color: var(--warn);
}

.tag.danger {
  border-color: rgba(240, 75, 75, 0.24);
  background: var(--soft-red);
  color: var(--danger);
}

.tag.sample-stage.stage-recommended {
  border-color: #9fd8c0;
  background: #e9f8f1;
  color: #087a4f;
}

.tag.sample-stage.stage-intent {
  border-color: #adc9ee;
  background: #edf5ff;
  color: #185da8;
}

.tag.sample-stage.stage-preproduction {
  border-color: #efc77f;
  background: #fff7e8;
  color: #8a5700;
}

.tag.sample-stage.stage-bulk {
  border-color: #c5cbd4;
  background: #f1f3f6;
  color: #2f3a4a;
}

.tag.sample-stage.stage-unclassified {
  color: var(--muted);
}

.tag.quote-type.type-estimated {
  border-color: #efc77f;
  background: #fff7e8;
  color: #8a5700;
}

.tag.quote-type.type-precise {
  border-color: #adc9ee;
  background: #edf5ff;
  color: #185da8;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--surface);
}

.drawer-backdrop {
  display: none;
}

.drawer-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100dvh;
  overflow: auto;
  background:
    linear-gradient(180deg, #ffffff 0, #f4f7fb 180px),
    var(--bg);
  box-shadow: none;
  padding: 0 32px 96px;
}

#detailContent {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.drawer-close {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.detail-hero {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin: 0 0 14px;
  padding: 20px 88px 16px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.detail-hero h2 {
  margin-top: 4px;
  line-height: 1.25;
}

.detail-kicker {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
  background: var(--surface);
}

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

.detail-actions {
  background: #fbfcfe;
}

.task-accept-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 10px 0 14px;
  border: 1px solid rgba(18, 100, 216, 0.3);
  border-radius: var(--radius-sm);
  background: var(--soft-blue);
  padding: 14px;
}

.task-accept-callout > div:first-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.task-accept-callout strong {
  color: var(--accent-strong);
  font-size: 15px;
}

.task-accept-callout span {
  color: #405166;
  font-size: 12px;
  line-height: 1.55;
}

.task-accept-callout .form-feedback {
  grid-column: 1 / -1;
}

.task-accept-button {
  min-width: 156px;
  min-height: 42px;
}

.workflow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.workflow-strip span {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 9px;
}

.empty-hint {
  color: var(--muted);
  font-size: 12px;
}

.supplier-empty {
  display: grid;
  min-height: 420px;
}

.supplier-empty-card {
  display: grid;
  align-content: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(18, 100, 216, 0.1), rgba(22, 118, 74, 0.08)),
    var(--surface);
  box-shadow: none;
  padding: 32px;
}

.supplier-empty-card h3 {
  font-size: 26px;
}

.supplier-empty-card p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.7;
}

.supplier-empty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.supplier-empty-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.supplier-empty-grid strong,
.supplier-empty-grid span {
  display: block;
}

.supplier-empty-grid span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  clear: both;
}

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

.field strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  margin-top: 3px;
  word-break: break-word;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

.action-row .wide-action {
  grid-column: span 2;
}

.form-feedback,
.form-hint {
  grid-column: 1 / -1;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.55;
}

.form-feedback {
  border: 1px solid #b8d6ff;
  background: var(--soft-blue);
  color: var(--accent-strong);
  font-weight: 700;
}

.form-feedback.error {
  border-color: #efb2b2;
  background: var(--soft-red);
  color: var(--danger);
}

.form-feedback.ok {
  border-color: #b7e2cc;
  background: var(--soft-green);
  color: var(--ok);
}

.form-hint {
  margin: 0;
  background: #f7f9fc;
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
    min-height: 0;
    align-content: start;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    align-self: start;
    max-height: 56px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

  .side-nav.has-open-submenu {
    max-height: 104px;
    align-items: flex-start;
  }

  .nav-group {
    flex: 0 0 auto;
    width: auto;
    margin-bottom: 0;
  }

  .nav-group:not(.expanded) .nav-submenu {
    display: none;
  }

  .nav-submenu {
    padding-left: 0;
    grid-template-columns: repeat(2, max-content);
  }

  .nav-submenu::before {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    max-height: 40px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    margin-bottom: 0;
  }

  .nav-subitem {
    flex: 0 0 auto;
    width: auto;
    max-height: 34px;
    white-space: nowrap;
  }

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

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

  .split,
  .split.even {
    gap: 12px;
  }

  .supplier-empty {
    min-height: 360px;
  }

  .supplier-empty-card {
    padding: 22px;
  }

  .supplier-empty-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .form-panel,
  .metric {
    border-radius: 10px;
  }

  .item {
    border-radius: 0;
  }
}

@media (max-width: 620px) {
  .section-head {
    flex-direction: column;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(88px, 42%);
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
  }

  .topbar-title,
  .user-box {
    width: auto;
    min-width: 0;
  }

  .user-box {
    max-width: 100%;
    align-items: flex-end;
    text-align: right;
  }

  .user-name,
  .user-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  h1 {
    font-size: 22px;
  }

  .topbar-subtitle {
    font-size: 12px;
  }

  .section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .section-actions button {
    flex: 1 1 140px;
  }

  .flow-list-heading {
    align-items: center;
  }

  .flow-search-control {
    width: 100%;
  }

  .form-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-panel-head button {
    width: 100%;
  }

  .content {
    padding: 14px;
  }

  .form-grid,
  .detail-grid,
  .action-row,
  .cost-row {
    grid-template-columns: 1fr;
  }

  .wide,
  .action-row .wide-action {
    grid-column: auto;
  }

  .department-options {
    display: grid;
    gap: 4px;
  }

  .attachment-head,
  .attachment-item {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .attachment-actions {
    justify-content: flex-start;
  }

  .drawer {
    background: var(--surface);
  }

  .drawer-backdrop {
    display: none;
  }

  .drawer-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    padding: 0 14px 82px;
    box-shadow: none;
  }

  .drawer-close {
    position: fixed;
    top: 10px;
    right: 12px;
    min-height: 34px;
    padding: 6px 10px;
    border-color: #d9e2ec;
    z-index: 30;
  }

  .detail-hero {
    margin: 0 -14px 10px;
    padding: 14px 74px 12px 14px;
    min-height: 88px;
  }

  .detail-hero h2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 19px;
  }

  .detail-hero .tag {
    flex: 0 0 auto;
    margin-top: 2px;
  }

  .detail-block {
    margin: 10px 0;
    padding: 12px;
    border-radius: 10px;
  }

  .detail-actions {
    padding-bottom: 14px;
  }

  .task-accept-callout {
    grid-template-columns: 1fr;
  }

  .task-accept-button {
    width: 100%;
  }

  .flow-task-statuses {
    display: grid;
    gap: 7px;
  }

  .flow-task-status {
    align-items: flex-start;
  }

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

  .detail-actions .action-row {
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }

  .detail-actions .action-row:first-of-type {
    border-top: 0;
    padding-top: 0;
  }

  .detail-actions button[type="submit"] {
    width: 100%;
    min-height: 44px;
  }
}
