* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f7fa; color: #1a1a2e; padding: 20px; }
.container { max-width: 1060px; margin: 0 auto; }
h1 { font-size: 24px; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.subtitle { color: #666; font-size: 14px; margin-bottom: 24px; }

.card { background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.card h2 { font-size: 16px; margin-bottom: 16px; color: #333; border-bottom: 1px solid #eee; padding-bottom: 8px; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.form-group { flex: 1; min-width: 180px; }
.form-group label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; font-weight: 600; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-group textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: #4a6cf7; outline: none; }
.form-hint { font-size: 11px; color: #999; margin-top: 2px; }

.file-row { display: flex; gap: 16px; margin-bottom: 12px; }
.file-group { flex: 1; }
.file-group label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; font-weight: 600; }
.file-group input[type="file"] { width: 100%; padding: 6px 0; font-size: 14px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 32px; font-size: 16px; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-primary { color: #fff; background: #4a6cf7; }
.btn-primary:hover:not(:disabled) { background: #3b5de7; }
.btn-primary:disabled { background: #b0b8c8; cursor: not-allowed; }
.btn-secondary { color: #fff; background: #6b7280; }
.btn-secondary:hover:not(:disabled) { background: #4b5563; }
.btn-secondary:disabled { background: #b0b8c8; cursor: not-allowed; }
.btn-success { color: #fff; background: #22c55e; }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-success:disabled { background: #b0b8c8; cursor: not-allowed; }
.btn-danger { color: #fff; background: #ef4444; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }
.btn-warning { color: #fff; background: #f59e0b; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-warning:disabled { background: #b0b8c8; cursor: not-allowed; }
.btn-download { color: #fff; text-decoration: none; }
.btn-download-cemetery { background: #f59e0b; }
.btn-download-cemetery:hover { background: #d97706; }
.btn-download-result { background: #22c55e; }
.btn-download-result:hover { background: #16a34a; }
.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.log-container { background: #1a1a2e; color: #e0e0e0; border-radius: 8px; padding: 16px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; line-height: 1.6; max-height: 400px; overflow-y: auto; min-height: 100px; }
.log-container .log-entry { padding: 2px 0; white-space: pre-wrap; word-break: break-all; }
.log-container .log-cemetery { color: #fbbf24; }
.log-container .log-clone { color: #34d399; }
.log-container .log-error { color: #ef4444; font-weight: bold; }
.log-container .log-done { color: #4ade80; font-weight: bold; }
.log-container .log-info { color: #60a5fa; }
.log-empty { color: #666; font-style: italic; }

.status-badge { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; transition: .2s; }
.status-idle { background: #e5e7eb; color: #666; }
.status-running { background: #dbeafe; color: #2563eb; }
.status-done { background: #dcfce7; color: #16a34a; }
.status-error { background: #fce7e7; color: #dc2626; }

.steps { display: flex; gap: 0; margin-bottom: 20px; background: #e5e7eb; border-radius: 8px; overflow: hidden; }
.step { flex: 1; padding: 10px; text-align: center; font-size: 13px; font-weight: 600; color: #9ca3af; transition: .2s; }
.step.active { background: #4a6cf7; color: #fff; }
.step.done { background: #22c55e; color: #fff; }
.step-num { display: inline-block; width: 22px; height: 22px; line-height: 22px; border-radius: 50%; text-align: center; margin-right: 6px; font-size: 12px; background: rgba(255,255,255,.3); }

.download-area { display: none; margin-top: 12px; }
.download-area.show { display: flex; gap: 12px; flex-wrap: wrap; }

.summary-box { background: #f0f4ff; border: 1px solid #dbeafe; border-radius: 8px; padding: 12px; margin-bottom: 12px; font-size: 13px; }
.summary-box .stat { display: inline-block; margin-right: 20px; }
.summary-box .stat-val { font-weight: 700; font-size: 16px; color: #2563eb; }
.summary-box .stat-label { color: #666; font-size: 11px; }

.tabs { display: flex; gap: 0; margin-bottom: 20px; background: #e5e7eb; border-radius: 8px; overflow: hidden; }
.tab { flex: 1; padding: 12px; text-align: center; font-size: 14px; font-weight: 600; color: #9ca3af; cursor: pointer; transition: .2s; border: none; background: none; }
.tab.active { background: #4a6cf7; color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.config-card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.config-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.config-title { font-weight: 600; font-size: 15px; }
.config-meta { font-size: 12px; color: #666; margin-top: 2px; }
.config-actions { display: flex; gap: 6px; flex-shrink: 0; }
.config-results { margin-top: 8px; border-top: 1px solid #e5e7eb; padding-top: 8px; }
.result-time { font-size: 11px; color: #999; margin-bottom: 6px; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-item { padding: 4px 8px; font-size: 13px; font-family: 'SF Mono', 'Fira Code', monospace; border-radius: 4px; margin-bottom: 2px; background: #f3f4f6; }
.result-item a { color: #2563eb; text-decoration: none; margin-left: 6px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.result-item a:hover { text-decoration: underline; }
.result-item.highlight { background: #fef3c7; color: #92400e; font-weight: 700; border-left: 3px solid #f59e0b; }
.result-item.highlight a { color: #92400e; }

.settings-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.settings-row label { font-size: 14px; font-weight: 600; color: #333; }
.settings-row input { width: 100px; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; text-align: center; }
.settings-row input:focus { border-color: #4a6cf7; outline: none; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 520px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal .form-group { margin-bottom: 12px; }

.engine-status { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.engine-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.engine-dot.on { background: #22c55e; }
.engine-dot.off { background: #ef4444; }

.config-empty { color: #666; font-style: italic; padding: 20px 0; text-align: center; }

/* ---- Auth Screen ---- */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: #f5f7fa;
  z-index: 1000;
}
.auth-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 400px;
  max-width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
}
.auth-box h3 {
  font-size: 18px;
  margin-bottom: 20px;
  color: #333;
}
.auth-box .form-group {
  margin-bottom: 16px;
}
.auth-error {
  background: #fef2f2;
  color: #dc2626;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.auth-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: #666;
}
.auth-switch a {
  color: #4a6cf7;
  text-decoration: none;
  font-weight: 600;
}
.auth-switch a:hover {
  text-decoration: underline;
}

/* ---- App Header ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header h1 {
  margin-bottom: 0;
}
.header-username {
  font-size: 13px;
  color: #666;
  background: #e5e7eb;
  padding: 3px 10px;
  border-radius: 12px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Account Cards ---- */
.account-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.account-card-info {
  flex: 1;
  min-width: 0;
}
.account-card-name {
  font-weight: 600;
  font-size: 15px;
}
.account-card-meta {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.account-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.account-balances {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.balance-item {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
}
.balance-wallet {
  background: #dbeafe;
  color: #2563eb;
}
.balance-advance {
  background: #dcfce7;
  color: #16a34a;
}
.balance-advance-low {
  background: #fce7e7;
  color: #dc2626;
}
.balance-loading {
  font-size: 11px;
  color: #999;
  font-style: italic;
}
.balance-error {
  font-size: 11px;
  color: #ef4444;
}

.account-card .acc-badge {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  background: #dcfce7;
  color: #16a34a;
  white-space: nowrap;
}

/* ---- Bidding ---- */
.bid-card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.bid-header { display: flex; align-items: center; gap: 12px; }
.bid-checkbox { flex-shrink: 0; }
.bid-checkbox input { width: 18px; height: 18px; cursor: pointer; }
.bid-info { flex: 1; cursor: pointer; min-width: 0; }
.bid-promotions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; font-size: 11px; color: #555; }
.bid-promotions label { display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }
.bid-promotions input { width: 15px; height: 15px; cursor: pointer; }
.bid-title { font-weight: 600; font-size: 14px; }
.bid-meta { font-size: 12px; color: #666; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bid-position { flex-shrink: 0; font-size: 14px; min-width: 50px; text-align: right; }
.bid-body { margin-top: 12px; border-top: 1px solid #e5e7eb; padding-top: 12px; }
.bid-config .form-row { margin-bottom: 8px; }
.bid-config .form-group label { font-size: 11px; }
.bid-config .form-group input,
.bid-config .form-group select { padding: 6px 8px; font-size: 13px; }
.bid-bar-wrap { margin-top: 8px; }
.bid-bar-label { font-size: 12px; color: #555; margin-bottom: 4px; }
.bid-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.bid-bar-fill { height: 100%; background: #4a6cf7; border-radius: 4px; transition: width .3s; }
.bid-history { font-size: 12px; }
.history-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.history-table th { background: #f3f4f6; padding: 6px 8px; text-align: left; font-weight: 600; border-bottom: 2px solid #e5e7eb; }
.history-table td { padding: 4px 8px; border-bottom: 1px solid #f3f4f6; }
.history-table tr:hover td { background: #f9fafb; }
.bid-up { color: #ef4444; font-weight: 600; }
.bid-down { color: #22c55e; font-weight: 600; }
.bid-results { font-size: 12px; }
.bid-schedule { margin-top: 12px; border: 1px solid #dbe3f0; border-radius: 8px; overflow: hidden; }
.bid-schedule-toggle { width: 100%; border: 0; background: #f3f6fb; color: #334155; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; text-align: left; }
.bid-schedule-toggle small { color: #64748b; font-weight: 400; margin-left: 4px; }
.bid-schedule-toggle[aria-expanded="true"] .bid-schedule-chevron { transform: rotate(180deg); }
.bid-schedule-chevron { transition: transform .2s ease; }
.bid-schedule-body { padding: 12px; background: #fff; }
.bid-schedule-label { margin: 0 0 7px; color: #475569; font-size: 12px; font-weight: 600; }
.bid-schedule-days { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 14px; }
.bid-schedule-days label,
.bid-schedule-hours label { display: flex; align-items: center; gap: 5px; color: #475569; font-size: 12px; cursor: pointer; }
.bid-schedule-days input,
.bid-schedule-hours input { width: 15px; height: 15px; }
.bid-schedule-hours { display: grid; grid-template-columns: repeat(6, minmax(70px, 1fr)); gap: 9px 14px; margin-bottom: 14px; }
.bid-off-hours-row { display: flex; align-items: flex-end; gap: 12px; border-top: 1px solid #e5e7eb; padding-top: 12px; }
.bid-off-hours-row .form-group { flex: 1; margin: 0; }
.bid-off-hours-fixed { max-width: 220px; }
@media (max-width: 760px) {
  .bid-schedule-hours { grid-template-columns: repeat(3, minmax(70px, 1fr)); }
  .bid-off-hours-row { align-items: stretch; flex-direction: column; }
  .bid-off-hours-fixed { max-width: none; }
}
.highlight-row { background: #fef3c7; font-weight: 600; }
.highlight-row td { border-bottom-color: #f59e0b; }

/* ---- Прямая ссылка (Plain URL) ---- */
.bid-config .form-group input.field-disabled,
.bid-config .form-group input.field-disabled:focus {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  border-color: #e5e7eb;
  opacity: 0.6;
}
.bid-plain-url-row .form-group {
  min-width: 100%;
}
.bid-plain-url-row .form-group input {
  width: 100%;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

/* ---- Recreate ---- */
.recreate-candidate { background: #fff8f0; border: 1px solid #fed7aa; border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.recreate-candidate .rc-info { flex: 1; min-width: 0; }
.recreate-candidate .rc-title { font-size: 13px; font-weight: 600; }
.recreate-candidate .rc-meta { font-size: 11px; color: #888; }
.recreate-candidate .rc-position { font-size: 12px; font-weight: 600; white-space: nowrap; }
.recreate-candidate .rc-city { flex: 0 0 200px; }
.recreate-candidate .rc-city input,
.recreate-candidate .rc-city select { width: 100%; padding: 5px 8px; border: 1px solid #ddd; border-radius: 5px; font-size: 13px; }
.recreate-candidate .rc-city input:focus,
.recreate-candidate .rc-city select:focus { border-color: #f59e0b; outline: none; }
.recreate-candidate .rc-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #fef3c7; color: #92400e; white-space: nowrap; }
.recreate-candidate.done .rc-badge { background: #dcfce7; color: #16a34a; }

/* ---- Autoload (Автозагрузка) ---- */
.autoload-file-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
  text-align: center;
}
.autoload-file-card:hover {
  border-color: #4a6cf7;
  background: #eff3ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(74,108,247,0.15);
}
.autoload-file-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 2px;
}
.autoload-file-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  word-break: break-all;
  max-width: 120px;
  line-height: 1.3;
}
.autoload-file-size {
  font-size: 11px;
  color: #999;
}

/* ---- Toast-уведомления ---- */
.bid-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 320px;
  max-width: 480px;
  padding: 16px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 9999;
  animation: bidToastSlideIn 0.3s ease-out;
  font-size: 14px;
  line-height: 1.5;
}
.bid-toast-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
}
.bid-toast-info {
  background: #dbeafe;
  border: 1px solid #4a6cf7;
  color: #1e40af;
}
.bid-toast-error {
  background: #fce7e7;
  border: 1px solid #ef4444;
  color: #dc2626;
}
.bid-toast-success {
  background: #dcfce7;
  border: 1px solid #22c55e;
  color: #16a34a;
}
.bid-toast-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  line-height: 1;
}
.bid-toast-close:hover {
  opacity: 1;
}
.bid-toast-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
  padding-right: 20px;
}
.bid-toast-message {
  font-size: 13px;
  opacity: 0.9;
}

@keyframes bidToastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ================================================================
   AD CREATOR — Степпер создания объявлений
   ================================================================ */

.ad-creator-stepper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-card {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: all 0.3s ease;
}

.step-card.disabled {
  opacity: 0.55;
  background: #fafafa;
}

.step-card.disabled .step-body {
  display: none;
}

.step-card:not(.disabled) {
  border-color: #4a6cf7;
  box-shadow: 0 2px 12px rgba(74,108,247,0.1);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #f8f9ff;
  cursor: default;
}

.step-card.disabled .step-header {
  background: #f5f5f5;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #4a6cf7;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.step-card.disabled .step-number {
  background: #bbb;
}

.step-title {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  flex: 1;
}

.step-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #fff3cd;
  color: #856404;
  font-weight: 500;
  white-space: nowrap;
}

.step-card:not(.disabled) .step-badge {
  background: #d1ecf1;
  color: #0c5460;
}

.step-body {
  padding: 16px 18px;
  border-top: 1px solid #e8e8e8;
}

.step-status {
  font-size: 13px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
}

/* Category tree */
.category-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 13px;
  cursor: default;
}

.category-tree-item:hover {
  background: #f0f4ff;
  border-radius: 4px;
}

.category-tree-item.selected {
  background: #e3f2fd;
  border-radius: 4px;
  font-weight: 600;
}

.category-tree-item .cat-name {
  cursor: pointer;
}

.expand-cat-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
  padding: 2px 4px;
  color: #666;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.expand-cat-btn:hover {
  color: #4a6cf7;
}

.expand-placeholder {
  display: inline-block;
  width: 20px;
  flex-shrink: 0;
}

/* Category search results */
.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

.category-item:hover {
  background: #f0f4ff;
}

.category-item .cat-path {
  color: #666;
  font-size: 12px;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.info-row {
  font-size: 13px;
  padding: 3px 0;
  color: #444;
}

/* ================================================================
   CERBER PRODUCT SHELL — task-oriented dashboard redesign
   ================================================================ */
:root {
  --navy-950: #041a32;
  --navy-900: #082540;
  --navy-800: #123b5f;
  --ink-950: #10243e;
  --ink-700: #40556f;
  --ink-500: #71839a;
  --surface: #ffffff;
  --canvas: #f4f7fa;
  --line: #dce5ed;
  --line-soft: #eaf0f5;
  --green: #079455;
  --green-dark: #067647;
  --green-soft: #e8f7ef;
  --blue: #2f80ed;
  --blue-soft: #eaf2ff;
  --amber: #e87511;
  --amber-soft: #fff2e3;
  --red: #d92d20;
  --red-soft: #ffebe9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 36, 62, .04), 0 8px 24px rgba(16, 36, 62, .035);
}

html { min-height: 100%; background: var(--canvas); }
body {
  min-height: 100%;
  padding: 0;
  background: var(--canvas);
  color: var(--ink-950);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(47, 128, 237, .26);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; width: 100%; }
.app-main {
  min-height: 100vh;
  margin-left: 232px;
  padding: 26px 30px 42px;
  overflow-x: hidden;
}
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 900;
  width: 232px;
  display: flex;
  flex-direction: column;
  padding: 22px 12px;
  background: linear-gradient(180deg, var(--navy-950), #062b4c 100%);
  color: #fff;
  box-shadow: 10px 0 30px rgba(4, 26, 50, .08);
}
.sidebar-brand, .auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand { padding: 0 10px 24px; font-size: 22px; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 54px;
  border: 2px solid currentColor;
  border-radius: 18px 18px 24px 24px;
  color: var(--green);
  font-weight: 800;
  letter-spacing: -.08em;
  transform: scale(.86);
}
.brand-mark-sidebar { color: #fff; width: 46px; height: 50px; }
.sidebar-nav { display: flex; flex: 1; flex-direction: column; gap: 5px; }
.sidebar-link {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #d8e4ef;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.sidebar-link.active { background: rgba(92, 160, 214, .17); color: #fff; }
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #34d399;
}
.nav-icon { width: 21px; font-size: 19px; line-height: 1; text-align: center; }
.sidebar-divider { height: 1px; margin: 13px 6px; background: rgba(255,255,255,.12); }
.sidebar-user {
  display: grid;
  grid-template-columns: 38px 1fr 28px;
  align-items: center;
  gap: 10px;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #eef3f7;
  color: var(--navy-900);
  font-weight: 700;
}
.sidebar-user div { min-width: 0; }
.sidebar-user strong, .sidebar-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user div span { margin-top: 2px; color: #aebfd0; font-size: 12px; }
.sidebar-logout { border: 0; background: transparent; color: #aebfd0; font-size: 20px; cursor: pointer; }
.sidebar-logout:hover { color: #fff; }
.sidebar-scrim { display: none; }

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 22px;
  max-width: 1500px;
}
.header-left { align-items: flex-start; gap: 12px; }
.breadcrumbs { margin-bottom: 10px; color: var(--ink-500); font-size: 12px; }
.breadcrumbs span { margin: 0 6px; color: #b0bcc8; }
.breadcrumbs strong { color: var(--ink-700); font-weight: 500; }
.app-header h1 { margin: 0; color: var(--ink-950); font-size: clamp(24px, 2.1vw, 34px); letter-spacing: -.035em; }
.page-subtitle { margin-top: 2px; color: var(--ink-500); font-size: 14px; }
.header-right { gap: 10px; padding-top: 23px; flex-wrap: nowrap; }
.account-filter, .icon-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-950);
  box-shadow: 0 1px 2px rgba(16,36,62,.03);
  cursor: pointer;
}
.account-filter { min-width: 200px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.icon-button { position: relative; width: 44px; padding: 0; color: var(--navy-900); }
.icon-button i { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.mobile-nav-toggle { display: none; border: 0; background: transparent; font-size: 24px; color: var(--ink-950); }

.btn {
  min-height: 42px;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 14px;
  box-shadow: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(16,36,62,.1); }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 12px; }
.btn-primary, .btn-success { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled), .btn-success:hover:not(:disabled) { background: var(--green-dark); }
.btn-secondary { border: 1px solid var(--line); background: #fff; color: var(--ink-950); }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; }
.btn-danger { background: var(--red); }
.tabs { display: none; }
.tab-panel { max-width: 1500px; margin: 0 auto; }
.tab-panel.active { display: block; animation: panelEnter .22s ease-out; }
@keyframes panelEnter { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.overview-engine-banner {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(300px, .9fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 92px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.overview-engine-banner.running { border-color: #cdebdc; }
.overview-engine-copy { display: flex; align-items: center; gap: 15px; }
.overview-engine-icon {
  display: grid;
  place-items: center;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: 26px;
  font-weight: 700;
}
.overview-engine-banner.running .overview-engine-icon { background: var(--green); color: #fff; }
.overview-engine-copy h2 { margin: 0 0 4px; border: 0; padding: 0; color: var(--ink-950); font-size: 15px; }
.overview-engine-copy p, .section-heading p { margin: 0; color: var(--ink-500); font-size: 12px; }
.overview-engine-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.overview-engine-stats div { min-width: 72px; }
.overview-engine-stats span, .overview-engine-stats strong { display: block; }
.overview-engine-stats span { margin-bottom: 4px; color: var(--ink-700); font-size: 10px; white-space: nowrap; }
.overview-engine-stats strong { font-size: 18px; }
.positive { color: var(--green) !important; }
.warning { color: var(--amber) !important; }
.danger { color: var(--red) !important; }

.overview-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.metric-card, .overview-card, .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.metric-card { min-height: 132px; padding: 16px; }
.metric-heading { display: flex; align-items: center; justify-content: space-between; color: var(--ink-700); font-size: 12px; }
.metric-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  font-style: normal;
  font-weight: 700;
}
.metric-icon.positive { background: var(--green-soft); }
.metric-sparkline { color: var(--blue); font-size: 28px; font-style: normal; letter-spacing: -5px; }
.metric-card > strong { display: block; margin: 7px 0 13px; font-size: 26px; line-height: 1; letter-spacing: -.03em; }
.metric-foot {
  min-height: 25px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-500);
  font-size: 10px;
}
.metric-foot b { color: var(--ink-950); font-size: 11px; }
.overview-workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 16px; }
.overview-card { overflow: hidden; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line-soft);
}
.section-heading h2 { margin: 0 0 2px; border: 0; padding: 0; color: var(--ink-950); font-size: 14px; }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 11px; cursor: pointer; }
.overview-table-wrap { overflow-x: auto; }
.overview-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.overview-table th {
  padding: 9px 13px;
  background: #fbfcfd;
  color: var(--ink-500);
  font-size: 9px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.overview-table td { height: 50px; padding: 8px 13px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.overview-table tbody tr:hover { background: #f8fbfd; }
.overview-ad-title { max-width: 320px; }
.overview-ad-title strong, .overview-ad-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-ad-title strong { color: var(--ink-950); font-size: 11px; }
.overview-ad-title span { margin-top: 2px; color: var(--ink-500); font-size: 9px; }
.overview-position { color: var(--ink-950); font-size: 14px; font-weight: 700; }
.overview-position.good { color: var(--green); }
.status-pill { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--ink-700); }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-500); }
.status-pill.good { color: var(--green); }
.status-pill.good::before { background: var(--green); }
.status-pill.warning { color: var(--amber); }
.status-pill.warning::before { background: var(--amber); }
.status-pill.danger { color: var(--red); }
.status-pill.danger::before { background: var(--red); }
.overview-empty { padding: 28px 16px; color: var(--ink-500); text-align: center; }
.count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 5px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-size: 10px; }
.attention-card { display: flex; min-height: 334px; flex-direction: column; }
.attention-list { flex: 1; }
.attention-item {
  width: calc(100% - 30px);
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  margin: 0 15px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.attention-item:hover { background: #fbfcfd; }
.attention-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); font-weight: 800; }
.attention-item.danger .attention-icon { background: var(--red-soft); color: var(--red); }
.attention-copy strong, .attention-copy span { display: block; }
.attention-copy strong { color: var(--ink-950); font-size: 11px; }
.attention-copy span { margin-top: 2px; color: var(--ink-500); font-size: 9px; }
.attention-action { color: var(--ink-500); font-size: 18px; }
.attention-footer { min-height: 42px; margin: 0 12px; border-top: 1px solid var(--line-soft); text-align: left; }
.activity-card { margin-top: 16px; }
.activity-list { display: flex; min-height: 70px; overflow-x: auto; }
.activity-item { min-width: 220px; display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 13px 16px; border-right: 1px solid var(--line-soft); }
.activity-arrow { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 700; }
.activity-arrow.down { background: var(--red-soft); color: var(--red); }
.activity-item strong, .activity-item span { display: block; }
.activity-item strong { max-width: 145px; overflow: hidden; color: var(--ink-950); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.activity-item span { margin-top: 2px; color: var(--ink-500); font-size: 9px; }
.activity-delta { color: var(--green); font-size: 10px; font-weight: 700; white-space: nowrap; }
.activity-delta.down { color: var(--red); }

#accountManagementArea { max-width: 1500px; margin: 0 auto 16px; }
#accountsList {
  margin: 0;
  padding: 14px 16px;
  background: rgba(255,255,255,.9);
}
#accountsList h2 {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  color: var(--ink-700);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
#accountsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
#accountsContainer .account-card {
  min-height: 74px;
  margin: 0;
  padding: 11px 12px;
  border-color: var(--line-soft);
  background: #fbfcfd;
}
#accountsContainer .account-card-name { color: var(--ink-950); font-size: 13px; }
#accountsContainer .account-card-meta { color: var(--ink-500); font-size: 10px; }
#accountsContainer .account-balances { gap: 6px; margin-top: 6px; }
#accountsContainer .balance-item { padding: 2px 7px; font-size: 10px; }
#accountsContainer .acc-badge { font-size: 9px; }
#accountsContainer .account-card-actions .btn { min-height: 30px; padding: 5px 8px; font-size: 10px; }
.card { padding: 20px; }
.card h2 { color: var(--ink-950); }
.form-group input, .form-group textarea, .form-group select, select {
  min-height: 40px;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--ink-950);
  background: #fff;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,128,237,.1); }
.form-hint { color: var(--ink-500); }
.bid-card { border-color: var(--line); border-radius: 10px; background: #fff; }
.bid-header { min-height: 44px; }
.bid-card:hover { border-color: #c7d5e2; box-shadow: 0 5px 18px rgba(16,36,62,.05); }
.bid-bar-fill { background: var(--green); }
.step-card:not(.disabled) { border-color: rgba(7,148,85,.45); box-shadow: 0 5px 18px rgba(7,148,85,.08); }
.step-number { background: var(--green); }
.step-header { background: #f7faf9; }
.auth-screen {
  background:
    radial-gradient(circle at 15% 20%, rgba(47,128,237,.08), transparent 32%),
    radial-gradient(circle at 82% 80%, rgba(7,148,85,.09), transparent 30%),
    var(--canvas);
}
.auth-box { width: 420px; padding: 34px; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(16,36,62,.12); }
.auth-brand { justify-content: center; margin-bottom: 28px; }
.auth-brand h1 { margin: 0; font-size: 25px; }
.auth-brand .subtitle { margin: 2px 0 0; text-align: left; }

@media (max-width: 1240px) {
  .overview-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-engine-banner { grid-template-columns: 1fr auto; }
  .overview-engine-stats { grid-row: 2; grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--line-soft); }
  .header-right .account-filter { display: none; }
}
@media (max-width: 980px) {
  .app-main { margin-left: 76px; padding: 22px 20px 36px; }
  .app-sidebar { width: 76px; padding-inline: 9px; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-brand strong, .sidebar-link span:last-child, .sidebar-user div, .sidebar-logout { display: none; }
  .brand-mark-sidebar { width: 44px; }
  .sidebar-link { justify-content: center; padding-inline: 0; }
  .sidebar-user { display: flex; justify-content: center; grid-template-columns: none; padding-inline: 0; }
  .overview-workspace { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-main { margin-left: 0; padding: 16px 14px 28px; }
  .app-sidebar { width: min(280px, 86vw); transform: translateX(-102%); transition: transform .2s ease; }
  .app-sidebar.open { transform: translateX(0); }
  .app-sidebar.open .sidebar-brand strong, .app-sidebar.open .sidebar-link span:last-child, .app-sidebar.open .sidebar-user div, .app-sidebar.open .sidebar-logout { display: block; }
  .app-sidebar.open .sidebar-link { justify-content: flex-start; padding-inline: 13px; }
  .app-sidebar.open .sidebar-user { display: grid; justify-content: initial; grid-template-columns: 38px 1fr 28px; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 850; border: 0; background: rgba(4,26,50,.48); }
  .sidebar-scrim.show { display: block; }
  .mobile-nav-toggle { display: inline-block; }
  .app-header { align-items: flex-start; }
  .header-right { padding-top: 0; }
  .header-right .icon-button, .header-right #addAccountGlobalBtn { display: none; }
  .header-right .btn-primary { min-height: 40px; padding: 9px 12px; font-size: 12px; }
  .breadcrumbs, .page-subtitle { display: none; }
  .app-header h1 { font-size: 23px; }
  .overview-engine-banner { grid-template-columns: 1fr; }
  .overview-engine-banner > .btn { width: 100%; }
  .overview-engine-stats { grid-row: auto; grid-column: auto; gap: 10px; }
  .overview-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 118px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .file-row { flex-direction: column; }
  .modal { width: calc(100vw - 28px); }
}
@media (max-width: 470px) {
  .overview-kpi-grid { grid-template-columns: 1fr; }
  .overview-engine-stats { grid-template-columns: 1fr 1fr; }
  .header-right .btn-primary { max-width: 150px; }
}
