:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --line: #dfe6f0;
  --text: #182334;
  --muted: #66758a;
  --blue: #1f5a96;
  --blue-strong: #174a7d;
  --orange: #ff8617;
  --green: #16805a;
  --yellow: #a66a00;
  --red: #b42318;
  --shadow: 0 16px 40px rgba(24, 35, 52, .08);
  --radius: 8px;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 120; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); pointer-events: none; }
.app-toast { transform: translateY(-8px); opacity: 0; padding: 13px 16px; border: 1px solid #bde8d7; border-radius: 8px; background: #eefaf5; color: #126c4c; box-shadow: 0 10px 28px rgba(20, 42, 66, .16); font-size: 14px; font-weight: 700; line-height: 1.5; transition: .18s ease; }
.app-toast.is-visible { transform: translateY(0); opacity: 1; }
.app-toast-error { border-color: #f0caca; background: #fff8f7; color: #b42318; }
.app-toast-warning { border-color: #f1d59b; background: #fff8e8; color: #8a5a08; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

.app-footer {
  margin-left: 260px;
  padding: 18px 24px 24px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.app-footer a { color: var(--blue); font-weight: 800; text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.auth-body > .app-footer { flex: 0 0 auto; width: 100%; margin: 0; padding: 14px 20px 20px; }

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

select {
  outline: none;
  box-shadow: none;
  transition: border-color .16s ease, background-color .16s ease;
}

select:focus,
select:focus-visible {
  outline: none;
  border-color: #91a0b2 !important;
  box-shadow: none !important;
  background-color: #fff;
}

select option:checked {
  background-color: #e8f1fb;
  color: #173b61;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: #0f1d2d;
  color: #e8eef7;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  padding: 8px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 5px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { color: #93a4ba; margin-top: 2px; }

.nav {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 4px;
}


.nav-link {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  min-height: 42px;
  color: #bdc9d8;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0 10px;
}

.nav-link:hover, .nav-link.active {
  background: #172a40;
  color: #fff;
}

.nav-link.active { box-shadow: inset 3px 0 0 var(--orange); }
.nav-link b {
  min-width: 24px;
  border-radius: 999px;
  background: rgba(255, 134, 23, .16);
  color: #ffb56d;
  text-align: center;
  font-size: 12px;
  padding: 2px 7px;
}

.nav-icon { color: #88a2bf; text-align: center; }

.mobile-sidebar-logout {
  display: none;
  width: 100%;
  margin: 8px 0 12px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  text-align: left;
}
.mobile-sidebar-logout:hover { border-color: rgba(255,255,255,.2); }

.sidebar-card {
  margin-top: auto;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  border-radius: var(--radius);
  padding: 14px;
}

.sidebar-card span, .sidebar-card p {
  color: #9aacbf;
  font-size: 12px;
}

.sidebar-card strong {
  display: block;
  margin: 4px 0 6px;
}

.sidebar-card small {
  display: block;
  color: #9aacbf;
  margin-bottom: 12px;
}

.sidebar-role-label {
  display: block;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-card p { display: none; margin: 0; line-height: 1.5; }

.app {
  margin-left: 260px;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  padding: 12px 28px;
  background: rgba(245, 247, 251, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(223, 230, 240, .82);
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  flex: 1;
  color: var(--muted);
  font-weight: 800;
}

.search {
  flex: 1;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
}

.search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.topbar-actions, .head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-switch {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-weight: 700;
}

.auth-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.avatar {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 700;
}

.view {
  display: none;
  padding: 28px;
}

.view.active { display: block; }

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; }
h2 { margin-bottom: 0; font-size: 17px; }
h3 { margin-bottom: 12px; font-size: 15px; }

.primary-button, .ghost-button, .text-button, .icon-button, .row-button {
  border-radius: var(--radius);
  min-height: 40px;
  border: 1px solid transparent;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
}

.primary-button {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 700;
}

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

.ghost-button {
  border-color: var(--line);
  color: #314154;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: var(--line);
}

.mobile-menu { display: none; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric, .panel, .data-panel, .code-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(24, 35, 52, .04);
}

.metric {
  padding: 18px;
  border-top: 3px solid #c5d0dd;
}

.metric.accent { border-top-color: var(--orange); }
.metric span, .metric small { color: var(--muted); }
.metric strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 30px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
}

.settings-grid {
  display: grid;
  /* 设置表单字段较多，固定单列可避免右侧卡片在窄内容区溢出并撑出空白行。 */
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.settings-grid > .form-panel {
  align-content: start;
}

.member-groups-layout { grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); }
.member-group-list { display: grid; gap: 10px; }
.member-group-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.member-group-item:last-child { border-bottom: 0; }
.member-group-item strong { margin-right: 8px; }
.member-group-item small { display: block; margin-top: 6px; color: var(--muted); }
.member-group-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.collaborator-field { display: grid; grid-column: 1 / -1; gap: 8px; min-width: 0; }
.collaborator-field > span { color: var(--muted); font-size: 14px; font-weight: 700; }
.collaborator-field > small { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.55; }
.collaborator-detail-field { padding: 14px; border: 1px solid #d9e5f0; border-radius: 10px; background: #f8fbfe; }
.collaborator-multi-picker { display: grid; gap: 8px; min-width: 0; }
.collaborator-picker-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.collaborator-selected-list { display: flex; flex: 1 1 220px; align-items: center; flex-wrap: wrap; gap: 7px; min-width: 0; }
.collaborator-empty { padding: 0 7px; color: #8190a3; font-size: 13px; font-weight: 600; }
.collaborator-person { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 2px 7px 2px 3px; border: 1px solid #b7d5ee; border-radius: 999px; background: #eef6fd; color: #1f5f96; white-space: nowrap; }
.collaborator-person i, .share-person i { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #2769a5; color: #fff; font-size: 12px; font-style: normal; font-weight: 800; }
.collaborator-person b { font-size: 13px; }
.collaborator-person button { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px; padding: 0; border: 0; border-radius: 50%; background: #d7e9f7; color: #28628f; font-size: 16px; line-height: 1; }
.collaborator-person button:hover { background: #c2def2; }
.collaborator-picker-toggle { display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; min-height: 34px !important; padding: 0 11px !important; border: 1px solid #b7d5ee !important; border-radius: 8px !important; background: #f5faff !important; color: #23649d !important; font-size: 13px; font-weight: 700; white-space: nowrap; }
.collaborator-picker-toggle:hover { border-color: #87b6dd !important; background: #eaf5ff !important; }
.collaborator-picker-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.collaborator-picker-panel { padding: 10px; border: 1px solid #cbdbea; border-radius: 10px; background: #f8fbfe; box-shadow: 0 8px 22px rgba(28, 69, 107, .08); }
.collaborator-option-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 248px; overflow: auto; }
.collaborator-option { display: grid !important; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px !important; min-height: 52px; padding: 7px 9px; border: 1px solid #d7e2ed; border-radius: 9px; background: #fff; color: var(--ink) !important; cursor: pointer; }
.collaborator-option:hover { border-color: #a9c9e4; background: #f4f9fe; }
.collaborator-option.is-selected { border-color: #82b8e5; background: #eaf5ff; box-shadow: inset 0 0 0 1px #c4def5; }
.collaborator-option input { width: 17px !important; min-height: 17px !important; margin: 0; accent-color: var(--blue); }
.collaborator-option > i { display: inline-flex; align-items: center; justify-content: center; width: 31px; height: 31px; border-radius: 50%; background: #e8eef5; color: #536b84; font-size: 12px; font-style: normal; font-weight: 800; }
.collaborator-option.is-selected > i { background: var(--blue); color: #fff; }
.collaborator-option span { display: grid; gap: 2px; min-width: 0; }
.collaborator-option b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.collaborator-option small { color: var(--muted); font-size: 11px; font-weight: 500; }
.collaborator-option em { visibility: hidden; color: var(--blue); font-size: 16px; font-style: normal; font-weight: 900; }
.collaborator-option.is-selected em { visibility: visible; }
.collaborator-picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; padding-top: 9px; border-top: 1px solid #dde7f0; color: var(--muted); font-size: 12px; }
.collaborator-picker-footer button { min-height: 28px; padding: 0 9px; border: 0; background: transparent; color: #b42318; font-size: 12px; }
.collaborator-options-empty { grid-column: 1 / -1; margin: 0; padding: 14px; color: var(--muted); text-align: center; }
.collaborator-multi-picker.is-disabled .collaborator-picker-summary { background: #f4f6f8; }
.share-cell small { display: block; margin-bottom: 6px; color: var(--muted); }
.share-people { display: flex; flex-wrap: wrap; gap: 5px; }
.share-person { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 7px 2px 2px; border: 1px solid #c7daea; border-radius: 999px; background: #f2f8fd; color: #315f88; font-size: 12px; font-weight: 700; white-space: nowrap; }
.share-person i { width: 23px; height: 23px; font-size: 10px; }
.share-person.primary { border-color: #bad8ca; background: #eff9f4; color: #247653; }
.share-person.primary i { background: #27825d; }
.share-none { color: #8795a7; font-size: 12px; }
.readonly-collaborators .share-people { margin-top: 5px; }

@media (max-width: 640px) {
  .collaborator-option-list { grid-template-columns: 1fr; }
  .collaborator-picker-toggle { width: 100%; }
}

.settings-year-panel {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 18px;
  padding: 18px;
}

.settings-year-panel h2,
.settings-year-panel .field-state {
  grid-column: 1 / -1;
}

.settings-year-panel label { min-width: 0; }
.settings-year-panel .primary-button { min-width: 160px; }

@media (max-width: 640px) {
  .settings-year-panel { grid-template-columns: 1fr; }
  .settings-year-panel .primary-button { width: 100%; }
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

.admin-overview-panel {
  align-content: start;
  grid-auto-rows: max-content;
}

.admin-user-summary > .panel-head {
  margin: 0;
  padding: 18px 18px 14px;
}

.panel { padding: 18px; }

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

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

.compact-list article {
  display: grid;
  grid-template-columns: 78px 1fr 38px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.compact-list small, .product-table small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-progress { background: #e8f1fb; color: var(--blue); }
.status-draft { background: #fff4df; color: var(--yellow); }
.status-done { background: #e6f6ef; color: var(--green); }

.todo-stack { display: grid; gap: 10px; }

.todo-stack label {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.todo-stack small {
  grid-column: 2;
  color: var(--muted);
}

.toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.product-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.product-search {
  flex: 2 1 340px;
  min-width: min(300px, 100%);
  max-width: 560px;
}

.toolbar .product-search input {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  outline: 0;
  background: transparent;
}

.product-filter-row > select {
  flex: 1 1 180px;
  min-width: 160px;
}

.product-filter-row .sort-select {
  flex: 0 1 230px;
  width: min(230px, 100%);
  min-width: 180px;
}

.filter-submit { min-height: 42px; padding-inline: 22px; }

.segmented {
  display: inline-flex;
  padding: 4px;
  background: #eaf0f7;
  border-radius: var(--radius);
}

.segmented button, .segmented a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}

.segmented button.active, .segmented a.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(24, 35, 52, .1);
}

.toolbar select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 12px;
  color: var(--text);
}

.log-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.log-toolbar label { display: grid; gap: 7px; color: var(--muted); font-weight: 700; }
.log-toolbar input, .log-toolbar select { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; background: #fff; color: var(--text); box-sizing: border-box; }
.log-toolbar .log-search { flex: 1 1 320px; min-width: min(320px, 100%); max-width: 520px; }
.log-toolbar > label:not(.log-search) { flex: 0 0 150px; }
.log-toolbar .log-search-submit { min-height: 42px; margin-bottom: 0; }
.danger-button { color: #b42318; border-color: #f0caca; background: #fff8f7; }
.danger-button:hover { color: #9e1d14; border-color: #d92d20; background: #fff0ee; }
.logs-page .view { visibility: hidden; }
.logs-page.is-ready .view { visibility: visible; }
.logs-page .compact-table td { vertical-align: top; }
.log-detail-cell { min-width: 260px; max-width: 440px; line-height: 1.55; }
.log-detail-cell strong,.log-detail-cell small { display: block; overflow-wrap: anywhere; }
.log-detail-cell small { margin-top: 4px; color: var(--muted); }
.log-device { display: block; max-width: 220px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
/* Logged-in static pages contain fallback demo HTML. Do not reveal it before session hydration. */
body[data-account] .sidebar, body[data-account] .app { visibility: hidden; }
body[data-account].session-ready .sidebar, body[data-account].session-ready .app { visibility: visible; }
@media (min-width: 901px) {
  body[data-account]:not(.session-ready) {
    background: linear-gradient(to right, #0f1d2d 0 260px, var(--bg) 260px 100%);
  }
}

.data-panel { overflow: auto; }

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

.product-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.table-sort-button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.table-sort-button:hover, .table-sort-button.is-active { color: var(--blue); }
.table-sort-icon { min-width: 12px; color: #93a2b5; font-style: normal; font-size: 14px; }
.table-sort-button.is-active .table-sort-icon { color: var(--blue); }
.table-sort-button:focus-visible, .sort-direction-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.list-sort-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.list-sort-controls label { position: relative; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.list-sort-controls label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.list-sort-controls select { width: auto; min-width: 130px; max-width: 220px; height: 40px; min-height: 40px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background-color: #fff; color: var(--text); font-size: 13px; }
.sort-direction-button { min-width: 76px; height: 40px; padding: 0 10px; border: 1px solid #cfe1f3; border-radius: var(--radius); background: #eef5fc; color: var(--blue); font-size: 13px; font-weight: 700; white-space: nowrap; }
.sort-direction-button:hover { background: #dfeefb; }
[draggable="false"] .category-draggable-name { cursor: default; }
.toolbar .list-sort-controls { margin: 0; }
.category-list-panel .list-sort-controls, .category-line-panel .list-sort-controls { padding-inline: 14px; }

.product-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.file-pill {
  display: inline-flex;
  margin: 2px 4px 2px 0;
  border: 1px solid #cbd6e3;
  border-radius: 999px;
  padding: 3px 8px;
  color: #435369;
  font-size: 12px;
  font-weight: 700;
}

.row-button {
  min-height: 32px;
  margin-right: 6px;
  border-color: var(--line);
  font-size: 13px;
}

.row-button.primary {
  background: #eef5fc;
  color: var(--blue);
  border-color: #cfe1f3;
}

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

.timeline article {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  padding-bottom: 18px;
}

.timeline article > span {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px #fff0e1;
}

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

.role {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.role-admin { background: #e6f6ef; color: var(--green); }
.role-manager { background: #fff4df; color: var(--yellow); }
.role-user { background: #e8f1fb; color: var(--blue); }
.role-auditor { background: #eef0f5; color: #46566c; }

.permission-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #cfe1f3;
  border-radius: var(--radius);
  background: #f2f8ff;
  color: #314154;
}

.permission-note strong {
  flex: 0 0 auto;
  color: var(--blue);
}

.permission-note span {
  color: var(--muted);
}

.readonly-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef0f5;
  color: #46566c;
  font-size: 12px;
  font-weight: 800;
}

.compact-table {
  min-width: 680px;
}

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

.code-grid article { padding: 18px; }
.code-grid strong { display: block; font-size: 20px; margin-bottom: 10px; }
.code-grid span, .code-grid small { display: block; color: var(--muted); }
.code-grid small { margin-top: 8px; }

.invite-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.invite-modal[hidden] { display: none; }
.invite-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 29, 50, .42); }
.invite-modal-panel { position: relative; width: min(460px, 100%); padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 48px rgba(11, 31, 53, .2); }
.invite-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.invite-modal-head h2 { margin: 0; font-size: 20px; }
.invite-form-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.invite-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.manager-modal-panel { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 24px; }
.manager-modal-head { align-items: flex-start; margin-bottom: 22px; }
.manager-modal-head h2 { max-width: calc(100% - 52px); color: var(--text); font-size: 18px; line-height: 1.55; }
.manager-modal-head h2 strong { color: var(--blue); font-size: 20px; overflow-wrap: anywhere; }
.manager-assign-form { display: grid; gap: 12px; }
.manager-assign-form label { display: grid; gap: 8px; color: var(--text); font-size: 14px; font-weight: 700; }
.manager-assign-form select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.manager-assign-form select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 90, 150, .12); }
.manager-form-note { margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.manager-assign-form .invite-modal-actions { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }

.notification-read-all { margin-left: auto; }
.timeline .notification-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.timeline .notification-row:last-child { border-bottom: 0; }
.timeline .notification-row > span { grid-column: 1; margin-top: 7px; }
.timeline .notification-row > div { grid-column: 2; min-width: 0; }
.timeline .notification-row > .row-button,
.timeline .notification-row > em { grid-column: 3; align-self: center; margin: 0; white-space: nowrap; }
.timeline .notification-row > em { color: var(--muted); font-style: normal; font-size: 13px; }
.timeline .notification-row.is-read { opacity: .6; }
.row-actions {
  white-space: nowrap;
}
.row-actions .row-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 36px;
  margin: 0;
  padding: 0 16px;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.row-actions .row-button + .row-button { margin-left: 10px; }
.row-actions .row-button:hover {
  border-color: #b9c9da;
  background: #f7f9fc;
  box-shadow: 0 1px 2px rgba(24, 35, 52, .08);
}
.row-actions .row-button.primary,
.row-actions [data-edit-company],
.row-actions [data-edit-line] {
  background: #eef5fc;
  color: var(--blue);
  border-color: #cfe1f3;
}
.row-actions .row-button.primary:hover,
.row-actions [data-edit-company]:hover,
.row-actions [data-edit-line]:hover {
  background: #dfeefb;
  border-color: #b9d5ee;
}
.row-actions .file-delete,
.row-actions .user-delete-button {
  color: #b42318;
  border-color: #f0caca;
  background: #fff8f7;
}
.row-actions .file-delete:hover,
.row-actions .user-delete-button:hover {
  color: #9e1d14;
  border-color: #e6a8a3;
  background: #fff0ee;
}
.row-actions .user-edit-button { background: #eef5fc; color: var(--blue); border-color: #cfe1f3; }
.row-actions .user-edit-button:hover { background: #dfeefb; }
#users-view .product-table th:last-child, #users-view .product-table td.row-actions { min-width: 240px; }
.user-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row-actions .user-row-actions .row-button { margin: 0; }
.row-actions .user-disable-button { color: #946000; border-color: #ecd49f; background: #fff8e8; }
.row-actions .user-disable-button:hover { border-color: #d8b66e; background: #fff1ce; }
.row-actions .user-enable-button { color: var(--green); border-color: #bde2d2; background: #effaf4; }
.row-actions .user-enable-button:hover { border-color: #8bc8ad; background: #e4f5ec; }
.row-actions .user-status-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.user-edit-page .settings-grid { visibility: hidden; }
.user-edit-page.is-ready .settings-grid { visibility: visible; }
.switch-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 9px 0 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); cursor: pointer; font-weight: 700; }
.switch-toggle i { width: 18px; height: 18px; border-radius: 50%; background: #a3b0bf; transition: .18s ease; }
.switch-toggle.is-on { border-color: #bde8d7; background: #eefaf5; color: #16845d; }
.switch-toggle.is-on i { background: #1aa776; }

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

.form-panel label, .detail-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-panel input, .form-panel select, .form-panel textarea,
.detail-grid input, .detail-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 11px;
  color: var(--text);
  background: #fff;
  box-sizing: border-box;
}

.form-panel textarea {
  min-height: 104px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.55;
}

.category-form-stack { display: grid; gap: 16px; }
.form-hint { margin: -2px 0 2px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.category-workspace { display: grid; gap: 18px; }
.category-top-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.category-list-panel { overflow: auto; }
.category-line-panel { width: 100%; }
.category-list-panel .panel-head { min-width: 460px; padding: 16px 16px 10px; }
.category-filter { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.category-filter select { min-height: 34px; max-width: 180px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 0 9px; color: var(--text); }
.category-drag-hint { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
.category-draggable-name { cursor: grab; }
.category-draggable-name:active { cursor: grabbing; }
.category-drag-handle { display: inline-block; margin-right: 9px; color: #8a9bb0; font-size: 18px; letter-spacing: -3px; vertical-align: -1px; }
.category-drag-copy { display: block; margin: 3px 0 0 28px; color: var(--muted); font-size: 12px; }
[data-drag-kind].is-dragging { opacity: .42; }
[data-drag-kind].is-drag-over td { border-top: 3px solid var(--blue); background: #eef6ff; }

.form-panel input[type="checkbox"], .detail-grid input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

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

.category-list article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.category-list strong,
.category-list span {
  display: block;
}

.category-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(62px, auto);
  align-items: center;
  width: 100%;
  height: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.unit-input input {
  height: 40px;
  min-height: 40px;
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
}

.unit-input input:focus {
  outline: 0;
}

.unit-input em {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 0 11px;
  background: var(--surface-soft);
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.unit-input input[type="number"] {
  appearance: textfield;
}

.unit-input input[type="number"]::-webkit-outer-spin-button,
.unit-input input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease;
}

.drawer.open {
  pointer-events: auto;
  opacity: 1;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 17, 28, .42);
}

.drawer-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(780px, 100%);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
  overflow: auto;
  transform: translateX(100%);
  transition: transform .22s ease;
}

.drawer.open .drawer-panel { transform: translateX(0); }
.drawer.is-loading .drawer-panel > :not(.drawer-head):not(.drawer-loading) { display: none !important; }
.drawer-loading { display: grid; min-height: 240px; place-items: center; color: var(--muted); font-size: 15px; }
.drawer-loading[hidden] { display: none; }

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

#product-drawer .drawer-head > div:first-child { min-width: 0; }
#product-drawer .drawer-head h2 { overflow-wrap: anywhere; }
#product-drawer .drawer-head > .icon-button[data-close-drawer] {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius);
}
.drawer-status-field { display: grid; align-self: flex-start; flex: 0 0 auto; gap: 6px; margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 700; }
.drawer-status-field select {
  width: 136px;
  height: 40px;
  min-height: 40px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  appearance: none;
  background: var(--surface-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m4 5.5 3 3 3-3' fill='none' stroke='%231f5a96' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--blue);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.drawer-status-field select:hover { border-color: #9fbddc; }
.drawer-status-field select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.drawer-status-field select:disabled { opacity: .6; cursor: default; }
@media (max-width: 480px) {
  #product-drawer .drawer-head { gap: 10px; }
  .drawer-status-field select { width: 112px; padding-left: 10px; }
}

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

.readonly-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.readonly-grid span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.readonly-grid b {
  min-width: 76px;
  color: var(--text);
}

.readonly-grid em { font-style: normal; }

.attachments, .history {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.file-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  margin-bottom: 12px;
  background: #eaf0f7;
  border-radius: var(--radius);
}

.file-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 700;
}

.file-tabs button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(24, 35, 52, .1);
}

.file-page { display: none; }
.file-page.active { display: block; }

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

.file-list article {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.file-list article > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border-radius: var(--radius);
  background: #eef5fc;
  color: var(--blue);
  font-weight: 800;
}

.file-list small { display: block; color: var(--muted); margin-top: 3px; }
.file-list button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 12px;
}

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

.batch-download-open { margin-left: auto; }
.batch-download-modal {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: grid;
  place-items: center;
  padding: 20px;
}
.batch-download-modal[hidden] { display: none; }
.batch-download-backdrop { position: absolute; inset: 0; background: rgba(9, 25, 43, .5); backdrop-filter: blur(2px); }
.batch-download-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(9, 29, 52, .24);
}
.batch-download-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; }
.batch-download-head p { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.batch-download-head h2 { margin: 0; font-size: 22px; }
.batch-download-all,
.batch-download-category,
.batch-download-files label { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.batch-download-all { margin: 0 24px 14px; padding: 14px 16px; background: #eef5fc; border: 1px solid #cfe0f2; border-radius: 12px; }
.batch-download-all input,
.batch-download-category input,
.batch-download-files input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--blue); }
.batch-download-all span,
.batch-download-category span,
.batch-download-files label > span { min-width: 0; flex: 1; }
.batch-download-all small,
.batch-download-category small,
.batch-download-files small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.batch-download-groups { min-height: 0; display: grid; grid-auto-rows: max-content; align-content: start; gap: 10px; overflow-y: auto; padding: 0 24px 18px; }
.batch-download-group { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.batch-download-category { padding: 13px 15px; background: #f7f9fc; }
.batch-download-files { display: grid; }
.batch-download-files label { padding: 11px 15px 11px 45px; border-top: 1px solid var(--line); }
.batch-download-files label:hover { background: #f8fbff; }
.batch-download-files strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-download-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 16px 24px 20px; border-top: 1px solid var(--line); }
.batch-download-actions > span { color: var(--muted); font-size: 13px; }
body.batch-download-opened { overflow: hidden; }

@media (max-width: 680px) {
  .batch-download-modal { padding: 10px; }
  .batch-download-panel { max-height: calc(100vh - 20px); border-radius: 14px; }
  .batch-download-head { padding: 18px 16px 14px; }
  .batch-download-all { margin: 0 16px 12px; }
  .batch-download-groups { padding: 0 16px 14px; }
  .batch-download-files label { padding-left: 25px; }
  .batch-download-actions { grid-template-columns: 1fr 1fr; padding: 14px 16px 16px; }
  .batch-download-actions > span { grid-column: 1 / -1; }
}

.file-list .file-delete {
  border-color: #f0caca;
  color: #b42318;
  background: #fff8f7;
}

.file-list .file-delete:hover {
  border-color: #d92d20;
  background: #fff0ee;
}
.history-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.history-pagination > div { display: flex; gap: 6px; }
.history-pagination .icon-button { width: 32px; min-width: 32px; height: 32px; }
.history-pagination .icon-button:disabled { opacity: .4; cursor: not-allowed; }
.overview-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.overview-pagination > div { display: flex; gap: 6px; }
.overview-pagination .icon-button { width: 32px; min-width: 32px; height: 32px; }
.overview-pagination .icon-button:disabled { opacity: .4; cursor: not-allowed; }
.category-list .overview-pagination { margin: 8px -18px -18px; }

.history ol {
  margin: 0;
  padding-left: 20px;
}

.history li { margin-bottom: 10px; }
.history span { display: block; color: var(--muted); margin-top: 3px; }

.drawer-actions {
  position: sticky;
  bottom: -24px;
  margin: 22px -24px -24px;
  padding: 14px 24px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notify-check {
  margin-right: auto;
  color: var(--muted);
}

.auth-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 90, 150, .08), transparent 42%),
    linear-gradient(315deg, rgba(255, 134, 23, .1), transparent 45%),
    var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px 0;
}

.auth-shell {
  flex: 0 0 auto;
  width: min(560px, 100%);
  min-height: 0;
  margin: auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.62);
  box-shadow: var(--shadow);
}

.auth-panel {
  background: #fff;
  padding: 26px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 0;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 18px;
}

.auth-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand small {
  color: var(--muted);
  margin-top: 2px;
}

.auth-title {
  margin-bottom: 14px;
}

.auth-title h1 {
  font-size: 26px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-form input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--text);
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.inline-check {
  display: inline-flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px !important;
}

.inline-check input {
  min-height: auto;
}

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.auth-form .auth-submit { min-height: 40px; }

.auth-footer {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.auth-side {
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-side {
  position: relative;
  min-height: 100%;
  background: #e9f0f7 url('/banner.png') center / cover no-repeat;
}
.auth-side > * { display: none; }

/* Authentication banner: image-only panel, always shown in full. */
.auth-shell .auth-side {
  padding: 0 !important;
  background-color: #e9f0f7 !important;
  background-image: url('/banner.png') !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 100% 100% !important;
}
.auth-shell .auth-side > div,
.auth-shell .auth-side > ul { display: none !important; }

.auth-side h2 {
  max-width: 620px;
  font-size: 28px;
  line-height: 1.35;
  margin-bottom: 26px;
}

.auth-side ul {
  display: grid;
  gap: 12px;
  max-width: 680px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-side li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.72);
  padding: 14px 16px;
}

.auth-side strong,
.auth-side span {
  display: block;
}

.auth-side span {
  color: var(--muted);
  margin-top: 4px;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.auth-register-form,
.auth-reset-form { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.auth-wide { grid-column: 1 / -1; }
.auth-form .field-state { line-height: 1.35; }

.captcha-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  gap: 8px;
  align-items: center;
}

.captcha-image {
  width: 150px;
  height: 46px;
  box-sizing: border-box;
  object-fit: contain;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(31, 90, 150, .12), transparent),
    repeating-linear-gradient(45deg, #fff, #fff 6px, #eef5fc 6px, #eef5fc 12px);
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 2px;
  user-select: none;
}

.invite-result.is-valid { border-color: #bde8d7; background: #eefaf5; }
.invite-result.is-valid strong { color: #16845d; }
.invite-result.is-invalid { border-color: #f0caca; background: #fff8f7; }
.invite-result.is-invalid strong { color: #b42318; }

.field-state {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field-state.success { color: #177245; }
.field-state.error { color: #b42318; }

.login-message {
  min-height: 18px;
  margin-top: 0;
}

.row-button.auth-submit,
.primary-button.auth-submit {
  text-decoration: none;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.create-product-image { display: grid; gap: 14px; }
.create-product-image .panel-head { align-items: flex-start; }
.create-product-image .panel-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.product-image-picker { display: grid; gap: 12px; cursor: pointer; }
.product-image-picker > input,
.product-image-actions input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.product-image-preview { position: relative; display: grid; place-items: center; min-height: 230px; overflow: hidden; border: 1px dashed #b9cee3; border-radius: var(--radius); background: linear-gradient(145deg,#f8fbff,#eef5fc); }
.product-image-preview img { width: 100%; height: 230px; object-fit: contain; background: #f3f6fa; }
.product-image-placeholder { display: grid; justify-items: center; gap: 6px; padding: 24px 14px; text-align: center; }
.product-image-placeholder b { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #e2effc; color: var(--blue); font-size: 28px; font-weight: 400; line-height: 1; }
.product-image-placeholder strong { color: var(--ink); }
.product-image-placeholder small { color: var(--muted); line-height: 1.5; }
.product-image-picker-actions { display: grid; gap: 4px; min-width: 0; }
.product-image-picker-actions strong { overflow: hidden; color: var(--blue); text-overflow: ellipsis; white-space: nowrap; }
.product-image-picker-actions small { color: var(--muted); line-height: 1.5; }
.product-image-picker.has-image .product-image-preview { border-style: solid; border-color: #9fc4ea; }
.product-image-picker.is-dragover .product-image-preview { border-style: solid; border-color: var(--blue); box-shadow: inset 0 0 0 2px rgba(30,103,181,.16); }

.product-image-card { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 18px; align-items: stretch; margin: 0 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fafc; }
.product-image-visual { position: relative; display: grid; place-items: center; min-height: 170px; overflow: hidden; border: 1px solid #d8e3ef; border-radius: var(--radius); background: #edf2f7; }
.product-image-visual img { width: 100%; height: 170px; object-fit: contain; background: #fff; }
.product-image-empty { display: grid; gap: 6px; padding: 20px; color: var(--muted); text-align: center; }
.product-image-empty span { color: var(--ink); font-weight: 800; }
.product-image-empty small { line-height: 1.5; }
.product-image-info { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; min-width: 0; padding: 5px 2px; }
.product-image-info > div:first-child { display: grid; gap: 6px; min-width: 0; }
.product-image-info span { color: var(--muted); font-size: 13px; font-weight: 700; }
.product-image-info strong { overflow: hidden; color: var(--ink); font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.product-image-info small { color: var(--muted); line-height: 1.5; }
.product-image-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.product-image-actions .ghost-button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.product-image-actions .danger { color: #b42318; border-color: #efc2bd; background: #fff8f7; }

.product-gallery-card { margin: 0 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fafc; transition: border-color .2s, box-shadow .2s; }
.product-gallery-card.is-dragover { border-color: var(--blue); box-shadow: inset 0 0 0 2px rgba(30,103,181,.13); }
.product-gallery-stage { position: relative; display: grid; place-items: center; min-height: 300px; overflow: hidden; border: 1px solid #d8e3ef; border-radius: var(--radius); background: #fff; }
.gallery-main { display: grid; place-items: center; width: 100%; min-height: 300px; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.gallery-main img { display: block; width: 100%; height: 300px; object-fit: contain; }
.product-gallery-empty { color: var(--muted); font-weight: 700; }
.gallery-nav { position: absolute; z-index: 2; top: 50%; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; transform: translateY(-50%); border: 1px solid rgba(196,211,227,.9); border-radius: 50%; background: rgba(255,255,255,.92); color: var(--ink); font-size: 29px; line-height: 1; box-shadow: 0 4px 14px rgba(22,45,70,.12); }
.gallery-prev { left: 14px; }.gallery-next { right: 14px; }
.gallery-counter { position: absolute; right: 14px; bottom: 12px; padding: 5px 9px; border-radius: 999px; background: rgba(15,29,45,.72); color: #fff; font-size: 12px; font-weight: 700; }
.product-gallery-strip { display: flex; gap: 10px; margin-top: 12px; padding: 2px 0 4px; overflow-x: auto; }
.gallery-thumb { position: relative; flex: 0 0 78px; width: 78px; height: 64px; padding: 0; overflow: visible; border: 2px solid transparent; border-radius: 10px; background: #edf2f7; }
.gallery-thumb.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(30,103,181,.12); }
.gallery-thumb img { width: 100%; height: 100%; overflow: hidden; border-radius: 8px; object-fit: cover; }
.gallery-thumb > span { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid #fff; border-radius: 50%; background: #c52b22; color: #fff; font-size: 17px; font-weight: 700; line-height: 1; }
.gallery-thumb > .gallery-primary { right: auto; left: -8px; background: rgba(255,255,255,.96); color: #8b99a8; box-shadow: 0 2px 8px rgba(20,43,68,.16); }
.gallery-thumb > .gallery-primary:hover,.gallery-thumb > .gallery-primary.is-primary { border-color: #fff5cc; background: #fff8d9; color: #f0a000; transform: scale(1.08); }
.gallery-primary svg { width: 15px; height: 15px; fill: currentColor; }
.gallery-thumb > em { position: absolute; left: 5px; bottom: 5px; padding: 2px 6px; border-radius: 999px; background: rgba(24,91,157,.9); color: #fff; font-size: 10px; font-style: normal; font-weight: 700; }
.gallery-add-wrap { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.gallery-add-wrap small { color: var(--muted); }
.gallery-add-button { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 13px; border: 1px solid #a8c8e8; border-radius: 10px; background: #f5faff; color: var(--blue); font-weight: 800; }
.gallery-add-button span { position: relative; display: block; width: 18px; height: 18px; }
.gallery-add-button span::before,.gallery-add-button span::after { position: absolute; top: 50%; left: 50%; width: 16px; height: 2px; border-radius: 2px; background: currentColor; content: ''; transform: translate(-50%,-50%); }
.gallery-add-button span::after { transform: translate(-50%,-50%) rotate(90deg); }
.gallery-add-button em { font-style: normal; }
.searchable-native-select { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; opacity: 0 !important; pointer-events: none !important; }
.searchable-select { position: relative; width: 100%; min-width: 0; }
.product-filter-row > .searchable-select { flex: 1 1 180px; width: auto; min-width: 160px; }
.toolbar .searchable-select-trigger { min-height: 42px; }
.searchable-select-trigger { position: relative; display: flex; align-items: center; width: 100%; min-height: 50px; padding: 10px 46px 10px 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); text-align: left; }
.searchable-select-trigger > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchable-select-trigger > i { position: absolute; top: 50%; right: 17px; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-65%) rotate(45deg); transition: transform .18s; }
.searchable-select.is-open .searchable-select-trigger { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,103,181,.12); }
.searchable-select.is-open .searchable-select-trigger > i { transform: translateY(-25%) rotate(225deg); }
.searchable-select-menu { position: absolute; z-index: 1200; top: calc(100% + 7px); left: 0; width: max(100%,320px); max-width: min(440px,calc(100vw - 32px)); padding: 10px; border: 1px solid #cfdeec; border-radius: 13px; background: #fff; box-shadow: 0 16px 38px rgba(20,43,68,.2); }
.searchable-select-search { position: relative; }
.searchable-select-search > span { position: absolute; top: 50%; left: 14px; width: 14px; height: 14px; border: 2px solid #71839a; border-radius: 50%; transform: translateY(-58%); pointer-events: none; }
.searchable-select-search > span::after { position: absolute; right: -6px; bottom: -4px; width: 7px; height: 2px; border-radius: 2px; background: #71839a; content: ''; transform: rotate(45deg); }
.searchable-select-search input { width: 100%; min-height: 44px; padding: 9px 12px 9px 39px; border: 1px solid #d6e2ed; border-radius: 9px; background: #f8fbfe; }
.searchable-select-results { max-height: 330px; margin-top: 8px; overflow-y: auto; overscroll-behavior: contain; }
.searchable-select-section { padding: 9px 10px 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.searchable-select-results button { position: relative; display: flex; align-items: center; width: 100%; min-height: 42px; padding: 8px 36px 8px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; }
.searchable-select-results button:hover,.searchable-select-results button.is-active { background: #edf5fd; color: var(--blue); }
.searchable-select-results button.is-selected { background: #e5f1fd; color: var(--blue); font-weight: 800; }
.searchable-select-results button.is-selected > i::before { position: absolute; right: 14px; top: 11px; width: 7px; height: 13px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; content: ''; transform: rotate(45deg); }
.searchable-select-empty { padding: 26px 12px; color: var(--muted); text-align: center; }
@media (max-width: 760px) { .product-filter-row > .searchable-select { flex: none; width: 100%; min-width: 0; } .searchable-select-menu { width: 100%; max-width: 100%; } }
body.lightbox-open { overflow: hidden; }
.product-lightbox[hidden] { display: none; }
.product-lightbox { position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center; }
.product-lightbox-backdrop { position: absolute; inset: 0; background: rgba(7,18,31,.9); backdrop-filter: blur(3px); }
.product-lightbox-view { position: relative; width: 100vw; height: 100vh; }
.product-lightbox-actions { position: fixed; z-index: 3; top: 22px; right: 24px; display: flex; gap: 10px; }
.product-lightbox-actions button { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(18,36,56,.76); color: #fff; font-size: 31px; line-height: 1; box-shadow: 0 6px 22px rgba(0,0,0,.25); }
.product-lightbox-actions button:hover { background: rgba(31,103,181,.94); }
.lightbox-magnifier { position: relative; display: block; width: 17px; height: 17px; border: 2px solid currentColor; border-radius: 50%; }
.lightbox-magnifier::after { position: absolute; right: -7px; bottom: -5px; width: 9px; height: 2px; border-radius: 2px; background: currentColor; content: ''; transform: rotate(45deg); transform-origin: left center; }
.product-lightbox-canvas { position: absolute; inset: 0; display: grid; place-items: center; padding: 82px 36px 36px; overflow: auto; }
.product-lightbox-canvas img { display: block; max-width: 100%; max-height: calc(100vh - 118px); object-fit: contain; border-radius: 4px; box-shadow: 0 12px 44px rgba(0,0,0,.35); cursor: zoom-in; }
.product-lightbox.is-zoomed .product-lightbox-canvas { display: block; text-align: center; }
.product-lightbox.is-zoomed .product-lightbox-canvas img { max-width: none; max-height: none; margin: 0 auto; cursor: zoom-out; }
.create-image-gallery { padding: 14px; border: 1px dashed #b9cee3; border-radius: var(--radius); background: #f8fbff; }
.create-image-gallery.is-dragover { border-style: solid; border-color: var(--blue); box-shadow: inset 0 0 0 2px rgba(30,103,181,.13); }
.create-image-drop { display: grid; justify-items: center; gap: 7px; padding: 18px; color: var(--muted); text-align: center; }
.create-image-drop > strong { color: var(--ink); }
.create-image-previews { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; }
.create-image-preview { position: relative; min-height: 110px; overflow: hidden; border: 1px solid #d5e1ed; border-radius: 10px; background: #fff; }
.create-image-preview img { display: block; width: 100%; height: 110px; object-fit: cover; }
.create-image-preview button { position: absolute; top: 6px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 2px 8px rgba(20,43,68,.16); }
.create-image-remove { right: 6px; background: #c52b22; color: #fff; font-size: 18px; }
.create-image-primary { left: 6px; background: rgba(255,255,255,.96); color: #8b99a8; }
.create-image-primary:hover,.create-image-primary.is-primary { border-color: #fff5cc; background: #fff8d9; color: #f0a000; transform: scale(1.08); }
.create-image-primary svg { width: 17px; height: 17px; fill: currentColor; }
.create-image-preview > span { position: absolute; left: 7px; bottom: 7px; padding: 3px 7px; border-radius: 999px; background: rgba(24,91,157,.9); color: #fff; font-size: 11px; font-weight: 700; }

.form-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.form-card + .form-card {
  margin-top: 18px;
}

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

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

.upload-box {
  min-height: 126px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px dashed #bfd2e6;
  border-radius: var(--radius);
  background: #f8fbff;
  padding: 16px;
}

.upload-box strong {
  color: var(--text);
}

.upload-box.has-file {
  border-color: var(--green);
  background: #f2fbf7;
  box-shadow: inset 0 0 0 1px rgba(20, 160, 110, .12);
}

.upload-box.has-file::after {
  content: "已选择";
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.upload-box.is-dragover {
  border-color: var(--blue);
  border-style: solid;
  background: #eef6ff;
  box-shadow: inset 0 0 0 2px rgba(30, 103, 181, .16);
}

.upload-box.is-dragover::after {
  content: "松开以上传";
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.upload-box span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-box input[type="file"] {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.upload-box span,
.upload-status-list small,
.empty-state span,
.error-state span,
.empty-state p,
.error-state p {
  color: var(--muted);
}

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

.upload-status-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.persistent-upload-status {
  margin: 0 18px 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fc;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.persistent-upload-status.is-loading { border-color: #9fc4ea; background: #eef6ff; color: var(--blue); }
.persistent-upload-status.is-success { border-color: #9edfc6; background: #effaf5; color: var(--green); }
.persistent-upload-status.is-error { border-color: #f0b6af; background: #fff3f1; color: #b42318; }
.persistent-upload-status progress { display: block; width: 100%; height: 12px; margin-top: 9px; }
.persistent-upload-status .text-button { margin-left: 8px; }
.edit-upload-grid { margin: 14px 18px 18px; }

.edit-lock-notice {
  position: sticky;
  top: -24px;
  z-index: 4;
  margin: -24px -24px 18px;
  padding: 13px 24px;
  border-bottom: 1px solid #efc06d;
  background: #fff7e6;
  color: #8a5700;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.detail-grid input:disabled,
.detail-grid select:disabled,
.detail-grid textarea:disabled {
  background: #eef1f5;
  color: #667085;
  cursor: not-allowed;
  opacity: 1;
}

.upload-progress-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 29, 50, .5);
}

.upload-progress-modal[hidden] { display: none; }

.upload-progress-panel {
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 20px 48px rgba(11, 31, 53, .22);
}

.upload-progress-panel h2 { margin: 0 0 10px; font-size: 20px; }
.upload-progress-panel p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; }
.upload-progress-panel strong { display: block; margin-bottom: 10px; overflow-wrap: anywhere; }
.upload-progress-panel progress { width: 100%; height: 14px; }
.upload-progress-percent { margin-top: 8px; color: var(--blue); font-weight: 800; text-align: right; }

.upload-success {
  color: #177245;
  font-weight: 800;
}

.upload-failed {
  color: #b42318;
  font-weight: 800;
}

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

.form-panel .drawer-actions.inline-actions {
  position: static;
  bottom: auto;
  margin: 8px 0 0;
  padding: 16px 0 0;
  width: 100%;
  background: transparent;
  backdrop-filter: none;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

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

.empty-state,
.error-state {
  min-height: 220px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 28px;
}

.empty-state .state-icon,
.error-state .state-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: #eef5fc;
  color: var(--blue);
  font-weight: 900;
}

.error-state .state-icon {
  background: #fff1f0;
  color: #b42318;
}

.invite-result {
  border: 1px solid #cfe1f3;
  border-radius: var(--radius);
  background: #f2f8ff;
  padding: 12px;
}

.invite-result strong,
.invite-result span {
  display: block;
}

.invite-result span {
  color: var(--muted);
  margin-top: 4px;
}

.error-shell {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 42px;
}

.error-panel {
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.error-panel h1 {
  font-size: 34px;
  margin-bottom: 12px;
}

.error-panel p {
  color: var(--muted);
  line-height: 1.8;
}

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 60;
  }

  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(10, 23, 38, .38);
  }
  .app { margin-left: 0; }
  .app-footer { margin-left: 0; }
  .mobile-menu { display: inline-flex; align-items: center; justify-content: center; }
  .mobile-sidebar-logout { display: grid; flex: 0 0 auto; }
  .metrics, .split-layout, .settings-grid, .admin-grid, .code-grid, .form-layout, .state-grid, .category-top-grid { grid-template-columns: 1fr; }
  .detail-grid, .readonly-grid { grid-template-columns: 1fr; }
  .auth-body { padding: 20px 20px 0; }
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .auth-panel { border-right: 0; }
  .auth-side { padding: 32px; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar-actions .ghost-button,
  .topbar-actions .auth-link { display: none; }
  .role-switch { max-width: 138px; }
  .view { padding: 18px 14px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .toolbar { flex-direction: column; }
  .product-filter-row { align-items: stretch; flex-direction: column; }
  .product-search { flex: none; width: 100%; max-width: none; min-width: 0; height: 42px; }
  .product-filter-row > select,
  .product-filter-row .sort-select { flex: none; width: 100%; min-width: 0; min-height: 42px; }
  .filter-submit { width: 100%; }
  .upload-grid { grid-template-columns: 1fr; }
  .product-image-card { grid-template-columns: 1fr; }
  .product-image-visual, .product-image-visual img { min-height: 190px; height: 190px; }
  .product-image-actions .ghost-button { flex: 1; }
  .product-gallery-stage,.gallery-main { min-height: 220px; }.gallery-main img { height: 220px; }
  .gallery-nav { width: 36px; height: 36px; }.gallery-prev{left:8px}.gallery-next{right:8px}
  .create-image-previews { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .upload-status-item { grid-template-columns: 1fr; }
  .segmented { overflow: auto; }
  .drawer-panel { padding: 18px; }
  .drawer-actions { margin: 22px -18px -18px; padding: 12px 18px; }
  .auth-body { padding: 0; place-items: stretch; }
  .auth-shell {
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .auth-panel { min-height: 100dvh; padding: 22px 20px; border: 0; }
  .auth-brand { margin-bottom: 20px; }
  .auth-register-form, .auth-reset-form { grid-template-columns: 1fr; }
  .auth-side { display: none !important; }
  .captcha-field {
    grid-template-columns: minmax(0, 1fr) 150px;
  }
  .captcha-field .ghost-button {
    grid-column: 1 / -1;
  }
}

/* Functional PHP application */
.functional-content { padding: 28px; }
.functional-content .data-panel { margin-top: 18px; }
.flash { margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.flash-success { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.flash-error { color: #b42318; background: #fff5f4; border-color: #fecaca; }
.functional-form { display: grid; gap: 18px; }
.functional-form label, .toolbar label { display: grid; gap: 7px; color: var(--muted); font-weight: 700; }
.functional-form input, .functional-form select, .toolbar input, .toolbar select, .upload-inline input, .upload-inline select, .inline-form select {
  width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 0 12px; color: var(--ink);
}
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.check-field { display: flex !important; align-items: center; align-self: end; min-height: 40px; }
.check-field input { width: auto; min-height: auto; }
.form-actions, .head-actions, .upload-inline, .inline-form { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.simple-list { display: grid; gap: 8px; margin-top: 16px; }
.simple-list article { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.simple-list span, .simple-list small, table small { display: block; color: var(--muted); margin-top: 3px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.functional-content .detail-grid > span { padding: 10px 0; }
.detail-grid b { display: block; margin-bottom: 5px; color: var(--muted); }
.upload-inline { justify-content: flex-start; margin: 14px 0; }
.upload-inline select { max-width: 190px; }
.upload-drop-zone { min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px dashed #b9cfe7; border-radius: var(--radius); color: var(--muted); cursor: pointer; }
.upload-drop-zone input[type="file"] { width: 1px; min-height: 1px; opacity: 0; position: absolute; }
.upload-drop-zone.is-dragover { border-color: var(--blue); border-style: solid; background: #eef6ff; color: var(--blue); }
.functional-tabs { overflow-x: auto; display: flex; }
.functional-tabs a { white-space: nowrap; color: var(--muted); padding: 10px 13px; text-decoration: none; }
.functional-tabs small { color: inherit; }
.attachment-group { padding-top: 16px; scroll-margin-top: 80px; }
.attachment-group + .attachment-group { border-top: 1px solid var(--line); margin-top: 18px; }
.history-list { display: grid; gap: 12px; }
.history-list span { display: block; color: var(--muted); margin-top: 4px; }
.notification-item.is-read { opacity: .65; }
.notification-item p { margin: 5px 0; }
.notification-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dashboard-notification { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.dashboard-notification strong, .dashboard-notification span, .dashboard-notification small { display: block; }
.dashboard-notification span, .dashboard-notification small { margin-top: 4px; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 820px; }
.status-danger { color: #b42318; background: #fff0ee; }
.table-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.table-pagination label, .table-pagination div { display: flex; align-items: center; gap: 6px; }
.table-pagination select { min-height: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 0 8px; color: var(--ink); }
.table-pagination .icon-button { width: 32px; min-width: 32px; height: 32px; }
.table-pagination .icon-button:disabled { opacity: .4; cursor: not-allowed; }
.category-panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.category-sort-button { white-space: nowrap; }
.muted-copy { color: var(--muted); }
.auth-form-separated { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.captcha-row { display: grid; grid-template-columns: 1fr 150px; gap: 8px; }
.captcha-row img { width: 150px; height: 46px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; }
.auth-links a { color: var(--blue); }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-page .auth-shell > .auth-brand { margin: 0; padding: 34px 42px 0; background: #fff; }
.auth-page .auth-shell > .auth-brand img { width: 48px; height: 48px; }
.auth-page .auth-shell > .auth-brand h1 { margin: 0; font-size: 22px; }
.auth-page .auth-shell > .auth-brand p { color: var(--muted); }
.drawer-fields label { display: grid; gap: 7px; color: var(--muted); font-weight: 700; }
.drawer-fields input, .drawer-fields select { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 0 12px; color: var(--ink); }
.drawer-fields input[readonly] { background: #fbfcfe; }
.drawer-action-spacer { flex: 1; }
.product-route-drawer .drawer-panel { width: min(780px, 100%); }
.compact-status-select { min-height: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 0 8px; }
.product-route-drawer .notify-check { margin: 10px 0 0; }
.recent-product-row { display: grid; grid-template-columns: 72px 1fr 24px; align-items: center; gap: 10px; min-height: 62px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.recent-product-row + .recent-product-row { margin-top: 8px; }
.recent-product-row small, .todo-row small { display: block; color: var(--muted); margin-top: 3px; }
.recent-product-row > b { color: var(--muted); font-size: 18px; text-align: center; }
.todo-row { display: grid !important; grid-template-columns: 18px 1fr; align-items: start; gap: 10px; min-height: 62px; }
.todo-row input { margin-top: 4px; }
.manager-metrics .metric { border-top: 3px solid #c7d4e2; }
.manager-metrics .metric.accent { border-top-color: var(--orange); }
.product-table-panel { margin-top: 14px !important; }
.product-list-controls { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.filter-details { position: relative; }
.filter-details summary { list-style: none; cursor: pointer; }
.filter-details summary::-webkit-details-marker { display: none; }
.filter-details[open] .product-filter-row { position: absolute; z-index: 8; top: 46px; right: 0; width: min(980px, calc(100vw - 300px)); padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.file-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.file-badges span { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-height: 24px; padding: 0 7px; border: 1px solid #cbd8e6; border-radius: 999px; color: #526b85; font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; }
#products-view .data-panel { max-width: 100%; }
#products-view .product-table { table-layout: fixed; min-width: 1280px; }
body[data-role="manager"] #products-view .product-table { min-width: 1500px; }
#products-view .product-table .sequence-cell { width: 68px; min-width: 68px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
#products-view .product-table th:nth-child(2), #products-view .product-table td:nth-child(2) { width: 300px; }
body[data-role="manager"] #products-view .product-table th:nth-child(6), body[data-role="manager"] #products-view .product-table td:nth-child(6) { width: 220px; }
#products-view .product-table th:last-child, #products-view .product-table td:last-child { width: 250px; min-width: 250px; }
#products-view .product-table td.attachment-cell { padding-right: 28px; }
#products-view .product-table td.row-actions { padding-left: 24px; white-space: normal; }
#products-view .product-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
#products-view .table-pagination { border-top: 0; }
#products-view .product-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#products-view .product-row-actions .row-button { min-width: 76px; margin: 0; padding-inline: 10px; white-space: nowrap; }
.product-cell-layout { display: flex; align-items: center; gap: 12px; min-width: 0; }
.product-cell-copy { display: grid; gap: 4px; min-width: 0; }
.product-cell-copy strong, .product-cell-copy small { overflow-wrap: anywhere; }
.product-thumbnail { display: inline-flex; flex: 0 0 58px; align-items: center; justify-content: center; width: 58px; height: 58px; margin: 0; padding: 0; overflow: hidden; border: 1px solid #d7e2ee; border-radius: 10px; background: #f4f7fb; color: #7c8da2; cursor: pointer; }
.product-thumbnail:hover { border-color: #9fc2e8; box-shadow: 0 3px 10px rgba(25,75,125,.12); }
.product-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-thumbnail-fallback { padding: 5px; font-size: 10px; font-weight: 700; line-height: 1.25; text-align: center; }

@media (max-width: 980px) {
  #products-view .product-table { min-width: 1280px; }
  .product-thumbnail { flex-basis: 48px; width: 48px; height: 48px; }
  #products-view .product-table th, #products-view .product-table td { padding: 12px 10px; }
  #products-view .product-table td.attachment-cell, #products-view .product-table td.row-actions { padding-left: 10px; padding-right: 10px; }
  #products-view .table-pagination { justify-content: center; flex-wrap: wrap; padding-inline: 12px; }
}
.create-fill-reminder, .sms-template-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #f7faff; }
.create-fill-reminder { margin-top: 14px; }
.create-fill-reminder > strong { display: block; margin-bottom: 12px; font-size: 14px; }
.create-fill-reminder .notify-check { margin: 12px 0 0; }
.create-fill-reminder > small, .sms-template-card > small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.sms-template-card p { margin: 10px 0 0; color: var(--text); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.invite-create-form { margin-bottom: 16px; }
.invite-card-grid article { min-height: 160px; }
.invite-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.invite-card-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.invite-card-actions .inline-form { flex-direction: row; }
.invite-card-actions input { width: 80px; min-height: 34px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 8px; }
.row-edit-details { position: relative; }
.row-edit-details summary { list-style: none; cursor: pointer; }
.row-edit-details summary::-webkit-details-marker { display: none; }
.row-edit-form { position: absolute; z-index: 12; top: 42px; right: 0; width: 280px; display: grid; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.row-edit-form label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
.row-edit-form select { min-height: 38px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; background: #fff; }

@media (max-width: 900px) {
  .functional-content { padding: 20px; }
  .form-grid, .detail-grid, .two-column { grid-template-columns: 1fr; }
  .upload-inline, .inline-form { align-items: stretch; flex-direction: column; }
  .upload-inline select { max-width: none; }
}

@media (max-width: 640px) {
  .timeline .notification-row { grid-template-columns: 18px minmax(0, 1fr); }
  .timeline .notification-row > .row-button,
  .timeline .notification-row > em { grid-column: 2; justify-self: start; margin-top: 2px; }
}
