:root {
  color-scheme: dark;
  --bg: #050b14;
  --bg-deep: #030810;
  --panel: #0a1524;
  --panel-2: #0e1c2e;
  --panel-3: #12243a;
  --line: #203752;
  --line-strong: #315579;
  --text: #f4f9ff;
  --muted: #91a8c2;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft: #7dd3fc;
  --green: #5ee0a0;
  --red: #ff7d89;
  --yellow: #ffd166;
  --shadow: 0 18px 55px rgba(0, 8, 20, .38);
  --focus: 0 0 0 3px rgba(56, 189, 248, .18);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 18% -8%, #11375a 0, transparent 34%), linear-gradient(180deg, var(--bg), var(--bg-deep)); }
body.menu-open { overflow: hidden; }
a { color: var(--accent-soft); }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; border: 1px solid transparent; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-strong), #0284c7); color: #fff;
  padding: 9px 15px; font-weight: 760; text-decoration: none; cursor: pointer;
  box-shadow: 0 8px 22px rgba(14, 165, 233, .18); transition: border-color .15s, background .15s, transform .15s, filter .15s;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:active, .button:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
button.secondary, .button.secondary { background: var(--panel-2); border-color: var(--line); box-shadow: none; color: var(--text); }
button.secondary:hover, .button.secondary:hover { background: var(--panel-3); border-color: var(--line-strong); }
.button.danger, button.danger { background: #501923; border-color: #8d3441; }
.button.ghost, button.ghost { background: transparent; border-color: var(--line); box-shadow: none; }
.button.small, button.small { min-height: 30px; padding: 5px 9px; font-size: 12px; }
button[disabled], .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
input, select, textarea {
  background: #071321; border: 1px solid #29445f; color: var(--text); border-radius: 7px;
  min-height: 38px; padding: 8px 10px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
input::placeholder { color: #7187a1; }
code { border: 1px solid var(--line); border-radius: 5px; background: #07111e; padding: 1px 5px; color: #cceeff; }

table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 2; background: #102035; color: #b9cce0; font-size: 11px; text-transform: uppercase; letter-spacing: .055em; }
tbody tr:hover { background: #0e1d2f; }
tbody tr:last-child td { border-bottom: 0; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); scrollbar-color: #315579 #081321; }
.code { font-family: "SFMono-Regular", Consolas, monospace; white-space: nowrap; }
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.danger-text, .danger { color: var(--red); }
.success { color: var(--green); }
.warning { color: var(--yellow); }
.nowrap { white-space: nowrap; }

.brand-main { color: #f7fbff; }
.brand-accent { color: var(--accent); text-shadow: 0 0 24px rgba(56, 189, 248, .28); }
.app-shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; z-index: 30; height: 100vh; display: flex; flex-direction: column;
  padding: 20px 13px; overflow-y: auto; background: rgba(5, 13, 24, .97); border-right: 1px solid var(--line);
  box-shadow: 12px 0 38px rgba(0, 5, 14, .15);
}
.office-brand, .public-brand { font-weight: 950; letter-spacing: .025em; text-decoration: none; }
.office-brand { display: block; padding: 5px 10px 20px; font-size: 23px; }
.nav-label { display: block; color: #647f9d; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; padding: 13px 10px 5px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a, .sidebar-foot a, .sidebar-foot button {
  display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: none; box-shadow: none;
  color: #c7d6e7; text-align: left; text-decoration: none; font-size: 13px; font-weight: 620;
}
.sidebar nav a:hover, .sidebar-foot a:hover, .sidebar-foot button:hover { background: #10243b; color: #fff; filter: none; }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(14,165,233,.24), rgba(14,165,233,.07)); color: #fff; border-left: 3px solid var(--accent); padding-left: 7px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; }
.role-badge { margin: 5px 10px 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.office-main { min-width: 0; width: 100%; max-width: 1900px; margin: 0 auto; padding: 26px; }
.mobile-bar, .sidebar-backdrop { display: none; }
.message { padding: 11px 14px; background: #103524; border: 1px solid #2f7650; border-radius: 8px; margin-bottom: 13px; }
.message.error { background: #35151c; border-color: #7d3340; }
.message.warning { background: #3a2e11; border-color: #7a6428; color: #ffe8a3; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.title-row h1, h1 { margin: 0 0 5px; font-size: 26px; line-height: 1.2; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.notice { margin: 14px 0; padding: 13px 15px; border: 1px solid #285b7d; border-radius: 9px; background: #0b2135; color: #d5eaff; line-height: 1.5; }
.panel h2 { margin: 0 0 13px; font-size: 18px; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0; }
.details-grid div { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(14, 28, 46, .65); }
.details-grid dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.details-grid dd { margin: 0; overflow-wrap: anywhere; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.metric { background: linear-gradient(180deg, var(--panel), #07111e); border: 1px solid var(--line); border-radius: 10px; padding: 15px; box-shadow: var(--shadow); }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 6px 0 4px; font-size: 25px; }
.metric small { font-size: 11px; line-height: 1.4; }
.compact-list { margin: 0; padding-left: 20px; }
.compact-list li { margin: 7px 0; line-height: 1.45; }
.form-stack { display: grid; gap: 12px; margin-top: 14px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(7, 19, 33, .72); cursor: pointer; }
.checkbox-row input { width: auto; min-height: auto; margin-top: 3px; }
.checkbox-row span { display: grid; gap: 3px; }
.checkbox-row small { color: var(--muted); line-height: 1.4; }
.field-error { color: var(--red); font-size: 12px; }

.filter-panel, .search { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); padding: 12px; border-radius: 10px; margin: 14px 0; }
.filter-panel label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.filter-panel .grow { flex: 1; min-width: 220px; }
.filter-panel .grow input { width: 100%; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin: 14px 0; }
.card, section, .form-card, .panel { background: linear-gradient(180deg, var(--panel), #07111e); border: 1px solid var(--line); border-radius: 10px; padding: 17px; box-shadow: var(--shadow); }
.card span { color: var(--muted); font-size: 12px; }
.card b { display: block; font-size: 24px; margin-top: 6px; }
.card-link { color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.card-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; }
.form-card { max-width: 820px; margin: 0 auto; }
.form-card p { position: relative; display: grid; gap: 6px; margin: 0 0 15px; }
.form-card label { font-weight: 700; }
.form-card input, .form-card select, .form-card textarea { width: 100%; }
.form-card .helptext { color: var(--muted); font-size: 12px; line-height: 1.45; }
.form-card ul.errorlist { color: #ff9aa3; margin: 0; padding-left: 18px; }
.form-actions { display: flex; gap: 9px; margin-top: 20px; }

.pagination { display: grid; justify-items: center; gap: 9px; padding: 18px 6px 5px; }
.pagination-summary { color: var(--muted); font-size: 12px; }
.pagination-pages { display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; }
.page-link { min-width: 34px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: #cfe2f6; text-decoration: none; font-weight: 680; }
.page-link:hover { border-color: var(--line-strong); background: var(--panel-3); color: #fff; }
.page-link.is-current { border-color: var(--accent); background: linear-gradient(135deg, #0c8fc8, #0874ad); color: #fff; box-shadow: 0 7px 18px rgba(14,165,233,.18); }
.page-prev, .page-next { padding-inline: 12px; }
.page-ellipsis { color: var(--muted); padding: 0 3px; }

.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: #153a25; color: #82e6a8; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-changed, .status-preview { background: #3d3013; color: #ffd86d; }
.status-error, .status-cancelled, .status-archive { background: #431a23; color: #ff9ca5; }
.status-draft { background: #123a62; color: #8bc9ff; }
.status-published { background: #123d29; color: #77e2a3; }
.status-muted { background: #202d3c; color: #b7c6d7; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }

.public-wrap { max-width: 1450px; margin: 0 auto; padding: 22px; }
.public-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 16px; }
.public-brand { display: inline-block; font-size: 30px; }
.public-meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.public-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.office-entry { border-color: #2b6587 !important; }
.public-panel { background: rgba(10, 21, 36, .94); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.public-tools { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.public-tools input { flex: 1; min-width: 240px; }
.result-line { margin: 6px 2px 10px; color: var(--muted); font-size: 12px; }
.result-line b { color: var(--text); }
.public-table td:nth-child(3), .public-table th:nth-child(3) { text-align: right; }
.public-table tbody tr:nth-child(even) { background: rgba(110, 190, 255, .018); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(460px, 100%); background: rgba(10,21,36,.97); border: 1px solid var(--line); padding: 28px; border-radius: 13px; box-shadow: var(--shadow); }
.login-brand { font-size: 27px; margin-bottom: 24px; }
.login-card h1 { font-size: 24px; }
.login-intro { color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.login-card p { display: grid; gap: 6px; }
.login-card input { width: 100%; }
.login-card > button { width: 100%; margin-top: 6px; }
.local-login-hint { display: grid; gap: 6px; margin-top: 18px; padding: 12px; border: 1px solid #28516f; border-radius: 8px; background: #0b2034; color: #bdd1e5; font-size: 12px; line-height: 1.45; }
.local-login-hint b { color: #fff; }
.back-link { display: block; text-align: center; margin-top: 18px; color: var(--muted); }

.inline-form { display: inline; }
.quick-input { width: 100%; min-width: 85px; padding: 6px 7px; min-height: 32px; }
.quick-name { min-width: 260px; }
.quick-category { min-width: 150px; }
.checkbox-cell { text-align: center; }
.diff-added { border-left: 3px solid var(--green); }
.diff-changed { border-left: 3px solid var(--yellow); }
.diff-removed { border-left: 3px solid var(--red); }
.audit-diff { display: grid; gap: 4px; min-width: 220px; }
.audit-line { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.audit-line span:first-child { color: var(--muted); }
.autocomplete-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; background: #0d1b2c; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); max-height: 270px; overflow: auto; }
.autocomplete-results button { display: block; width: 100%; text-align: left; background: none; box-shadow: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px; color: var(--text); }
.autocomplete-results button:hover, .autocomplete-results button.is-active { background: #17324e; filter: none; }
.metric-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
.toolbar-note { padding: 10px 12px; border: 1px solid #36536d; background: #0f2032; border-radius: 8px; color: #c8d9ea; }
.error-box { background: #35171d; border: 1px solid #7a303c; padding: 13px; border-radius: 8px; }
.warning-box { background: #372d13; border: 1px solid #765e23; padding: 13px; border-radius: 8px; }
.problems { padding-left: 20px; }
.problems li { margin: 8px 0; }
.spaced-top { margin-top: 16px; }
.confirmation { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.confirmation input { width: auto; }

@media (max-width: 900px) {
  .app-shell { display: block; }
  .mobile-bar { display: flex; position: sticky; top: 0; z-index: 50; align-items: center; justify-content: space-between; background: rgba(5,13,24,.98); border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .mobile-bar .office-brand { padding: 3px 0; font-size: 20px; }
  .menu-button { min-height: 34px; padding: 6px 10px; }
  .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: min(310px, 87vw); height: 100vh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 55px rgba(0,0,0,.5); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 5, 12, .68); backdrop-filter: blur(2px); }
  .sidebar-backdrop[hidden] { display: none; }
  .office-main { padding: 13px; }
  .public-wrap { padding: 10px; }
  .public-head { align-items: flex-start; flex-direction: column; }
  .public-actions { width: 100%; }
  .public-actions .button { flex: 1; }
  .public-tools { align-items: stretch; }
  .public-tools > * { width: 100%; }
  .title-row { flex-direction: column; }
  .filter-panel { align-items: stretch; }
  .filter-panel > * { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .table-scroll { border-radius: 7px; }
  .public-table th:nth-child(1), .public-table td:nth-child(1) { width: 110px; }
  .quick-category { min-width: 130px; }
  .actions { width: 100%; }
  .actions .button, .actions button { flex: 1; }
  .card b { font-size: 20px; }
}

@media (max-width: 560px) {
  .public-table th, .public-table td { padding: 8px 6px; font-size: 12px; }
  .public-table th:nth-child(1), .public-table td:nth-child(1) { width: 90px; }
  .public-table th:nth-child(3), .public-table td:nth-child(3) { width: 90px; }
  .public-brand { font-size: 24px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 13px; }
  .card b { font-size: 18px; }
  .page-prev, .page-next { font-size: 0; }
  .page-prev::after { content: "←"; font-size: 14px; }
  .page-next::after { content: "→"; font-size: 14px; }
  .page-edge { display: none; }
  .login-card { padding: 22px 18px; }
}

.public-description { max-width: 760px; margin: 7px 0 0; color: #c6d7e8; line-height: 1.5; }
.public-footer { margin-top: 14px; padding: 14px 4px 4px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.public-footer p { margin: 0; }
.public-contacts { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 8px; color: #d9e7f5; }
.security-hint { margin-top: 16px; padding: 11px 12px; border-left: 3px solid var(--accent); background: #0d1d2e; color: #b9cde0; font-size: 12px; line-height: 1.5; }
.error-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.error-card { width: min(620px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 13px; background: rgba(10,21,36,.97); box-shadow: var(--shadow); text-align: center; }
.error-card .actions { justify-content: center; margin-top: 20px; }
.error-code { margin-top: 22px; font-size: clamp(54px, 10vw, 92px); line-height: 1; font-weight: 900; color: var(--accent); letter-spacing: -.05em; }
.office-error { margin: 8vh auto 0; }
.compact-actions { min-width: 170px; }
.compact-actions form { display: inline-flex; }

@media (max-width: 560px) {
  .public-description { font-size: 13px; }
  .public-contacts { display: grid; gap: 4px; }
  .error-card { padding: 24px 18px; }
  .compact-actions { min-width: 140px; }
}


.workflow-grid{display:grid;gap:12px}.workflow-step{display:flex;gap:16px;align-items:flex-start;padding:18px;border:1px solid var(--line);border-radius:16px;background:var(--panel);color:inherit;text-decoration:none;transition:.18s ease}.workflow-step:hover{transform:translateY(-1px);border-color:var(--accent)}.workflow-step>span{display:grid;place-items:center;flex:0 0 38px;height:38px;border-radius:12px;background:var(--accent);color:#03101f;font-weight:900}.workflow-step b{font-size:1.05rem}.workflow-step p{margin:6px 0 0;color:var(--muted);line-height:1.5}.help-list{margin:0;padding-left:20px;display:grid;gap:8px;line-height:1.5}

/* Director-oriented reporting and unified catalog */
.center, .percent-cell { text-align: center; }
.percent-input { width: 82px; min-width: 82px; text-align: center !important; font-variant-numeric: tabular-nums; }
.money-input { min-width: 112px; text-align: right !important; font-variant-numeric: tabular-nums; }
.period-presets { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.period-chip { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: #c8d9ea; text-decoration: none; font-size: 12px; font-weight: 720; }
.period-chip:hover { border-color: var(--line-strong); background: var(--panel-3); color: #fff; }
.period-chip.active { border-color: var(--accent); background: rgba(14,165,233,.2); color: #fff; box-shadow: var(--focus); }
.compact-filter { width: fit-content; max-width: 100%; }
.catalog-form { margin: 0; }
.catalog-toolbar { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0; padding: 12px 14px; border: 1px solid #2c5878; border-radius: 10px; background: rgba(8, 25, 42, .97); box-shadow: 0 12px 30px rgba(0,0,0,.28); }
.catalog-toolbar-copy { display: grid; gap: 3px; }
.catalog-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.catalog-toolbar .muted { font-size: 11px; }
.catalog-scroll { max-height: calc(100vh - 245px); min-height: 360px; }
.catalog-table { min-width: 1600px; }
.catalog-table th { top: 0; }
.catalog-table td { vertical-align: middle; }
.catalog-table td:nth-child(2) { min-width: 270px; }
.catalog-table td:nth-child(3) { min-width: 390px; max-width: 540px; }
.catalog-table td:nth-child(4) { min-width: 180px; }
.marketplace-names { display: grid; gap: 6px; line-height: 1.35; }
.marketplace-names > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 7px; align-items: start; }
.channel-badge { display: inline-flex; justify-content: center; border: 1px solid #31506d; border-radius: 999px; padding: 2px 6px; background: #0d2033; color: #a9dfff; font-size: 9px; font-weight: 800; white-space: nowrap; }
.archived-row { opacity: .65; }
.status-rejected { background: #3d1a2c; color: #ff9abc; }
.reject-panel { margin: 16px 0; border-color: #71364a; background: linear-gradient(180deg, #26131d, #160b11); }
.reject-panel h2 { margin-top: 0; }
.inline-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.inline-actions input { min-width: min(440px, 100%); flex: 1; }
[data-requires-saved].is-disabled { opacity: .45; pointer-events: none; filter: grayscale(.4); }
.dirty-indicator { color: var(--yellow); font-size: 12px; font-weight: 700; }

@media (max-width: 900px) {
  .catalog-toolbar { top: 53px; align-items: stretch; flex-direction: column; }
  .catalog-toolbar-actions { width: 100%; }
  .catalog-toolbar-actions > * { flex: 1; }
  .catalog-scroll { max-height: none; }
  .compact-filter { width: 100%; }
}

.success-box { background: #123528; border: 1px solid #28694f; padding: 13px; border-radius: 8px; }
