:root {
  font: 15px/1.52 Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color-scheme: light;
  --page-bg: #f7f0e2;
  --panel: #fffdf7;
  --paper: #fbf7ed;
  --sand: #f2e8d5;
  --ink: #33281d;
  --subtle-ink: #54412e;
  --mute: #695641;
  --line: #e6d8c2;
  --line-strong: #d4bea0;
  --control-border: #988266;
  --primary: #8a4b08;
  --primary-hover: #6d3803;
  --on-primary: #fffdf7;
  --accent: #ae691e;
  --light: #f8ead0;
  --accent-line: #eed8ad;
  --success-bg: #e7efe1;
  --success-ink: #35573b;
  --error-bg: #fcf0eb;
  --error-ink: #8b392a;
  --error-line: #eccac0;
  --activity-bg: #f2e7d4;
  --activity-ink: #714315;
  --attention-bg: #fae8be;
  --attention-ink: #694916;
  --shadow-low: #5235190b;
  --shadow-float: #52351928;
  --shadow-dialog: #442d2240;
  --scrim: #39281f75;
  --shell-gutter: clamp(16px, 3vw, 42px);
  --shell-width: 1536px;
  color: var(--ink);
  background: var(--page-bg);
}

:root[data-theme="lightning"] {
  color-scheme: dark;
  --page-bg: #111b2c;
  --panel: #19283d;
  --paper: #142235;
  --sand: #21324a;
  --ink: #edf3fc;
  --subtle-ink: #c9d7e8;
  --mute: #a9b9cf;
  --line: #2e405a;
  --line-strong: #46607e;
  --control-border: #6d84a2;
  --primary: #f7d64a;
  --primary-hover: #ffe783;
  --on-primary: #111b2c;
  --accent: #f7d64a;
  --light: #30344a;
  --accent-line: #45435a;
  --success-bg: #213a38;
  --success-ink: #a7e0c3;
  --error-bg: #422d3c;
  --error-ink: #ffbcb6;
  --error-line: #855368;
  --activity-bg: #253c56;
  --activity-ink: #bcd9f6;
  --attention-bg: #3e3524;
  --attention-ink: #f8da86;
  --shadow-low: #00000024;
  --shadow-float: #00000052;
  --shadow-dialog: #00000066;
  --scrim: #060d1ab8;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 3vw, 37px); letter-spacing: -.04em; line-height: 1.2; }
h2 { font-size: 19px; letter-spacing: -.018em; }
h3 { font-size: 16px; }
.skip, .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { z-index: 10; clip-path: none; width: auto; height: auto; background: var(--panel); padding: .6rem; }

.header {
  position: relative;
  z-index: 2;
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 2px 10px var(--shadow-low);
}
.header-inner {
  min-height: 64px;
  max-width: var(--shell-width);
  padding-inline: var(--shell-gutter);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.75vw, 31px);
}
.brand { display: inline-flex; align-items: center; gap: 9px; flex-shrink: 0; color: var(--ink); font-size: 17px; font-weight: 750; white-space: nowrap; }
.brand:hover { color: var(--primary); }
.brand-icon {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 34px;
  height: 34px;
  padding-bottom: 8px;
  border-radius: 9px;
  background: var(--primary);
}
.brand-icon i { display: block; width: 4px; height: 8px; border-radius: 4px; background: var(--on-primary); }
.brand-icon i:nth-child(2) { height: 14px; }
.brand-icon i:nth-child(3) { height: 18px; }
.header-navigation { min-width: 0; flex: 1; display: flex; align-items: center; gap: clamp(10px, 1.2vw, 20px); }
.header nav { display: flex; align-items: stretch; gap: 2px; }
.header nav a {
  display: inline-flex;
  position: relative;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  padding: 7px clamp(7px, .9vw, 15px);
  color: var(--subtle-ink);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
}
.header nav a:hover { background: var(--paper); color: var(--primary); }
.header nav a[aria-current="page"] { background: var(--light); color: var(--primary); font-weight: 720; }
.header nav a[aria-current="page"]::after {
  position: absolute;
  content: "";
  bottom: 0;
  inset-inline: 10px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.header .utility-nav {
  gap: 2px;
  padding-inline-start: clamp(8px, 1vw, 16px);
  border-inline-start: 1px solid var(--line);
}
.header .utility-nav a { font-weight: 550; }
.header .utility-nav a[aria-current="page"] { font-weight: 720; }
.dropdown { position: relative; flex-shrink: 0; }
.dropdown summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 3px 8px 3px 4px; list-style: none; border-radius: 20px; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary:hover, .dropdown[open] summary { background: var(--paper); }
.dropdown-body {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 10;
  min-width: 180px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: 0 9px 26px var(--shadow-float);
}
.dropdown-body a, .dropdown-body button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
  border: 0;
  border-radius: 5px;
  background: none;
}
.dropdown-body a:hover, .dropdown-body button:hover { background: var(--light); color: var(--primary); }
.dropdown-body a[aria-current="location"] { background: var(--light); color: var(--primary); font-weight: 700; }
.avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  background: var(--light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}
#account-name { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chevron { width: 7px; height: 7px; flex-shrink: 0; border-right: 1px solid var(--mute); border-bottom: 1px solid var(--mute); transform: translateY(-2px) rotate(45deg); }

main { width: min(var(--shell-width), 100%); margin-inline: auto; padding: 0 var(--shell-gutter) 44px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 29px 0 24px; }
.head p { color: var(--mute); margin-top: 7px; }
.breadcrumb { color: var(--mute); font-size: 13px; margin-bottom: 8px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 2px; }
.layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 18px; align-items: start; }
#rail { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 7px; }
.rail-label { padding: 7px 10px 10px; color: var(--mute); font-size: 13px; font-weight: 700; }
#rail a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  margin: 2px 0;
  padding: 7px 9px;
  border-radius: 6px;
  border-inline-start: 3px solid transparent;
  color: var(--subtle-ink);
  font-size: 14px;
}
#rail a:hover { background: var(--paper); color: var(--primary); }
#rail a[aria-current="page"] { background: var(--light); color: var(--primary); border-inline-start-color: var(--accent); font-weight: 700; }
.rail-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  min-width: 24px;
  height: 23px;
  background: var(--sand);
  color: var(--mute);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
#rail a[aria-current="page"] .rail-number { background: var(--accent-line); color: var(--primary-hover); }

.page { display: grid; gap: 14px; min-width: 0; }
.panel { min-width: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel-header { padding: 17px 20px; }
.panel-header p { color: var(--mute); margin-top: 4px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.metric { padding: 12px 17px; min-width: 0; }
.metric + .metric { border-inline-start: 1px solid var(--line); }
.metric p { color: var(--mute); font-size: 13px; }
.metric strong { display: block; margin-top: 1px; font-size: 23px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.metric:nth-child(3) strong { color: var(--primary); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 15px; }
.filters .search { flex: 1; min-width: min(100%, 180px); }
.filters input, .filters select { width: auto; max-width: 100%; }
.table-wrap { overflow: auto; border-top: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
th, td { font-variant-numeric: tabular-nums; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th { color: var(--subtle-ink); background: var(--sand); font-size: 13px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--paper); }
tbody tr:focus-within { background: var(--light); }
td small { display: block; color: var(--mute); }
.glossary-tools label { margin: 12px 0 5px; }
.glossary-tools input { width: min(100%, 420px); min-height: 44px; }
.glossary-tools [role="status"] { margin-top: 8px; }
.glossary-action { margin-top: 12px; }
.glossary-table table { table-layout: fixed; white-space: normal; }
.glossary-table thead th:first-child { width: 30%; }
.glossary-table th, .glossary-table td { overflow-wrap: anywhere; vertical-align: top; }
.glossary-table tbody th { background: transparent; color: var(--ink); font-size: 14px; }
.glossary-table tbody tr:last-child th { border-bottom: 0; }
.job-name > strong, .job-name > small { display: block; max-width: clamp(184px, 23vw, 330px); overflow: hidden; text-overflow: ellipsis; }
.task-action { display: flex; align-items: center; gap: 9px; }
.task-action button, .task-action a { padding: 3px 0; white-space: nowrap; font-size: 13px; }
.link { color: var(--primary); border: 0; background: none; padding: 0; text-align: left; }
.link:hover { text-decoration: underline; }
.empty { padding: 32px 16px 38px; color: var(--mute); text-align: center; white-space: normal; }
.empty-mark { display: inline-grid; place-items: center; width: 43px; height: 43px; margin-bottom: 9px; background: var(--light); color: var(--primary); border-radius: 10px; font-size: 23px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty .button { margin-top: 11px; }

.status { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--sand); color: var(--subtle-ink); font-size: 12px; font-weight: 650; }
.status.running, .status.launching { background: var(--activity-bg); color: var(--activity-ink); }
.status.review, .status.needs_user { background: var(--attention-bg); color: var(--attention-ink); }
.status.approved { background: var(--success-bg); color: var(--success-ink); }
.status.failed { background: var(--error-bg); color: var(--error-ink); }
.progress { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.progress span { display: grid; place-items: center; width: 26px; height: 21px; border-radius: 4px; background: var(--sand); color: var(--mute); font-size: 12px; }
.progress .complete { background: var(--success-bg); color: var(--success-ink); }
.progress .current { background: var(--light); color: var(--primary); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.button.primary { color: var(--on-primary); background: var(--primary); }
.button.primary:hover { background: var(--primary-hover); }
.button.outline { color: var(--subtle-ink); background: var(--panel); border-color: var(--line-strong); }
.button.outline:hover { color: var(--primary); background: var(--light); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.icon { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 6px; background: var(--sand); color: var(--subtle-ink); font-size: 23px; }
.icon:hover { background: var(--light); color: var(--primary); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.notice { padding: 10px 13px; margin-bottom: 14px; border: 1px solid var(--accent-line); border-radius: 8px; background: var(--light); color: var(--subtle-ink); }
.notice.error { border-color: var(--error-line); background: var(--error-bg); color: var(--error-ink); }
.toast { position: fixed; bottom: 24px; right: 24px; z-index: 7; max-width: min(460px, 90vw); padding: 12px 16px; border-radius: 8px; background: var(--ink); color: var(--page-bg); box-shadow: 0 12px 40px var(--shadow-float); }

.dialog { width: min(850px, calc(100% - 24px)); max-height: min(90vh, 940px); padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: 0 20px 80px var(--shadow-dialog); }
.dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.dialog::backdrop { background: var(--scrim); }
.dialog.review { width: min(1040px, calc(100% - 24px)); }
.dialog.confirm { width: min(420px, calc(100% - 24px)); }
.dialog.confirm p { padding: 16px 22px; }
.dialog-title { display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.dialog-title p { color: var(--mute); font-size: 14px; margin-top: 3px; }
.dialog form { display: flex; flex-direction: column; min-height: 0; }
.dialog-scroll { padding: 14px 22px; overflow: auto; background: var(--paper); overscroll-behavior: contain; }
.dialog-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex: 0 0 auto; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--line); }
.dialog-footer p { color: var(--mute); font-size: 13px; margin-right: auto; max-width: 58%; }
.dialog-footer p:empty { display: none; }
fieldset, .edit-card { min-width: 0; margin: 0 0 12px; padding: 12px 15px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
legend { padding: 0 6px; color: var(--ink); font-size: 15px; font-weight: 700; }
label { display: block; margin-bottom: 8px; color: var(--subtle-ink); font-size: 14px; }
label:last-child { margin-bottom: 0; }
label b { color: var(--error-ink); }
input:not([type=radio], [type=checkbox], [type=file]), select, textarea { display: block; width: 100%; min-height: 38px; padding: 8px 9px; color: var(--ink); background: var(--panel); border: 1px solid var(--control-border); border-radius: 7px; }
label input:not([type=radio], [type=checkbox]), label select, label textarea { margin-top: 5px; }
input[type=radio], input[type=checkbox] { accent-color: var(--primary); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--mute); opacity: .92; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 13px; }
.grid label { margin: 0; }
.mode { display: flex; gap: 19px; margin-bottom: 12px; }
.mode label { margin: 0; }
.file-area { padding: 11px; margin-top: 8px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--paper); }
.file-area p, .helper { color: var(--mute); font-size: 13px; margin-top: 5px; }
.file-area ul { list-style: none; margin: 0; padding: 0; }
.file-area li { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-top: 6px; overflow-wrap: anywhere; }
.variant { padding: 10px 0; border-top: 1px solid var(--line); }
.variant > div:first-child { display: flex; justify-content: space-between; margin-bottom: 6px; }
.tabs { display: flex; flex-shrink: 0; gap: 6px; padding: 7px 16px 0; overflow: auto; border-bottom: 1px solid var(--line); }
.tabs button { padding: 8px 9px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--mute); white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--primary); font-weight: 700; border-bottom-color: var(--accent); }
.edit-card h3 { margin: 0 0 10px; }
.edit-card h4 { margin: 10px 0 6px; }
.edit-card summary { color: var(--primary); font-weight: 650; }
.edit-card details { margin-top: 9px; }
.counter { float: right; color: var(--mute); font-size: 12px; }
.review textarea[readonly] { background: var(--paper); }
.report-link { display: inline-block; margin-left: 8px; }
.skill-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

@media (max-width: 1050px) {
  .header-inner { flex-wrap: wrap; justify-content: space-between; column-gap: 12px; row-gap: 3px; padding-block: 8px 5px; }
  .header-navigation { order: 3; flex: 1 0 100%; justify-content: space-between; }
  .header nav a { min-height: 36px; }
  .layout { grid-template-columns: 180px minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 720px) {
  .header-navigation { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .header .primary-nav { gap: 2px; overflow-x: auto; scrollbar-width: thin; }
  .header .primary-nav a { flex: 1 0 auto; padding-inline: 4px; font-size: 12px; }
  .header .primary-nav a:focus-visible { outline-offset: -2px; }
  .header .utility-nav { justify-content: flex-end; padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--line); }
  .header .utility-nav a { min-height: 34px; font-size: 13px; }
  .head { align-items: flex-start; flex-direction: column; padding-top: 18px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  #rail { display: flex; overflow: auto; padding: 5px; gap: 4px; }
  #rail a { white-space: nowrap; padding: 5px 8px; }
  .rail-label { display: none; }
  .table-wrap { max-width: 100%; }
  .panel-header, .filters { padding-inline: 14px; }
  .filters .search { flex: 1 0 100%; }
  .filters select { flex: 1; min-width: 0; }
  .glossary-table thead th:first-child { width: 36%; }
  .glossary-table th, .glossary-table td { padding-inline: 10px; }
  .grid { grid-template-columns: 1fr; }
  .dialog-scroll, .dialog-title, .dialog-footer { padding-inline: 13px; }
  .dialog-footer p { max-width: none; width: 100%; }
}
@media (max-width: 400px) {
  .metric { padding-inline: 9px; }
  .metric p { font-size: 12px; }
}

.channel-grid, .image-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,185px),1fr)); gap: 12px; }
.channel-choice { display: flex; gap: 9px; align-items: flex-start; margin: 0; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.channel-choice:has(input:checked) { border-color: var(--primary); background: var(--paper); }
.channel-choice input, .image-tile input { width: auto; margin: 4px 0 0; }
.channel-choice small, .image-tile small { display: block; margin-top: 4px; color: var(--mute); }
.image-grid { margin-block: 12px; }
.source-grid { grid-template-columns: repeat(auto-fill,minmax(112px,1fr)); }
.image-tile { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.image-tile a { display: grid; place-items: center; overflow: hidden; aspect-ratio: 1; background: var(--paper); }
.image-tile img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.image-tile figcaption { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px; padding: 8px; overflow-wrap: anywhere; }
.image-tile figcaption span { min-width: 0; }
.image-copy { margin: 10px 0; padding: 10px 12px; border-radius: 6px; background: var(--paper); overflow-wrap: anywhere; }
.image-copy > p { white-space: pre-wrap; }
.image-copy li + li { margin-top: 5px; }
.image-token { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.image-token label { margin-bottom: 0; flex: 1 1 250px; }
.image-token input { margin: 4px 0 0; }
.image-upload { margin: 8px 0 0; }

.asset-drop { padding: 14px; margin-bottom: 14px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--panel); }
.asset-drop p { margin-top: 8px; }
.asset-queue { max-height: 240px; overflow: auto; margin: 10px 0 0; padding-inline-start: 24px; }
.asset-queue li { padding: 5px 8px 5px 0; overflow-wrap: anywhere; }
.asset-queue li + li { border-top: 1px solid var(--line); }
.asset-queue small { display: inline-block; margin-inline-start: 8px; color: var(--mute); white-space: nowrap; }
.asset-panel-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.asset-image-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,140px),1fr)); margin: 14px 18px; }
.asset-path { max-width: 280px; white-space: normal; overflow-wrap: anywhere; }

.gallery-editor { width: min(440px, calc(100% - 24px)); }
.gallery-editor input, .gallery-editor select, .gallery-editor .button,
.gallery-group-actions .button { min-height: 44px; }
.gallery-editor #gallery-editor-fields > p { margin-bottom: 12px; }
#gallery-groups:empty { display: none; }
#gallery-groups { margin: 0; }
#gallery-groups ul { margin: 0; padding: 0; list-style: none; }
#gallery-groups li + li { padding-inline-start: 10px; }
#rail #gallery-groups a { min-height: 44px; padding-block: 11px; white-space: normal; overflow-wrap: anywhere; display: block; }
.gallery-folders h2 { min-width: 0; overflow-wrap: anywhere; }
.gallery-group-actions .danger { color: var(--error-ink); }
.gallery-group-actions .danger:hover { background: var(--error-bg); border-color: var(--error-ink); }
.gallery-hierarchy { display: grid; gap: 12px; padding: 0 18px 18px; }
.gallery-overview .gallery-toolbar + .gallery-hierarchy { padding-top: 12px; }
.gallery-group-section { border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; }
.gallery-group-section h3, .gallery-folder-links a { min-width: 0; overflow-wrap: anywhere; }
.gallery-group-section > p { margin-top: 8px; color: var(--mute); }
.gallery-folder-links { list-style: none; margin: 8px 0 0; padding: 0; }
.gallery-folder-links li { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.gallery-folder-links a { padding-block: 11px; }
.gallery-folder-links span { font-size: 13px; color: var(--mute); }
.gallery-destinations { min-width: 0; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 10px 14px 14px; }
.gallery-destinations legend { padding-inline: 6px; font-weight: 700; }
#asset-destination-fields { display: grid; gap: 8px; }
#asset-destination-fields label { margin: 0; }
.gallery-folder-picker { display: grid; gap: 8px; max-height: 230px; overflow: auto; border-block: 1px solid var(--line); padding: 8px; }
.gallery-folder-picker label { display: flex; gap: 8px; align-items: center; min-height: 40px; overflow-wrap: anywhere; cursor: pointer; }
.gallery-folder-picker input { flex-shrink: 0; }
.gallery-inline-create summary { width: fit-content; cursor: pointer; color: var(--primary); padding-block: 7px; }
.gallery-inline-create > div { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 8px; padding: 10px; }
.gallery-inline-create .button { justify-self: start; }
.gallery-inline-feedback { color: var(--error-ink); }
#asset-destination-summary:not(:empty) { color: var(--subtle-ink); margin-top: 8px; overflow-wrap: anywhere; }
#asset-destination-summary ul { margin: 3px 0 0; padding-inline-start: 20px; }
.gallery-text-cell { min-width: 6em; max-width: 16em; white-space: normal; overflow-wrap: anywhere; }
.gallery-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 6px 18px;
  border-bottom: 1px solid var(--line);
}
.gallery-select-all, .gallery-checkbox { margin: 0; cursor: pointer; }
.gallery-select-all { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; }
.gallery-select-all input, .gallery-checkbox input { width: 17px; height: 17px; margin: 0; }
.gallery-selection-count { color: var(--mute); font-size: 13px; flex: 1; white-space: nowrap; }
.gallery-selector { width: 64px; }
.gallery-checkbox { display: grid; place-items: center; width: 36px; height: 36px; }
.gallery-toolbar .danger { color: var(--error-ink); }
.gallery-toolbar .danger:not(:disabled):hover { background: var(--error-bg); border-color: var(--error-ink); }
#apply-confirm.danger { background: var(--error-ink); }
#confirm-message { overflow-wrap: anywhere; }
.gallery-tile { position: relative; }
.gallery-tile:has(input:checked) { border-color: var(--accent); }
.gallery-tile .gallery-card-checkbox {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
.gallery-tile figcaption { display: block; }
.gallery-tile figcaption a { display: inline; background: none; }
.gallery-copy { width: 100%; margin-top: 8px; padding-inline: 5px; font-size: 13px; }
@media (max-width: 720px) {
  #rail:has(> #gallery-groups) { display: block; overflow: visible; }
  .gallery-hierarchy { padding-inline: 12px; }
}
@media (max-width: 520px) {
  .gallery-folders .gallery-toolbar { padding-inline: 12px; gap: 4px 8px; }
  .gallery-folders .gallery-toolbar .button { padding-inline: 8px; }
  .gallery-folders th, .gallery-folders td { padding-inline: 6px; }
  .gallery-folders td.gallery-selector { width: 44px; }
  .gallery-text-cell { min-width: 4em; max-width: 10em; }
}

.image-reference-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.image-reference-controls .helper { margin: 0; }
.reference-folders { list-style: none; padding: 0; margin: 0; }
.reference-folders li + li { margin-top: 8px; }
.reference-folder {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  text-align: left;
}
.reference-folder strong, .reference-photo strong { overflow-wrap: anywhere; }
.reference-folder small { color: var(--mute); white-space: nowrap; }
.reference-photo-grid { margin-inline: 0; }
.reference-photo {
  display: block;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.reference-photo:has(input:checked) { border-color: var(--accent); background: var(--light); }
.reference-photo:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.reference-photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--paper); }
.reference-photo > span { display: flex; gap: 6px; align-items: flex-start; padding: 8px; }
.reference-photo input { flex: 0 0 auto; width: auto; margin: 4px 0 0; }
.reference-folder-heading { gap: 8px; }

[data-personnel]:not([data-personnel=""]) #rail a { min-height: 44px; }
.personnel-view { min-width: 0; }
.personnel-view .empty { padding-block: 36px 44px; }
.personnel-view .table-wrap td { vertical-align: middle; }
.personnel-view .table-wrap strong, .personnel-view .table-wrap small {
  display: block;
  max-width: min(280px, 55vw);
  overflow-wrap: anywhere;
  white-space: normal;
}
.personnel-view .task-action button { min-height: 32px; }
.personnel-editor { width: min(480px, calc(100% - 24px)); }
@media (max-width: 720px) {
  [data-personnel]:not([data-personnel=""]) #rail { flex-wrap: wrap; }
  [data-personnel]:not([data-personnel=""]) #rail .rail-label { display: none; }
  .personnel-view .empty { padding-block: 24px 32px; }
  .personnel-view .table-wrap { scrollbar-width: thin; }
  .personnel-view th, .personnel-view td { padding-inline: 7px; }
  .personnel-view :is(th, td):first-child { min-width: 88px; padding-inline-start: 14px; }
  .personnel-view :is(th, td):last-child { padding-inline-end: 14px; }
}

.signin-page { min-height: 100vh; }
.signin-main { padding-block: clamp(28px, 8vh, 90px); }
.signin-panel { max-width: 530px; margin-inline: auto; padding: clamp(20px, 5vw, 38px); }
.signin-panel h1 { margin-bottom: 10px; }
.signin-panel p { color: var(--mute); }
.signin-panel .notice { margin: 16px 0 0; }
.signin-panel .actions { margin-top: 20px; }
.signin-form { display: grid; gap: 14px; margin-top: 22px; }
.signin-form label { display: grid; gap: 6px; margin: 0; font-weight: 600; }
.signin-form input, .signin-form button { min-height: 44px; }
.signin-form .notice { margin: 0; }
.signin-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  color: var(--mute);
  font-size: 13px;
}
.signin-divider::before, .signin-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}
.signin-divider + .actions { margin-top: 12px; }
.session-loading { margin: 44px auto; padding-inline: 24px; text-align: center; color: var(--mute); }
.session-loading .button { margin-top: 12px; }
#personnel-fields label + .helper { margin-top: -4px; margin-bottom: 12px; }
.personnel-username { white-space: normal; overflow-wrap: anywhere; }
.password-control { margin-bottom: 12px; }
.password-control label { margin-bottom: 5px; }
.password-control + .helper { margin: -7px 0 12px; }
.password-input { position: relative; }
.password-input input { padding-inline-end: 48px; }
.password-visibility {
  position: absolute;
  inset-block: 2px;
  inset-inline-end: 2px;
  display: grid;
  place-items: center;
  width: 44px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--mute);
}
.password-visibility:hover { background: var(--light); }
.password-visibility svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.password-preview { display: inline-flex; align-items: center; gap: 4px; }
.password-preview .password-visibility { position: static; flex: none; width: 34px; min-height: 34px; }
.password-preview > span { white-space: normal; overflow-wrap: anywhere; }
.personnel-choices { max-height: 240px; overflow: auto; margin-top: 10px; }
.personnel-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.personnel-choice input { flex: none; margin: 5px 0 0; }
.personnel-choice span { min-width: 0; overflow-wrap: anywhere; }
.personnel-choice small { display: block; color: var(--mute); }
@media (max-width: 600px) {
  .personnel-group-actions { flex-wrap: wrap; gap: 0 8px; min-width: 115px; }
}
#signin-code { margin-top: 10px; }
#signin-number { color: var(--ink); font-family: ui-monospace, monospace; font-size: 1.05em; letter-spacing: .08em; }
@media (max-width: 540px) {
  .feishu-access td:nth-child(4) { min-width: 70px; white-space: normal; overflow-wrap: anywhere; }
  .feishu-access .task-action { flex-wrap: wrap; gap: 0 8px; }
}

/* Advertising project workbench */
.ads-overview { display:flex; align-items:center; gap:12px; flex-wrap:wrap; padding:16px 20px; border:1px solid var(--line); border-radius:12px; background:linear-gradient(110deg, var(--panel), var(--light)); }
.ads-overview > div:first-child { flex:1 0 min(260px,100%); min-width:0; }
.ads-overview h2 { margin:0; font-size:20px; overflow-wrap:anywhere; }
.ads-overview p { margin:4px 0 0; color:var(--mute); overflow-wrap:anywhere; }
.ads-panel { min-width:0; }
.ads-body { padding:14px 18px; display:grid; gap:12px; min-width:0; }
.ads-body > p, .ads-body h3 { margin:0; }
.ads-actions { display:flex; flex-wrap:wrap; gap:8px 10px; align-items:center; padding:7px 0; min-width:0; }
.ads-actions .button { white-space:normal; }
.ads-actions input, .ads-actions select { width:auto; max-width:100%; min-width:0; }
.ads-actions input[type="search"] { flex:1 1 240px; }
.panel > .ads-actions { padding:10px 16px; }
.ads-actions [hidden], .ads-dialog [hidden] { display:none; }
.ads-tag { display:inline-flex; width:fit-content; align-items:center; border-radius:6px; background:var(--activity-bg); color:var(--activity-ink); padding:4px 8px; font-size:13px; font-weight:650; white-space:normal; }
.ads-tag.rehearsed,.ads-tag.complete,.ads-tag.success,.ads-tag.approved { background:var(--success-bg); color:var(--success-ink); }
.ads-tag.failed,.ads-tag.execution_failed,.ads-tag.blocked { background:var(--error-bg); color:var(--error-ink); }
.ads-tag.running,.ads-tag.executing,.ads-tag.pending { background:var(--attention-bg); color:var(--attention-ink); }
.ads-field { display:grid; align-items:start; gap:6px; min-width:0; font-weight:600; margin:0; }
.ads-field input:not([type="checkbox"]), .ads-field select, .ads-field textarea { width:100%; min-width:0; }
.ads-field input[type="checkbox"] { justify-self:start; width:18px; height:18px; }
.ads-dialog { width:min(690px, calc(100% - 22px)); }
.ads-dialog form { display:grid; grid-template-rows:minmax(0,1fr) auto auto; min-height:0; }
.ads-dialog .dialog-scroll { overflow:auto; max-height:62dvh; }
.ads-form { display:grid; gap:12px; min-width:0; }
.ads-feedback { padding:0 18px; color:var(--error-ink); font-weight:650; }
.ads-feedback:not(:empty) { padding-block:10px; }
.ads-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr)); gap:12px; }
.ads-grid fieldset { min-width:0; border:1px solid var(--line); border-radius:7px; }
.ads-summary { margin:0; display:grid; grid-template-columns:repeat(auto-fit,minmax(min(190px,100%),1fr)); gap:10px 16px; }
.ads-summary dt { color:var(--mute); font-size:13px; }
.ads-summary dd { margin:3px 0 0; font-weight:600; overflow-wrap:anywhere; white-space:pre-wrap; }
.ads-wizard-progress { list-style:none; display:grid; grid-template-columns:repeat(4,1fr); gap:5px; padding:0; margin:0 0 8px; font-size:13px; color:var(--mute); }
.ads-wizard-progress li { border-bottom:2px solid var(--line); padding:6px 4px; }
.ads-wizard-progress li[aria-current] { color:var(--primary); border-color:var(--accent); font-weight:bold; }
.ads-work { background:var(--paper); border:1px solid var(--line-strong); padding:10px 16px; border-radius:9px; }
.ads-work summary, .ads-panel summary { cursor:pointer; font-weight:650; }
.ads-tabs { display:flex; flex-wrap:wrap; gap:6px; }
.ads-tabs [aria-pressed="true"] { background:var(--light); border-color:var(--accent); color:var(--activity-ink); }
.ads-plan-content { display:grid; gap:12px; min-width:0; }
.ads-preview ul, .ads-preview ol { padding-inline-start:24px; }
.ads-code { white-space:pre-wrap; overflow-wrap:anywhere; }
.ads-prototype { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(205px,100%),1fr)); gap:12px; }
.ads-prototype article { border:1px solid var(--line); padding:12px; border-radius:7px; background:var(--paper); }
.ads-prototype h3 { margin:0 0 6px; }
.ads-prototype p { margin:0; }
.ads-tasks { margin-top:12px; }
@media (max-width:600px) {
  .ads-overview,.ads-body { padding:10px 12px; }
  .ads-panel .table-wrap { max-width:100%; }
  .ads-actions .button, .ads-tabs .button, .ads-dialog .button { min-height:44px; }
}

[data-theme="lightning"] #rail a[aria-current="page"] {
  position: relative;
  padding-inline-end: 26px;
  border-inline-start-color: transparent;
}
[data-theme="lightning"] #rail a[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset-inline-end: 9px;
  top: calc(50% - 6px);
  width: 8px;
  height: 12px;
  background: var(--accent);
  clip-path: polygon(59% 0, 0 58%, 45% 58%, 31% 100%, 100% 36%, 55% 36%);
}

.account-center {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 452px);
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: 0;
}
.account-center .dialog-title {
  flex-shrink: 0;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 22px 14px;
  background: var(--panel);
}
.account-center h2 { font-size: 23px; }
.account-center h2:focus { outline: none; }
.account-center .icon { width: 44px; height: 44px; }
.account-center-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 22px max(24px, env(safe-area-inset-bottom)); }
.account-center-scroll > .button { margin-top: 12px; }
#account-load-message { margin-top: 16px; }
#account-settings-content > section { padding-block: 20px; }
#account-settings-content > section + section { border-top: 1px solid var(--line); }
.account-center h3 { margin-bottom: 12px; }
.account-center label { margin-bottom: 5px; }
.account-center .button, .account-form-row input { min-height: 44px; }
.account-form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.account-center .helper { margin-top: 8px; }
.account-center form + form, .account-verified + form { margin-top: 12px; }
.account-message { margin-top: 8px; color: var(--subtle-ink); font-size: 14px; }
.account-message.account-message-error { color: var(--error-ink); }
.account-verified { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.account-verified p { min-width: 0; overflow-wrap: anywhere; }
.account-verified strong { display: block; }
.account-check { color: var(--success-ink); font-weight: 750; }

.theme-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-choice {
  display: grid;
  gap: 7px;
  min-width: 0;
  min-height: 44px;
  padding: 7px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: start;
}
.theme-choice:hover, .theme-choice[aria-pressed="true"] { background: var(--light); border-color: var(--primary); }
.theme-choice[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--primary); }
.theme-choice[aria-disabled="true"] { cursor: wait; }
.theme-choice-label { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding-inline: 2px; font-weight: 650; }
.theme-mark { visibility: hidden; color: var(--primary); }
.theme-choice[aria-pressed="true"] .theme-mark { visibility: visible; }
.theme-choice[data-choice="warm"] {
  --preview-bg: #f7f0e2;
  --preview-panel: #fffdf7;
  --preview-line: #d4bea0;
  --preview-ink: #695641;
  --preview-accent: #8a4b08;
}
.theme-choice[data-choice="lightning"] {
  --preview-bg: #111b2c;
  --preview-panel: #19283d;
  --preview-line: #46607e;
  --preview-ink: #a9b9cf;
  --preview-accent: #f7d64a;
}
.theme-preview {
  display: grid;
  grid-template: 14px 1fr / 25% 1fr;
  gap: 4px;
  height: 67px;
  overflow: hidden;
  padding: 4px;
  border: 1px solid var(--preview-line);
  border-radius: 5px;
  background: var(--preview-bg);
}
.theme-preview i, .theme-preview b, .theme-preview em { position: relative; display: block; background: var(--preview-panel); border: 1px solid var(--preview-line); border-radius: 2px; }
.theme-preview i { grid-column: 1 / -1; }
.theme-preview i::before, .theme-preview b::before, .theme-preview em::before, .theme-preview em::after {
  position: absolute;
  content: "";
  height: 3px;
  border-radius: 1px;
  background: var(--preview-ink);
}
.theme-preview i::before { inset: 4px auto auto 4px; width: 33%; }
.theme-preview b::before { inset: 5px 4px auto; background: var(--preview-accent); }
.theme-preview em::before { inset: 6px 30% auto 5px; box-shadow: 0 8px var(--preview-line), 0 16px var(--preview-line); }
.theme-preview em::after { inset: auto 5px 5px auto; width: 23%; height: 6px; background: var(--preview-accent); }

@media (max-width: 720px) {
  .account-center { width: 100%; border: 0; }
  .account-center .dialog-title, .account-center-scroll { padding-inline: 16px; }
}

.brand { min-width: 0; flex-shrink: 1; }
.brand-icon, .brand-image { flex: 0 0 34px; }
.brand-image { display: block; object-fit: contain; }
.brand-name { min-width: 0; max-width: 10em; overflow: hidden; text-overflow: ellipsis; }
.signin-page .brand-name { max-width: none; }
.account-brand-logo-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 8px; }
#account-brand-preview { display: grid; place-items: center; height: 44px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
#account-branding form > label:not(:first-child), .account-brand-actions { margin-top: 12px; }
#account-brand-logo { min-width: 0; font-size: 14px; }
#account-brand-logo::file-selector-button {
  min-height: 44px;
  margin-inline-end: 8px;
  padding-inline: 9px;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
@media (max-width: 720px) {
  .header .brand { max-width: calc(100% - min(136px, 42vw)); }
}
.signin-panel h1 { overflow-wrap: anywhere; }

/* Knowledge base */
.kb-grid { display: grid; grid-template-columns: minmax(245px, 0.75fr) minmax(0, 1.55fr); gap: 14px; align-items: start; }
.kb-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.kb-grid .button { min-height: 44px; white-space: normal; }
.kb-form, .kb-ingest { display: grid; gap: 10px; padding: 16px 19px 19px; min-width: 0; }
.kb-form textarea { min-height: 148px; padding: 10px 11px; }
.kb-label { font-weight: 650; color: var(--subtle-ink); }
.kb-help { color: var(--mute); font-size: 14px; }
.kb-examples { display: flex; flex-wrap: wrap; gap: 7px; }
.kb-examples .kb-example { justify-content: flex-start; padding: 6px 10px; border-color: var(--accent-line); background: var(--paper); text-align: left; font-size: 14px; }
.kb-form .notice { margin: 0; }
.kb-submit { width: 100%; }
.kb-result { display: grid; min-height: 325px; }
.kb-result > .kb-help { align-self: center; text-align: center; padding: 16px; }
.kb-result .empty, .kb-review-body > .empty { align-self: center; min-height: auto; padding: 26px 19px; }
.kb-loading { display: grid; align-content: center; justify-items: center; gap: 8px; padding: 24px; text-align: center; overflow-wrap: anywhere; }
.kb-loading p { color: var(--mute); }
.kb-spinner { width: 22px; height: 22px; border: 2px solid var(--accent-line); border-top-color: var(--primary); border-radius: 50%; animation: kb-spin 0.85s linear infinite; }
@keyframes kb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kb-spinner { animation: none; } }
.kb-answer, .kb-review-body { display: grid; gap: 16px; padding: 17px 19px 20px; align-content: start; min-width: 0; }
.kb-tags, .kb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kb-pill { display: inline-flex; padding: 4px 9px; border-radius: 6px; background: var(--light); color: var(--activity-ink); font-size: 14px; font-weight: 650; }
.kb-pill.success { background: var(--success-bg); color: var(--success-ink); }
.kb-prose, .kb-quote { white-space: pre-wrap; overflow-wrap: anywhere; }
.kb-prose { font-size: 16px; line-height: 1.7; }
.kb-evidence { display: grid; gap: 9px; border-top: 1px solid var(--line); padding-top: 14px; }
.kb-references { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; }
.kb-references li { display: grid; gap: 6px; min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); overflow-wrap: anywhere; }
.kb-references small, .kb-quote { color: var(--mute); }
.kb-quote { font-size: 14px; }
.kb-links, .kb-issues { margin: 0; padding-inline-start: 21px; overflow-wrap: anywhere; }
.kb-links a, .kb-references a, .kb-review-card a { text-decoration: underline; text-underline-offset: 3px; }
.kb-ingest .kb-form { padding: 13px 0 0; margin-top: 4px; border-top: 1px solid var(--line); }
.kb-import-progress { display: grid; gap: 5px; color: var(--subtle-ink); font-size: 14px; overflow-wrap: anywhere; }
.kb-import-progress:empty, .kb-actions:empty { display: none; }
.kb-issues { max-height: 180px; overflow: auto; }
.kb-review-list { display: grid; gap: 12px; }
.kb-review-card { display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); overflow-wrap: anywhere; }
.kb-review-title { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kb-review-title h3 { flex: 1 1 12rem; }
.kb-review-history { border-top: 1px solid var(--line); padding-top: 12px; }
.kb-review-history summary { color: var(--primary); font-weight: 650; }
.kb-review-history[open] summary { margin-bottom: 11px; }
.kb-warning { display: block; color: var(--error-ink); overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .kb-grid { grid-template-columns: minmax(0, 1fr); }
  .kb-heading, .kb-form, .kb-ingest, .kb-answer, .kb-review-body { padding-inline: 14px; }
  .kb-result { min-height: 210px; }
}
