/* Shared dashboard foundations for extension and web. */
* { box-sizing: border-box; }

html, body {
      height: 100vh;
      max-height: 100vh;
      overflow: hidden;
      margin: 0;
      padding: 0;
    }

body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
      background: var(--bg-body);
      color: var(--text-primary);
      display: flex;
      flex-direction: column;
      transition: background 0.3s ease, color 0.3s ease;
    }

.header {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 10px;
      margin-bottom: 6px;
      box-shadow: none;
      flex-shrink: 0;
      transition: background 0.3s ease, box-shadow 0.3s ease;
    }

.header-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      flex-wrap: nowrap;
      position: relative;
      min-height: 34px;
    }

.header-title {
      display: flex;
      align-items: center;
      gap: 8px;
      white-space: nowrap;
      flex: 0 0 auto;
    }

.header-title h2 {
      margin: 0;
      font-size: 15px;
      font-weight: 800;
      color: var(--text-primary);
      letter-spacing: -0.3px;
    }

.version-badge { background: var(--accent); color: white; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0; }

.action-buttons {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-end;
      flex: 0 0 auto;
    }

.app-layout {
      display: flex;
      gap: 8px;
      flex: 1;
      min-height: 0;
      align-items: stretch;
      overflow: hidden;
    }

.side-rail {
      display: flex;
      flex-direction: column;
      gap: 3px;
      width: 42px;
      flex-shrink: 0;
      transition: width 0.22s ease;
      overflow: hidden;
      align-self: flex-start;
      position: sticky;
      top: 0;
    }

.side-rail.expanded { width: 118px; }

.rail-toggle {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 42px;
      height: 34px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      cursor: pointer;
      color: var(--text-secondary);
      font-size: 16px;
      box-shadow: 0 2px 6px var(--shadow-light);
      flex-shrink: 0;
      transition: background 0.18s;
    }

.rail-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.main-tab-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 42px;
      height: 38px;
      padding: 0;
      overflow: hidden;
      white-space: nowrap;
      border: none;
      border-radius: 8px;
      background: var(--bg-card);
      box-shadow: 0 1px 3px var(--shadow-light);
      font-size: 17px;
      font-weight: 600;
      color: var(--text-secondary);
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      flex-shrink: 0;
    }

.main-tab-btn:hover {
      background: var(--bg-hover);
      color: var(--text-primary);
      transform: translateY(-1px);
    }

.main-tab-btn.active {
      background: #2563eb;
      color: white;
      box-shadow: 0 4px 12px rgba(79,70,229,0.3);
      transform: none;
    }

.tab-label {
      font-size: 13px;
      font-weight: 600;
      opacity: 0;
      max-width: 0;
      transition: opacity 0.18s ease, max-width 0.22s ease;
      overflow: hidden;
      color: inherit;
    }

.side-rail.expanded .main-tab-btn {
      width: 118px;
      justify-content: flex-start;
      padding: 0 9px;
    }

.side-rail.expanded .tab-label {
      opacity: 1;
      max-width: 60px;
    }

.search-box {
      position: relative;
      margin-bottom: 0;
    }

.search-input {
      width: 100%;
      height: 30px;
      padding: 0 32px;
      border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary);
      border-radius: 7px;
      font-size: 13px;
      transition: all 0.2s ease;
    }

.search-input:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
    }

.search-icon {
      position: absolute;
      left: 10px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-secondary);
      font-size: 14px;
    }

.clear-search {
      position: absolute;
      right: 8px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      color: var(--text-secondary);
      cursor: pointer;
      padding: 2px 6px;
      border-radius: 3px;
      font-size: 14px;
      display: none;
    }

.clear-search:hover { background: var(--bg-hover); color: #a5b4fc; }

.quick-filters {
      display: flex;
      gap: 4px;
      flex-wrap: nowrap;
      overflow-x: auto;
      padding-bottom: 1px;
    }

.filter-chip {
      padding: 2px 8px;
      border: 1.5px solid var(--border);
      border-radius: 999px;
      font-size: 11px;
      background: var(--bg-card);
      cursor: pointer;
      transition: all 0.2s ease;
      user-select: none;
      color: var(--text-secondary);
      font-weight: 500;
    }

.filter-chip:hover { border-color: #6366f1; background: var(--bg-input); color: #a5b4fc; }

.filter-chip.active {
      background: #2563eb;
      color: white;
      border-color: transparent;
      font-weight: 600;
    }

.api-check-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 4px;
      align-items: center;
      min-width: 0;
    }

.api-check-field { position: relative; display: block; }

.api-check-field label { display: none; }

.api-check-input {
      width: 100%;
      height: 28px;
      padding: 0 28px 0 8px;
      border: 1px solid var(--border);
      border-radius: 7px;
      font-size: 12px;
      background: var(--bg-input); color: var(--text-primary);
    }

.api-check-input:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(99,102,241,0.25);
    }

.token-status-dot {
      position: absolute;
      right: 10px; top: 50%;
      transform: translateY(-50%);
      width: 10px; height: 10px;
      border-radius: 50%;
      background: #cbd5e1;
      box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
      pointer-events: none;
    }

.token-status-dot.valid   { background: #22c55e; }

.token-status-dot.invalid { background: #ef4444; }

.token-status-dot.checking{ background: #f59e0b; }

.token-status-text {
      display: none;
      margin-top: 3px;
      font-size: 11px;
      color: var(--text-muted);
      line-height: 1.3;
      word-break: break-word;
      grid-column: 1;
    }

.api-token-field {
      position: absolute;
      opacity: 0;
      pointer-events: none;
      width: 1px;
      height: 1px;
      overflow: hidden;
    }

.api-date-hidden {
      position: absolute;
      opacity: 0;
      pointer-events: none;
      width: 1px;
      height: 1px;
    }

.date-range-trigger {
      width: 100%;
      height: 28px;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: var(--bg-input);
      color: var(--text-primary);
      font-size: 12px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 0 9px;
      cursor: pointer;
    }

.date-range-popover {
      position: fixed;
      top: 0;
      left: 0;
      width: min(606px, calc(100vw - 28px));
      max-height: min(332px, calc(100vh - 50px));
      display: none;
      grid-template-columns: 176px 1fr;
      background: #fff;
      color: #172033;
      border: 1px solid #e5e7eb;
      border-radius: 16px;
      box-shadow: 0 22px 60px rgba(15, 23, 42, 0.18);
      z-index: var(--z-popover);
      overflow: hidden;
    }

.date-range-popover.open { display: grid; }

.date-preset-list {
      max-height: 330px;
      padding: 8px;
      border-right: 1px solid #f3f4f6;
      overflow-y: auto;
    }

.date-preset-btn {
      width: 100%;
      border: 0;
      background: transparent;
      color: #374151;
      border-radius: 8px;
      min-height: 47px;
      margin-bottom: 2px;
      padding: 6px 8px;
      text-align: left;
      cursor: pointer;
      display: block;
    }

.date-preset-btn span {
      display: block;
      font-size: 13px;
      font-weight: 500;
      line-height: 20px;
    }

.date-preset-btn small {
      display: block;
      color: #94a3b8;
      font-size: 11px;
      font-weight: 600;
      line-height: 16px;
    }

.date-preset-btn.active,
    .date-preset-btn:hover {
      background: #eff6ff;
      color: #2563eb;
    }

.date-calendar-area {
      padding: 12px;
      min-width: 0;
    }

.date-calendar-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
      color: #334155;
      font-weight: 800;
      min-height: 23px;
    }

.date-nav-btn {
      width: 23px;
      height: 23px;
      border: 0;
      border-radius: 4px;
      background: transparent;
      color: #6b7280;
      cursor: pointer;
      font-size: 16px;
    }

.date-nav-btn:hover { background: #f3f4f6; color: #2563eb; }

.date-month-title-row {
      flex: 1;
      display: flex;
      justify-content: space-around;
      color: #374151;
      font-size: 12px;
      font-weight: 600;
      line-height: 18px;
    }

.date-months {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }

.date-weekdays,
    .date-days {
      display: grid;
      grid-template-columns: repeat(7, 26px);
      justify-content: center;
      gap: 2px;
    }

.date-weekdays span {
      text-align: center;
      font-size: 11px;
      color: #94a3b8;
      font-weight: 700;
    }

.date-day {
      width: 26px;
      height: 24px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: #374151;
      cursor: pointer;
      font-size: 11px;
      font-weight: 400;
    }

.date-day-empty {
      visibility: hidden;
      pointer-events: none;
    }

.date-day.outside {
      color: #d1d5db;
      cursor: default;
      opacity: 0.55;
    }

.date-day.in-range { background: #dbeafe; color: #1d4ed8; }

.date-day.selected { background: #2563eb; color: #fff; font-weight: 600; }

.date-picker-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-top: 12px;
      padding-top: 8px;
      border-top: 1px solid #f3f4f6;
    }

.date-picker-range {
      font-size: 13px;
      font-weight: 800;
      color: #334155;
    }

.date-picker-range small {
      display: block;
      color: #94a3b8;
      font-size: 11px;
      font-weight: 600;
      margin-top: 2px;
    }

.date-picker-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

.date-picker-actions button {
      border: 0;
      border-radius: 8px;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

.date-picker-cancel { background: transparent; color: #4b5563; font-weight: 400; }

.date-picker-apply { background: #2563eb; color: #fff; }

.token-status-text.valid   { color: #15803d; }

.token-status-text.invalid { color: #b91c1c; }

.token-status-text.checking{ color: #b45309; }

.stats-grid {
      position: relative;
      z-index: 1;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      gap: 6px;
      margin-bottom: 6px;
      flex-shrink: 0;
    }

.stat-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 10px;
      box-shadow: none;
      border-left: 4px solid var(--accent);
      transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, background 0.3s ease;
    }

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.13); }

.stat-card.data0   { border-left-color: #E91E63; }

.stat-card.rdt     { border-left-color: #FF9800; }

.stat-card.book    { border-left-color: #9C27B0; }

.stat-card.ci      { border-left-color: #4CAF50; }

.stat-card.revenue { border-left-color: #F44336; }

.stat-label {
      font-size: 11px;
      color: var(--text-secondary);
      margin-bottom: 5px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0;
    }

.stat-value {
      font-size: 20px;
      font-weight: 800;
      color: var(--text-primary);
      line-height: 1;
      letter-spacing: -0.3px;
    }

.stat-value.currency { font-size: 14px; font-weight: 800; }

#tabs-container {
      position: relative;
      z-index: 1;
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

.tab-container {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      box-shadow: none;
      overflow: hidden;
      transition: background 0.3s ease;
    }

.tab-header {
      background: var(--tab-header-bg);
      color: var(--text-primary);
      padding: 8px 10px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }

.tab-title {
      font-weight: 700;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 5px;
    }

.row-count-badge {
      background: rgba(255,255,255,0.25);
      padding: 2px 7px;
      border-radius: 8px;
      font-size: 11px;
      font-weight: 600;
    }

.table-wrapper {
      flex: 1;
      min-height: 0;
      overflow-x: auto;
      overflow-y: auto;
    }
.name-result-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
      table-layout: fixed;
    }
.name-result-table tbody tr:nth-child(even) { background: var(--bg-zebra); }
.name-result-table tbody tr:hover { background: var(--bg-hover); }

.num-highlight { font-weight: 700; color: var(--text-primary); }

td.cell-revenue, td.cell-spend { color: #16a34a; font-weight: 700; }

td.cell-negative { color: #dc2626; font-weight: 700; }



.name-filter-panel {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      gap: 6px;
      overflow: hidden;
    }

.name-filter-input-area {
      background: var(--bg-card);
      border-radius: 8px;
      padding: 7px 10px;
      box-shadow: 0 2px 8px var(--shadow-light);
      flex-shrink: 0;
      transition: background 0.3s ease;
    }

.name-filter-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 6px;
    }

.name-filter-textarea {
      width: 100%;
      padding: 6px 8px;
      height: 90px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 14px;
      font-family: monospace;
      resize: vertical;
      transition: all 0.2s ease;
    }

.name-filter-textarea:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
    }

.name-filter-hint,
    .mindmap-hint {
      margin-top: 4px;
      font-size: 11px;
      color: var(--text-muted);
    }

#nameFilterResult, #dateFilterResult {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

.name-result-container {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      background: var(--bg-card);
      border-radius: 8px;
      box-shadow: 0 2px 10px var(--shadow-light);
      overflow: hidden;
      transition: background 0.3s ease;
    }

.name-result-header {
      background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
      color: white;
      padding: 7px 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }

.name-result-wrapper {
      flex: 1;
      min-height: 0;
      overflow-x: auto;
      overflow-y: auto;
    }

.name-result-summary {
      background: var(--summary-bg);
      padding: 5px 10px;
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      border-bottom: 1px solid var(--summary-border);
      font-size: 11px;
      flex-shrink: 0;
    }

.name-result-summary span { font-weight: 700; }

.name-result-summary .s-label { color: var(--text-muted); font-weight: 400; }

.name-copy-btn {
      background: rgba(255,255,255,0.2);
      border: 1px solid rgba(255,255,255,0.4);
      color: white;
      padding: 3px 10px;
      border-radius: 8px;
      font-size: 13px;
      cursor: pointer;
      font-weight: 600;
    }

.date-filter-card {
      background: var(--bg-card);
      border-radius: 8px;
      padding: 7px 10px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.3);
      flex-shrink: 0;
      margin-bottom: 6px;
    }

.date-summary-header {
      margin-bottom: 0;
    }

.date-summary-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 6px;
      flex-wrap: wrap;
    }

.date-header-range {
      width: 240px;
      flex: 0 0 240px;
    }

.date-filter-machine-fields {
      position: absolute !important;
      opacity: 0 !important;
      pointer-events: none !important;
      width: 1px !important;
      height: 1px !important;
      overflow: hidden !important;
      padding: 0 !important;
      margin: 0 !important;
      border: 0 !important;
      box-shadow: none !important;
    }

.date-filter-bar {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: flex-end;
    }

.date-filter-field {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 120px;
    }

.date-filter-field.wide { min-width: 130px; flex: 0 0 180px; }

.date-filter-field.date-tab-range-field { flex: 0 0 260px; }

.date-filter-field label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

.date-filter-input,
    .date-filter-select {
      height: 28px;
      padding: 0 7px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 13px;
      background: var(--bg-input);
      color: var(--text-primary);
    }

.date-filter-input:focus,
    .date-filter-select:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
    }

.date-filter-native-hidden,
    .date-filter-native-hidden-wrap {
      position: absolute !important;
      opacity: 0 !important;
      pointer-events: none !important;
      width: 1px !important;
      height: 1px !important;
      overflow: hidden !important;
      min-width: 0 !important;
      flex: 0 0 0 !important;
      padding: 0 !important;
      margin: 0 !important;
    }

.date-tab-trigger {
      min-width: 0;
      width: 100%;
      height: 30px;
      border-radius: 8px;
    }

.month-picker-popover {
      position: fixed;
      width: min(288px, calc(100vw - 28px));
      display: none;
      padding: 12px;
      background: #fff;
      color: #172033;
      border: 1px solid #e5e7eb;
      border-radius: 14px;
      box-shadow: 0 22px 60px rgba(15, 23, 42, 0.18);
      z-index: var(--z-popover);
    }

.month-picker-popover.open { display: block; }

.month-picker-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;
      font-weight: 800;
      color: #334155;
    }

.month-picker-nav {
      width: 28px;
      height: 28px;
      border: 0;
      border-radius: 7px;
      background: transparent;
      color: #64748b;
      cursor: pointer;
      font-size: 18px;
    }

.month-picker-nav:hover { background: #eff6ff; color: #2563eb; }

.month-picker-month {
      min-height: 34px;
      border: 0;
      border-radius: 8px;
      background: #f8fafc;
      color: #334155;
      font-weight: 700;
      cursor: pointer;
    }

.month-picker-month:hover,
    .month-picker-month.active {
      background: #2563eb;
      color: #fff;
    }

.date-filter-btn {
      height: 28px;
      padding: 0 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg-card);
      color: var(--text-primary);
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
    }

.date-filter-btn:hover { background: var(--bg-hover); }

.date-filter-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

.date-filter-btn.primary:hover { background: #4338ca; }

.date-filter-status {
      margin-top: 5px;
      font-size: 12px;
      color: var(--text-muted);
      font-weight: 500;
      line-height: 1.4;
    }

.mindmap-panel {
      background: var(--bg-card);
      border-radius: 8px;
      padding: 7px 10px;
      margin-bottom: 6px;
      box-shadow: 0 2px 8px var(--shadow-light);
      flex-shrink: 0;
      transition: background 0.3s ease;
    }

.mindmap-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 6px;
    }

.mindmap-actions {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
      margin-bottom: 6px;
    }

.mindmap-hint {
      margin-top: 4px;
      font-size: 11px;
      color: var(--text-muted);
    }

.mindmap-validation-box {
      background: var(--bg-card);
      border-radius: 8px;
      padding: 7px 10px;
      margin-bottom: 6px;
      box-shadow: 0 2px 8px var(--shadow-light);
      flex-shrink: 0;
      transition: background 0.3s ease;
    }

.validation-summary { font-size: 13px; color: var(--text-table); margin-bottom: 5px; }

.validation-list {
      display: grid;
      gap: 4px;
      max-height: 120px;
      overflow-y: auto;
    }

.validation-item {
      border: 1px solid rgba(220, 38, 38, 0.3);
      background: #0f172a5f;
      border-radius: 6px;
      padding: 5px 7px;
      font-size: 12px;
      color: #fca5a5;
    }

.validation-ok {
      color: #86efac;
      background: rgba(22, 163, 74, 0.1);
      border: 1px solid rgba(22, 163, 74, 0.3);
      border-radius: 6px;
      padding: 5px 7px;
      font-size: 13px;
    }

.fill-history-container {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      background: var(--bg-card);
      border-radius: 8px;
      box-shadow: 0 2px 10px var(--shadow-light);
      overflow: hidden;
      transition: background 0.3s ease;
    }

.fill-history-container .name-result-header {
      padding-left: 14px;
      padding-right: 14px;
      cursor: pointer;
      user-select: none;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

.fill-history-hint {
      font-size: 11px;
      font-weight: 600;
      opacity: 0.82;
    }

.mindmap-history-list {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding: 6px 14px;
      display: grid;
      gap: 5px;
      align-content: start;
    }

.mindmap-history-item {
      border: 1px solid rgba(0,0,0,0.06);
      padding: 5px 7px;
      border-radius: 6px;
      background: rgba(0,0,0,0.02);
      font-size: 13px;
      color: var(--text-table);
    }

.mindmap-history-list:not(:empty) {
      cursor: pointer;
    }

.mindmap-history-item.compact {
      transition: border-color 0.2s ease, background 0.2s ease;
    }

.mindmap-history-item.compact:hover {
      border-color: rgba(102, 126, 234, 0.55);
      background: rgba(102, 126, 234, 0.08);
    }

.fill-history-card {
      cursor: pointer;
      outline: none;
    }

.fill-history-card:focus-visible {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
    }

.fill-history-card-date {
      color: var(--text-secondary);
      font-size: 11px;
    }

.fill-history-card-summary {
      margin-top: 4px;
      color: var(--text-primary);
      font-weight: 700;
    }

.fill-history-card-cta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-top: 5px;
      color: var(--accent);
      font-size: 11px;
      font-weight: 700;
    }

.fill-history-card-cta span {
      font-size: 18px;
      line-height: 12px;
    }

.fill-history-modal {
      position: fixed;
      inset: 10px;
      z-index: var(--z-popover);
      display: none;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 18px 60px rgba(0,0,0,0.45);
      overflow: hidden;
    }

.fill-history-modal.show {
      display: flex;
      flex-direction: column;
    }

.fill-history-modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: var(--z-popover);
      display: none;
      background: rgba(15, 23, 42, 0.58);
    }

.fill-history-modal-backdrop.show {
      display: block;
    }

.fill-history-modal-header {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 14px;
      color: #fff;
      background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
    }

.fill-history-modal-title {
      font-size: 14px;
      font-weight: 800;
    }

.fill-history-back {
      flex: 0 0 auto;
      border: 1px solid rgba(255,255,255,0.34);
      border-radius: 6px;
      padding: 6px 9px;
      background: rgba(255,255,255,0.14);
      color: #fff;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
    }

.fill-history-back:hover {
      background: rgba(255,255,255,0.24);
    }

.fill-history-modal-meta {
      margin-left: auto;
      font-size: 12px;
      font-weight: 600;
      opacity: 0.9;
    }

.fill-history-close {
      width: 30px;
      height: 30px;
      border: 0;
      border-radius: 6px;
      background: rgba(255,255,255,0.16);
      color: #fff;
      font-size: 18px;
      font-weight: 800;
      line-height: 1;
      cursor: pointer;
    }

.fill-history-close:hover {
      background: rgba(255,255,255,0.26);
    }

.fill-history-modal-body {
      flex: 1;
      min-height: 0;
      overflow: auto;
      padding: 10px 14px 14px;
      display: grid;
      gap: 8px;
      align-content: start;
      background: var(--bg-body);
    }

.fill-history-modal-body .mindmap-history-item {
      background: var(--bg-card);
      border-color: var(--border);
      padding: 8px 10px;
      font-size: 13px;
    }

.fill-history-log {
      margin-top: 7px;
      color: var(--text-secondary);
      font-size: 12px;
      line-height: 1.45;
      white-space: normal;
    }

.fill-history-log-line {
      padding: 1px 0;
      overflow-wrap: anywhere;
    }

.fill-history-mkt {
      color: #22c55e;
      font-weight: 700;
    }

.theme-switch-wrapper {
      display: inline-flex;
      background: var(--toggle-seg-bg);
      border-radius: 8px;
      padding: 3px;
      gap: 2px;
      box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    }

.theme-btn {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      font-size: 13px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 4px;
      transition: all 0.2s ease;
    }

.theme-btn:hover {
      color: var(--text-primary);
    }

.theme-btn.active {
      background: var(--toggle-seg-active);
      color: white;
      box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

.btn {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 4px 9px;
      border: none;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      white-space: nowrap;
    }

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.btn:active { transform: translateY(0); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-primary { background: #2563eb; color: white; }

.btn-secondary { background: var(--bg-card); color: #2563eb; border: 1px solid #2563eb; }

.btn-success { background: #16a34a; color: white; }

.btn-danger  { background: #dc2626; color: white; }

.btn-warning { background: #f59e0b; color: white; }

.switch-wrapper-basic-1 {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      position: relative;
      overflow: visible;
    }

.switch-wrapper-basic-1 .switch-basic-1 {
      appearance: none;
      background-color: #334155;
      border-radius: 115px;
      border-style: none;
      flex-shrink: 0;
      height: 32px;
      margin: 0;
      position: relative;
      width: 48px;
      cursor: pointer;
      transition: all 100ms ease-out;
    }

.switch-wrapper-basic-1 .switch-basic-1::before {
      bottom: -9.6px; content: "";
      left: -9.6px; position: absolute;
      right: -9.6px; top: -9.6px;
    }

.switch-wrapper-basic-1 .switch-basic-1::after {
      background-color: #fff;
      border-radius: 50%;
      content: "";
      height: 22.4px;
      left: 4.8px;
      position: absolute;
      top: 4.8px;
      width: 22.4px;
      transition: all 100ms ease-out;
    }

.switch-wrapper-basic-1 .switch-basic-1:hover { background-color: #c9cbcd; }

.switch-wrapper-basic-1 .switch-basic-1:checked { background-color: #256176; }

.switch-wrapper-basic-1 .switch-basic-1:checked::after { left: 20.8px; }

.switch-wrapper-basic-1 .switch-basic-1:checked:hover { background-color: #13313c; }

.switch-wrapper-basic-1 .switch-basic-1:focus { outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,0.16); }

.switch-wrapper-basic-1 .switch-basic-1.status-updating { opacity: 0.86; cursor: wait; }

.switch-wrapper-basic-1 :focus:not(.focus-visible) { outline: 0; }

.status-inline-spinner {
      position: absolute;
      right: -20px; top: 50%;
      width: 14px; height: 14px;
      transform: translateY(-50%);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease;
    }

.spinner-basic {
      border-radius: 50%;
      border: 2.25px solid;
      border-color: #334155;
      border-right-color: #256176;
      animation: spinner-basic-anim 1s infinite linear;
      box-sizing: border-box;
    }

.spinner-arrow-head {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      padding: 2.15px;
      background:
        conic-gradient(from 135deg at top, #256176 90deg, #0000 0) 0 calc(50% - 1.45px) / 6.1px 3.05px,
        radial-gradient(farthest-side at bottom left, #0000 calc(100% - 2.15px), #256176 calc(100% - 1.8px) 99%, #0000) top right / 50% 50% content-box content-box,
        radial-gradient(farthest-side at top, #0000 calc(100% - 2.15px), #256176 calc(100% - 1.8px) 99%, #0000) bottom / 100% 50% content-box content-box;
      background-repeat: no-repeat;
      animation: spinner-v8og74 1.0s infinite linear;
      display: none;
    }

.status-dot {
      display: inline-block;
      width: 10px; height: 10px;
      border-radius: 50%;
      margin-right: 4px;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

.status-active { background: #4CAF50; }

.status-paused { background: #fff; border: 2px solid #ccc; }

.status-processing { background: #f59e0b; }

.status-refresh-btn {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 3px;
      font-size: 13px;
      border-radius: 4px;
      margin-left: 6px;
      opacity: 0.5;
      transition: all 0.2s;
      display: inline-flex;
      align-items: center;
    }

.status-refresh-btn:hover {
      opacity: 1;
      background: rgba(0,0,0,0.05);
    }

.status-refresh-btn.spinning {
      opacity: 1;
      pointer-events: none;
    }

.loading-overlay.active { display: flex; }

.spinner {
      width: 50px; height: 50px;
      border: 4px solid #f3f3f3;
      border-top: 4px solid var(--accent);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }

.no-data { text-align: center; padding: 60px 20px; color: var(--text-muted); }

.no-data-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.3; }

.no-data-text { font-size: 16px; font-weight: 500; }

.toast {
      position: fixed;
      bottom: 20px; right: 20px;
      background: var(--bg-card);
      padding: 12px 20px;
      border-radius: 8px;
      box-shadow: 0 4px 20px var(--shadow-light);
      display: none;
      align-items: center;
      gap: 12px;
      z-index: var(--z-popover);
      color: var(--text-primary);
    }

.toast.show    { display: flex; }

.toast.success { border-left: 4px solid #4CAF50; }

.toast.error   { border-left: 4px solid #f44336; }

.toast.info    { border-left: 4px solid #2196F3; }

.toast.warning { border-left: 4px solid #ff9800; }

.meta-account-panel {
      position: relative;
      min-width: 0;
      border-top: 0;
      margin-top: 0;
      padding-top: 0;
    }

.meta-account-actions {
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 4px;
    }

.meta-account-title {
      color: var(--text-secondary);
      font-size: 12px;
      font-weight: 700;
    }

.meta-account-buttons {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }

.meta-account-dropdown {
      position: relative;
      border: 0;
      border-radius: 0;
      background: transparent;
      overflow: visible;
    }

.meta-account-dropdown[open] {
      display: grid;
      gap: 8px;
      z-index: var(--z-popover);
    }

.meta-account-dropdown summary {
      list-style: none;
      cursor: pointer;
      min-height: 32px;
      padding: 0 12px;
      border: 1px solid rgba(255, 255, 255, 0.25);
      border-radius: 12px;
      background: #3b82f6;
      color: #fff;
      font-size: 13px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
    }

.meta-account-dropdown summary span { color: #fff; }

.meta-account-dropdown summary small {
      color: rgba(255,255,255,0.78);
      font-size: 11px;
      font-weight: 700;
      max-width: 78px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

.meta-account-dropdown summary::-webkit-details-marker { display: none; }

.meta-account-dropdown summary::after {
      content: "v";
      color: rgba(255,255,255,0.85);
      font-size: 11px;
    }

.meta-account-dropdown[open] summary::after { content: "^"; }

.meta-account-list {
      position: static;
      width: 100%;
      display: flex;
      flex-direction: column;
      gap: 0;
      max-height: 390px;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 0 10px 10px;
      border: 1px solid var(--border);
      border-top: 0;
      border-radius: 0 0 12px 12px;
      background: var(--bg-card);
      box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
      z-index: auto;
    }

.meta-account-popover-head {
      position: static;
      width: 100%;
      padding: 9px 10px 8px;
      border: 1px solid var(--border);
      border-bottom: 0;
      border-radius: 12px 12px 0 0;
      background: var(--bg-card);
      box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
      z-index: auto;
      display: none;
    }

.meta-account-dropdown[open] .meta-account-popover-head { display: block; }

.meta-account-alert {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      border: 1px solid #fde68a;
      border-radius: 8px;
      background: #fffbeb;
      color: #92400e;
      font-size: 12px;
      font-weight: 800;
    }

.meta-account-mini-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      padding: 8px 0 7px;
      font-size: 11px;
      color: var(--text-muted);
      font-weight: 700;
    }

.meta-account-link-btn {
      border: 0;
      background: transparent;
      color: #2563eb;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      padding: 0 2px;
    }

.meta-account-running {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      height: 24px;
      width: fit-content;
      padding: 0 10px;
      border-radius: 999px;
      background: #dcfce7;
      color: #047857;
      font-size: 11px;
      font-weight: 800;
      margin-bottom: 7px;
    }

.meta-account-search {
      position: static;
      width: 100%;
      height: 34px;
      padding: 0 10px;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: var(--bg-input);
      color: var(--text-primary);
      font-size: 12px;
      z-index: auto;
      box-shadow: none;
    }

.meta-account-search:focus {
      outline: none;
      border-color: #2563eb;
      box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16), 0 10px 28px rgba(15, 23, 42, 0.12);
    }

.meta-account-row {
      display: grid;
      grid-template-columns: 18px minmax(0, 1fr) auto;
      grid-template-rows: auto;
      align-items: center;
      gap: 8px;
      border: 0;
      border-bottom: 1px solid var(--border);
      border-radius: 0;
      padding: 8px 0;
      background: transparent;
      color: var(--text-primary);
      font-size: 13px;
      min-width: 0;
      width: 100%;
    }

.meta-account-row input {
      grid-column: 1;
      grid-row: 1;
      width: 14px;
      height: 14px;
      margin: 0;
    }

.meta-account-row span {
      min-width: 0;
      display: grid;
      gap: 1px;
    }

.meta-account-row strong,
    .meta-account-row small {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

.meta-account-row small,
    .meta-account-empty {
      color: var(--text-muted);
      font-size: 11px;
    }

.meta-account-status {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      color: #ef4444;
      font-size: 11px;
      font-weight: 800;
      white-space: nowrap;
      grid-column: 3;
      grid-row: 1;
      justify-self: end;
      min-width: max-content;
      padding: 3px 8px;
      border-radius: 999px;
      background: #fee2e2;
    }

.meta-account-status.active {
      color: #047857;
      background: #dcfce7;
    }

.meta-account-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: currentColor;
      flex-shrink: 0;
    }

.meta-account-empty { padding: 8px; }

.excel-table {
      width: 100%;
      border-collapse: collapse;
      background: var(--bg-card);
      color: var(--text-primary);
      margin-bottom: 10px;
    }

.excel-table th, .excel-table td {
      border: 1px solid var(--border);
      padding: 6px 8px;
      text-align: center;
      min-width: 60px;
    }

.excel-table th { background: var(--table-th-bg); font-weight: bold; }

.excel-table td[contenteditable="true"] {
      background: var(--bg-input);
      outline: none;
      transition: box-shadow 0.2s;
    }

.excel-table td[contenteditable="true"]:focus {
      background: var(--bg-card);
      box-shadow: 0 0 0 2px #4a90e2;
    }



body:not(.light-theme) .container {
      background: #0f172a;
    }

.header {
      margin: 0 -5px 0;
      border: 0;
      border-radius: 0;
      padding: 8px 12px;
      background: linear-gradient(90deg, #1d4ed8 0%, #2563eb 55%, #2f7df0 100%);
      color: #fff;
    }

.header-title h2,
    .header .theme-btn {
      color: #fff;
    }

.version-badge {
      background: rgba(255,255,255,0.22);
      border: 1px solid rgba(255,255,255,0.25);
    }

.header .theme-switch-wrapper {
      background: rgba(255,255,255,0.16);
      box-shadow: none;
    }

.header .theme-btn.active {
      background: rgba(255,255,255,0.24);
      box-shadow: none;
    }

.header .btn-primary,
    .header .btn-secondary {
      border: 1px solid rgba(255,255,255,0.28);
      background: rgba(255,255,255,0.14);
      color: #fff;
      box-shadow: none;
    }

.app-layout {
      flex-direction: column;
      gap: 0;
      overflow: visible;
    }

.side-rail,
    .side-rail.expanded {
      position: static;
      width: auto;
      height: 34px;
      flex-direction: row;
      align-items: center;
      gap: 4px;
      padding: 0;
      background: transparent;
      overflow-x: auto;
      overflow-y: hidden;
      flex-shrink: 0;
      flex: 1 1 auto;
      justify-content: center;
    }

.rail-toggle {
      display: none;
    }

.main-tab-btn,
    .side-rail.expanded .main-tab-btn {
      width: auto;
      min-width: 62px;
      height: 28px;
      justify-content: center;
      padding: 0 12px;
      border-radius: 8px;
      background: transparent;
      color: rgba(255,255,255,0.82);
      box-shadow: none;
      font-size: 13px;
      gap: 6px;
    }

.main-tab-btn:hover {
      background: rgba(255,255,255,0.14);
      color: #fff;
      transform: none;
    }

.main-tab-btn.active {
      background: rgba(255,255,255,0.22);
      color: #fff;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
    }

.tab-label,
    .side-rail.expanded .tab-label {
      opacity: 1;
      max-width: none;
      font-size: 12px;
      font-weight: 800;
      text-transform: uppercase;
    }

body:not(.light-theme) .search-filter-bar {
      border-bottom-color: #1e3a8a;
      background: #1d4ed8;
    }

.search-input {
      height: 32px;
      border-radius: 999px;
      border-color: rgba(255,255,255,0.45);
      background: #fff;
      color: #0f172a;
      box-shadow: inset 0 1px 2px rgba(15,23,42,0.06);
    }

.quick-filters {
      justify-content: flex-start;
      align-items: center;
    }

.filter-chip {
      height: 26px;
      display: inline-flex;
      align-items: center;
      border: 1px solid rgba(255,255,255,0.28);
      background: rgba(255,255,255,0.13);
      color: #eef6ff;
      font-size: 11px;
      font-weight: 700;
    }

.filter-chip:hover,
    .filter-chip.active {
      border-color: rgba(255,255,255,0.7);
      background: rgba(255,255,255,0.28);
      color: #fff;
    }

.search-filter-bar .date-range-trigger {
      height: 32px;
      border-color: rgba(255,255,255,0.45);
      border-radius: 10px;
      background: #fff;
      color: #172033;
      box-shadow: inset 0 1px 2px rgba(15,23,42,0.06);
    }

.meta-account-title {
      font-size: 11px;
      text-transform: uppercase;
      color: var(--text-muted);
    }

.stats-grid {
      display: flex !important;
      gap: 0;
      min-height: 34px;
      margin-bottom: 4px;
      border: 1px solid var(--border);
      border-radius: 7px;
      overflow-x: auto;
      background: var(--bg-card);
    }

.stats-grid[style*="display: none"] {
      display: none !important;
    }

#statsContainer { display: grid; position: static; width: auto; height: auto; min-height: 0; margin: 0; padding: 0; }
#statsContainer[hidden] { display: none; }

.stat-card {
      min-width: 118px;
      border: 0;
      border-right: 1px solid var(--border);
      border-left-width: 0;
      border-radius: 0;
      padding: 6px 10px;
      background: transparent;
      box-shadow: none;
    }

.stat-card:hover {
      transform: none;
      box-shadow: none;
      background: var(--bg-hover);
    }

.stat-label {
      margin-bottom: 2px;
      font-size: 11px;
      line-height: 1;
    }

.stat-value {
      font-size: 15px;
      line-height: 1.1;
    }

.stat-value.currency {
      font-size: 12px;
    }

.header .stats-grid {
      flex: 1 1 620px;
      max-width: 780px;
      min-width: 420px;
      height: 32px;
      min-height: 32px;
      margin: 0 6px;
      border-color: rgba(255,255,255,0.22);
      border-radius: 8px;
      background: rgba(255,255,255,0.12);
      align-self: center;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
    }

.header .stats-grid[style*="display: none"] {
      display: none !important;
    }

.header .stat-card {
      min-width: 104px;
      padding: 4px 8px;
      border-right-color: rgba(255,255,255,0.18);
      color: #fff;
      background: transparent;
    }

.header .stat-card:hover {
      background: rgba(255,255,255,0.12);
    }

.header .stat-label {
      color: rgba(255,255,255,0.72);
      font-size: 11px;
      line-height: 1;
    }

.header .stat-value {
      color: #fff;
      font-size: 14px;
      line-height: 1.1;
    }

.header .stat-value.currency {
      font-size: 11px;
    }

.tab-container {
      border-radius: 7px;
      border-color: #d9e1ee;
    }

.tab-header {
      min-height: 34px;
      padding: 6px 10px;
      background: #f7f9fd;
    }

body:not(.light-theme) .tab-header {
      background: #111827;
    }

#panel-ads #tabs-container .tab-header {
      display: none !important;
    }

.web-bridge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  background: var(--bg-input);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.web-bridge-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
}

.web-bridge-status[data-state="connected"] {
  color: #047857;
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.web-bridge-status[data-state="connected"] .web-bridge-status-dot {
  background: #10b981;
}

.web-bridge-status[data-state="disconnected"] {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.web-bridge-status[data-state="disconnected"] .web-bridge-status-dot {
  background: #ef4444;
}

body:not(.light-theme) .web-bridge-status[data-state="connected"] {
  color: #6ee7b7;
  border-color: #065f46;
  background: #052e2b;
}

body:not(.light-theme) .web-bridge-status[data-state="disconnected"] {
  color: #fca5a5;
  border-color: #7f1d1d;
  background: #3f1518;
}

@media (max-width: 720px) {
  .web-bridge-status-label {
    display: none;
  }
}

.header-top .side-rail {
  min-width: 0;
}
.search-filter-bar .filter-chip.active {
  box-shadow: inset 0 -3px 0 currentColor;
}
@media (max-width: 720px) {
  .header-top .action-buttons {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-left: 0;
    max-width: 100%;
  }
  .header-top .side-rail,
  .header-top .side-rail.expanded {
    flex-wrap: wrap;
    height: auto;
    overflow: visible;
  }
  .header .stats-grid {
    height: auto;
    flex-wrap: wrap;
  }
}
