:root {
  --sidebar: #102a4b;
  --sidebar-text: #c9d5e5;
  --sidebar-muted: #91a6bd;
  --blue: #1677f2;
  --blue-hover: #0867dc;
  --ink: #17283b;
  --muted: #788a9d;
  --canvas: #f4f7fb;
  --line: #e3e9f1;
  --line-soft: #edf1f6;
  --white: #fff;
  --selected: #dcecff;
  --console: #071d3c;
  --danger-bg: #fff2f3;
  --danger: #ce7078;
  --sidebar-width: 174px;
  --chrome-height: 38px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #e9edf3;
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.desktop-window {
  width: 100%;
  height: 100%;
  min-width: 980px;
  min-height: 620px;
  overflow: hidden;
  background: var(--canvas);
}

.window-titlebar {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #20252a;
  background: #fff;
  border-bottom: 1px solid #e7e9ed;
  user-select: none;
}

.window-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 2px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  background: linear-gradient(145deg, #4a95ee, #175aa4);
  border: 1px solid #0d4e94;
  border-radius: 2px;
}

.app-icon::before {
  content: "";
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
}

.app-icon i {
  position: absolute;
  width: 2px;
  height: 2px;
  top: 2px;
  right: 2px;
  border-radius: 50%;
  background: #fff;
}

.window-controls {
  display: flex;
  align-self: stretch;
}

.window-controls button {
  width: 38px;
  height: 19px;
  border: 0;
  background: transparent;
  color: #25282d;
  font-size: 11px;
  line-height: 1;
  padding: 0;
}

.window-controls button:hover {
  background: #e9ebee;
}

.window-controls .close-control:hover {
  color: #fff;
  background: #e81123;
}

.menu-bar {
  height: 18px;
  display: flex;
  align-items: stretch;
  gap: 1px;
  padding-left: 3px;
  background: #fff;
  border-bottom: 1px solid #e6ebf1;
  user-select: none;
}

.menu-bar button {
  height: 17px;
  border: 0;
  background: transparent;
  padding: 0 6px;
  color: #24313e;
  font-size: 11px;
  cursor: default;
}

.menu-bar button:hover {
  background: #e7f1ff;
}

.app-layout {
  height: calc(100% - var(--chrome-height));
  display: flex;
  min-height: 0;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  display: flex;
  flex-direction: column;
  color: var(--sidebar-text);
  background: var(--sidebar);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.035);
}

.brand-block {
  padding: 22px 20px 17px;
}

.brand-block h1 {
  margin: 0;
  color: #f2f7fc;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-block p {
  margin: 8px 0 0;
  color: var(--sidebar-muted);
  font-size: 9px;
  white-space: nowrap;
}

.sidebar-nav {
  display: grid;
  gap: 0;
  padding: 2px 9px;
}

.nav-item {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: #c4d0de;
  background: transparent;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.065);
}

.nav-item.active {
  color: #fff;
  font-weight: 600;
  background: var(--blue);
  box-shadow: 0 2px 5px rgba(0, 71, 179, 0.28);
}

.sidebar-status {
  margin-top: auto;
  padding: 0 20px 36px;
  color: var(--sidebar-muted);
  font-size: 9px;
}

.sidebar-status p {
  margin: 0 0 15px;
}

.sidebar-status p:last-child {
  margin-bottom: 0;
}

.main-panel {
  min-width: 0;
  flex: 1;
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
}

.page-header {
  height: 80px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 69px 0 20px;
}

.page-header h2 {
  margin: 0;
  color: #14283e;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-header p {
  margin: 10px 0 0;
  color: #8292a2;
  font-size: 10px;
  line-height: 1.3;
}

.primary-button,
.soft-button,
.submitted-button {
  min-height: 32px;
  border-radius: 6px;
  padding: 0 13px;
  white-space: nowrap;
  cursor: pointer;
}

.primary-button {
  border: 1px solid #0d6ce5;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 2px 5px rgba(20, 105, 219, 0.2);
}

.primary-button:hover {
  background: var(--blue-hover);
}

.page-header > .primary-button {
  min-width: 83px;
  margin-top: 7px;
}

.cycle-page {
  height: calc(100% - 80px);
  display: grid;
  grid-template-rows: 64px minmax(230px, 1fr) 61px;
  gap: 0;
  padding: 0 0 32px 20px;
  min-height: 0;
}

.action-card {
  height: 51px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 13px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 6px 0 0 6px;
  box-shadow: 0 1px 3px rgba(30, 57, 88, 0.035);
}

.section-label {
  color: #314559;
  font-size: 12px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-buttons button {
  font-size: 10px;
}

.soft-button {
  min-height: 31px;
  border: 1px solid #e2e7ed;
  color: #2b3e52;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 51, 78, 0.04);
}

.soft-button:hover {
  color: var(--blue);
  border-color: #bbd7fa;
  background: #f8fbff;
}

.submitted-button {
  min-height: 31px;
  border: 1px solid #f1dbdf;
  color: var(--danger);
  background: var(--danger-bg);
  cursor: default;
}

.table-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e6ebf1;
  border-right: 0;
  box-shadow: 0 1px 3px rgba(31, 56, 84, 0.025);
}

.table-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding-bottom: 14px;
  scrollbar-width: none;
}

.table-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.plan-table {
  width: 1266px;
  min-width: 1266px;
  border-collapse: collapse;
  table-layout: fixed;
  color: #35485d;
  font-size: 11px;
}

.plan-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}

.plan-table th,
.plan-table td {
  height: 35px;
  padding: 0 8px;
  border-right: 1px solid #edf1f5;
  border-bottom: 1px solid #e7ebf0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-table th {
  height: 36px;
  color: #2d4054;
  font-size: 11px;
  font-weight: 600;
  background: #fff;
}

.plan-table td {
  height: 35px;
  padding-right: 7px;
  padding-left: 7px;
  font-size: 10px;
}

.plan-table tbody tr {
  cursor: default;
}

.plan-table tbody tr.selected td {
  background: var(--selected);
}

.plan-table tbody tr:not(.selected):hover td {
  background: #f7faff;
}

.plan-table td:first-child {
  color: #344457;
  text-align: center;
}

.col-index { width: 28px; }
.col-id { width: 45px; }
.col-name { width: 130px; }
.col-platform { width: 80px; }
.col-group { width: 75px; }
.col-strategy { width: 90px; }
.col-count { width: 61px; }
.col-account-gap { width: 68px; }
.col-cycle-gap { width: 65px; }
.col-limit { width: 66px; }
.col-finished { width: 66px; }
.col-success { width: 50px; }
.col-failed { width: 50px; }
.col-waiting { width: 62px; }
.col-step { width: 70px; }
.col-failed-account { width: 80px; }
.col-extra { width: 180px; }

.fake-h-scroll {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  height: 14px;
  display: flex;
  align-items: center;
  color: #4f5963;
  background: #f3f4f5;
  border-top: 1px solid #cfd4da;
}

.scroll-arrow {
  width: 14px;
  height: 13px;
  flex: 0 0 14px;
  display: grid;
  place-items: center;
  color: #59636d;
  background: #eff1f3;
  border-right: 1px solid #d3d7dc;
  font-size: 13px;
  line-height: 1;
}

.scroll-arrow:last-child {
  border-right: 0;
  border-left: 1px solid #d3d7dc;
}

.scroll-rail {
  position: relative;
  height: 13px;
  flex: 1;
}

.scroll-thumb {
  position: absolute;
  top: 2px;
  left: 1px;
  width: 55%;
  height: 9px;
  border-radius: 1px;
  background: #aeb5bd;
  box-shadow: inset 0 0 0 1px rgba(95, 105, 116, 0.22);
}

.log-section {
  min-height: 0;
  padding-right: 0;
}

.log-label {
  height: 20px;
  display: flex;
  align-items: center;
  color: #5c6c7c;
  font-size: 10px;
}

.log-console {
  height: 41px;
  overflow-y: auto;
  padding: 7px 8px;
  color: #d2dfef;
  background: var(--console);
  border: 1px solid #183659;
  border-right: 0;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  line-height: 17px;
  scrollbar-color: #8c98a7 #e7e9ec;
  scrollbar-width: thin;
}

.log-line {
  white-space: nowrap;
}

.log-time {
  color: #94a8c2;
}

.placeholder-page {
  height: calc(100% - 80px);
  padding: 0 19px 19px;
}

.accounts-page {
  height: calc(100% - 80px);
  overflow: auto;
  padding: 0 19px 20px;
}

.accounts-toolbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 15px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.accounts-toolbar-status {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
}

.accounts-toolbar p,
.campaigns-panel-head p {
  margin: 6px 0 0;
  color: #8493a3;
  font-size: 10px;
}

.social-summary {
  padding: 7px 9px;
  color: #4d6c8a;
  background: #f1f7fd;
  border: 1px solid #dcebf8;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
}

.adspower-status {
  max-width: 310px;
  overflow: hidden;
  color: #8a6a35;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adspower-status.connected {
  color: #3d805a;
}

.adspower-status.error {
  color: #b36b70;
}

.connection-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.connection-card {
  min-height: 92px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.connection-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #44586c;
  font-size: 11px;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aeb9c5;
}

.connection-dot.connected {
  background: #27a86b;
  box-shadow: 0 0 0 3px rgba(39, 168, 107, 0.12);
}

.asset-icon {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  background: #1877f2;
  font-size: 14px;
  font-weight: 700;
}

.asset-icon.ig {
  background: linear-gradient(135deg, #f9ce34, #ee2a7b 52%, #6228d7);
}

.connection-value {
  margin-top: 12px;
  overflow: hidden;
  color: #273d54;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-note {
  margin-top: 5px;
  overflow: hidden;
  color: #8795a4;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaigns-panel {
  min-height: 290px;
  padding: 15px;
}

.campaigns-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.api-badge {
  padding: 5px 7px;
  color: #3076c4;
  background: #edf5ff;
  border: 1px solid #d8eafd;
  border-radius: 4px;
  font-size: 9px;
  white-space: nowrap;
}

.campaigns-table-wrap {
  margin-top: 14px;
  overflow: auto;
  border: 1px solid #e7ebf0;
}

.campaigns-table {
  width: 100%;
  min-width: 690px;
  border-collapse: collapse;
  font-size: 11px;
}

.campaigns-table th,
.campaigns-table td {
  height: 35px;
  padding: 0 9px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  white-space: nowrap;
}

.campaigns-table th {
  color: #5a6b7d;
  background: #f9fbfd;
  font-weight: 600;
}

.campaigns-table td {
  color: #34495e;
}

.campaign-status {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 4px;
  color: #42785c;
  background: #eef9f1;
  font-size: 10px;
}

.campaign-status.paused {
  color: #718092;
  background: #f0f3f6;
}

.campaign-action {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #dbe4ed;
  border-radius: 4px;
  color: #48647f;
  background: #fff;
  cursor: pointer;
  font-size: 10px;
}

.campaign-action:hover {
  color: var(--blue);
  border-color: #b9d6f6;
  background: #f8fbff;
}

.empty-campaigns {
  height: 110px !important;
  color: #92a0ad !important;
  text-align: center !important;
}

.account-map-panel {
  margin-top: 12px;
  padding: 15px;
}

.account-map-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.account-map-head p {
  margin: 6px 0 0;
  color: #8493a3;
  font-size: 10px;
}

.account-map-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.account-map-actions .soft-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 10px;
}

.import-hint {
  margin-top: 12px;
  color: #8493a3;
  font-size: 10px;
}

.import-hint code {
  padding: 2px 4px;
  color: #526b83;
  background: #f1f5f9;
  border-radius: 3px;
  font-family: Consolas, monospace;
  font-size: 9px;
}

.safety-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding: 7px 9px;
  color: #677b8e;
  background: #f8fbfd;
  border: 1px solid #e5edf4;
  border-radius: 4px;
  font-size: 10px;
}

.safety-note span:first-child {
  color: #5d91c9;
  font-size: 12px;
}

.account-map-table-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid #e7ebf0;
}

.account-map-table {
  width: 100%;
  min-width: 1450px;
  border-collapse: collapse;
  font-size: 10px;
}

.account-map-table th,
.account-map-table td {
  height: 39px;
  padding: 0 7px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  white-space: nowrap;
}

.account-map-table th {
  color: #5a6b7d;
  background: #f9fbfd;
  font-weight: 600;
}

.account-map-table td {
  color: #34495e;
}

.account-map-table input,
.account-map-table select {
  width: 100%;
  height: 26px;
  padding: 0 5px;
  border: 1px solid #dfe6ed;
  border-radius: 3px;
  outline: none;
  color: #34495e;
  background: #fff;
  font-size: 10px;
}

.account-map-table input:focus,
.account-map-table select:focus {
  border-color: #8dbbf0;
  box-shadow: 0 0 0 2px rgba(22, 119, 242, 0.09);
}

.account-map-table .map-platform-select { width: 84px; }
.account-map-table .map-id-input { width: 125px; }
.account-map-table .map-name-input { width: 130px; }
.account-map-table .map-browser-input { width: 108px; }
.account-map-table .map-proxy-select { width: 220px; }
.account-map-table .map-proxy-detail { display: block; margin-top: 3px; color: #8795a4; font-size: 9px; }
.account-map-table .map-type-select { width: 67px; }
.account-map-table .map-host-input { width: 132px; }
.account-map-table .map-port-input { width: 58px; }
.account-map-table .map-region-input { width: 68px; }
.account-map-table .map-profile-id-input { width: 125px; }

.adspower-row-state {
  display: block;
  margin-top: 3px;
  color: #8795a4;
  font-size: 9px;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-action-button {
  min-width: 32px;
  height: 23px;
  padding: 0 5px;
  border: 1px solid #d7e3ef;
  border-radius: 3px;
  color: #356c9e;
  background: #f8fbff;
  cursor: pointer;
  font-size: 9px;
}

.map-action-button:hover {
  border-color: #9fc5e9;
  background: #eef6ff;
}

.map-state {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 4px;
  color: #98722f;
  background: #fff8e9;
  font-size: 9px;
}

.map-state.ready {
  color: #3c7b59;
  background: #eef9f1;
}

.remove-map-button {
  width: 23px;
  height: 23px;
  border: 1px solid #e4e9ee;
  border-radius: 3px;
  color: #8b99a7;
  background: #fff;
  cursor: pointer;
}

.remove-map-button:hover {
  color: #c36068;
  border-color: #f0cdd1;
  background: #fff6f7;
}

.placeholder-card {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: #7d8ea1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.placeholder-icon {
  color: #a9b9ca;
  font-size: 36px;
}

.placeholder-card h3 {
  margin: 13px 0 8px;
  color: #283d52;
  font-size: 18px;
}

.placeholder-card p {
  margin: 0 0 20px;
}

.modal-layer[hidden],
.placeholder-page[hidden] {
  display: none;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 31, 52, 0.28);
  backdrop-filter: blur(1px);
}

.modal {
  position: relative;
  width: min(460px, calc(100vw - 36px));
  overflow: hidden;
  background: #fff;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(13, 35, 63, 0.22);
  animation: modal-in 150ms ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(7px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px 0 18px;
  border-bottom: 1px solid #e7ebf0;
}

.modal-header h3 {
  margin: 0;
  color: #23384e;
  font-size: 15px;
}

.modal-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 5px;
  color: #718397;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

.modal-close:hover {
  background: #f0f3f7;
}

.modal-body {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  color: #536578;
  font-size: 11px;
}

.form-field input,
.form-field select {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #d9e1ea;
  border-radius: 5px;
  outline: none;
  background: #fff;
}

.form-field input:focus,
.form-field select:focus {
  border-color: #7fb5f5;
  box-shadow: 0 0 0 2px rgba(26, 119, 242, 0.1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.detail-list {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 10px 16px;
  margin: 0;
}

.detail-list dt {
  color: #7d8c9c;
}

.detail-list dd {
  margin: 0;
  color: #2c4054;
}

.account-preview {
  margin: 0;
  padding: 0;
  list-style: none;
}

.account-preview li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 41px;
  padding: 0 11px;
  border: 1px solid #e6ebf1;
  border-radius: 5px;
  background: #f9fbfd;
}

.account-preview b {
  font-weight: 600;
}

.account-preview span {
  color: #6b7e91;
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: 320px;
  padding: 10px 13px;
  color: #fff;
  background: rgba(17, 42, 75, 0.94);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(10, 31, 57, 0.23);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1050px) {
  :root { --sidebar-width: 160px; }
  .brand-block { padding-left: 15px; padding-right: 12px; }
  .brand-block h1 { font-size: 15px; }
  .sidebar-status { padding-left: 15px; }
  .page-header { padding-left: 15px; padding-right: 20px; }
  .cycle-page { padding-left: 15px; }
  .accounts-page { padding-left: 15px; padding-right: 15px; }
}
