:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9e1ea;
  --text: #182230;
  --muted: #64748b;
  --strong: #0f172a;
  --brand: #1f6f78;
  --brand-dark: #14545c;
  --green: #16845b;
  --blue: #2f5fb3;
  --amber: #b7791f;
  --red: #b42318;
  --violet: #6254b2;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef3f5;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  font-size: 13px;
}

.login-panel h1 {
  margin: 18px 0 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.login-panel p {
  color: var(--muted);
  margin: 0 0 24px;
}

.icp-link {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.icp-link:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.login-icp {
  display: block;
  margin-top: 18px;
  text-align: center;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
}

input,
select,
textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.12);
}

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px 1fr;
  overflow: hidden;
}

.sidebar {
  background: #17212b;
  color: #dbe4ee;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand strong {
  display: block;
  color: #fff;
  font-size: 16px;
}

.sidebar-brand span {
  display: block;
  color: #9fb0c3;
  font-size: 12px;
  margin-top: 3px;
}

.nav-menu {
  padding: 12px;
  display: grid;
  gap: 10px;
  overflow: auto;
  flex: 1;
  align-content: start;
}

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

.nav-section-title {
  padding: 10px 12px 4px;
  color: #7f93a8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-item {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: #cbd7e4;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item svg,
button svg,
.search-box svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.nav-item:hover,
.nav-item.active {
  background: #223241;
  color: #fff;
}

.sidebar-utility {
  display: none;
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 8px;
}

.app-shell.compact-topbar .sidebar-utility {
  display: grid;
}

.app-shell.compact-topbar .topbar {
  display: none;
}

.sidebar-role,
.sidebar-notice-btn,
.sidebar-logout-btn {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #dbe4ee;
}

.sidebar-role {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
}

.sidebar-role span {
  color: #9fb0c3;
  font-size: 12px;
}

.sidebar-role strong {
  color: #fff;
  font-size: 14px;
}

.sidebar-notice-btn,
.sidebar-logout-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 10px;
}

.sidebar-notice-btn:hover,
.sidebar-logout-btn:hover {
  background: #223241;
  color: #fff;
}

.sidebar-notice-btn svg,
.sidebar-logout-btn svg {
  width: 17px;
  height: 17px;
}

.main-area {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.topbar {
  height: 64px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 8;
}

.mobile-title {
  display: none;
  font-weight: 700;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 720px;
}

.app-shell.hide-global-search .search-box {
  display: none;
}

.app-shell.hide-global-search .top-actions {
  margin-left: auto;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  padding-left: 38px;
}

.search-results {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 20;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
}

.search-result-item:hover {
  background: var(--panel-soft);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#notificationButton,
#roleSwitch {
  display: none;
}

.icon-btn,
.ghost-btn,
.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.icon-btn {
  width: 36px;
  padding: 0;
  position: relative;
}

.ghost-btn {
  background: #fff;
}

.primary-btn {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.secondary-btn {
  background: #edf7f8;
  color: var(--brand-dark);
  border-color: #b9dde2;
}

.danger-btn {
  color: var(--red);
  border-color: #f1c9c5;
  background: #fff7f6;
}

.full {
  width: 100%;
}

.login-panel .ghost-btn.full {
  margin-top: 10px;
}

.login-note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}

.dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
}

.page-content {
  padding: 20px;
  min-width: 0;
  flex: 1 0 auto;
}

.app-footer {
  flex: 0 0 auto;
  padding: 0 24px 18px;
  text-align: center;
}

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

.page-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

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

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-row.compact {
  margin-top: 0;
  align-items: center;
}

.compact-actions {
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 6px;
}

.compact-actions .ghost-btn,
.compact-actions .secondary-btn,
.compact-actions .danger-btn {
  min-height: 30px;
  padding: 0 8px;
  white-space: nowrap;
}

.modal-tip {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

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

.metric-card,
.panel,
.table-panel,
.chart-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  padding: 16px;
  min-height: 112px;
  display: grid;
  align-content: space-between;
}

.metric-card span {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  font-size: 26px;
  margin-top: 8px;
  letter-spacing: 0;
}

.metric-card small {
  color: var(--green);
}

.metric-card.warn small {
  color: var(--amber);
}

.metric-card.danger small {
  color: var(--red);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 16px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}

.panel-header h2,
.modal-header h2,
.drawer-header h2 {
  font-size: 16px;
  margin: 0;
  letter-spacing: 0;
}

.panel-header small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

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

.filter-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.filter-bar label {
  margin: 0;
  gap: 6px;
  font-size: 12px;
}

.order-filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.order-filter-panel label {
  margin: 0;
  gap: 6px;
  font-size: 12px;
}

.order-filter-panel .wide {
  min-width: 0;
}

.table-action-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-line-builder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.order-line-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.order-item-list {
  display: grid;
  gap: 8px;
}

.order-item-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(76px, 0.65fr) minmax(96px, 0.8fr) minmax(88px, 0.75fr) minmax(104px, 0.9fr) 36px;
  gap: 8px;
  align-items: end;
}

.order-item-row label {
  margin: 0;
  gap: 5px;
  font-size: 12px;
}

.info-grid.compact {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-bottom: 0;
}

.report-filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.report-filter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.report-filter-header h2 {
  font-size: 16px;
  margin: 0 0 5px;
}

.report-filter-header p {
  color: var(--muted);
  margin: 0;
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(135px, 1fr));
  gap: 10px;
}

.report-filter-grid label {
  margin: 0;
  gap: 6px;
  font-size: 12px;
}

.saved-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pill-btn {
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid #b9dde2;
  background: #edf7f8;
  color: var(--brand-dark);
  padding: 0 11px;
}

.settings-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-sidebar,
.settings-main {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 132px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.settings-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  text-align: left;
}

.settings-tab:hover,
.settings-tab.active {
  background: #edf7f8;
  color: var(--brand-dark);
}

.settings-main {
  padding: 16px;
  min-width: 0;
}

.settings-main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.settings-main-header h2 {
  margin: 0;
  font-size: 18px;
}

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

.permission-list,
.settings-form-list {
  display: grid;
  gap: 10px;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--text);
}

.switch-line input {
  width: 16px;
  height: 16px;
}

.permission-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.permission-card p {
  color: var(--muted);
  margin: 6px 0 10px;
}

.notice-panel {
  border: 1px solid #b9dde2;
  background: #edf7f8;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.notice-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.compact-notice {
  padding: 10px 12px;
}

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

.role-permission-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  min-width: 0;
}

.role-permission-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.role-permission-head small {
  color: var(--muted);
}

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

.permission-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.permission-check input {
  width: 15px;
  height: 15px;
}

.permission-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dictionary-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.dictionary-menu {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 5px;
}

.dict-menu-item {
  min-height: 36px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
}

.dict-menu-item.active,
.dict-menu-item:hover {
  background: #fff;
  color: var(--brand-dark);
}

.dict-menu-item span {
  color: var(--muted);
}

.dictionary-layout > .panel {
  min-width: 0;
  overflow: hidden;
}

.dictionary-layout > .panel .table-wrap {
  max-height: calc(100vh - 332px);
  overflow: auto;
  overscroll-behavior: contain;
}

.switch-row {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  color: var(--text);
}

.switch-row input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.settings-actions {
  margin-top: 14px;
  justify-content: flex-start;
}

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

.required-star {
  color: var(--red);
  font-weight: 800;
}

.form-hint {
  color: var(--muted);
  line-height: 1.7;
  margin: 12px 0 0;
}

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

.required-field-card {
  align-content: start;
}

.transfer-filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.transfer-filter-panel label {
  margin: 0;
  gap: 6px;
  font-size: 12px;
}

.transfer-info-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  margin-bottom: 10px;
}

.transfer-info-block strong {
  display: block;
  margin-bottom: 8px;
}

.transfer-info-block p {
  color: var(--muted);
  margin: 0;
}

.table-panel {
  overflow: hidden;
}

.table-toolbar {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  background: #f7f9fb;
  color: #475569;
  font-weight: 700;
}

tr:hover td {
  background: #fbfcfd;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.tag,
.status,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag {
  background: #eef6f0;
  color: #166534;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag.blue {
  background: #edf3ff;
  color: #244a91;
}

.tag.amber {
  background: #fff7e8;
  color: #92400e;
}

.tag.violet {
  background: #f1efff;
  color: #4f46a5;
}

.status {
  background: #edf7f8;
  color: var(--brand-dark);
}

.status.success {
  background: #eaf7ef;
  color: var(--green);
}

.status.warn {
  background: #fff6df;
  color: var(--amber);
}

.status.danger {
  background: #fff1f0;
  color: var(--red);
}

.status.muted {
  background: #eef2f6;
  color: #64748b;
}

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

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
}

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

.timeline-content {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.chart-bars {
  display: grid;
  gap: 10px;
}

.chart-row {
  display: grid;
  grid-template-columns: 88px 1fr 70px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.bar-fill.blue {
  background: var(--blue);
}

.bar-fill.amber {
  background: var(--amber);
}

.bar-fill.green {
  background: var(--green);
}

.drawer,
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 40;
}

.drawer-panel {
  margin-left: auto;
  width: min(720px, 100%);
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.drawer-header,
.modal-header {
  min-height: 68px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-body,
.modal-body {
  padding: 18px;
  overflow: auto;
}

.eyebrow {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal {
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

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

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

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

.info-item {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 11px;
  min-height: 64px;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.info-item strong {
  color: var(--strong);
}

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

.tab-btn {
  border: 0;
  background: transparent;
  min-height: 38px;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
}

.tab-btn.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #17212b;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 60;
}

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.import-hint {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.6;
}

.import-error-box {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px;
  line-height: 1.6;
}

.import-error-box p {
  margin: 6px 0 0;
}

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

.kpi-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.kpi-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.workflow-chain {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.workflow-step {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 14px;
  display: grid;
  grid-template-columns: 32px 1fr;
  grid-template-rows: 1fr auto;
  gap: 10px;
  text-align: left;
}

.workflow-step svg {
  color: var(--brand);
}

.workflow-step span {
  display: grid;
  gap: 5px;
}

.workflow-step strong {
  font-size: 15px;
}

.workflow-step small {
  color: var(--muted);
  line-height: 1.5;
}

.workflow-step b {
  grid-column: 1 / -1;
  color: var(--brand-dark);
  font-size: 18px;
}

.workflow-step:hover {
  border-color: #b9dde2;
  background: #fbfefe;
}

.workflow-mini {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 8px;
}

.workflow-mini span,
.relation-note {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.customer-action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.relation-note {
  margin-top: 10px;
  min-height: 42px;
  color: var(--brand-dark);
}

.tech-filter {
  grid-template-columns: minmax(140px, 220px) minmax(220px, 1fr) auto;
}

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

.tech-direction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.tech-direction-card {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 12px;
  min-height: 112px;
  text-align: left;
  display: grid;
  gap: 8px;
  align-content: space-between;
}

.tech-direction-card:hover {
  border-color: #99d1d8;
  background: #f8fcfd;
}

.tech-direction-card strong {
  color: var(--strong);
  line-height: 1.35;
}

.tech-direction-card span,
.tech-direction-card small {
  color: var(--muted);
}

.tech-progress {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: #e8eef2;
  overflow: hidden;
  min-width: 120px;
}

.tech-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1f7a7e, #40a68f);
}

.tech-progress b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #0f172a;
}

.tech-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(106px, 1fr));
  gap: 10px;
}

.tech-flow-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  min-height: 78px;
  min-width: 0;
  display: grid;
  align-content: space-between;
}

.tech-flow-step span {
  font-size: 24px;
  color: var(--brand-dark);
  font-weight: 700;
}

.tech-task-line,
.tech-summary-line {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.tech-task-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tech-task-line small,
.tech-summary-line small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.tech-task-line.overdue strong,
.row-warn td:first-child {
  color: var(--red);
}

.tech-summary-line p {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.5;
}

.tech-table {
  max-width: 100%;
  overflow: hidden;
}

.tech-table .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.tech-table table {
  min-width: 980px;
  table-layout: fixed;
}

.tech-table th,
.tech-table td {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}

.tech-table th:nth-child(2),
.tech-table th:nth-child(3),
.tech-table .tech-project-name-cell,
.tech-table .tech-structure-cell {
  text-align: center;
  vertical-align: middle;
}

.tech-table .tech-project-name-cell .link-btn {
  display: inline-block;
  max-width: 100%;
  line-height: 1.45;
  text-align: center;
  white-space: normal;
}

.tech-table .tech-structure-cell {
  font-weight: 700;
  color: var(--text);
}

.tech-table .tech-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 150px;
}

.tech-table .ghost-btn,
.tech-table .primary-btn,
.tech-table .secondary-btn,
.tech-table .danger-btn {
  min-height: 32px;
  padding: 0 9px;
  white-space: nowrap;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.view-switch button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}

.view-switch button:last-child {
  border-right: 0;
}

.view-switch button.active {
  background: #edf7f8;
  color: var(--brand-dark);
}

.tech-map-list {
  display: grid;
  gap: 14px;
}

.tech-summary-board {
  display: grid;
  gap: 14px;
}

.tech-summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  min-width: 0;
}

.tech-summary-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 240px);
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.tech-summary-head .link-btn {
  max-width: 100%;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

.tech-summary-head small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.tech-summary-progress {
  display: grid;
  gap: 8px;
}

.tech-role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.tech-role-card {
  border: 1px solid #cfe3e7;
  border-radius: 8px;
  background: #f8fcfd;
  padding: 10px;
  min-width: 0;
}

.tech-role-card.empty {
  border-style: dashed;
  background: #fafafa;
}

.tech-role-card strong {
  color: var(--brand-dark);
}

.tech-role-card p,
.tech-summary-bottom p {
  margin: 7px 0 4px;
  line-height: 1.5;
  word-break: break-word;
}

.tech-role-card small,
.tech-summary-bottom small {
  color: var(--muted);
  line-height: 1.45;
}

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

.tech-summary-bottom > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
  min-width: 0;
}

.tech-summary-bottom strong {
  color: var(--strong);
}

.tech-fish-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  overflow: hidden;
}

.tech-fish-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  align-items: start;
  gap: 14px;
  margin-bottom: 14px;
}

.tech-fish-head .link-btn {
  max-width: 100%;
  text-align: left;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.tech-fish-head small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.tech-fish-status {
  display: grid;
  gap: 8px;
}

.tech-fish-spine {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 8px;
  padding: 12px 0 4px;
  overflow-x: auto;
}

.tech-fish-spine::before {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 27px;
  height: 2px;
  background: #d7e3e8;
}

.tech-fish-node {
  position: relative;
  min-width: 92px;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.tech-fish-node span {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #fff;
}

.tech-fish-node strong {
  font-size: 13px;
  line-height: 1.3;
  color: var(--strong);
}

.tech-fish-node small {
  font-size: 11px;
  color: var(--muted);
}

.tech-fish-node.done span {
  border-color: #1f7a7e;
  background: #1f7a7e;
}

.tech-fish-node.current span {
  border-color: #c7831e;
  background: #fff7ed;
  box-shadow: 0 0 0 4px #fdebd0;
}

.tech-fish-node.current strong {
  color: #9a5b12;
}

.tech-fish-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.tech-fish-detail > div {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.tech-fish-detail strong {
  color: var(--brand-dark);
}

.tech-fish-detail p {
  margin: 7px 0 4px;
  line-height: 1.5;
  word-break: break-word;
}

.tech-fish-detail small {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    min-width: 0;
    max-width: 100vw;
    overflow: hidden;
  }

  .sidebar-brand {
    display: none;
  }

  .nav-menu {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    max-width: 100vw;
    min-width: 0;
    flex: none;
  }

  .nav-section {
    display: flex;
    gap: 4px;
    flex: 0 0 auto;
  }

  .nav-section-title {
    display: none;
  }

  .app-shell.compact-topbar .sidebar-utility {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    overflow-x: auto;
    max-width: 100vw;
  }

  .sidebar-role,
  .sidebar-notice-btn,
  .sidebar-logout-btn {
    flex: 0 0 auto;
  }

  .main-area,
  .topbar,
  .page-content {
    min-width: 0;
    max-width: 100vw;
  }

  .main-area {
    height: auto;
    min-height: 0;
  }

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

  .metric-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

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

  .order-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .settings-shell,
  .dictionary-layout {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

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

  .transfer-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .workflow-mini {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tech-filter,
  .tech-direction-grid,
  .tech-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tech-fish-detail {
    grid-template-columns: 1fr;
  }

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

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

  .role-permission-grid {
    grid-template-columns: 1fr;
  }

  .required-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    padding: 12px;
    flex-wrap: wrap;
  }

  .mobile-title {
    display: block;
  }

  .search-box {
    order: 3;
    min-width: 100%;
  }

  .top-actions {
    margin-left: auto;
  }

  .page-content {
    padding: 12px;
  }

  .page-title {
    display: grid;
  }

  .panel-header {
    display: grid;
    align-items: start;
  }

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

  .action-row {
    justify-content: flex-start;
  }

  .metric-grid,
  .filter-bar,
  .order-filter-panel,
  .order-item-row,
  .report-filter-grid,
  .settings-summary-grid,
  .transfer-filter-panel,
  .workflow-chain,
  .workflow-mini,
  .tech-filter,
  .tech-direction-grid,
  .tech-flow,
  .role-permission-grid,
  .permission-check-grid,
  .form-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .tech-fish-head {
    grid-template-columns: 1fr;
  }

  .tech-summary-head,
  .tech-role-grid {
    grid-template-columns: 1fr;
  }

  .view-switch,
  .view-switch button {
    width: 100%;
  }

  .view-switch button {
    justify-content: center;
  }

  .report-filter-header {
    display: grid;
  }

  .drawer-panel {
    width: 100%;
  }
}
