:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  color: #25343d;
  background: #eef3f6;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #eef3f6; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #e8f0f4; }
.login-panel { width: min(390px, 100%); background: #fff; border: 1px solid #d4e0e6; padding: 30px; box-shadow: 0 12px 32px rgba(34, 52, 61, .12); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; padding: 3px; border: 1px solid #c9dbe4; background: #fff; border-radius: 6px; }
.brand-mark img { width: 100%; height: 100%; display: block; border-radius: 3px; object-fit: cover; }
.brand-mark.small { width: 30px; height: 30px; font-size: 15px; }
.login-panel h1 { margin: 16px 0 24px; font-size: 21px; }
label { display: grid; gap: 7px; margin-bottom: 15px; color: #536771; }
input, select, textarea { width: 100%; border: 1px solid #c9d7df; border-radius: 4px; padding: 9px 10px; color: #25343d; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #2f84b7; box-shadow: 0 0 0 2px rgba(47, 132, 183, .12); }
textarea { resize: vertical; min-height: 130px; }
.primary, .secondary, .danger, .toolbar-button { min-height: 34px; border: 1px solid transparent; border-radius: 4px; padding: 7px 14px; }
.primary { background: #2f84b7; color: #fff; }
.primary:hover { background: #246f9a; }
.secondary, .toolbar-button { background: #fff; border-color: #c8d6de; color: #40545e; }
.secondary:hover, .toolbar-button:hover { background: #f2f7f9; border-color: #9eb5c1; }
.danger { color: #b73b43; background: #fff; border-color: #e1afb2; }
.wide { width: 100%; }
.form-error { color: #b73b43; min-height: 20px; margin: 5px 0 10px; }
.app-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #253944; color: #fff; display: flex; flex-direction: column; }
.product { height: 62px; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid #3b505b; }
.sidebar nav { padding: 12px 8px; display: grid; gap: 3px; }
.sidebar nav button, .sidebar-footer button { border: 0; background: transparent; color: #cbd8de; padding: 10px 12px; text-align: left; border-radius: 4px; }
.sidebar nav button:hover, .sidebar nav button.active { color: #fff; background: #3a5968; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #3b505b; padding: 10px 8px; }
.workspace { min-width: 0; }
.topbar { min-height: 62px; background: #fff; border-bottom: 1px solid #d7e1e6; display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; }
.topbar h2 { font-size: 18px; margin: 0 0 2px; }
.server-state { color: #6b7e88; font-size: 12px; }
.server-state.ok { color: #218751; }
.account-badge { color: #526771; text-align: right; }
.page-content { padding: 22px 24px 40px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid #d7e1e6; border-top: 3px solid #2f84b7; padding: 16px; min-height: 92px; }
.stat:nth-child(2n) { border-top-color: #33a06f; }
.stat:nth-child(3n) { border-top-color: #e0a02d; }
.stat span { color: #6a7d87; }
.stat strong { display: block; margin-top: 8px; font-size: 25px; }
.section { margin-top: 18px; background: #fff; border: 1px solid #d7e1e6; }
.section-header { min-height: 52px; padding: 9px 14px; border-bottom: 1px solid #e0e8ec; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-header h3 { margin: 0; font-size: 15px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar select, .toolbar input { width: auto; min-width: 130px; padding: 7px 9px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e7edef; vertical-align: top; }
th { background: #f5f8fa; color: #5b6e78; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #f8fbfc; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.row-actions button { border: 0; background: transparent; color: #2f79a5; padding: 2px 4px; }
.row-actions button.danger-link { color: #b73b43; }
.link-button { padding: 0; border: 0; background: transparent; color: #2f79a5; text-align: left; }
.link-button:hover { color: #1f6389; text-decoration: underline; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border-radius: 3px; background: #e7f2f8; color: #286d94; font-size: 12px; }
.tag.green { background: #e5f4eb; color: #277d4e; }
.tag.red { background: #fae9ea; color: #a83d43; }
.empty { padding: 42px 18px; text-align: center; color: #7b8c95; }
dialog { width: min(560px, calc(100vw - 28px)); border: 0; padding: 0; box-shadow: 0 18px 55px rgba(28, 46, 56, .25); }
dialog::backdrop { background: rgba(29, 42, 49, .45); }
dialog header, dialog footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid #dfe7eb; }
dialog footer { border: 0; border-top: 1px solid #dfe7eb; justify-content: flex-end; gap: 8px; }
dialog h3 { margin: 0; font-size: 16px; }
.dialog-fields { padding: 16px; max-height: 65vh; overflow: auto; }
.icon-button { width: 30px; height: 30px; border: 0; background: transparent; font-size: 20px; color: #6b7d87; }
#dialog-error { padding: 0 16px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 340px; background: #263a44; color: #fff; padding: 11px 14px; border-radius: 4px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.muted { color: #71838c; font-size: 12px; }
.content-preview { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 164px minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .page-content { padding: 16px; }
  .topbar { padding: 10px 16px; }
}
@media (max-width: 620px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; }
  .product { height: 52px; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav button { white-space: nowrap; }
  .sidebar-footer { display: none; }
  .stat-grid, .split { grid-template-columns: 1fr; }
  .account-badge { display: none; }
}

.tenant-tree { background: #fff; }
.tree-base, .tree-project { border: 0; }
.tree-base + .tree-base { border-top: 1px solid #d7e1e6; }
.tree-base > summary, .tree-project > summary {
  list-style: none; display: flex; align-items: center; gap: 9px;
  min-height: 46px; padding: 8px 14px; cursor: pointer; user-select: none;
}
.tree-base > summary { background: #edf5f8; border-bottom: 1px solid #dbe6eb; }
.tree-project > summary { background: #f8fafb; border-bottom: 1px solid #e5ecef; }
.tree-base > summary::-webkit-details-marker, .tree-project > summary::-webkit-details-marker { display: none; }
.tree-chevron { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 7px solid #5b7a89; transition: transform .15s ease; }
details[open] > summary .tree-chevron { transform: rotate(90deg); }
.tree-projects { margin-left: 22px; border-left: 1px solid #b9ced8; }
.tree-project { position: relative; }
.tree-project > summary::before { content: ""; width: 18px; border-top: 1px solid #b9ced8; margin-left: -14px; }
.tree-shops { margin-left: 36px; border-left: 1px solid #d2e0e6; }
.tree-shop { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 0; border-bottom: 1px solid #edf1f3; }
.tree-line { width: 18px; border-top: 1px solid #d2e0e6; }
.tree-shop-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; }
.tree-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.tree-actions button { border: 0; background: transparent; color: #2f79a5; padding: 4px 5px; }
.tree-actions button:hover { background: #e7f1f6; }
.tree-actions .danger-link { color: #b73b43; }
.tree-empty { color: #7b8c95; padding: 12px 18px 12px 36px; border-bottom: 1px solid #edf1f3; }
@media (max-width: 720px) {
  .tree-base > summary, .tree-project > summary { flex-wrap: wrap; }
  .tree-actions { width: 100%; margin-left: 24px; }
  .tree-shop { align-items: flex-start; flex-wrap: wrap; }
  .tree-shop .tree-actions { width: auto; margin-left: 28px; }
}


/* Script resource manager */
.script-manager { height: calc(100vh - 124px); min-height: 520px; margin-top: 18px; display: flex; flex-direction: column; background: #fff; border: 1px solid #d4e0e6; }
.script-manager-toolbar { flex: 0 0 auto; border-bottom: 1px solid #dce6ea; background: #f8fafb; }
.script-scope-tabs { min-height: 48px; display: flex; align-items: end; gap: 3px; padding: 8px 14px 0; border-bottom: 1px solid #dce6ea; background: #fff; }
.script-scope-tabs button { min-width: 78px; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #526a76; font-weight: 600; }
.script-scope-tabs button:hover { background: #f2f7f9; color: #1f6f96; }
.script-scope-tabs button.active { border-bottom-color: #2187b2; color: #176f99; background: #f4f9fb; }
.script-scope-tabs small { min-width: 22px; padding: 1px 5px; border-radius: 8px; background: #e7eef1; color: #6b7f89; font-size: 11px; font-weight: 500; }
.script-scope-tabs button.active small { background: #d9edf6; color: #176f99; }
.script-filter-row { min-height: 58px; display: grid; grid-template-columns: repeat(4, minmax(120px, 160px)) minmax(220px, 1fr); gap: 9px; align-items: center; padding: 10px 14px; }
.script-filter-row select, .script-filter-row input { min-width: 0; min-height: 36px; margin: 0; }
.script-filter-row .primary { min-height: 36px; white-space: nowrap; }
.script-search { position: relative; min-width: 0; }
.script-search input { padding-right: 34px; }
.script-search button { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border: 0; background: transparent; color: #7b8c95; font-size: 18px; line-height: 1; }
.script-search button:hover { color: #2f84b7; background: #eef5f8; }
.script-workspace { min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: minmax(250px, 292px) minmax(0, 1fr); }
.script-sidebar { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); border-right: 1px solid #dce6ea; background: #f8fafb; }
.script-sidebar-header, .script-main-header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #dce6ea; background: #fff; }
.script-sidebar-header > div { min-width: 0; display: grid; gap: 2px; }
.script-sidebar-header strong { font-size: 15px; }
.script-sidebar-header span { color: #7a8c95; font-size: 11px; }
.script-main-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.script-main-actions button { min-height: 34px; white-space: nowrap; }
.icon-add { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #bfd0d9; border-radius: 4px; background: #fff; color: #2f79a5; font-size: 17px; line-height: 1; }
.icon-add:hover { background: #eaf4f8; border-color: #7da9bd; }
.script-tree { min-height: 0; padding: 7px 0 28px; overflow-x: hidden; overflow-y: hidden; scrollbar-color: #8fa2ab #eef2f3; scrollbar-width: auto; }
.script-tree.is-scrollable { overflow-y: auto; }
.script-tree::-webkit-scrollbar { width: 11px; }
.script-tree::-webkit-scrollbar-track { background: #eef2f3; }
.script-tree::-webkit-scrollbar-thumb { min-height: 42px; border: 2px solid #eef2f3; border-radius: 6px; background: #8fa2ab; }
.script-tree::-webkit-scrollbar-thumb:hover { background: #718892; }
.script-tree-base, .script-tree-category { border: 0; }
.script-tree-base + .script-tree-base { border-top: 1px solid #dce6ea; }
.script-tree-base > summary, .script-tree-category > summary { position: relative; display: flex; align-items: center; gap: 4px; list-style: none; cursor: pointer; user-select: none; }
.script-tree-base > summary { min-height: 43px; padding: 4px 8px; background: #eef5f8; }
.script-tree-category > summary { min-height: 42px; padding: 3px 7px 3px 5px; }
.script-tree-base > summary::-webkit-details-marker, .script-tree-category > summary::-webkit-details-marker { display: none; }
.script-tree-base > summary:hover { background: #e5f0f5; }
.script-tree-category > summary:hover, .script-tree-group:hover { background: #edf4f7; }
.script-tree-base > summary .script-tree-select { color: #284b5c; font-weight: 600; }
.script-tree-base > summary .script-tree-select.active { background: #cfe8f3; color: #176b94; }
.script-tree-base .tree-chevron { flex: 0 0 auto; border-left-color: #527486; transform: scale(.85); }
.script-tree-category .tree-chevron { flex: 0 0 auto; border-left-color: #66808d; transform: scale(.75); }
.script-tree-categories { margin-left: 17px; border-left: 1px solid #bdd1db; background: #f9fbfc; }
.script-tree-select { min-width: 0; flex: 1; min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; border-radius: 3px; padding: 5px 7px; background: transparent; color: #304650; text-align: left; }
.script-tree-select > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-tree-select > .script-tree-label { min-width: 0; display: grid; gap: 1px; overflow: hidden; }
.script-tree-label > span, .script-tree-label em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-tree-label em { color: #81929a; font-size: 11px; font-style: normal; font-weight: 400; }
.script-tree-select small { flex: 0 0 auto; min-width: 22px; padding: 1px 5px; border-radius: 9px; background: #e4ecef; color: #6d7e86; text-align: center; font-size: 11px; }
.script-tree-select.active, .script-tree-group.active .script-tree-select { background: #dceef6; color: #216f98; font-weight: 600; }
.script-tree-select.active small, .script-tree-group.active small { background: #fff; color: #216f98; }
.script-tree-groups { padding-left: 23px; }
.script-tree-group { position: relative; min-height: 38px; display: flex; align-items: center; padding: 2px 7px 2px 6px; border-left: 1px solid #c8d9e1; }
.script-tree-group::before { content: ""; width: 10px; flex: 0 0 10px; border-top: 1px solid #c8d9e1; }
.script-tree-empty { padding: 9px 14px 9px 30px; color: #81919a; font-size: 12px; }
.script-tree-empty.large { padding: 34px 14px; text-align: center; }
.script-tree-actions { position: relative; flex: 0 0 auto; }
.script-tree-more { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #718690; font-size: 18px; line-height: 1; opacity: .12; }
.script-tree-category > summary:hover .script-tree-more, .script-tree-group:hover .script-tree-more, .script-tree-actions.open .script-tree-more, .script-tree-more:focus { opacity: 1; }
.script-tree-more:hover, .script-tree-actions.open .script-tree-more { background: #dbeaf1; color: #1f759f; }
.script-tree-menu { position: fixed; z-index: 1000; inset: auto; top: 0; left: 0; width: 138px; display: none; margin: 0; padding: 5px; border: 1px solid #cddbe2; background: #fff; box-shadow: 0 8px 22px rgba(32,55,66,.16); }
.script-tree-actions.open .script-tree-menu, .script-tree-menu.portal-open, .script-tree-menu:popover-open { display: grid; }
.script-tree-menu button { min-height: 31px; border: 0; border-radius: 3px; background: transparent; color: #334b57; text-align: left; }
.script-tree-menu button:hover { background: #edf5f8; color: #1d7098; }
.script-tree-menu span { height: 1px; margin: 4px 3px; background: #e1e9ed; }
.script-tree-menu button.danger { color: #b53c45; }
.script-tree-menu button.danger:hover { background: #faecee; color: #a12832; }
.script-main { min-width: 0; background: #fff; }
.script-main-header h3 { margin: 0 0 3px; font-size: 15px; }
.script-main-header h3 span { padding: 0 4px; color: #9aabb3; font-weight: 400; }
.script-list { max-height: calc(100vh - 287px); overflow-x: hidden; overflow-y: auto; }
.script-list-head, .script-item-row { display: grid; grid-template-columns: minmax(210px, 1.45fr) minmax(175px, .9fr) 128px 82px; column-gap: 15px; align-items: center; padding: 0 15px; }
.script-list-head { position: sticky; top: 0; z-index: 2; min-height: 38px; border-bottom: 1px solid #dce5e9; background: #f4f7f8; color: #617781; font-size: 12px; font-weight: 600; }
.script-item-row { min-height: 76px; border-bottom: 1px solid #e7edef; transition: background-color .12s ease; }
.script-item-row:hover { background: #f5fafc; }
.script-item-copy { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 8px; }
.script-item-title { grid-column: 1 / -1; overflow: hidden; color: #233c48; text-overflow: ellipsis; white-space: nowrap; }
.script-item-copy p { min-width: 0; grid-column: 2; display: -webkit-box; margin: 0; overflow: hidden; color: #405660; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.scope-badge { grid-column: 1; grid-row: 2; align-self: start; min-width: 38px; display: inline-flex; justify-content: center; padding: 2px 6px; border-radius: 3px; background: #e7f1f6; color: #2b759b; font-size: 11px; }
.scope-group { background: #e8f3ea; color: #397b4f; }
.scope-shop { background: #fff0df; color: #9a641f; }
.scope-private { background: #f5e9f1; color: #955078; }
.script-item-location { min-width: 0; display: grid; gap: 3px; }
.script-item-location strong, .script-item-location span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-item-location strong { color: #324b57; font-size: 13px; }
.script-item-location span { color: #71848e; font-size: 12px; }
.script-item-row time { color: #6f828b; font-size: 12px; white-space: nowrap; }
.script-item-actions { display: flex; justify-content: flex-end; gap: 3px; }
.script-item-actions button { border: 0; background: transparent; color: #2f79a5; padding: 5px; }
.script-item-actions button:hover { background: #e7f1f6; }
.script-item-actions .danger-link { color: #b73b43; }
.script-empty { min-height: 280px; display: grid; place-content: center; gap: 7px; padding: 24px; text-align: center; color: #84949b; }
.script-empty strong { color: #516974; font-size: 15px; }
button:disabled { cursor: not-allowed; opacity: .48; }
@media (max-width: 1180px) {
  .script-filter-row { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .script-search { grid-column: 1 / 3; }
  .script-list-head, .script-item-row { grid-template-columns: minmax(240px, 1.35fr) minmax(180px, .8fr) 84px; }
  .script-list-head span:nth-child(3), .script-item-row time { display: none; }
}
@media (max-width: 820px) {
  .script-scope-tabs { overflow-x: auto; }
  .script-scope-tabs button { min-width: 68px; }
  .script-filter-row { grid-template-columns: 1fr 1fr; }
  .script-search { grid-column: 1 / -1; }
  .script-manager { height: auto; min-height: 0; }
  .script-workspace { grid-template-columns: 1fr; }
  .script-sidebar { grid-template-rows: auto minmax(0, 300px); border-right: 0; border-bottom: 1px solid #dce6ea; }
  .script-tree { max-height: 300px; }
  .script-list { max-height: none; }
  .script-list-head, .script-item-row { grid-template-columns: minmax(0, 1fr) 78px; }
  .script-list-head span:nth-child(2), .script-item-location { display: none; }
}
.audit-action { display: inline-flex; min-width: 64px; color: #285f7d; font-weight: 600; }
.resource-id { color: #647781; font-family: Consolas, "Segoe UI", sans-serif; font-size: 12px; }

.tenant-path { min-width: 170px; max-width: 260px; color: #526b77; line-height: 1.55; }

/* 2026 business UI */
:root {
  color: #26332f;
  background: #f4f6f5;
  font-size: 14px;
  --ink: #26332f;
  --muted: #6c7974;
  --line: #dce3e0;
  --line-strong: #c8d2ce;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --accent: #087f6b;
  --accent-dark: #066654;
  --accent-soft: #e5f3ef;
  --amber: #b87a17;
  --danger: #bd3d45;
}
body { background: #f4f6f5; color: var(--ink); }
.login-view { padding: 28px; background: #eef2f0; }
.login-panel { width: min(400px, 100%); padding: 0 34px 34px; border: 1px solid var(--line-strong); border-top: 4px solid var(--accent); border-radius: 6px; box-shadow: 0 18px 44px rgba(30, 48, 41, .12); }
.login-brand { min-height: 82px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #e7ecea; }
.login-brand > div:last-child { display: grid; gap: 2px; }
.login-brand strong { color: #173b33; font-size: 18px; }
.login-brand span { color: var(--muted); font-size: 12px; }
.brand-mark { width: 42px; height: 42px; border-color: #cbd8d3; border-radius: 6px; }
.login-heading { padding: 27px 0 19px; }
.login-heading > span { display: block; margin-bottom: 7px; color: var(--accent); font-size: 12px; font-weight: 600; }
.login-panel .login-heading h1 { margin: 0; color: #20312c; font-size: 22px; line-height: 1.35; }
.login-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.login-panel label { gap: 8px; margin-bottom: 17px; color: #42534d; font-weight: 600; }
.login-panel input { height: 43px; padding: 9px 12px; font-weight: 400; }
input, select, textarea { border-color: var(--line-strong); border-radius: 5px; color: var(--ink); }
input:hover, select:hover, textarea:hover { border-color: #9fafa9; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 127, 107, .11); }
.primary, .secondary, .danger, .toolbar-button { min-height: 36px; border-radius: 5px; font-weight: 600; }
.primary { background: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.secondary, .toolbar-button { border-color: var(--line-strong); color: #40504a; }
.secondary:hover, .toolbar-button:hover { border-color: #a7b6b0; background: #f4f7f6; }
.danger { color: var(--danger); border-color: #e5b7ba; }
.login-panel .primary { height: 43px; margin-top: 2px; }
.form-error { color: var(--danger); }
.app-shell { grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { background: var(--surface); color: var(--ink); border-right: 1px solid var(--line); }
.product { height: 64px; padding: 0 17px; border-bottom: 1px solid var(--line); color: #173b33; }
.product strong { font-size: 15px; }
.brand-mark.small { width: 32px; height: 32px; }
.sidebar nav { gap: 2px; padding: 16px 10px; }
.sidebar nav button, .sidebar-footer button { position: relative; min-height: 40px; padding: 9px 12px 9px 16px; border-radius: 5px; color: #53615c; font-weight: 500; }
.sidebar nav button::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: transparent; }
.sidebar nav button:hover { color: #174e42; background: #f0f6f4; }
.sidebar nav button.active { color: #086c5b; background: var(--accent-soft); font-weight: 700; }
.sidebar nav button.active::before { background: var(--accent); }
.sidebar-footer { border-top-color: var(--line); }
.sidebar-footer button { color: #687670; }
.workspace { background: #f4f6f5; }
.topbar { min-height: 64px; padding: 10px 26px; border-bottom-color: var(--line); box-shadow: 0 1px 0 rgba(27, 45, 38, .02); }
.topbar h2 { color: #26352f; font-size: 18px; }
.server-state { color: var(--muted); }
.server-state.ok { color: #15805d; }
.account-badge { color: #43534d; }
.page-content { max-width: 1680px; padding: 24px 26px 42px; }
.stat-grid { gap: 12px; }
.stat { min-height: 94px; padding: 17px 18px; border-color: var(--line); border-top: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 5px; }
.stat:nth-child(2n) { border-top-color: var(--line); border-left-color: #3a7aa0; }
.stat:nth-child(3n) { border-top-color: var(--line); border-left-color: var(--amber); }
.stat span { color: var(--muted); }
.stat strong { color: #20352e; font-size: 26px; }
.section { margin-top: 16px; border-color: var(--line); border-radius: 5px; overflow: hidden; }
.section-header { min-height: 54px; padding: 9px 14px 9px 16px; border-bottom-color: var(--line); }
.section-header h3 { color: #2a3934; font-size: 15px; }
.toolbar { gap: 7px; }
.toolbar select, .toolbar input { min-height: 36px; border-radius: 5px; }
.table-wrap { background: var(--surface); }
th, td { padding: 11px 13px; border-bottom-color: #e6ebe9; }
th { background: var(--surface-soft); color: #52625c; }
tbody tr:nth-child(even) { background: #fbfcfc; }
tbody tr:hover { background: #edf7f4; }
.row-actions button, .link-button { color: #087461; }
.row-actions button:hover { color: #075d4f; text-decoration: underline; }
.row-actions button.danger-link { color: var(--danger); }
.tag { background: #e5f3ef; color: #08715f; }
.tag.green { background: #e8f5ed; color: #27784c; }
.empty { color: #7b8883; }
dialog { border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 22px 60px rgba(23, 42, 35, .24); }
dialog::backdrop { background: rgba(24, 37, 32, .42); }
dialog header { min-height: 54px; background: var(--surface-soft); border-bottom-color: var(--line); }
dialog footer { min-height: 58px; border-top-color: var(--line); }
.dialog-fields { padding: 19px 18px 8px; }
.toast { background: #1f3b33; border-left: 4px solid #22a27f; }
.tenant-tree, .script-manager { border-color: var(--line); border-radius: 5px; overflow: hidden; }
.tree-base > summary { background: #f1f7f5; }
.tree-project > summary { background: #fafbfb; }
.tree-actions button, .script-item-actions button { color: #087461; }
.script-manager-toolbar, .script-sidebar { background: var(--surface-soft); }
.script-scope-tabs button.active { border-bottom-color: var(--accent); color: var(--accent-dark); background: #f1f8f6; }
.script-scope-tabs button:hover { color: var(--accent-dark); }
.script-tree-base > summary { background: #eef6f3; }
.script-tree-select.active, .script-tree-group.active .script-tree-select { background: #dff1ec; color: #096755; }
.script-list-head { background: #f5f7f6; }
.script-item-row:hover { background: #eef7f4; }
.scope-badge { background: #e2f2ed; color: #08715f; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 176px minmax(0, 1fr); }
  .page-content { padding: 18px; }
}
@media (max-width: 620px) {
  .login-view { padding: 14px; }
  .login-panel { padding: 0 24px 26px; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* Management login */
.login-view { display: grid; min-height: 100vh; place-items: center; padding: 48px 6vw; background: #f1f5f8; }
.login-layout { width: min(1460px, 100%); display: grid; grid-template-columns: minmax(520px, 1fr) minmax(400px, 480px); align-items: center; gap: clamp(72px, 9vw, 150px); }
.login-intro { position: relative; min-width: 0; padding: 34px 0 35px 46px; }
.login-intro::before { content: ""; position: absolute; left: 0; top: 42px; bottom: 42px; width: 3px; background: #b51f35; }
.company-logo { width: 300px; height: 151px; margin-bottom: 34px; overflow: hidden; }
.company-logo img { width: 300px; height: 300px; display: block; transform: translateY(-66px); mix-blend-mode: multiply; }
.login-kicker { display: block; margin-bottom: 13px; color: #b51f35; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; }
.login-intro-copy h1 { margin: 0; color: #202e42; font-size: 42px; font-weight: 500; line-height: 1.28; }
.login-intro-copy > p { margin: 22px 0 0; color: #647389; font-size: 16px; line-height: 1.8; }
.operation-map { width: min(660px, 100%); display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 45px; border-top: 1px solid #d4dee8; border-bottom: 1px solid #d4dee8; }
.operation-map > div { position: relative; display: grid; min-height: 106px; align-content: center; gap: 4px; padding: 15px 24px; }
.operation-map > div + div { border-left: 1px solid #d4dee8; }
.operation-map small { color: #b51f35; font-size: 10px; font-weight: 700; }
.operation-map strong { color: #25364c; font-size: 17px; font-weight: 600; }
.operation-map span { color: #7b8898; font-size: 12px; }
.login-panel { width: 100%; padding: 44px 42px 34px; border: 1px solid #d7e0ea; border-top: 3px solid #b51f35; border-radius: 6px; background: #fff; box-shadow: 0 18px 48px rgba(42, 59, 80, .09); }
.login-heading { padding: 0 0 29px; }
.login-heading h2 { margin: 0; color: #1f2c40; font-size: 32px; font-weight: 500; line-height: 1.35; }
.login-heading p { margin: 10px 0 0; color: #758296; font-size: 14px; }
.login-panel label { gap: 8px; margin-bottom: 18px; color: #2d3a4d; font-size: 14px; }
.login-panel input:not([type="checkbox"]) { height: 44px; padding: 9px 12px; border-color: #d4dde7; border-radius: 4px; color: #1f2e43; }
.login-panel input:not([type="checkbox"]):focus { border-color: #2475db; box-shadow: 0 0 0 3px rgba(36, 117, 219, .1); }
.login-panel input::placeholder { color: #a2adbb; }
.remember-login { display: flex; width: fit-content; grid-template-columns: none; align-items: center; gap: 9px !important; margin: 2px 0 17px !important; color: #506077 !important; font-weight: 400 !important; cursor: pointer; }
.remember-login input { width: 17px; height: 17px; margin: 0; accent-color: #2475db; }
.login-panel .form-error { min-height: 20px; margin: 0 0 7px; font-size: 13px; }
.login-panel .primary { height: 44px; margin: 0; border-radius: 4px; background: #2475db; font-weight: 500; }
.login-panel .primary:hover { background: #195fbb; }
.login-note { margin: 28px 0 0; color: #8b96a5; text-align: center; font-size: 12px; }
@media (max-width: 1050px) {
  .login-view { padding: 38px; }
  .login-layout { grid-template-columns: minmax(400px, 1fr) minmax(370px, 440px); gap: 54px; }
  .login-intro { padding-left: 32px; }
  .company-logo { width: 270px; height: 136px; margin-bottom: 26px; }
  .company-logo img { width: 270px; height: 270px; transform: translateY(-59px); }
  .login-intro-copy h1 { font-size: 34px; }
  .operation-map > div { padding: 14px; }
}
@media (max-width: 780px) {
  .login-view { align-items: start; padding: 22px 18px 32px; }
  .login-layout { width: min(450px, 100%); grid-template-columns: 1fr; gap: 18px; }
  .login-intro { display: grid; justify-items: center; padding: 0; text-align: center; }
  .login-intro::before { display: none; }
  .company-logo { width: 245px; height: 122px; margin: 0 0 7px; }
  .company-logo img { width: 245px; height: 245px; transform: translateY(-54px); }
  .login-kicker { margin-bottom: 6px; }
  .login-intro-copy h1 { font-size: 27px; }
  .login-intro-copy > p, .operation-map { display: none; }
  .login-panel { padding: 30px 26px 26px; }
  .login-heading h2 { font-size: 27px; }
}
