/* Server edition: a compact product workbench with a clear, protected entry. */
:root {
  --ink: #172333;
  --navy: #142238;
  --blue: #265f9e;
  --blue-dark: #164676;
  --muted: #68798b;
  --pale: #f3f6f8;
  --line: #dce4ea;
  --selected: #e5f0f8;
  --white: #fff;
  --gold: #c9a272;
  --shadow: 0 14px 34px rgba(24, 43, 65, .065), 0 1px 3px rgba(24, 43, 65, .045);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 13px;
}

body { background: #ecf1f5; }
button { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .58; }
::selection { color: #123b62; background: #c6dff1; }

.login-screen {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
  align-items: center;
  min-height: 100dvh;
  padding: clamp(24px, 5vw, 88px);
  gap: clamp(32px, 8vw, 130px);
  overflow: hidden;
  background: linear-gradient(145deg, #142238 4%, #203753 58%, #263d57 100%);
}
.login-screen::before, .login-screen::after {
  content: "";
  position: absolute;
  width: min(66vw, 850px);
  aspect-ratio: 1;
  border: 1px solid rgba(225, 233, 241, .08);
  border-radius: 50%;
  pointer-events: none;
}
.login-screen::before { left: -18%; top: -48%; }
.login-screen::after { left: -9%; top: -32%; width: min(53vw, 700px); }
.login-backdrop {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  justify-content: space-between;
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, .65);
  letter-spacing: .2em;
  font: 600 12px/1.5 "Segoe UI", sans-serif;
}
.login-backdrop span:first-child {
  color: rgba(255, 255, 255, .08);
  font: 500 clamp(90px, 13vw, 190px)/.8 Georgia, serif;
  letter-spacing: -.06em;
}
.login-backdrop span:last-child { border-top: 1px solid rgba(255,255,255,.18); padding-top: 17px; }
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: clamp(32px, 4vw, 56px);
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 20px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .22);
  background: #fff;
}
.login-logo { display: block; width: 74px; height: 74px; object-fit: contain; margin-bottom: 28px; border: 1px solid #e6e7e7; border-radius: 15px; }
.eyebrow { margin: 0; color: #8c6a43; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.login-card h1 { margin: 11px 0 12px; color: var(--navy); font-size: clamp(27px, 3vw, 36px); letter-spacing: .03em; }
.login-intro { max-width: 26em; margin: 0 0 35px; color: #68788b; font-size: 14px; line-height: 1.75; }
.login-card label { display: block; margin-bottom: 9px; color: #2b3a4b; font-weight: 700; }
.login-card input {
  width: 100%; height: 48px; padding: 0 15px;
  color: var(--ink); background: #f8fafb;
  border: 1px solid #cbd7e1; border-radius: 10px;
}
.login-card input:focus { outline: 3px solid #cee2f3; border-color: var(--blue); }
.login-card button {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 48px; margin-top: 17px; padding: 0 16px;
  color: #fff; background: var(--navy); border: 1px solid var(--navy);
  border-radius: 10px; font-weight: 700;
}
.login-card button:hover { background: #263d58; }
.login-card button span { font-size: 22px; font-weight: 400; line-height: 1; }
.login-status { min-height: 22px; margin: 9px 0 0; color: #ad403e; }
.login-card small { display: block; margin-top: 18px; color: #8895a2; line-height: 1.55; }

#app { min-height: 100dvh; height: 100dvh; }
.topbar {
  flex: 0 0 82px; gap: 16px; padding: 12px 22px;
  background: linear-gradient(105deg, #142238 0%, #1d3048 100%);
  border-bottom: 3px solid var(--gold);
}
.brand { gap: 12px; }
.brand-logo { width: 48px; height: 48px; object-fit: contain; padding: 3px; border-radius: 8px; background: #fff; }
.brand-overline { display: block; margin-bottom: 2px; color: #d0ac7e; font: 700 9px/1.2 "Segoe UI", sans-serif; letter-spacing: .17em; }
.brand h1 { margin: 0 0 1px; font-size: 20px; letter-spacing: .035em; }
.brand p { color: #bbcce0; }
.top-actions { gap: 8px; }
.header-button {
  min-width: 92px; min-height: 38px; padding: 7px 13px;
  color: #e9f1fa; background: rgba(255,255,255,.09);
  border: 1px solid rgba(221,233,245,.21); border-radius: 8px;
  font-weight: 600;
}
.header-button:hover { color: #fff; background: rgba(255,255,255,.18); }
.header-button.primary { color: #1e3449; background: #f5f8fb; border-color: #f5f8fb; }
.header-button.primary:hover { background: #e1edf6; }
.header-button.subtle { min-width: 62px; border-color: transparent; background: transparent; color: #c0cfe0; }
.header-button.subtle:hover { color: #fff; background: rgba(255,255,255,.12); }

.workspace { grid-template-columns: minmax(380px, 43%) minmax(0, 57%); gap: 13px; padding: 13px; }
.pane { border: 1px solid #dbe3e9; border-radius: 13px; box-shadow: var(--shadow); }
.main-list-pane { border-right: 1px solid #dbe3e9; overflow: hidden; }
.pane-controls { padding: 16px 17px 11px; border-bottom: 1px solid #e5ebef; }
.section-heading { margin-bottom: 11px; }
.section-heading strong { font-size: 16px; letter-spacing: .025em; }
.count-label { display: inline-block; color: #5c7085; font-variant-numeric: tabular-nums; font-size: 12px; }
.search-row { gap: 8px; }
.search-row input, .overview-search-row input {
  height: 38px; padding: 5px 13px;
  border: 1px solid #c8d4df; border-radius: 8px;
  background: #fbfcfd;
}
.search-row input:focus, .overview-search-row input:focus { outline: 3px solid #d8e9f6; border-color: var(--blue); background: #fff; }
.search-row select { flex-basis: 122px; padding: 0 8px; border-radius: 8px; border-color: #c8d4df; background: #f5f8fa; }
.helper { color: #8797a8; font-size: 11px; }
.pane-controls .helper { margin-top: 8px; }
.main-table-scroll { margin: 0; scrollbar-color: #b7c8d7 #f4f7f9; }
.catalog-table { color: #23384d; }
.catalog-table th, .catalog-table td { border-color: #e3eaf0; }
.catalog-table th { height: 39px; color: #4d6074; background: #f4f7f9; font-size: 12px; letter-spacing: .03em; }
.catalog-table td { padding: 7px 10px; }
.main-table-scroll tbody td { height: 37px; }
.catalog-table tbody tr:nth-child(even) { background: #fafcfd; }
.catalog-table tbody tr:hover { background: #f1f7fb; }
.catalog-table tbody tr.is-selected { background: #deebf6; }
.main-table-scroll tbody tr.is-selected td:first-child { box-shadow: inset 4px 0 #3e80b9; font-weight: 700; }

.detail-pane { overflow: hidden; }
.detail-content { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 16px 19px 18px; }
.detail-top { flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) minmax(190px, 34%); gap: 18px; min-height: 190px; }
.detail-picture { min-width: 0; min-height: 0; overflow: hidden; }
.detail-copy h2 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin: 0 0 11px; font-size: 24px; color: #11243a; }
.detail-style { cursor: pointer; }
.detail-style:hover { color: var(--blue); }
.copy-style {
  align-self: center; margin-left: 7px; padding: 4px 8px;
  color: #38658a; background: #eef5fa; border: 1px solid #d7e5ef;
  border-radius: 6px; font-size: 11px; font-weight: 600;
}
.copy-style:hover { background: #deedf7; }
.detail-role { color: #68839b; margin-bottom: 12px; }
.detail-copy dl { grid-template-columns: 80px 1fr; row-gap: 8px; }
.detail-copy dt { color: #8291a1; }
.detail-copy dd { color: #1b4165; font-weight: 650; }
.detail-tip { color: #8091a2; margin-top: 9px; }
.detail-picture .image-button {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 172px; max-width: 100%; min-width: 0; min-height: 0;
  overflow: hidden; border: 1px solid #e8edf1; border-radius: 10px;
}
.detail-picture .image-button img {
  display: block; width: 100%; height: 100%; min-width: 0; min-height: 0;
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.image-button { min-width: 0; overflow: hidden; background: #f5f8fa; }
.image-button:hover:not(:disabled) { background: #edf4f9; }
.image-button img { min-width: 0; max-width: 100%; max-height: 100%; mix-blend-mode: multiply; }
.picture-hint { color: #8291a0; font-size: 11px; }
.reference-badge { border-radius: 5px; }
.base-button { border-radius: 7px; margin-top: 10px; }
.relations-heading { flex: 0 0 auto; margin: 9px 0 9px; padding-top: 10px; border-top: 1px solid #e5ebef; font-size: 13px; }
.relation-modes { flex: 0 0 auto; gap: 7px; }
.relation-modes button, .mode-buttons button {
  min-height: 35px; border-radius: 7px; border-color: #d4dee7; background: #f7f9fb; font-weight: 600;
}
.relation-modes button.active, .mode-buttons button.active { box-shadow: 0 4px 10px rgba(38, 95, 158, .13); }
.relation-table-scroll { flex: 1 1 auto; min-height: 145px; max-height: none; margin-top: 11px; border: 1px solid #e2e9ef; border-radius: 8px; }
.relation-table { min-width: 510px; }
.relation-table td { height: 37px; }
.relation-table .style-cell { color: #1f5c96; }

.overview-page { background: #ecf1f5; }
.overview-controls { padding: 14px 15px 12px; }
.mode-buttons { gap: 8px; }
.mode-buttons button { min-height: 39px; background: #fff; box-shadow: 0 1px 3px rgba(24,43,65,.04); }
.mode-buttons button.active { background: var(--blue); color: #fff; }
.overview-search-row { min-height: 45px; gap: 12px; }
.overview-search-row label { font-weight: 700; }
.overview-search-row input { width: 340px; }
.overview-workspace { grid-template-columns: minmax(270px, 31%) minmax(0, 69%); gap: 12px; padding: 0 15px 12px; background: transparent; }
.overview-list-pane, .overview-product-pane { margin: 0; overflow: hidden; }
.overview-list-pane .table-scroll, .overview-product-pane .table-scroll { min-height: 0; }
.panel-title { flex-basis: 41px; padding: 0 14px; border-bottom: 1px solid #e4eaf0; color: #1b3044; }
.overview-product-table td { height: 112px; }
.overview-product-table .image-button { height: 104px; border-radius: 7px; }
.overview-product-table .image-button img { max-height: 96px; }
.overview-code-table tbody tr.is-selected td:first-child { box-shadow: inset 4px 0 #3e80b9; font-weight: 700; }
.overview-note { flex-basis: 34px; color: #75889a; background: transparent; }
.statusbar { flex-basis: 30px; border-top: 1px solid #dce4eb; color: #6d8193; background: #f8fafc; }

.image-viewer { background: rgba(13, 23, 36, .96); }
.viewer-bar { min-height: 55px; padding: 6px 20px; }
.viewer-bar button { border-radius: 7px; }
.viewer-bar button:hover { background: rgba(255,255,255,.12); }
.viewer-stage img { border-radius: 6px; }

.text-context-menu {
  position: fixed; z-index: 70; min-width: 176px; padding: 5px;
  border: 1px solid #d8e2ea; border-radius: 9px;
  background: #fff; box-shadow: 0 15px 40px rgba(12, 35, 59, .20);
}
.text-context-menu button {
  display: block; width: 100%; padding: 9px 11px;
  border: 0; border-radius: 6px; background: transparent;
  color: #263b50; text-align: left; font-size: 12px;
}
.text-context-menu button:hover { color: #174d7e; background: #eef5fa; }

.manage-dialog { border: 0; border-radius: 16px; box-shadow: 0 24px 80px #0a193866; }
.dialog-header { padding: 20px 23px 18px; background: #17283e; }
.dialog-body { padding: 22px 23px 26px; }
.admin-connection { border-radius: 8px; }
#workbookFile { width: 100%; padding: 11px; border: 1px dashed #afc3d6; border-radius: 8px; background: #f7fafc; }
.action-button { border-radius: 8px; font-weight: 700; }
.source-item { border-color: #e0e8ee; }

@media (max-width: 1040px) {
  .workspace { grid-template-columns: minmax(340px, 46%) minmax(0, 54%); }
  .detail-top { grid-template-columns: minmax(0, 1fr) 155px; }
  .detail-picture .image-button { height: 160px; }
  .detail-copy h2 { font-size: 20px; }
}
@media (max-width: 760px) {
  #app { height: auto; min-height: 100dvh; }
  .topbar { flex-basis: auto; align-items: flex-start; flex-direction: column; padding: 14px; }
  .brand-logo { width: 42px; height: 42px; }
  .brand h1 { font-size: 18px; }
  .brand p { font-size: 11px; }
  .top-actions { width: 100%; gap: 6px; }
  .header-button { min-width: 0; flex: 1 1 auto; padding: 7px 6px; font-size: 12px; }
  .header-button.subtle { flex: 0 0 48px; min-width: 0; }
  .workspace { display: flex; flex-direction: column; padding: 10px; gap: 10px; }
  .main-list-pane { height: min(51vh, 490px); min-height: 330px; border: 1px solid #dbe3e9; }
  .detail-pane { min-height: 520px; overflow: hidden; }
  .detail-content { min-height: 520px; }
  .overview-controls { padding: 10px; }
  .mode-buttons { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .overview-workspace { display: flex; flex-direction: column; padding: 0 10px 10px; gap: 10px; }
  .overview-list-pane { height: min(34vh, 280px); }
  .overview-product-pane { height: min(60vh, 520px); }
  .overview-note { padding: 6px 13px; }
  .login-screen { display: grid; grid-template-columns: 1fr; padding: 22px; }
  .login-backdrop { display: none; }
  .login-card { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 500px) {
  .pane-controls { padding: 12px 12px 9px; }
  .search-row select { flex-basis: 104px; }
  .detail-content { padding: 13px; }
  .detail-top { grid-template-columns: minmax(0, 1fr) 118px; gap: 8px; }
  .detail-picture .image-button { height: 132px; }
  .detail-copy h2 { font-size: 18px; }
  .detail-copy dl { grid-template-columns: 61px 1fr; }
  .detail-copy dt, .detail-copy dd { font-size: 12px; }
  .relation-modes { gap: 5px; }
  .relation-modes button { min-height: 41px; padding: 5px; font-size: 12px; }
  .login-card { padding: 29px 24px; }
}
