
:root {
  --bg: #f4f7f6;
  --panel: #fff;
  --ink: #172321;
  --muted: #687774;
  --line: #dfe8e5;
  --brand: #0f766e;
  --brand2: #0a5c56;
  --soft: #e9f7f4;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 12px 35px rgba(31, 55, 50, 0.08);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 800;
}
.logo-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(145deg, #19a89b, #0a5c56);
  color: white;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.25);
}
.logo-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 21px;
}
.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: linear-gradient(120deg, #e8f6f3, #f7faf9);
}
.auth-brand {
  padding: 10vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(37, 194, 177, 0.15),
    transparent 45%
  );
}
.auth-brand h1 {
  font-size: clamp(34px, 5vw, 64px);
  margin: 18px 0 12px;
  letter-spacing: -0.05em;
}
.auth-brand > p:not(.eyebrow) {
  font-size: 18px;
  line-height: 1.8;
  max-width: 650px;
  color: #52605e;
}
.auth-points {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.auth-points span {
  padding: 9px 13px;
  border: 1px solid #c8ded9;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}
.auth-card {
  width: min(440px, calc(100% - 40px));
  margin: auto;
  background: white;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 25px 80px rgba(22, 67, 60, 0.15);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f0f5f4;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 26px;
}
.auth-tabs button {
  border: 0;
  background: transparent;
  padding: 11px;
  border-radius: 9px;
  color: var(--muted);
}
.auth-tabs button.active {
  background: white;
  color: var(--brand);
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
}
.form-stack,
.form-grid {
  display: grid;
  gap: 17px;
}
.form-stack label,
.form-grid label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #465552;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #d4dfdc;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #34a99f;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.11);
}
textarea {
  resize: vertical;
}
.primary,
.ghost,
.icon-button {
  border: 0;
  border-radius: 10px;
  padding: 11px 17px;
}
.primary {
  background: var(--brand);
  color: white;
  font-weight: 800;
}
.primary:hover {
  background: var(--brand2);
}
.ghost {
  background: #edf3f1;
  color: #344440;
}
.ghost.small {
  padding: 7px 11px;
}
.icon-button {
  background: transparent;
  color: #53625f;
  font-size: 20px;
  padding: 7px 10px;
}
.form-help,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #102d2a;
  color: #d7ebe7;
  padding: 24px 15px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 7px 26px;
}
.brand b,
.brand small {
  display: block;
}
.brand small {
  font-size: 12px;
  color: #87aaa4;
  margin-top: 2px;
}
.sidebar nav {
  display: grid;
  gap: 6px;
}
.sidebar nav button {
  border: 0;
  background: transparent;
  color: #a9c5c0;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  display: flex;
  gap: 11px;
  align-items: center;
}
.sidebar nav button:hover,
.sidebar nav button.active {
  background: #1a4843;
  color: white;
}
.sidebar nav button span {
  width: 20px;
  text-align: center;
}
.sidebar-foot {
  margin-top: auto;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #9bb8b3;
}
.dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}
.dot.offline {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}
main {
  min-width: 0;
}
.topbar {
  height: 88px;
  padding: 0 34px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.topbar h2 {
  margin: 0;
  font-size: 24px;
}
.topbar .eyebrow {
  margin: 0;
}
.topbar > #menu-btn {
  display: none;
}
.user-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: right;
}
.user-menu small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.page {
  display: none;
  padding: 28px 34px 50px;
  max-width: 1500px;
  margin: auto;
}
.page.active {
  display: block;
}
.offline-banner {
  padding: 10px 34px;
  background: #fff1d7;
  color: #79520d;
  border-bottom: 1px solid #f0d49b;
  font-size: 13px;
}
.welcome {
  background: linear-gradient(125deg, #0f766e, #16443f);
  color: white;
  border-radius: 20px;
  padding: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}
.welcome h3 {
  font-size: 29px;
  margin: 4px 0 7px;
}
.welcome p {
  margin: 0;
  color: #cce4df;
}
.welcome .eyebrow {
  color: #88e3d9;
}
.welcome .primary {
  background: white;
  color: var(--brand);
}
.cards {
  display: grid;
  gap: 18px;
  margin: 20px 0;
}
.cards.four {
  grid-template-columns: repeat(4, 1fr);
}
.cards.two {
  grid-template-columns: repeat(2, 1fr);
}
.metric {
  background: white;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.metric span {
  color: var(--muted);
  font-size: 13px;
}
.metric strong {
  display: block;
  font-size: 29px;
  margin-top: 8px;
}
.grid {
  display: grid;
  gap: 20px;
}
.grid.two {
  grid-template-columns: 1.15fr 0.85fr;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 5px 18px rgba(31, 55, 50, 0.035);
  margin-bottom: 20px;
}
.panel h3 {
  margin: 3px 0 15px;
}
.panel-head,
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.page-actions {
  margin-bottom: 18px;
}
.page-actions p {
  margin: 0;
  color: var(--muted);
}
.service-list {
  display: grid;
  gap: 10px;
}
.service-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #edf1f0;
  padding: 11px 0;
}
.service-row:last-child {
  border: 0;
}
.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 99px;
  background: #edf3f1;
  font-size: 12px;
  font-weight: 800;
  color: #53625f;
}
.badge.good {
  background: #e6f7ee;
  color: #15803d;
}
.badge.wait {
  background: #fff3dc;
  color: #a16207;
}
.badge.busy {
  background: #e8f1ff;
  color: #1d4ed8;
}
.badge.bad {
  background: #feeceb;
  color: #b42318;
}
.notice {
  padding: 15px;
  border-radius: 12px;
  margin-top: 12px;
  font-size: 13px;
}
.notice p {
  margin: 7px 0 0;
  line-height: 1.65;
}
.notice.teal {
  background: #eaf8f5;
  color: #28534d;
}
.notice.amber {
  background: #fff5e3;
  color: #76541c;
}
.filters {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.filters input,
.filters select {
  width: auto;
}
.form-grid {
  grid-template-columns: repeat(2, 1fr);
}
.form-grid.compact {
  grid-template-columns: repeat(3, 1fr);
}
.span-2 {
  grid-column: span 2;
}
.span-3 {
  grid-column: span 3;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
legend {
  font-size: 13px;
  font-weight: 800;
  padding: 0 7px;
}
.checks {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.checks label {
  display: flex;
  align-items: center;
  gap: 7px;
}
.checks input {
  width: auto;
}
.promotion-fieldset {
  background: #fbfdfc;
}
.promotion-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.promotion-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.promotion-grid label {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.promotion-grid select {
  margin-top: 2px;
}
.promotion-history small {
  display: block;
  margin-top: 5px;
  max-width: 300px;
  white-space: normal;
}
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress {
  height: 8px;
  background: #e8efed;
  border-radius: 99px;
  flex: 1;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 30%;
  background: var(--brand);
  animation: loading 1.2s infinite ease-in-out;
}
.batch-upload-list {
  display: grid;
  gap: 8px;
}
.batch-upload-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dce7e4;
  border-radius: 10px;
  background: #f8fbfa;
}
.batch-upload-item .file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-upload-item .file-name small {
  display: block;
  color: var(--muted);
}
.batch-upload-item .batch-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8efed;
}
.batch-upload-item .batch-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width .2s ease;
}
.batch-upload-item.failed { border-color: #efb1a8; background: #fff7f5; }
.batch-upload-item.completed { border-color: #a9d9c8; background: #f3fbf7; }
@media (max-width: 680px) {
  .batch-upload-item { grid-template-columns: minmax(0, 1fr) auto; }
  .batch-upload-item .batch-progress { grid-column: 1 / -1; }
}
@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
}
th,
td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid #edf1f0;
  font-size: 13px;
  vertical-align: top;
}
th {
  color: #64716f;
  font-weight: 700;
  background: #f8faf9;
  position: sticky;
  top: 0;
}
td b,
td small {
  display: block;
}
td small {
  color: var(--muted);
  margin-top: 4px;
}
.job-progress {
  min-width: 150px;
}
.jobs-table {
  table-layout: fixed;
  min-width: 920px;
}
.jobs-table th:nth-child(1) { width: 130px; }
.jobs-table th:nth-child(2) { width: 300px; }
.jobs-table th:nth-child(3) { width: 190px; }
.jobs-table th:nth-child(4) { width: 170px; }
.jobs-table th:nth-child(5) { width: 130px; }
.job-product {
  width: 300px;
  max-width: 300px;
  overflow: hidden;
}
.product-link {
  display: -webkit-box;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--brand);
  line-height: 1.35;
}
.product-link.invalid {
  color: var(--muted);
}
.job-actions {
  min-width: 130px;
}
.job-progress .progress {
  margin: 7px 0;
}
.job-progress .progress i {
  animation: none;
  transform: none;
}
.publish-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.empty {
  text-align: center !important;
  color: var(--muted);
  padding: 36px !important;
}
.ai-panel {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 24px;
}
.ai-panel form {
  display: grid;
  gap: 10px;
}
.ai-output {
  grid-column: 1/-1;
  background: #112624;
  color: #dff4ef;
  border-radius: 12px;
  padding: 18px;
  white-space: pre-wrap;
  line-height: 1.7;
  max-height: 440px;
  overflow: auto;
}
.staff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 18px;
}
.staff-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.staff-card h4 {
  font-size: 18px;
  margin: 0 0 14px;
}
.stat-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.stat-lines div {
  background: #f7f9f8;
  padding: 10px;
  border-radius: 9px;
}
.stat-lines span,
.staff-pay span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.stat-lines b {
  font-size: 17px;
}
.staff-pay {
  margin-top: 12px;
  padding: 13px;
  background: #eaf8f5;
  border-radius: 10px;
}
.staff-pay b {
  font-size: 22px;
  color: var(--brand);
}
.credit-balance strong {
  font-size: 48px;
  color: var(--brand);
}
.credit-balance span {
  display: block;
  color: var(--muted);
}
.inline-form {
  display: flex;
  gap: 9px;
}
.inline-form input {
  flex: 1;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 35, 31, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.password-card {
  margin: 0;
  width: min(460px, 100%);
}
.password-card h3 {
  margin: 3px 0 15px;
}
.toast {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 100;
  background: #102d2a;
  color: white;
  padding: 13px 17px;
  border-radius: 11px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: 0.2s;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.error {
  background: #9f2922;
}
@media (max-width: 1050px) {
  .cards.four {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid.two,
  .ai-panel {
    grid-template-columns: 1fr;
  }
  .staff-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 760px) {
  .auth-view {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    padding: 45px 25px 20px;
  }
  .auth-brand h1 {
    font-size: 34px;
  }
  .auth-brand > p:not(.eyebrow),
  .auth-points {
    display: none;
  }
  .auth-card {
    margin: 20px auto 50px;
  }
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -250px;
    z-index: 30;
    width: 236px;
    transition: 0.2s;
  }
  .sidebar.open {
    left: 0;
  }
  .topbar {
    height: 76px;
    padding: 0 16px;
  }
  .topbar > #menu-btn {
    display: block;
  }
  .user-menu div {
    display: none;
  }
  .page {
    padding: 20px 14px 40px;
  }
  .welcome {
    padding: 24px;
    align-items: flex-start;
    gap: 20px;
  }
  .welcome h3 {
    font-size: 23px;
  }
  .cards.four,
  .cards.two,
  .staff-grid {
    grid-template-columns: 1fr;
  }
  .form-grid,
  .form-grid.compact {
    grid-template-columns: 1fr;
  }
  .span-2,
  .span-3 {
    grid-column: span 1;
  }
  .promotion-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 16px;
  }
  .panel-head,
  .page-actions {
    align-items: flex-start;
  }
  .filters input,
  .filters select {
    width: 100%;
  }
  .inline-form {
    display: grid;
  }
  .ai-panel {
    display: block;
  }
  .ai-panel form {
    margin-top: 20px;
  }
}

/* v1.3 video-store binding and per-file batch metadata */
.page-action-buttons,
.inline-apply-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.video-store-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}
.video-store-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fbfa;
}
.video-store-row b,
.video-store-row small {
  display: block;
}
.video-store-row small {
  margin-top: 3px;
  color: var(--muted);
}
.compact-empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.batch-upload-item {
  display: block;
  padding: 13px;
}
.batch-file-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.batch-metadata-grid {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.5fr) minmax(180px, 1fr);
  gap: 10px;
  margin: 11px 0 9px;
}
.batch-metadata-grid label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 750;
  color: #344440;
}
.batch-metadata-grid input,
.batch-metadata-grid select {
  min-width: 0;
  font-size: 13px;
}
.batch-upload-item .batch-progress {
  width: 100%;
}
@media (max-width: 900px) {
  .batch-metadata-grid { grid-template-columns: 1fr; }
  .page-action-buttons { width: 100%; }
}

